-
Notifications
You must be signed in to change notification settings - Fork 12
Add --attestation-committee-count CLI parameter #141
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
Merged
+9
−7
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ce8572e
Bump leanSpec commit to 8b7636b
pablodeymo 1f69319
Fix signature fixture deserialization for new leanSpec hex format
pablodeymo e0b9aaf
Run cargo fmt
pablodeymo a877998
Add head >= target and head slot consistency checks to attestation va…
pablodeymo f17d086
Merge known and new attestation pools in update_safe_target
pablodeymo d72c3a3
Broadcast aggregated attestations after committee signature aggregation
pablodeymo ff04494
Fix gossip config
pablodeymo a10a4d4
changing devnet3 to devnet0 for network in gossip messages
pablodeymo ef9b2e1
Add --attestation-committee-count CLI parameter to make the number of…
pablodeymo ea37b6d
Reject --attestation-committee-count 0 at CLI parse time to prevent d…
pablodeymo a6f6a5e
Add comment clarifying attestation_committee_count >= 1 is guaranteed…
pablodeymo c35a5a6
Merge branch 'devnet-3' into add-attestation-committee-count-cli
MegaRedHand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ use std::{ | |||||||||||||||||
| time::Duration, | ||||||||||||||||||
| }; | ||||||||||||||||||
|
|
||||||||||||||||||
| use ethlambda_blockchain::{ATTESTATION_COMMITTEE_COUNT, BlockChain, P2PMessage}; | ||||||||||||||||||
| use ethlambda_blockchain::{BlockChain, P2PMessage}; | ||||||||||||||||||
| use ethlambda_storage::Store; | ||||||||||||||||||
| use ethlambda_types::primitives::H256; | ||||||||||||||||||
| use ethrex_common::H264; | ||||||||||||||||||
|
|
@@ -56,6 +56,7 @@ pub(crate) struct PendingRequest { | |||||||||||||||||
| pub(crate) last_peer: Option<PeerId>, | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| #[allow(clippy::too_many_arguments)] | ||||||||||||||||||
| pub async fn start_p2p( | ||||||||||||||||||
| node_key: Vec<u8>, | ||||||||||||||||||
| bootnodes: Vec<Bootnode>, | ||||||||||||||||||
|
|
@@ -64,6 +65,7 @@ pub async fn start_p2p( | |||||||||||||||||
| p2p_rx: mpsc::UnboundedReceiver<P2PMessage>, | ||||||||||||||||||
| store: Store, | ||||||||||||||||||
| validator_id: Option<u64>, | ||||||||||||||||||
| attestation_committee_count: u64, | ||||||||||||||||||
| ) { | ||||||||||||||||||
| let config = libp2p::gossipsub::ConfigBuilder::default() | ||||||||||||||||||
| // d | ||||||||||||||||||
|
|
@@ -175,9 +177,8 @@ pub async fn start_p2p( | |||||||||||||||||
| .unwrap(); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Subscribe to attestation subnet topic (validators subscribe to their committee's subnet) | ||||||||||||||||||
| // ATTESTATION_COMMITTEE_COUNT is 1 for devnet-3 but will increase in future devnets. | ||||||||||||||||||
| #[allow(clippy::modulo_one)] | ||||||||||||||||||
| let subnet_id = validator_id.map(|vid| vid % ATTESTATION_COMMITTEE_COUNT); | ||||||||||||||||||
| // attestation_committee_count is validated to be >= 1 by clap at CLI parse time. | ||||||||||||||||||
| let subnet_id = validator_id.map(|vid| vid % attestation_committee_count); | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modulo by zero will panic if
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/net/p2p/src/lib.rs
Line: 180
Comment:
modulo by zero will panic if `attestation_committee_count` is 0
```suggestion
let subnet_id = validator_id.and_then(|vid| {
if attestation_committee_count == 0 {
None
} else {
Some(vid % attestation_committee_count)
}
});
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||
| let attestation_topic_kind = match subnet_id { | ||||||||||||||||||
| Some(id) => format!("{ATTESTATION_SUBNET_TOPIC_PREFIX}_{id}"), | ||||||||||||||||||
| // Non-validators subscribe to subnet 0 to receive attestations | ||||||||||||||||||
|
|
||||||||||||||||||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move the arguments into some
P2PConfigstruct.