-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: add BlockAnnounce trait for outbound block propagation #18931
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
Open
itsdevbear
wants to merge
11
commits into
paradigmxyz:main
Choose a base branch
from
itsdevbear:feat/block-announce-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add BlockAnnounce trait for outbound block propagation #18931
itsdevbear
wants to merge
11
commits into
paradigmxyz:main
from
itsdevbear:feat/block-announce-support
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
Adds symmetric counterpart to BlockImport for announcing blocks to the network. This enables PoW chains, development scenarios, and L2s to propagate blocks produced at the execution layer. Key features: - BlockAnnounce trait with poll-based interface - Integration with NetworkManager's event loop - Builder API for easy configuration - PoS safety check to prevent invalid propagation - Optional by default, backward compatible 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Moved BlockAnnounce trait, event types, and implementations to a dedicated announce.rs module for better code organization. Added comprehensive unit tests to verify: - ProofOfStakeBlockAnnounce always returns Pending - Mock BlockAnnounce returns blocks in FIFO order - BlockAnnounceEvent structure works correctly - Multiple blocks can be queued and polled sequentially Tests use a noop waker pattern with proper lifetime management. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added block_announce field to NetworkConfig and NetworkConfigBuilder to enable configuration of block announcement via the config pattern. This provides an alternative to the builder pattern for setting up block propagation. Changes: - Added block_announce field to NetworkConfig struct - Added block_announce field to NetworkConfigBuilder - Added block_announce() setter method to NetworkConfigBuilder - Updated NetworkManager::new() to extract and use block_announce from config - Cleaned up imports to use top-level imports instead of inline crate:: paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updated the block announcement handler to follow proper Ethereum block propagation patterns: - Announce full block to √n peers (for quick propagation) - Announce block hash to all peers (for network-wide awareness) Also updated documentation to be more generic ("custom chains" instead of specifically "PoW chains") to better reflect the broader use cases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implemented flexible block propagation with strategy enum: - PropagationStrategy::FullBlock - announce full block to √n peers - PropagationStrategy::HashOnly - announce hash to all peers - PropagationStrategy::Both (default) - full block to √n + hash to all Changes: - Added PropagationStrategy enum with Default trait - Updated BlockAnnounceRequest to single Announce variant with strategy field - Removed redundant AnnounceHash variant - Updated handler to match on strategy and propagate accordingly - Made block_announce required (Box<dyn>) with ProofOfStakeBlockAnnounce default - Updated all tests to use new structure with strategy field - Removed unused imports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added detailed example showing: - How to implement BlockAnnounce with a channel-based approach - Using PropagationStrategy to control block propagation - Configuration via NetworkConfig builder - Sending blocks for announcement Example demonstrates the most common pattern for integrating block production with network propagation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
51e8179
to
805e858
Compare
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.
This PR adds a symmetric counterpart to BlockImport for announcing blocks to the network. This is useful for custom chains that want to leverage a singular p2p layer instead of running a separate consensus client.
Scope:
Example Usage: