Skip to content
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

limit deneb block requests (by range and by root) #6892

Closed

Conversation

mehdi-aouadi
Copy link
Contributor

PR Description

No more than MAX_REQUEST_BLOCKS_DENEB may be requested at a time (BeaconBlocksByRange and BeaconBlocksByRoot)

Fixed Issue(s)

#6870

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@mehdi-aouadi mehdi-aouadi self-assigned this Mar 2, 2023
Copy link
Contributor

@StefanBratanov StefanBratanov left a comment

Choose a reason for hiding this comment

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

Hmm think this is not correct. MAX_BLOCK_BY_RANGE_REQUEST_SIZE is used for rate limiting. Think can leave this value as it is for Deneb. We should see the usage of MAX_REQUEST_BLOCKS instead and change it accordingly for the Deneb fork.

@zilm13
Copy link
Contributor

zilm13 commented Mar 2, 2023

@StefanBratanov is MAX_BLOCK_BY_RANGE_REQUEST_SIZE anywhere in specs? I've not find. And 128 is smaller than 200 so we just rate limiting even more

@mehdi-aouadi
Copy link
Contributor Author

mehdi-aouadi commented Mar 3, 2023

@StefanBratanov is MAX_BLOCK_BY_RANGE_REQUEST_SIZE anywhere in specs? I've not find. And 128 is smaller than 200 so we just rate limiting even more

Actually MAX_BLOCK_BY_RANGE_REQUEST_SIZE is defined internally for peers sync limitation. Not needed anymore

@mehdi-aouadi
Copy link
Contributor Author

mehdi-aouadi commented Mar 3, 2023

Hmm think this is not correct. MAX_BLOCK_BY_RANGE_REQUEST_SIZE is used for rate limiting. Think can leave this value as it is for Deneb. We should see the usage of MAX_REQUEST_BLOCKS instead and change it accordingly for the Deneb fork.

Actually MAX_REQUEST_BLOCKS_DENEB < MAX_BLOCK_BY_RANGE_REQUEST_SIZE as @zilm13 mentioned so it doesn't make sense to use different limits in the method and in the peer, the smaller one will be enforced anyway. I added a unit test for the BeaconBlockByRange method when the count is greater than MAX_REQUEST_BLOCKS.
There is no MAX_REQUEST_BLOCKS check in the BeaconBlockByRoot because the BeaconBlocksByRootRequestMessage cannot contain more than MAX_REQUEST_BLOCKS elements anyway.

Copy link
Contributor

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@StefanBratanov StefanBratanov left a comment

Choose a reason for hiding this comment

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

Hmm, not sure why MAX_BLOCK_BY_RANGE_REQUEST_SIZE was introduced. But there are usages of MAX_REQUEST_BLOCKS still which are definied in phase0 specs https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md. In my mind this constant is getting overriden for Deneb https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/p2p-interface.md so all usages of MAX_REQUEST_BLOCKS should be replaced by MAX_REQUEST_BLOCKS_DENEB once Deneb is active. Maybe @tbenr can jump in and have a look as well if he agrees with me.

@tbenr
Copy link
Contributor

tbenr commented Mar 7, 2023

@mehdi-aouadi @StefanBratanov

MAX_BLOCK_BY_RANGE_REQUEST_SIZE has been introduced way back here #1061

I agree with @StefanBratanov that we should change at runtime the limit from MAX_REQUEST_BLOCKS to MAX_REQUEST_BLOCKS_DENEB

@mehdi-aouadi
Copy link
Contributor Author

Done in: #6938

@mehdi-aouadi mehdi-aouadi deleted the 6870-max-blocks-deneb branch March 13, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants