-
Notifications
You must be signed in to change notification settings - Fork 886
Fork aware max values in rpc #6847
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
Changes from 6 commits
84efe19
0dd02f2
692245e
a1468b3
6ba3c7c
34cfc1d
c228e57
afc4c20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -855,6 +855,45 @@ where | |
} | ||
|
||
let (req, substream) = substream; | ||
let current_fork = self.fork_context.current_fork(); | ||
let spec = &self.fork_context.spec; | ||
|
||
match &req { | ||
RequestType::BlocksByRange(request) => { | ||
let max_allowed = spec.max_request_blocks(current_fork) as u64; | ||
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. Have we ever thought about making the limit dependent on the protocol version or the active fork at the time of the 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. Hi Michael, can you elaborate on what you mean by 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. We are always using the current fork according to wall clock time, so if the request is for pre-Deneb data but the current fork is post-Deneb, we will use the Deneb value. 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. I think we don't do it that way to keep things consistent between byroot and byrange requests (since we cannot know the slot when we get root requests). |
||
if *request.count() > max_allowed { | ||
self.events_out.push(HandlerEvent::Err(HandlerErr::Inbound { | ||
id: self.current_inbound_substream_id, | ||
proto: Protocol::BlocksByRange, | ||
error: RPCError::InvalidData(format!( | ||
"requested exceeded limit. allowed: {}, requested: {}", | ||
max_allowed, | ||
request.count() | ||
)), | ||
})); | ||
return self.shutdown(None); | ||
} | ||
} | ||
RequestType::BlobsByRange(request) => { | ||
let max_requested_blobs = request | ||
.count | ||
.saturating_mul(spec.max_blobs_per_block_by_fork(current_fork)); | ||
let max_allowed = spec.max_request_blob_sidecars(current_fork) as u64; | ||
if max_requested_blobs > max_allowed { | ||
pawanjay176 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.events_out.push(HandlerEvent::Err(HandlerErr::Inbound { | ||
id: self.current_inbound_substream_id, | ||
proto: Protocol::BlobsByRange, | ||
error: RPCError::InvalidData(format!( | ||
"requested exceeded limit. allowed: {}, requested: {}", | ||
max_allowed, max_requested_blobs | ||
)), | ||
})); | ||
return self.shutdown(None); | ||
} | ||
} | ||
_ => {} | ||
}; | ||
|
||
let max_responses = | ||
req.max_responses(self.fork_context.current_fork(), &self.fork_context.spec); | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.