-
Notifications
You must be signed in to change notification settings - Fork 907
Fix for #7122 Avoid attempting to serve BlobsByRange RPC requests on Fulu slots #7328
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2c0311e
init commit, test fails
SunnysidedJ f79d741
implementation complete with existing test passed
SunnysidedJ 6d18d89
tests blocked. non-zero start slot not working
SunnysidedJ e858190
add BlobsByRoot avoiding its tests. Also, fix for other tests
SunnysidedJ 356f9a8
Merge branch 'unstable' into avoid-BlobsByRange-rpc
SunnysidedJ ea2bbad
cargo-fmt and lint
SunnysidedJ 6f731d0
Fix for by root tests
SunnysidedJ e83d93d
merge conflicts
SunnysidedJ 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![cfg(not(debug_assertions))] // Tests are too slow in debug. | ||
//#![cfg(not(debug_assertions))] // Tests are too slow in debug. | ||
#![cfg(test)] | ||
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. Unwanted diff |
||
|
||
use crate::{ | ||
|
@@ -429,13 +429,13 @@ impl TestRig { | |
} | ||
} | ||
|
||
pub fn enqueue_blobs_by_range_request(&self, count: u64) { | ||
pub fn enqueue_blobs_by_range_request(&self, start_slot: u64, count: u64) { | ||
self.network_beacon_processor | ||
.send_blobs_by_range_request( | ||
PeerId::random(), | ||
InboundRequestId::new_unchecked(42, 24), | ||
BlobsByRangeRequest { | ||
start_slot: 0, | ||
start_slot, | ||
count, | ||
}, | ||
) | ||
|
@@ -1216,9 +1216,55 @@ async fn test_blobs_by_range() { | |
if test_spec::<E>().deneb_fork_epoch.is_none() { | ||
return; | ||
}; | ||
let rig_slot = 64; | ||
let mut rig = TestRig::new(rig_slot).await; | ||
let slot_count = 32; | ||
// can I use slots_per_epoch from types::EthSpec? | ||
rig.enqueue_blobs_by_range_request(0, slot_count); | ||
|
||
SunnysidedJ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let mut blob_count = 0; | ||
for slot in 0..slot_count { | ||
let root = rig | ||
.chain | ||
.block_root_at_slot(Slot::new(slot), WhenSlotSkipped::None) | ||
.unwrap(); | ||
blob_count += root | ||
.map(|root| { | ||
rig.chain | ||
.get_blobs(&root) | ||
.map(|list| list.len()) | ||
.unwrap_or(0) | ||
}) | ||
.unwrap_or(0); | ||
} | ||
let mut actual_count = 0; | ||
while let Some(next) = rig._network_rx.recv().await { | ||
if let NetworkMessage::SendResponse { | ||
peer_id: _, | ||
response: Response::BlobsByRange(blob), | ||
inbound_request_id: _, | ||
} = next | ||
{ | ||
if blob.is_some() { | ||
actual_count += 1; | ||
} else { | ||
break; | ||
} | ||
} else { | ||
panic!("unexpected message {:?}", next); | ||
} | ||
} | ||
assert_eq!(blob_count, actual_count); | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_blobs_by_range_fulu() { | ||
if !test_spec::<E>().is_peer_das_scheduled() { | ||
return; | ||
}; | ||
let mut rig = TestRig::new(64).await; | ||
let slot_count = 32; | ||
rig.enqueue_blobs_by_range_request(slot_count); | ||
rig.enqueue_blobs_by_range_request(0, slot_count); | ||
|
||
let mut blob_count = 0; | ||
for slot in 0..slot_count { | ||
|
@@ -1252,5 +1298,7 @@ async fn test_blobs_by_range() { | |
panic!("unexpected message {:?}", next); | ||
} | ||
} | ||
assert_eq!(blob_count, 0); | ||
assert_eq!(actual_count, 0); | ||
assert_eq!(blob_count, actual_count); | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hmm, rethinking this maybe this is too punishing? Why not allow the request to creep into Fulu and just check that the start slot is in Deneb. It's fine to return empty for slots in Fulu.
Lighthouse only does by_range requests for a single epoch, but other clients may have different logic.
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.
Yes, I agree that it could be bit too punishing. The issue was vague in a way that we didn't set how much punishment we will give. Do you think it is okay to accept the request as long as it contains pre-Fulu slots?
Also, it seems like there's no check from Lighthouse to not send Fulu slots as left on the comment #7122 (comment). So, we could potentially be penalized by ourselves
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.
Feels like something that should be clarified in the spec to align behaviour on all clients. Do you want to raise an issue to the specs?
Uh oh!
There was an error while loading. Please reload this page.
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.
Sure! Just raised a PR to the specs ethereum/consensus-specs#4286
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.
Changed as per the spec PR to not punish and return empty for Fulu slots