Open
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.
Delayed QC Aggregation Panic Fix (pending_votes.rs): Replaced a panic! with graceful error handling (VoteReceptionResult::ErrorAddingVote) when a delayed Quorum Certificate (QC) aggregation is triggered with insufficient voting power. This prevents the consensus from crashing upon receiving stale or maliciously delayed votes.
Rotating Proposer Safety (rotating_proposer_election.rs): Added strict assertions during RotatingProposer initialization to guarantee that the proposer set is not empty and contiguous_rounds > 0, neutralizing potential division-by-zero or out-of-bounds panics.
2. Prevention of Undefined Behavior (UB) in Concurrency (gravity_node)
Safe Environment Variables (
main.rs
): Moved the conditional evaluation and mutation of RUST_BACKTRACE to the absolute start of
main()
before any threads are spawned. This mitigates a known Undefined Behavior (UB) caused by calling std::env::set_var in a multithreaded environment.
3. Data Recovery and State Sync Improvements (api/bootstrap.rs & api/consensus_mempool_handler.rs)
Optimized Block Buffer Initialization: Completely refactored the recovery exit condition during init_block_buffer_manager. Instead of an ad-hoc flag, the loop now intelligently breaks once the block_number_to_block_id map length fulfills the required range
(latest_block_number - start_block_number + 1)
, significantly improving boot/sync performance.
Unhandled Channel Logs: Added explicit .is_none() error logging internally if the persist_notifiers channel silently closes during commit_blocks or commit_ledger, averting silent transaction processing failures.
Save Transaction Robustness: Properly handled the
Err
result returned by self.inner.db.writer.save_transactions(...) during the commit_ledger sequence, actively logging any database storage faults.
4. Block Parent Resolution Safety (block_buffer_manager.rs)
Integer Underflow Protection: Safeguarded the block parent lookup mechanism by using checked_sub(1). When evaluating block_number == 0 (the genesis block edge-case), it skips looking up parent mappings and inherently relies on the canonically provided parent_id, averting subtraction underflow crashes.