Skip to content

Optimize computation of unrealized checkpoints#678

Open
tushar994 wants to merge 2 commits into
grandinetech:developfrom
tushar994:unrealized-checkpoint-optimisation
Open

Optimize computation of unrealized checkpoints#678
tushar994 wants to merge 2 commits into
grandinetech:developfrom
tushar994:unrealized-checkpoint-optimisation

Conversation

@tushar994

@tushar994 tushar994 commented May 5, 2026

Copy link
Copy Markdown

Fork choice: skip process_justification_and_finalization when result is provably unchanged

Implements the optimization described in the existing TODO(Grandine Team) comment in fork_choice_store/src/store.rs. Referenced lighthouse for the appropriate change.

When computing unrealized checkpoints for a new block in epoch N, if the parent's unrealized justified checkpoint is already at epoch N and its unrealized finalized checkpoint is at epoch N−1, no block in this epoch can push those checkpoints any higher. The child block inherits the parent's values directly and the O(validators) process_justification_and_finalization call is skipped. This fires roughly one third of the time under normal finality conditions.

Tests

cargo test --release --no-default-features --features default-networks,blst \
  --workspace \
  --exclude zkvm_host --exclude zkvm_guest_risc0 \
  --exclude c_grandine --exclude csharp_grandine \
  --exclude slashing_protection --exclude http_api \
  -p fork_choice_control

all tests passed

@CLAassistant

CLAassistant commented May 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@tushar994 tushar994 marked this pull request as ready for review May 5, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants