Skip to content

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
@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 MetaMask/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.
colinlyguo pushed a commit to scroll-tech/go-ethereum that referenced this pull request Oct 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