Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chain-state): notify about new safe/finalized only if modified #11383

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Oct 1, 2024

ForkChoiceSubscriptions is expected to be triggered only on new safe/finalized headers, but we in fact notify the subscribers every time we get an FCU, even if it's the same safe/finalized hash.

/// A trait that allows to register to fork choice related events
/// and get notified when a new fork choice is available.
pub trait ForkChoiceSubscriptions: Send + Sync {
/// Get notified when a new safe block of the chain is selected.
fn subscribe_safe_block(&self) -> ForkChoiceNotifications;
/// Get notified when a new finalized block of the chain is selected.
fn subscribe_finalized_block(&self) -> ForkChoiceNotifications;
/// Convenience method to get a stream of the new safe blocks of the chain.
fn safe_block_stream(&self) -> ForkChoiceStream<SealedHeader> {
ForkChoiceStream::new(self.subscribe_safe_block().0)
}
/// Convenience method to get a stream of the new finalized blocks of the chain.
fn finalized_block_stream(&self) -> ForkChoiceStream<SealedHeader> {
ForkChoiceStream::new(self.subscribe_finalized_block().0)
}
}

@shekhirin shekhirin added the C-enhancement New feature or request label Oct 1, 2024
@shekhirin shekhirin marked this pull request as ready for review October 1, 2024 15:08
@mattsse

This comment was marked as resolved.

crates/chain-state/src/chain_info.rs Outdated Show resolved Hide resolved
@shekhirin shekhirin requested a review from mattsse October 2, 2024 11:42
@mattsse mattsse added this pull request to the merge queue Oct 2, 2024
Merged via the queue into main with commit b44fff4 Oct 2, 2024
35 checks passed
@mattsse mattsse deleted the alexey/chain-info-tracker-send-if-modified branch October 2, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants