Conversation
src/node/vote_producer.rs
Outdated
| let mut count = 1; | ||
| if chain_spec.is_fermi_active_at_timestamp(head.number(), head.timestamp()) { | ||
| count = K_ANCESTOR_GENERATION_DEPTH; | ||
| } |
There was a problem hiding this comment.
It is recommended to encapsulate this into a function called GetAncestorGenerationDepth in parlia, similar to BSC-geth.
There was a problem hiding this comment.
There are multiple places where this logic exists and no suitable way to make it a public method is found because of the ChainSpec parameter
There was a problem hiding this comment.
Pull Request Overview
This PR implements Fermi hardfork changes for the BEP-590 vote attestation mechanism, enabling ancestor block voting across up to 3 generations instead of just the direct parent block.
Key changes:
- Extends vote attestation to search through up to 3 ancestor generations (K_ANCESTOR_GENERATION_DEPTH) when the Fermi hardfork is active
- Updates the vote assembly logic to iterate through ancestors until sufficient quorum is reached
- Adjusts validation logic to check ancestor blocks for attestation target matching
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/consensus/parlia/constants.rs | Adds K_ANCESTOR_GENERATION_DEPTH constant and changes MILLISECONDS_UNIT from 250ms to 50ms |
| src/consensus/parlia/consensus.rs | Refactors assemble_vote_attestation to search ancestors for quorum and adds snapshot_provider parameter |
| src/consensus/parlia/error.rs | Adds HeaderNotFound and SnapshotNotFound error variants |
| src/node/vote_producer.rs | Adjusts vote assembly timing calculation to account for K_ANCESTOR_GENERATION_DEPTH |
| src/node/evm/pre_execution.rs | Updates verification to check ancestors up to depth based on Fermi activation, removes get_ancestor_generation_depth method |
| src/node/miner/util.rs | Passes snapshot_provider to assemble_vote_attestation and changes error logging from debug to warn |
| src/node/evm/assembler.rs | Threads snapshot_provider parameter through finalize_new_header calls |
| src/hardforks/mod.rs | Fixes comment incorrectly referencing Maxwell instead of Fermi |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
feat: 450ms hard fork
geth-bsc prs:
https://github.com/bnb-chain/bsc/pull/3367/files
https://github.com/bnb-chain/bsc/pull/3368/files
bnb-chain/bsc#3397
bnb-chain/bsc#3400
BEP:
https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP-619.md
https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP-590.md