Skip to content

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

Merged
merged 8 commits into from
Jan 29, 2025
Merged

Conversation

pawanjay176
Copy link
Member

@pawanjay176 pawanjay176 commented Jan 23, 2025

Issue Addressed

N/A

Proposed Changes

In #6329 we changed max_blobs_per_block from a preset to a config value.
We weren't using the right value based on fork in that PR. This is a follow up PR to use the fork dependent values.

In the proces, I also updated other places where we weren't using fork dependent values from the ChainSpec.

Note to reviewer: easier to go through by commit

@pawanjay176 pawanjay176 added Networking electra Required for the Electra/Prague fork labels Jan 23, 2025
@pawanjay176 pawanjay176 requested a review from jxs as a code owner January 23, 2025 02:33
@@ -455,7 +459,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
(None, None)
};

// TODO(pawan): this would break if a batch contains multiple epochs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if a batch contains multiple epochs (which it doesn't), this is a very niche case that would only break during fork boundaries.

@pawanjay176 pawanjay176 added the ready-for-review The code is ready for review label Jan 23, 2025
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Pawan, left some suggestions :)


match &req {
RequestType::BlocksByRange(request) => {
let max_allowed = spec.max_request_blocks(current_fork) as u64;
Copy link
Member

Choose a reason for hiding this comment

The 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 request.slot range? It seems like we could inadvertently reject requests from clients that use different limits for pre-Deneb blocks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Michael, can you elaborate on what you mean by request.slot range?
If it's pre Deneb max_request_blocks will return the value for pre Deneb right?

Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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).
I asked other CL teams how they handle it and it seems like prysm and lodestar do by slot, but nimbus does it by current fork.
In practice, I don't think this matters that much because all clients request 1/2 epochs per by_range request which doesn't hit the limits.

@michaelsproul michaelsproul added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jan 28, 2025
Co-authored-by: Michael Sproul <[email protected]>
@pawanjay176 pawanjay176 added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jan 29, 2025
@pawanjay176 pawanjay176 added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Jan 29, 2025
mergify bot added a commit that referenced this pull request Jan 29, 2025
@jxs jxs dismissed michaelsproul’s stale review January 29, 2025 19:24

suggestions have already been addressed

@mergify mergify bot merged commit 4a07c08 into sigp:unstable Jan 29, 2025
31 checks passed
ackintosh added a commit to ackintosh/lighthouse that referenced this pull request Feb 14, 2025
because that such invalid requests are handled in the Handler since the following PRs:

sigp#6847
sigp#6986
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electra Required for the Electra/Prague fork Networking ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants