Repository navigation
Conversation
BlockValidationConfig::default armed assume-valid at height 938343 with n_minimum_chain_work 0. Connect skips scripts when height < assume_valid_height && best_header_chainwork >= n_minimum_chain_work, so with a floor of 0 any chain with any work skipped every script below the height. A config that set only the height also got 0 from serde. Set the floor to Bitcoin Core v31.1 mainnet nMinimumChainWork (src/kernel/chainparams.cpp, CMainParams), in Default and as the serde default. Export the matching defaultAssumeValid height and hash as constants. No test network reaches the mainnet floor, so they verify every script unless the caller sets their own values. The hash stays unset in this network-agnostic default: connect rejects a block at the assume-valid height whose hash differs, so a mainnet hash here would reject testnet and signet blocks at that height. blvm-node sets the per-network hash.
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.
What remains after main
blvm-primitives
mainis still 7b27888, the base of this branch, so nothing on main overlaps this PR and there was nothing to merge (no push).On main,
BlockValidationConfig::default()and any config that leaves outn_minimum_chain_workget a floor of 0. Since consensus bbdaccb a skip also needs an assume-valid hash, so a floor of 0 is no longer exploitable on its own. But any caller that sets a hash (blvm-node#31, the-assumevalid=<hash>CLI from blvm#11, a library user) has its skip gated on no chain work. This PR changes that:n_minimum_chain_workdefaults to Core v31.1's mainnetnMinimumChainWork,0x1128750f82f4c366153a3a030, both inDefaultand in serde when the field is omitted.MAINNET_ASSUME_VALID_HEIGHT/MAINNET_ASSUME_VALID_HASH/MAINNET_MINIMUM_CHAIN_WORKconstants, with Core's values. The hash is stored in internal byte order.assume_valid_hashstaysNoneby default, because the default doesn't know the network.Verification (Rust 1.88.0, branch head e2405f5 = main 7b27888 + this PR)
n_minimum_chain_work: 0,#[serde(default)])default_minimum_chain_work_is_the_mainnet_flooromitted_minimum_chain_work_deserializes_to_the_floormainnet_constants_match_core_v31_1cargo test: 45 passed, 0 failed (plus 1 ignored doc test).cargo clippy --all-targets: 3 warnings on main and 3 on the branch (identical), none insrc/config.rs.rustfmt --edition 2024 --check src/config.rs: clean.Review notes
tests/fixtures/consensus_config_default.json(the regen helper is intests/config_golden.rs), or that golden test fails. No other consensus test depends on a floor of 0.