Toccata Cleanup - Part 2 - #1083
Open
biryukovmaxim wants to merge 1 commit into
Open
Conversation
This was referenced Jul 27, 2026
* Collapse consensus activation checks to their post-Toccata branch * Move transaction version and signature script checks back to isolation * Restore the context-free header version check * Drop the activation field from the transaction, coinbase, pruning proof, virtual and seq commit services * Stop generating DAGs that span the activation in simpa test pruning
biryukovmaxim
force-pushed
the
toccata-cleanup/2-consensus-leaves
branch
from
July 27, 2026 16:07
b5b1b00 to
e851107
Compare
biryukovmaxim
marked this pull request as ready for review
July 28, 2026 09:38
This was referenced Jul 28, 2026
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.
Stack
master)Each PR targets the branch below it, so its diff contains only its own layer. Review bottom to top.
Second of a stacked series removing dead Toccata activation handling. Stacked on #1082; review that one first, this PR's diff is only the changes on top of it.
Toccata activated on mainnet at DAA
474_165_565and testnet at467_579_632. With a 30 hour pruning duration and a 432,000 block finality depth,pruning_point.daa_score - finality_depth > toccata_activationholds on every live network. That is what makes the pre-Toccata branches below unreachable, including the ones that operate inside the[pruning_point - finality_depth, pruning_point]window. Part 1 activated Toccata on devnet, so all networks are now post-activation.This part collapses every activation check inside the consensus crates to its post-Toccata branch, and drops each
toccata_activationfield once its last reader is gone.Params::toccata_activationdeliberately stays; it is still read outside consensus and is removed at the top of the stack.Collapsed checks
check_transaction_versionandcheck_transaction_signature_scripts_in_header_contextare deleted, and the isolation-stage checks become the single enforcement point. This is what the deletedTODO(post-toccata)asked for, and it restores the arrangement described byvalidate_tx_in_isolation's own doc comment: checks live in header context only while they are activation dependent.check_covenant_infoand the script engine's covenant flag become unconditional.TX_VERSION_TOCCATA.check_header_version_in_contextis deleted and the context-freecheck_header_versionis restored in pre-GHOSTDAG validation. Historical headers are unaffected: pruning-proof headers are inserted directly byapply_proofwithout passing isolation validation, and ordinary IBD headers start at the current post-activation pruning point.accepted_id_digestsis always the single-element seq_commit form, chain qualification is unconditional, the seq commit accessor is always present, and the inactivity shortcut no longer folds toZERO_HASHfor pre-Toccata ancestors.calc_accepted_id_merkle_rootis deleted once both callers are gone.get_seq_commit_lane_prooflose their remaining gates.ForkedParamcall sites move from.get(daa_score)to.after()rather than to plain constants. The field types stay as they are and collapse to plain values at the top of the stack, so this PR contains no parameter-shape changes.Genesis accepted-id digests
compute_genesis_accepted_id_digestsbranched on the genesis DAA score. Mainnet and testnet genesis predate the activation, so the pre-Toccata branch was the live one for them, but it is collapsed here along with the rest.A node with an existing database does not process genesis at all. A node starting from an empty database does compute this value, but discards it while syncing, because the headers proof builds a staging consensus that skips genesis and seeds virtual state at the current pruning point. Any network defined from now on is post-activation at genesis. The reasoning is recorded in a doc comment on the function.
This is also what allows
Params::toccata_activationto be deleted entirely later in the series, rather than kept for a computation that permanently depends on the activation score.Removed plumbing
toccata_activationis dropped fromTransactionValidator,CoinbaseManager,PruningProofManager,VirtualStateProcessorandSeqCommitAccessor, together with their constructor arguments andservices.rscall sites.UtxoProcessingContext::accepted_tx_idsandaccepted_tx_versionsare removed as well: the collapse left them written on every accepted transaction and read nowhere.Test data
What changes in test data, how and why. Exactly one fixture changes,
goref_custom_pruning_depth/blocks.json.gz, regenerated by rerunningsimpa/generate-json-tests-data.shrather than edited by hand. ItsOverrideParamsheader line is identical to the previous one excepttoccata_activation: 1000 -> 0;pruning_depth: 450,finality_depth: 200and every other param are unchanged, so the fixture still exercises the custom pruning depth it exists for.goref_custom_pruning_depth_testis not touched and still passes.simpa's--test-pruningprofile pinnedtoccata_activationat DAA 1000, sogoref_custom_pruning_depthwas a DAG spanning the activation with mixed header versions. Now that the header version check is unconditional, such a DAG is not valid input, so the toggle is removed and the fixture regenerated; it pinstoccata_activation: 0and is uniformly version 2. The file is a gzipped block dump, so it is meant to be reproduced withsimpa/generate-json-tests-data.shrather than read as a diff.Integration tests covering the pre-activation to post-activation transition are deleted, since the transition no longer exists in the code. The durable invariants they shared coverage with (covenants, push limits, native payloads, KIP-10, header and transaction version enforcement) remain covered. One assertion in
header_in_isolation_validation_testmoves fromBLOCK_VERSIONtoTOCCATA_BLOCK_VERSION, following the version check into isolation.Not in scope
Params::toccata_activation, theForkedParamgetters,BLOCK_VERSION := 2andTOCCATA_BLOCK_VERSIONare handled at the top of the stack. The txscriptEngineFlagscovenant flag, theMiningManager/Mempoolplumbing andprotocol/flowsfollow in later parts. Pre-Toccata storage decoders (utxo/pre_toccata.rs, the EOF tolerantUtxoEntrydeserializer,db_compat.rs) are permanent DB compatibility and are never removed, as are theTX_VERSION_TOCCATAkeyed transaction rules.A
TODOis left onVirtualState::accepted_id_digests: it now always holds exactly one hash, and could become a dedicated type that serializes as a one-element vector, keeping the stored bytes identical while making the invariant explicit.