Skip to content

Commit 28ac8af

Browse files
werner-stacksgitbook-bot
authored andcommitted
GITBOOK: Bond Troubleshooting: add u39, Audit B fixes
1 parent b4195e1 commit 28ac8af

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎docs/operate/protocol-bonds/bond-troubleshooting.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The bond has not been set up yet. `setup-bond` runs once per bond, within the tw
2424

2525
### ERR\_STAKE\_IN\_PREPARE\_PHASE (u47)
2626

27-
`register-for-bond` is rejected during the prepare phase, the last 100 Bitcoin blocks of every reward cycle. The prepare phase immediately before the bond starts is where most late registrations fail: in practice, registration closes when that prepare phase begins. Earlier prepare phases inside the registration window also block it; send once the next cycle has started.
27+
`register-for-bond` is rejected during the prepare phase, the last 100 Bitcoin blocks of every reward cycle. Registration closes when the prepare phase immediately before the bond starts begins. Earlier prepare phases inside the registration window also block it; send once the next cycle has started.
2828

2929
### ERR\_BOND\_ALREADY\_STARTED (u43)
3030

@@ -82,10 +82,7 @@ The signer-manager's own `validate-stake!` runs during registration and can reje
8282
The unlock height committed in a lock output is not acceptable:
8383

8484
* It is below the bond's minimum unlock height (`get-bond-l1-unlock-height`), or
85-
* it is 500,000,000 or higher, which Bitcoin would read as a Unix timestamp rather than a block height, or
86-
* it is 2³⁹ or higher, beyond what the lock script can encode.
87-
88-
`buildLockScript` and `fetchConstructLockupOutputScript` reject the last case before you fund the address.
85+
* it is 500,000,000 or higher, which Bitcoin would read as a Unix timestamp rather than a block height.
8986

9087
### ERR\_INVALID\_LOCKUP\_SCRIPT (u42)
9188

@@ -99,13 +96,17 @@ The amount in your proof does not equal the value of the output on Bitcoin.
9996

10097
The same output (transaction ID and output index) appears twice in your registration. A registration takes at most 10 lock outputs, each listed once.
10198

99+
### ERR\_READ\_TX\_OUT\_OF\_BOUNDS (u39)
100+
101+
The block header in your proof is shorter than 80 bytes, so the contract cannot parse it. Despite the constant's name, this is about the header, not the transaction. Pass the full 80-byte header of the block that contains the transaction, for example from Esplora's `/block/{hash}/header`.
102+
102103
### ERR\_INVALID\_BTC\_HEADER (u40) or ERR\_INVALID\_MERKLE\_PROOF (u41)
103104

104105
The proof does not match Bitcoin: u40 means the block header does not match the canonical header at that height, u41 means the transaction is not in that block according to the merkle path. Rebuild the proof with `buildLockProof` (Esplora-shaped indexer responses) or `buildLockProofFromBlock` (`bitcoind`-shaped), which handle witness stripping and byte order. To isolate the failing part, `fetchVerifyBlockHeader`, `fetchParseBlockHeader`, `fetchReversedTxid` and `fetchBurnBlockHeaderHash` run the contract's own helpers read-only.
105106

106107
### (err u1), (err u2) or (err u3) while reading the transaction
107108

108-
These come from Clarity's `get-bitcoin-tx-output?`, not from pox-5, even though pox-5 uses the same numbers for unrelated errors: u1 means the transaction bytes did not decode, u2 means the output index is out of range, and u3 means the output's script is over 1,024 bytes. The usual cause is passing the segwit serialization instead of the legacy one; `buildLockProof` strips the witness for you.
109+
These come from Clarity's `get-bitcoin-tx-output?`, not from pox-5, even though pox-5 uses the same numbers for unrelated errors: u1 means the transaction bytes did not decode, u2 means the output index is out of range, and u3 means the output's script is over 1,024 bytes.
109110

110111
## Related
111112

0 commit comments

Comments
 (0)