Skip to content

Toccata Cleanup - Part 1 - #1082

Open
biryukovmaxim wants to merge 2 commits into
masterfrom
toccata-cleanup/1-transition-machinery
Open

Toccata Cleanup - Part 1#1082
biryukovmaxim wants to merge 2 commits into
masterfrom
toccata-cleanup/1-transition-machinery

Conversation

@biryukovmaxim

@biryukovmaxim biryukovmaxim commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Stack

  1. Toccata Cleanup - Part 1 #1082 Part 1 - transition-only machinery (base: master)
  2. Toccata Cleanup - Part 2 #1083 Part 2 - consensus activation checks
  3. Toccata Cleanup - Part 3 #1084 Part 3 - txscript covenants flag
  4. Toccata Cleanup - Part 4 #1086 Part 4 - mining and mempool policy

Each PR targets the branch below it, so its diff contains only its own layer. Review bottom to top.


First of a stacked series removing dead Toccata activation handling.

Toccata activated on mainnet at DAA 474_165_565 (~2026-06-30) and testnet at 467_579_632. With a 30 hour pruning duration and a 432,000 block finality depth, every pre-Toccata window is far behind the pruning point on all live networks, so none of the machinery below can fire again.

This part removes transition-only machinery: code that existed to announce or handle the activation moment itself. Apart from activating Toccata on devnet, it changes no consensus rule.

Changes

  • Activate Toccata on devnet (never() -> always()). Devnet was still running pre-Toccata rules; every later part of the series assumes all networks are post-activation, so this has to land first. This is the only behavior change here, and it is what drives the test-data changes described below.
  • Remove the fork activation logger: ForkLogger and the toccata_logger fields and call sites on the header and virtual processors.
  • Remove the fork log encoder: ForkEncoder, FORK_KEYWORD and FORK_LOG_LINE_PATTERN_COLORED; the console appender falls back to the plain pattern. Resolves the TODO (post HF) in core/src/log/appender.rs.
  • Remove the p2p activation countdown: CountdownActivation and the [Toccata countdown: -N] block event suffix. The DAA scores that only fed the countdown are dropped from BlockLogEvent::Relay/Submit.
  • Remove the IBD pre-activation pruning point guard (validate_pruning_point_freshness_for_toccata) and the unconditional set_pruning_smt_stable workaround for pre-Toccata nodes, both marked TODO(post-toccata).
  • Delete daemon_toccata_activation_log_file_test, which existed solely to assert the logging removed above.

HeaderProcessor.toccata_activation is dropped as well: the activation logger was its only reader.

Test changes caused by the devnet activation

What changes in test data, how and why. The three dags_for_json_tests/*/blocks.json.gz fixtures are regenerated, not hand edited: simpa/generate-json-tests-data.sh reruns simpa with the same arguments and overwrites them. They are regenerated because json_test derives its params from DEVNET_PARAMS, so flipping devnet to Toccata changed the block version the replay expects while the stored headers were still version 1. No test case is added or removed by this: the same five goref_* tests replay the same DAG shapes, only the recorded blocks differ. Part 2 (#1083) regenerates goref_custom_pruning_depth once more, for a different reason described there.

Activating Toccata on devnet means devnet headers must now carry block version 2 instead of 1. Two things in the test suite were still producing version 1 headers:

  • TestConsensus::build_header_with_parents built headers via Header::from_precomputed_hash, which hardcodes version: BLOCK_VERSION. It now takes the version from the configured params (params.block_version().get(daa_score)), so the helper follows whichever network it is given instead of assuming pre-Toccata. Tests that configure their own activation score, such as header_version_is_enforced_by_activation, still get version 1 for their pre-activation blocks.

  • testing/integration/testdata/dags_for_json_tests/*/blocks.json.gz are the three DAGs replayed by json_test (goref_notx_test, goref_tx_small_test, goref_custom_pruning_depth_test and their concurrent variants). Despite the goref- prefix these are not Go reference vectors; they are simpa-generated. json_test derives its params from DEVNET_PARAMS, so the devnet flip changed the rules used to replay them while their stored headers were still version 1.

    All three were regenerated with simpa/generate-json-tests-data.sh. The first line of each file is an OverrideParams blob pinning the fork activations the DAG was generated under; previously it carried no Toccata key, so the fixtures silently inherited whatever activation devnet had. They now pin it explicitly:

    fixture toccata_activation
    goref-notx-5000-blocks 0
    goref-1060-tx-265-blocks 0
    goref_custom_pruning_depth 1000

    The pruning DAG gets 1000 because simpa's --test-pruning profile sets that activation score, so that DAG deliberately spans the activation boundary and exercises both header versions in one replay.

    These files are gzipped block dumps, so the diff is not reviewable by inspection. They are meant to be reproduced rather than read: re-running simpa/generate-json-tests-data.sh regenerates them, and the pinned activations above match what the params imply.

Not in scope

Later parts of the series handle the activation checks in consensus, the txscript EngineFlags gate, the MiningManager/Mempool plumbing, and the Params surface. Pre-Toccata storage decoders (utxo/pre_toccata.rs, the EOF tolerant UtxoEntry deserializer, db_compat.rs, the utxoindex compact entry shim) are permanent DB compatibility and are never removed. TX_VERSION_TOCCATA keyed rules are permanent semantics.

* Activate Toccata on devnet
* Remove the fork activation logger and its log encoder
* Remove the p2p activation countdown
* Remove the IBD pre-activation pruning point guard and SMT stable workaround
* Build test headers with the configured block version instead of the constant
* Regenerate the JSON DAG fixtures now that devnet is Toccata active
@biryukovmaxim
biryukovmaxim force-pushed the toccata-cleanup/1-transition-machinery branch from 4260ee2 to 95dde9c Compare July 27, 2026 16:07
@biryukovmaxim
biryukovmaxim marked this pull request as ready for review July 28, 2026 09:37
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.

1 participant