feat: Chronicle-ready script validation and go-sdk upgrade#1007
feat: Chronicle-ready script validation and go-sdk upgrade#1007oskarszoon merged 7 commits intomainfrom
Conversation
Use current block height for UTXO heights in BDK script validation instead of hardcoding genesisForkBlock. The BDK script engine uses UTXO heights to determine which consensus flags apply per input — hardcoding to genesisForkBlock meant Chronicle-era rules (OTDA sighash) were never activated, requiring X-SkipScriptValidation as a workaround. BDK already has correct Chronicle activation heights per network (mainnet: 882687, testnet: 1621670, regtest: 15000), so passing the current block height enables Chronicle rules for post-activation UTXOs. Also upgrades go-sdk from v1.2.12 to v1.2.20 for Chronicle compatibility.
Add blockHeight <= 0 guard to both validators to prevent incorrect script validation during startup before the first block height update (~5 seconds). Previously masked by the hardcoded genesisForkBlock. Also documents the rationale for using current block height as UTXO height: actual UTXO creation heights are not available in ARC's current architecture, and this is safe because Chronicle only adds capabilities without removing existing ones.
Fixes revive unnecessary-format lint errors in CI.
sirdeggen
left a comment
There was a problem hiding this comment.
Use a constant for blockheight of utxos because at the moment it seems like you can have different rules applied per utxo which is just not the case. Behavior is constant, so make it a constant.
Replace per-UTXO current block height with network-specific Chronicle fork block constants (mainnet: 882687, testnet: 1621670, regtest: 15000). All UTXOs are now treated uniformly under Chronicle rules — the most lenient — eliminating false negatives. ARC does not know UTXO creation heights, so this makes the constant behavior explicit rather than masking it behind a per-input loop.
…Cloud coverage Add test for the zero block height error path in DefaultValidator script validation, and pass WithChronicleForkBlock option in BEEF validator tests to cover the options loop in New().
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…e network switch Add chronicleForkBlock <= 0 guard in both validators to catch misconfiguration where WithChronicleForkBlock option is not provided. Make examples/custom/main.go panic on unsupported network instead of silently falling through to regtest defaults.
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Deggen <d.kellenschwiler@bsvassociation.org>



Summary
ChronicleForkBlockMain(882687),ChronicleForkBlockTest(1621670), andChronicleForkBlockRegtest(15000) constants alongside the existingGenesisForkBlock*constants. BothDefaultValidatorand BEEFValidatornow use the Chronicle fork block height as the UTXO height for all inputs passed to BDK'sVerifyScript, replacing the previous approach of using the current block height per-UTXO. This makes the behavior explicit and constant — transactions coming into ARC have unknown parent heights, so Chronicle rules (the most lenient) are applied uniformly, eliminating false negatives while accepting some expected false positives.genesisForkBlockfield from validator structs, constructors, and all callers (from prior commits).Design rationale
Previously, the current block height was used as the UTXO creation height for every input, creating the illusion that each UTXO could have different rules applied. In reality, ARC does not know UTXO creation heights, and the behavior should be uniform. The Chronicle fork block is the correct constant because:
This eliminates the need for
X-SkipScriptValidationheader when submitting Chronicle-era transactions.Test plan
go build ./...— compiles cleango vet ./...— cleanX-SkipScriptValidation