From fbc4955c1de15b904233227eb13ce43737f8c7de Mon Sep 17 00:00:00 2001 From: Kayos Date: Fri, 8 May 2026 07:42:06 -0700 Subject: [PATCH] fix(core): bump WITNESS_OVERHEAD_BYTES from 256 to 512 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 256 still underbid by ~16 bytes (721 lovelace) on the same preprod_test2 governor mint shape that 128 missed by 144 bytes. The actual CBOR delta between the unsigned tx (def-length witness set arrays, no vkey witness, no redeemer expansion) and the signed tx (indef-length flips, vkey witness, finalized redeemer) is ~270 bytes for this shape, not the 144 the first FeeTooSmallUTxO suggested. 512 gives plenty of headroom — worst-case ~22k lovelace overestimate which is trivial. For multi-sig flows with N vkey witnesses, this needs revisiting; plutus_mint's only signer today is the wallet's own payment key so a single-vkey budget is correct. --- crates/aldabra-core/src/plutus_mint.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/aldabra-core/src/plutus_mint.rs b/crates/aldabra-core/src/plutus_mint.rs index aed6e88..e7b6da6 100644 --- a/crates/aldabra-core/src/plutus_mint.rs +++ b/crates/aldabra-core/src/plutus_mint.rs @@ -193,11 +193,13 @@ fn hash_to_hex_32(h: &[u8; 32]) -> String { // Generous overhead for the vkey witness + redeemer ex_units inflation + // CBOR length-prefix flips between unsigned (def-length) and signed -// (indef-length) array tags. Original 128 underbid by ~144 bytes on a +// (indef-length) array tags. Original 128 underbid by 144 bytes on a // 3-input + inline-V2-policy mint (preprod_test2 governor bootstrap -// 2026-05-08, FeeTooSmallUTxO @ 6353 lovelace short). 256 is plenty -// for any single-vkey signing case. -const WITNESS_OVERHEAD_BYTES: u64 = 256; +// 2026-05-08, FeeTooSmallUTxO @ 6353 lovelace short). Bumping to 256 +// got within 16 bytes on retry — still rejected. 512 is generous head- +// room for any single-vkey case (~+22k lovelace overestimate worst-case, +// trivial); reconsider for multi-sig where many vkey witnesses are added. +const WITNESS_OVERHEAD_BYTES: u64 = 512; /// Build + sign a Plutus-policy mint with a fully-specified output. ///