-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
eth/api: add rpc method to obtain which states are accessible #23646
Conversation
Is this api a standard api? If not, should we follow below discussions to standardize it first? |
No, it's not. It's in the |
Changed it a bit, so that it now skips over the pre-pivot section, and also that it only returns the first result.
|
It would've been nice to a get a list of all blocks with accessible state in that range but I suppose that's gonna take too long |
That's actually what I implemented first. Then it became kind of annoying, because if you just want the latest, then you're going to have to either pick a short:ish segment and hope to find one, or pick a longer segment and wait it out. So I instead changed it to just return the first, and if you want them all, you'll have to make a little script to iterate based on the results. |
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…um#23646) This PR adds a method to the debug namespace, to iterate over the blocks and check where we have the roots on disk.
…um#23646) This PR adds a method to the debug namespace, to iterate over the blocks and check where we have the roots on disk.
From time to time, it's useful to know what roots are "accessible", meaning they can be used for tracing, or can be used when doing a
setHead
to hit a good target block. This PR adds a method to thedebug
namespace, to iterate over the blocks and check where we have the roots on disk.This is also pretty interesting from a diagnostic perspective, as it reveals a bit about what the actual periods between flushes are.
IN the example below, I use the pivot block as 'from', and
latest
as 'end'.After the pivot marker, there was ~19K blocks until next flush, then 14K. It seems that my machine flushes usually around 14K intervals in the 13M segment. At certain points, there are consecutive block/states:
13138897, 13138898
-- those come from shutdowns.This PR can be improved further automatically skipping checks below the pivot block. It takes a huge amount of time to dump from
0, "latest"
if it has to load 12M headers and do 12M db state lookups before it starts finding anything.