parlia: opt consensus perf and FF stability;#267
parlia: opt consensus perf and FF stability;#267galaio wants to merge 3 commits intobnb-chain:developfrom
Conversation
|
|
||
| } | ||
|
|
||
| async fn check_fast_atteatation(vote: VoteEnvelope) -> Result<(), eyre::Error> { |
There was a problem hiding this comment.
| async fn check_fast_atteatation(vote: VoteEnvelope) -> Result<(), eyre::Error> { | |
| async fn check_fast_attestation(vote: VoteEnvelope) -> Result<(), eyre::Error> { |
| // TODO: remove it now, miner can produce block until timeout. | ||
| // let mut time_for_mining_ms = period_ms / 2; | ||
| // let last_block_in_turn = snap.last_block_in_one_turn(header.number); | ||
| // if !last_block_in_turn { | ||
| // time_for_mining_ms = period_ms; | ||
| // } | ||
| // if delay_ms > time_for_mining_ms { | ||
| // delay_ms = time_for_mining_ms; | ||
| // } |
| // once one attestation generated, attestation of snap would not be nil forever basically | ||
| // ref: https://github.com/bnb-chain/bsc/blob/583cfec3ea811fb124e6812aabd190555d5aeabc/consensus/parlia/parlia.go#L2161 | ||
| if justified_hash == B256::ZERO { | ||
| match get_cannonical_header_from_cache(0) { |
There was a problem hiding this comment.
| match get_cannonical_header_from_cache(0) { | |
| match get_canonical_header_from_cache(0) { |
| reth-chainspec = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.7" } | ||
| reth-cli-util = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.7" } | ||
| reth-discv4 = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.7", features = [ | ||
| reth = { git = "https://github.com/galaio/bnb-reth.git", rev = "f3d3416a47059c8815891eee9997cb15b32b473a" } |
There was a problem hiding this comment.
please be sure our are using https://github.com/bnb-chain/reth/tree/rebase-v1.10.2-bnb as we rebased the old reth and the history will not be the same
| guard | ||
| .cur_votes | ||
| .get(&target_hash) | ||
| .map(|vm| vm.vote_messages.len()) |
There was a problem hiding this comment.
quorum is calculated from raw pool count (vote_messages.len()), not validator-filtered/verified votes
| if guard.notified_quorum_blocks.contains(&target_hash) { | ||
| return Ok(()); | ||
| } | ||
| guard.notified_quorum_blocks.insert(target_hash); |
There was a problem hiding this comment.
happens before confirming event channel availability/send success. If send fails (or channel is not initialized), this block is permanently marked and future valid notifications are suppressed
| } | ||
|
|
||
| // record finality duration in header | ||
| let finalized_header = get_header_by_hash_from_cache(&justified_hash) |
There was a problem hiding this comment.
Metric collection is now in the attestation assembly critical path. If header lookup misses, we return error and skip attestation assembly.
| total_job_duration_ms = total_job_duration.as_millis(), | ||
| "No best payload available, building empty payload as in-turn fallback" | ||
| ); | ||
| warn!( |
There was a problem hiding this comment.
fallback empty payload is now built unconditionally when no best payload exists. Previously this was gated to in-turn behavior. Was this intentional? This may increase off-turn empty block attempts.
Description
This PR primarily optimizes consensus performance and FF stability, enabling reth-bsc to produce blocks and complete finalization in lower latency scenarios.
Specific optimizations:
Changes
Notable changes: