Skip to content

feat: Chronicle-ready script validation and go-sdk upgrade#1007

Merged
oskarszoon merged 7 commits intomainfrom
feature/chronicle-readiness
Apr 1, 2026
Merged

feat: Chronicle-ready script validation and go-sdk upgrade#1007
oskarszoon merged 7 commits intomainfrom
feature/chronicle-readiness

Conversation

@oskarszoon
Copy link
Copy Markdown
Collaborator

@oskarszoon oskarszoon commented Mar 31, 2026

Summary

  • Chronicle fork block height constants for UTXO validation — Defines ChronicleForkBlockMain (882687), ChronicleForkBlockTest (1621670), and ChronicleForkBlockRegtest (15000) constants alongside the existing GenesisForkBlock* constants. Both DefaultValidator and BEEF Validator now use the Chronicle fork block height as the UTXO height for all inputs passed to BDK's VerifyScript, 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.
  • Upgrade go-sdk from v1.2.12 to v1.2.20 for Chronicle compatibility.
  • Clean up unused genesisForkBlock field from validator structs, constructors, and all callers (from prior commits).
  • Allow non-push-only unlocking scripts for v2+ transactions (from PR fix: allow non-push-only unlocking scripts for v2+ transactions #1005, already merged).

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:

  1. All UTXOs are treated identically — there is no per-UTXO rule differentiation
  2. Chronicle rules are the most permissive, so no valid transactions are rejected (no false negatives)
  3. Some pre-Chronicle transactions may pass that shouldn't (false positives), but this is expected and unavoidable without UTXO creation heights
  4. ARC is a pre-check — the node performs authoritative validation

This eliminates the need for X-SkipScriptValidation header when submitting Chronicle-era transactions.

Test plan

  • go build ./... — compiles clean
  • All validator unit tests pass (default, beef, common)
  • go vet ./... — clean
  • Handler tests pass
  • Verify on testnet that Chronicle transactions no longer require X-SkipScriptValidation
  • Verify pre-Chronicle transactions still validate correctly

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.

This comment was marked as outdated.

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.
@oskarszoon oskarszoon requested a review from Copilot March 31, 2026 14:21

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator

@sirdeggen sirdeggen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/validator/defaultvalidator/default_validator.go
Comment thread internal/validator/beef/beef_validator.go
Comment thread examples/custom/main.go Outdated
…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.
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/validator/defaultvalidator/default_validator.go
Comment thread internal/validator/beef/beef_validator.go
@oskarszoon oskarszoon merged commit e7efc5b into main Apr 1, 2026
11 checks passed
@oskarszoon oskarszoon deleted the feature/chronicle-readiness branch April 1, 2026 08:38
github-actions bot pushed a commit that referenced this pull request Apr 1, 2026
Co-authored-by: Deggen <d.kellenschwiler@bsvassociation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants