Read randomize values at the checkpoint parent height during v1 HookValidator and HookVerifyMNs instead of the latest chain state. This fixes a sync-time race where historical checkpoint headers could be rejected with ErrInvalidCheckpointValidators and then accepted later after local state advanced.
The accompanying regression test now derives expected validators independently from HookValidator and the M2 generation path uses a local RNG source, removing CI-only nondeterminism during repeated verification.
* bug fix for using same config object
* update
* change log level to trace on ispochswtich
---------
Co-authored-by: liam.lai <liam.lai@babylonchain.io>
The upstream libray has removed the assembly-based implementation of
keccak. We need to maintain our own library to avoid a peformance
regression.
---------
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
* use signer pubkey to check for unique signatures and optimize performance
* change waitgroup to errgroup
* optimize
* fix typo
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* format files
* after rebase new commits, refactor from snap.NextEpochCandidates to epochInfo.Masternodes
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* revert: use masternodes from snapshot to verify vote
* fix underflow during chain initialization
* add previously removed test
* rename snapshot > snap for consistency
Previously, vote verification would log errors and fail when the referenced block header was not yet available locally, especially when nodes in the same round processed votes before receiving the block header. This commit changes the logic to defer verification and log at debug level if the header is missing, preventing unnecessary error logs and aligning with upstream geth behavior for out-of-order message arrival during consensus voting.
* use epochInfo.Masternodes instead of snap.NextEpochCandidates
* remove missing snapshot test (now irrelevant)
* add masternodes length check in getEpochSwitchInfo
* get blockhash directly from vote object
* feat: GetTokenSupply API, total minted and burned
* feat: token supply API finish burned token. rename minted record functions
* fix(api): handle edge case about minus 1 for epoch in token supply
* fix: check both total minted and burned before breaking loop
* style: modify minor style
* style: modify by comment and rebase code
* chore: modify test based on statedb_utils