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

Use Max Request Limit in Initial Sync #13641

Merged
merged 2 commits into from
Feb 22, 2024
Merged

Use Max Request Limit in Initial Sync #13641

merged 2 commits into from
Feb 22, 2024

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Feb 21, 2024

What type of PR is this?

Deneb Improvement

What does this PR do? Why is it needed?

In the event a user provides a larger than expected batch limit, we will lower it to be inline with network limits. This is to prevent users from being silently banned by all peers for requesting too large of a batch.

Which issues(s) does this PR fix?

N.A

Other notes for review

#13499 #13502

@nisdas nisdas added Ready For Review Sync Sync (regular, initial, checkpoint) related issues labels Feb 21, 2024
@nisdas nisdas requested a review from a team as a code owner February 21, 2024 10:24
@nisdas nisdas requested review from kasey, rauljordan and potuz February 21, 2024 10:24
}
castedMaxLimit, err := math.Int(maxLimit)
if err != nil {
// Should be impossible to hit this case.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add an error log if such a case happens?

func maxBatchLimit() int {
currLimit := flags.Get().BlockBatchLimit
maxLimit := params.BeaconConfig().MaxRequestBlocks
if params.DenebEnabled() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The limit is a function of which p2p topic we are subscribed to. I think we need to base this on current slot.

Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look at

func MaxRequestBlock(e primitives.Epoch) uint64 {

Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved in side discussion - this is kind of a hack but the effect is only lowering the batch size. Larger batch sizes probably are not that helpful anyway given how we parallelize requests.

@nisdas nisdas added this pull request to the merge queue Feb 22, 2024
Merged via the queue into develop with commit e6a6365 Feb 22, 2024
17 checks passed
@nisdas nisdas deleted the useMaxLimit branch February 22, 2024 01:33
prestonvanloon pushed a commit that referenced this pull request Mar 1, 2024
* use max limit

* manu's review

(cherry picked from commit e6a6365)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sync Sync (regular, initial, checkpoint) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants