ASERT fractional polynomial diverges from BCH reference #20
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
pool
post-quantum
question
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ignotusnemo/parano1d#20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
noid_chain/src/consensus/difficulty.rsdescribes its fractional exponent approximation as identical to BCHCalculateASERT, but the implemented terms are scaled differently:B * f * f / 65536instead ofB * f * f;(f / 65536), which is zero for everyu16fractional value.The resulting factor increasingly understates
2^(frac/65536), reaching about 15.2% at the upper fractional boundary. For a six-block epoch that is one second ahead of its 120-second schedule, the reference target multiplier is about 0.994 while the current implementation produces about 0.845, introducing a large discontinuity around zero schedule error.Protocol impact
This calculation is consensus-critical: correcting it changes expected difficulty targets and therefore block validity. It must be handled as a coordinated network upgrade or explicit activation, not silently deployed to only some nodes.
Proposed change
u128intermediates.v2branch as required byCONTRIBUTING.md.Reference: https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/blob/master/src/pow.cpp#L230-238
Confirmed. I reproduced the divergence and verified the one-second-fast boundary against BCH CalculateASERT. Current mainnet nodes all use the same existing rule and remain in consensus.
I will integrate the corrected polynomial into v2 alongside the legacy rule, with activation disabled until the complete v2 consensus scope and activation height are finalized. The implementation and regression vectors are being handled in #21.
Implemented in v2 by #21. The legacy and corrected BCH rules are now explicit and covered by exact regression vectors. Production activation remains disabled until the complete v2 consensus scope and activation height are finalized. Current mainnet behavior is unchanged.
Although this report predates the Bug Hunt and was public before its rules existed, the finding was real and led to a correction prepared for v2. I am awarding it 500 NOID retroactively. @getrigeos, please reply here with your NOID payout address. I will only use an address posted from the account that opened this issue.