From 1c852f3a6854d77992b03510cbff46c443b91f76 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 14 May 2026 16:51:22 +0200 Subject: [PATCH] =?UTF-8?q?shared:=20drop=20tx=20setMinFee=20floor=20500K?= =?UTF-8?q?=20=E2=86=92=20200K=20(unmask=20CIP-33=20fee=20savings)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 500K lovelace floor was set higher than the natural fee for both inlined (~340K) and ref-script (~242K) Plutus V3 spend txs. With it in place, every script-spending tx pays the same 0.5 AP3X regardless of whether scripts are inlined or referenced — masking the on-chain size reduction of ~3.4 KB / -82% per Claim/Submit/Accept measured end-to-end on Vector L2 testnet. 200K is below both natural fees (so lucid's auto-estimate wins) and still ~5x above the lucid-evolution 0.4.30 ~5K under-estimate the floor was originally guarding against. Expected per-cycle saving on Vector L2 testnet: ~0.32 AP3X (Claim: 0.34 → 0.24, Submit: 0.34 → 0.25, Accept: 0.35 → 0.23). Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/shared/src/tx/internal/liveCbor.ts | 18 ++++++++++-------- .../src/tx/internal/publishReferenceScripts.ts | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/shared/src/tx/internal/liveCbor.ts b/packages/shared/src/tx/internal/liveCbor.ts index 8224f28..eee0751 100644 --- a/packages/shared/src/tx/internal/liveCbor.ts +++ b/packages/shared/src/tx/internal/liveCbor.ts @@ -374,7 +374,7 @@ export async function buildLiveTxForEscrow( // lucid 0.4.30 under-estimates Conway fees by ~1K lovelace on // PostEscrow (Ogmios 3122). 500K is a comfortable floor; excess // becomes change. Same fix as Claim/Submit/Accept paths. - .setMinFee(500_000n); + .setMinFee(200_000n); const completed = await txBuilder.complete(); signed = await completed.sign.withWallet().complete(); @@ -468,9 +468,11 @@ async function buildSpendOpenOrClaimedTx(opts: { .validTo(opts.validToMs) // lucid-evolution 0.4.30 under-estimates fee for Plutus V3 spends by // ~5K lovelace (Conway minFeeReferenceScripts multiplier appears to be - // missed). Set a comfortable floor so the ledger accepts. ~0.5 AP3X - // is well below the locked deposit; excess is normal change. - .setMinFee(500_000n); + // missed). 0.2 AP3X floor leaves headroom for that under-estimate + // without masking the savings from CIP-33 ref-scripts (natural + // ref-script tx fee is ~0.24 AP3X; inlined is ~0.34 AP3X — both above + // the floor, so lucid's estimate wins and the size delta surfaces). + .setMinFee(200_000n); // Let lucid pick coins + compute fee normally; production wallets have // multiple real UTxOs (no need for the test-side leftover-as-fee hack). @@ -608,7 +610,7 @@ export async function buildLiveTxForAccept(params: LiveAcceptParams): Promise= deliver_by, so a 60s back-pad is safe. .validFrom(params.tipMs - 60_000) .validTo(params.tipMs + 60_000) - .setMinFee(500_000n); + .setMinFee(200_000n); // Same UPLC eval delegation as Accept — lucid's CML evaluator falsely // rejects valid Plutus V3 spends; route to Ogmios. @@ -736,7 +738,7 @@ export async function buildLiveTxForAdvert( .addSignerKey(walletKey.pubKeyHash) .validFrom(advertisedAt - 60_000) .validTo(advertisedAt + 5 * 60_000) - .setMinFee(500_000n); + .setMinFee(200_000n); const completed = await txBuilder.complete(); signed = await completed.sign.withWallet().complete(); @@ -799,7 +801,7 @@ export async function buildLiveTxForRetireAdvert( // propagation lag the same as sibling builders. .validFrom(nowMs - 60_000) .validTo(nowMs + 5 * 60_000) - .setMinFee(500_000n); + .setMinFee(200_000n); // Same UPLC-eval delegation as Claim/Submit/Accept — see // buildSpendOpenOrClaimedTx for the lucid 0.4.30 false-rejection rationale. diff --git a/packages/shared/src/tx/internal/publishReferenceScripts.ts b/packages/shared/src/tx/internal/publishReferenceScripts.ts index 38cfaf1..1a8235a 100644 --- a/packages/shared/src/tx/internal/publishReferenceScripts.ts +++ b/packages/shared/src/tx/internal/publishReferenceScripts.ts @@ -79,7 +79,7 @@ export async function buildLiveTxForPublishReferenceScripts( advertScript, ) .addSignerKey(walletKey.pubKeyHash) - .setMinFee(500_000n); + .setMinFee(200_000n); const completed = await txBuilder.complete({ presetWalletInputs: realWalletUtxos,