Skip to content

Commit dfcf39e

Browse files
committed
test: re-record register-for-bond L1 and combined fixtures
The eligibility preflight now reads get-bond-l1-unlock-height, a request the previous fixtures did not capture, so replay failed with a missing-fixture error. Re-recorded both L1 register suites against the patched regtest node so the new read is captured and replay is green.
1 parent 9c46fee commit dfcf39e

7 files changed

Lines changed: 1198 additions & 149 deletions

‎packages/bitcoin-staking/tests/regtest/actions/register-for-bond-combined.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
fetchBondMembership,
2121
fetchEligibleRegisterForBond,
2222
fetchTotalSbtcStaked,
23+
fetchVerifyBlockHeader,
2324
minUstxForSatsAmount,
2425
} from '../../../src';
2526
import { ACCOUNTS, REGTEST_KEYS, SIGNER_MANAGER, getAccount, type Account } from '../regtest';
@@ -145,6 +146,18 @@ test('one bond, two participants: user A (L1) + user B (sBTC)', async () => {
145146
const btcTxid = await sendToAddress(lockupAddress, Number(MAX_SATS) / 1e8);
146147
const proof = await waitForFulfilled(() => getBtcTxProofInputs(btcTxid));
147148
await waitForBurnBlockHeight(proof.blockHeight);
149+
// The burn tip reaching the block is not enough: read-onlys evaluate at the
150+
// STACKS tip, whose burn view lags several burn blocks at regtest cadence, so
151+
// `get-burn-block-info?` still returns `none` and both the preflight and the
152+
// on-chain register would false-negative with InvalidBtcHeader (u40).
153+
await waitForFulfilled(async () => {
154+
const visible = await fetchVerifyBlockHeader({
155+
header: proof.header,
156+
burnHeight: proof.blockHeight,
157+
network,
158+
});
159+
if (!visible) throw new Error('lockup burn block not yet visible at stacks tip');
160+
});
148161
const output = buildLockProofFromBlock({
149162
txHex: proof.txHex,
150163
header: proof.header,

‎packages/bitcoin-staking/tests/regtest/actions/register-for-bond-l1.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
fetchBondMembership,
2424
fetchEligibleRegisterForBond,
2525
fetchSignerInfo,
26+
fetchVerifyBlockHeader,
2627
minUstxForSatsAmount,
2728
} from '../../../src';
2829
import { REGTEST_KEYS, SIGNER_MANAGER, getAccount, type Account } from '../regtest';
@@ -119,6 +120,18 @@ test('l1 register-for-bond happy path: setup-bond → fund BTC → prove → reg
119120
// SPV PROOF
120121
const proofInputs = await waitForFulfilled(() => getBtcTxProofInputs(btcTxid));
121122
await waitForBurnBlockHeight(proofInputs.blockHeight);
123+
// The burn tip reaching the block is not enough: read-onlys evaluate at the
124+
// STACKS tip, whose burn view lags several burn blocks at regtest cadence, so
125+
// `get-burn-block-info?` still returns `none` and both the preflight and the
126+
// on-chain register would false-negative with InvalidBtcHeader (u40).
127+
await waitForFulfilled(async () => {
128+
const visible = await fetchVerifyBlockHeader({
129+
header: proofInputs.header,
130+
burnHeight: proofInputs.blockHeight,
131+
network,
132+
});
133+
if (!visible) throw new Error('lockup burn block not yet visible at stacks tip');
134+
});
122135
const output = buildLockProofFromBlock({
123136
txHex: proofInputs.txHex,
124137
header: proofInputs.header,

‎packages/bitcoin-staking/tests/regtest/fixtures/fixtures-register-for-bond-combined-a.json‎

Lines changed: 88 additions & 20 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
{
2-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a5755fcc7e71c045232b6b6d6a91cac1d2cdb1af9\"]": "{\"okay\":true,\"result\":\"0x0a0c000000050b616d6f756e742d7361747301000000000000000000000000000027100b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000080a69732d6c312d6c6f636b04067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}",
3-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a9e8f1a580d7735c04b1bf134c92419c4a0e541de\"]": "{\"okay\":true,\"result\":\"0x0a0c000000050b616d6f756e742d7361747301000000000000000000000000000027100b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000030a69732d6c312d6c6f636b03067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}",
4-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a114360e36f6cdf0bbf23694dfe001f23ac45a9cd\"]": "{\"okay\":true,\"result\":\"0x0a0c000000050b616d6f756e742d7361747301000000000000000000000000000027100b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000080a69732d6c312d6c6f636b03067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}",
5-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a14bbf7b46fce79cdcb7c1e24be5c16c98e6b036d\"]": "{\"okay\":true,\"result\":\"0x09\"}",
6-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a164247d6f2b425ac5771423ae6c80c754f7172b0\"]": "{\"okay\":true,\"result\":\"0x0a0c000000040b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000010a69732d6c312d6c6f636b03067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}",
7-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a3486e65ae2b89d6e41584f968f2679f3e8935d81\"]": "{\"okay\":true,\"result\":\"0x0a0c000000040b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000010a69732d6c312d6c6f636b04067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}",
8-
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-total-sbtc-staked#ST000000000000000000002AMW42H:[]": "{\"okay\":true,\"result\":\"0x0100000000000000000000000000002710\"}"
2+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a114360e36f6cdf0bbf23694dfe001f23ac45a9cd\"]": {
3+
"status": 200,
4+
"body": "{\"okay\":true,\"result\":\"0x0a0c000000050b616d6f756e742d7361747301000000000000000000000000000027100b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e646578010000000000000000000000000000000f0a69732d6c312d6c6f636b03067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}"
5+
},
6+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a14bbf7b46fce79cdcb7c1e24be5c16c98e6b036d\"]": {
7+
"status": 200,
8+
"body": "{\"okay\":true,\"result\":\"0x09\"}"
9+
},
10+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a164247d6f2b425ac5771423ae6c80c754f7172b0\"]": {
11+
"status": 200,
12+
"body": "{\"okay\":true,\"result\":\"0x0a0c000000040b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000010a69732d6c312d6c6f636b03067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}"
13+
},
14+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a3486e65ae2b89d6e41584f968f2679f3e8935d81\"]": {
15+
"status": 200,
16+
"body": "{\"okay\":true,\"result\":\"0x0a0c000000040b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000010a69732d6c312d6c6f636b04067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}"
17+
},
18+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a5755fcc7e71c045232b6b6d6a91cac1d2cdb1af9\"]": {
19+
"status": 200,
20+
"body": "{\"okay\":true,\"result\":\"0x0a0c000000050b616d6f756e742d7361747301000000000000000000000000000027100b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e646578010000000000000000000000000000000f0a69732d6c312d6c6f636b04067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}"
21+
},
22+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-bond-membership#ST000000000000000000002AMW42H:[\"0x051a9e8f1a580d7735c04b1bf134c92419c4a0e541de\"]": {
23+
"status": 200,
24+
"body": "{\"okay\":true,\"result\":\"0x0a0c000000050b616d6f756e742d7361747301000000000000000000000000000027100b616d6f756e742d7573747801000000000000000000000000000013880a626f6e642d696e64657801000000000000000000000000000000030a69732d6c312d6c6f636b03067369676e6572061aeabc65f3e890fb8bf20d153e95119c72d85765a90e7369676e65722d6d616e61676572\"}"
25+
},
26+
"/v2/contracts/call-read/ST000000000000000000002AMW42H/pox-5/get-total-sbtc-staked#ST000000000000000000002AMW42H:[]": {
27+
"status": 200,
28+
"body": "{\"okay\":true,\"result\":\"0x0100000000000000000000000000002710\"}"
29+
}
930
}

0 commit comments

Comments
 (0)