ASERT DAA and timestamp hardening (activation: 2026-04-20)#51
Open
NyanCatTW1 wants to merge 18 commits intoProjectFactor:mainfrom
Open
ASERT DAA and timestamp hardening (activation: 2026-04-20)#51NyanCatTW1 wants to merge 18 commits intoProjectFactor:mainfrom
NyanCatTW1 wants to merge 18 commits intoProjectFactor:mainfrom
Conversation
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.
Goal
To ensure the chain recovers rapidly after major hashrate fluctuation, while keeping the chain safe from selfish mining attempts.
ASERT combined with hardened timestamp is safe from all except for 51% attacks, in which case we have better things to worry about than selfish mining
Summary
FACTOR's nonlinear (integer) nBits instead of BCH's 256-bit target. Uses a
precomputed log2 lookup table with Q32.32 fixed-point arithmetic to compute
2^(exponent) over nBits space. Half-life is 2 days on mainnet, 1 hour on
testnet/regtest. Activates on mainnet at 2026-04-20 10:09:00 UTC.
adjustment (GetTimeOffset always returns 0), and reduce MAX_FUTURE_BLOCK_TIME
to 4 seconds. ASERT uses block time directly rather than MTP for activation.
Details
Core implementation:
CalculateFACTORASERT()- pure function, no chain-state deps (pow.cpp)asert_table.h- 512-entry log2(compute()) lookup table generated byscripts/gen_compute_table.pyGetNextWorkRequired()routes to ASERT after activationTimestamp changes:
timedata.cppignores median peer offsetvalidation.cppenforcesnTime > prev.nTime(monotonic)MAX_FUTURE_BLOCK_TIMEreduced from 2h to 4sTesting:
asert_tests.cpp- unit tests for CalculateFACTORASERT including boundary,clamping, degenerate cases, and mainnet anchor
pow_tests.cpp- updated for ASERT integration and monotonic timestampsgen_asert_test_vectors.cpp- deterministic test vector generatorvalidate_nbits_aserti3_2d.py- independent Python validation of thefixed-point math
Smoke tests performed