From 1754f4909dab3bad3591cb1176b8be6f260ffdb9 Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Wed, 14 Jan 2026 14:24:35 +0100 Subject: [PATCH 1/2] fix(utxo-ord): fix inscription reveal size test Update the test to match actual reveal transaction size by using the same output address in both estimation and the actual transaction. Also increase commit value for a more realistic test case. Issue: BTC-2936 Co-authored-by: llm-git --- modules/utxo-ord/test/inscription.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/utxo-ord/test/inscription.ts b/modules/utxo-ord/test/inscription.ts index 0ec771bf41..f6ab938449 100644 --- a/modules/utxo-ord/test/inscription.ts +++ b/modules/utxo-ord/test/inscription.ts @@ -9,7 +9,7 @@ function createCommitTransactionPsbt(commitAddress: string, walletKeys: utxolib. commitTransactionPsbt.addOutput({ script: commitTransactionOutputScript, - value: BigInt(42), + value: BigInt(10_000), }); const walletUnspent = testutil.mockWalletUnspent(networks.testnet, BigInt(20_000), { keys: walletKeys }); @@ -64,7 +64,7 @@ describe('inscriptions', () => { }); }); - xdescribe('Inscription Reveal Data', () => { + describe('Inscription Reveal Data', () => { it('should sign reveal transaction and validate reveal size', () => { const walletKeys = testutil.getDefaultWalletKeys(); const inscriptionData = Buffer.from('And Desert You', 'ascii'); @@ -76,11 +76,13 @@ describe('inscriptions', () => { ); const commitTransactionPsbt = createCommitTransactionPsbt(address, walletKeys); + // Use the commit address (P2TR) as recipient to match the output script size + // used in getInscriptionRevealSize estimation const fullySignedRevealTransaction = inscriptions.signRevealTransaction( walletKeys.user.privateKey as Buffer, tapLeafScript, address, - '2N9R3mMCv6UfVbWEUW3eXJgxDeg4SCUVsu9', + address, commitTransactionPsbt.getUnsignedTx().toBuffer(), networks.testnet ); @@ -88,7 +90,6 @@ describe('inscriptions', () => { fullySignedRevealTransaction.finalizeTapInputWithSingleLeafScriptAndSignature(0); const actualVirtualSize = fullySignedRevealTransaction.extractTransaction(true).virtualSize(); - // TODO(BG-70861): figure out why size is slightly different and re-enable test assert.strictEqual(revealTransactionVSize, actualVirtualSize); }); }); From 4d4bae3982657ab81b533547719d36776dffc4d3 Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Wed, 14 Jan 2026 14:34:50 +0100 Subject: [PATCH 2/2] feat(utxo-ord): use constant for default postage amount Define a default postage amount constant based on the ord reference implementation. Replace the hardcoded value with this named constant for better readability and maintainability. Issue: BTC-2936 Co-authored-by: llm-git --- modules/utxo-ord/src/inscriptions.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/utxo-ord/src/inscriptions.ts b/modules/utxo-ord/src/inscriptions.ts index 2d5f0e5879..7e8f92c31f 100644 --- a/modules/utxo-ord/src/inscriptions.ts +++ b/modules/utxo-ord/src/inscriptions.ts @@ -21,6 +21,9 @@ import { PreparedInscriptionRevealData } from '@bitgo/sdk-core'; const OPS = bscript.OPS; const MAX_LENGTH_TAP_DATA_PUSH = 520; +// default "postage" amount +// https://github.com/ordinals/ord/blob/0.24.2/src/lib.rs#L149 +const DEFAULT_POSTAGE_AMOUNT = BigInt(10_000); /** * The max size of an individual OP_PUSH in a Taproot script is 520 bytes. This @@ -100,7 +103,7 @@ function getInscriptionRevealSize( }, ], }); - psbt.addOutput({ script: commitOutput, value: BigInt(10_000) }); + psbt.addOutput({ script: commitOutput, value: DEFAULT_POSTAGE_AMOUNT }); psbt.signTaprootInput( 0,