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

core/rawdb: add logging and fix comments around AncientRange function. #28379

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

jakub-freebit
Copy link
Contributor

This PR adds logging and fixes some comments around the AncientRange function. Addresses #27667.

}
// The data is on the order [h, h+1, .., n] -- reordering needed
for i := range data {
rlpHeaders = append(rlpHeaders, data[len(data)-1-i])
Copy link
Member

Choose a reason for hiding this comment

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

Can you elaborate what's the difference between the old and new logic?

In the old code, ancient headers are reordered/appended only if they are all loaded
In the new code, the logic is same?

Btw, I think we can use max=0 to un-specify the size limit. As function description says,

This method assumes that the caller already has placed a cap on count, to prevent DoS issues., we don't need to worry about the size overflow issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't change the logic, just added logging errors in case AncientRange fails and logging warnings in case AncientRange reads less than requested count.
Thank you for clarifying that it is ok to use max=0 here.
I will update the PR.

@fjl fjl merged commit 447945e into ethereum:master Oct 31, 2023
2 checks passed
@fjl fjl added this to the 1.13.5 milestone Oct 31, 2023
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
ethereum#28379)

This adds warning logs when the read does not match the expected count.
We can also remove the size limit since the function documentation explicitly states
that callers should limit the count.
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Dergarcon pushed a commit to specialmechanisms/mev-geth-0x2mev that referenced this pull request Jan 31, 2024
ethereum#28379)

This adds warning logs when the read does not match the expected count.
We can also remove the size limit since the function documentation explicitly states
that callers should limit the count.
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.

3 participants