feat: toolkit hard-fork support#711
Merged
Merged
Conversation
Introduce version-agnostic block handling so the toolkit can replay blocks from a chain that started on ledger 7 and forked to ledger 8, building correct context state across the version boundary. Core changes: - Add RawBlockData/RawTransaction types that store transactions as raw serialized bytes with a spec_version field, deferring deserialization until the ledger version is known. - Add ForkAwareLedgerContext enum wrapping ledger 7/8 LedgerContext, with update_from_block() that deserializes using the correct version's types and auto-forks via fork_context_7_to_8 when transitioning. - Remove S, P, D generic parameters from the entire fetch pipeline: FetchStorage, ComputeTask, FetchTask, fetch_all now all operate on RawBlockData. - Make SourceTransactions non-generic, holding Vec<RawBlockData> with version-aware network_id extraction. - Replace all inline LedgerContext construction + update_from_block loops with a shared build_fork_aware_context helper, used by both builders and command files. Phase 1 assumes the chain always ends at ledger 8 for transaction building. Pure ledger 7 transaction building is deferred to Phase 2.
…ding Remove S, P generic parameters from Sender, SendTxs, and TxGenerator by introducing SerializedTx/BuiltTransactions types that pre-serialize transactions in the builder. Externalize context building from individual builders to TxGenerator::build_txs via relevant_wallet_seeds().
- Restructure builders into common/ + version wrappers (ledger_8.rs, ledger_7.rs) using ledger_helpers_local module alias for explicit version-specific imports - build_fork_aware_context and build_context_with_cache now return Result<_, ContextNotLedger8Error> instead of panicking - Update all callers to propagate errors with ? - Delete unused fork_aware_block_data.rs
Builders now dispatch to the correct ledger version at construction time via Builder::to_versioned_builder(). Cross-version type conversion uses raw bytes for hash types, bech32 for addresses, and try_from for seeds. Version-local tx serialization replaces the ledger-8-bound DeserializedTransactionsWithContext. contract_custom is excluded from ledger 7 as EncodedOutputInfo only implements ledger 8 BuildOutput.
Contributor
Pass --build to docker compose up so that locally-built images (e.g. contract-compiler) are rebuilt when their Dockerfile changes, preventing stale images from being reused.
local-env uses a different chain network id to the network id encoded in the ledger transactions - this is non-standard, but the toolkit should not break because of this.
…ion support Move version-dependent logic from command files into fork/common/commands/, compiled against both ledger_7 and ledger_8 types via the existing #[path] pattern. Context-building commands (contract_state, show_wallet, dust_balance, generate_intent, generate_sample_intent) dispatch based on ForkAwareLedgerContext::version(). Deserialization commands (show_transaction, contract_address, get_tx_from_context) use try-both dispatch: attempt ledger_8 first, fall back to ledger_7.
The top-level fork/ module mixed concerns (commands, builders, transactions) under a single umbrella. Move version-specific command implementations into commands/fork/ where they colocate with the dispatch logic, and consolidate the shared from_serde_tx into the existing tx_generator builders via a transactions.rs module. The duplicate fork/builders/ is removed since tx_generator/builder/builders/ already provides the same functionality.
justinfrevert
approved these changes
Feb 26, 2026
LGLO
reviewed
Feb 26, 2026
gilescope
reviewed
Feb 26, 2026
gilescope
reviewed
Feb 26, 2026
gilescope
reviewed
Feb 26, 2026
gilescope
reviewed
Feb 26, 2026
gilescope
reviewed
Feb 26, 2026
gilescope
reviewed
Feb 26, 2026
gilescope
approved these changes
Feb 26, 2026
gilescope
left a comment
Contributor
There was a problem hiding this comment.
Looking good aside from a few nits - love the bonfire of generic args!
Replace the manual PartialEq/Eq/Ord/PartialOrd impls that only compared tblock_secs with derived PartialEq/Eq. The single sort call site now uses sort_by_key instead.
The reusable sbom-scan-image workflow requires attestations:write, but the caller workflow did not include it in top-level permissions.
gilescope
pushed a commit
that referenced
this pull request
Apr 8, 2026
m2ux
added a commit
that referenced
this pull request
Apr 23, 2026
Signed-off-by: Mike Clay <mike.clay@shielded.io>
m2ux
added a commit
that referenced
this pull request
Apr 23, 2026
Signed-off-by: Mike Clay <mike.clay@shielded.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Overview
RawBlockDataForkAwareContextstruct that forks between ledger 7 and ledger 8Testing:
toolkit-e2etests into an integration test usingtestcontainers🗹 TODO before merging
Update chainspec/mod.rs to support old format📌 Submission Checklist
🧪 Testing Evidence
Please describe any additional testing aside from CI:
🔱 Fork Strategy
Links