Skip to content

Use BIP9 activation for ASERT#54

Open
NyanCatTW1 wants to merge 6 commits intoProjectFactor:mainfrom
NyanCatTW1:202604update
Open

Use BIP9 activation for ASERT#54
NyanCatTW1 wants to merge 6 commits intoProjectFactor:mainfrom
NyanCatTW1:202604update

Conversation

@NyanCatTW1
Copy link
Copy Markdown
Member

@NyanCatTW1 NyanCatTW1 commented Apr 15, 2026

Goal

Ensure ASERT only activates after miners have explicitly signaled readiness,
replacing the hardcoded timestamp activation with BIP9 versionbits consensus.
This guarantees the DAA switch happens only when a supermajority (95% on
mainnet) of hashrate has upgraded and agreed to the change.

Summary

  • BIP9 activation for ASERT: Replace asertActivationTime timestamp gate
    with a proper DEPLOYMENT_ASERT versionbits deployment (bit 24). Mainnet
    signaling window runs 2026-03-01 to 2027-03-01 with period=672 and
    threshold=639 (95%). Testnet/signet use ALWAYS_ACTIVE; regtest uses real BIP9
    (nStartTime=0, period=32) so the full state machine is exercisable in tests.
  • Unified anchor discovery: GetASERTAnchorBlock now uses
    StateSinceHeight to derive the anchor for all networks — block 1 for
    ALWAYS_ACTIVE, last block of the LOCKED_IN period for real BIP9 — eliminating
    the old asertActivationTime == 0 special case.

Details

Consensus params:

  • consensus/params.h — remove asertActivationTime, add DEPLOYMENT_ASERT
    to DeploymentPos enum
  • deploymentinfo.cpp — register deployment name and gbt_force = true
  • chainparams.cpp — configure DEPLOYMENT_ASERT per network, fix TESTDUMMY
    min_activation_height (1 → 0) to satisfy period-boundary invariant

Activation logic:

  • pow.cppIsASERTEnabled delegates to DeploymentActiveAfter;
    GetASERTAnchorBlock replaced timestamp walk-back with StateSinceHeight
    query; GetNextFACTORASERTWorkRequired uses a single GetASERTAnchorBlock
    call for all networks

Tests:

  • pow_tests.cpp — anchor tests now use RegtestTestingSetup with a
    BuildBIP9ActivatedChain helper that constructs a chain with explicit
    version-bit signaling (blocks 32-63), exercising the full
    DEFINED → STARTED → LOCKED_IN → ACTIVE state machine. Covers anchor
    discovery, cache invalidation on reorg, fast blocks, and slow blocks
  • versionbits_tests.cppcheck_computeblockversion respects per-deployment
    period overrides instead of assuming global nMinerConfirmationWindow

Smoke tests performed

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