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

verifying logs from in between synced blocks #342

Closed
yuvalelmo opened this issue Jul 30, 2024 · 4 comments
Closed

verifying logs from in between synced blocks #342

yuvalelmo opened this issue Jul 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@yuvalelmo
Copy link

Hey everyone,
I am encountering an issue while syncing blocks from MAINNET. The blocks transmitted from the consensus layer to the execution’s state do not always follow a consecutive order by block number.

For example, I've added an info log at the point where the execution's state receives the execution payloads from the consensus, to understand which block are getting cached in the state.
Here's an illustrative screenshot:
Screenshot 2024-07-30 at 17 54 07

In the picture we can see that block 20420065 is successfully synced to the execution state, and then the subsequent block is 20420067, and no syncing of 20420066.
The same goes for 20420069, 20420071 - not synced.

My questions is, what should I do if I need to use get_logs to retrieve and verify logs from one of these missing blocks? In the code, for verifying logs, it queries the entire block from the state to accomplish this - however, the block appears to be missing.
For example, if I have a log I wish to query from block 20420069, is it possible to verify this log?

@ncitron
Copy link
Collaborator

ncitron commented Jul 30, 2024

Ah this is a good catch. We should be backfilling blocks if we miss one, but as it stands right now we do not.

For the case of log fetching it will miss that log, which is definitely a bug. We'll get on this soon.

@ncitron ncitron added the bug Something isn't working label Jul 30, 2024
@yuvalelmo
Copy link
Author

yuvalelmo commented Jul 31, 2024

Happy to help 😁
Just out of curiosity, how would you backfill the missing blocks?
Since the blocks that are received from consensus are the execution payloads of the beacon headers we get from the updates, which are not controllable in terms of which beacon block header would you get inside the Update, how would you be able to backfill this gap?

If I'm not clear, what i mean is that whenever you fetch an Update, you can only give it a "from" period, but you cannot limit it with a slot number or anything else, so how can you fetch the exact beacon block that would fit to the missing execution block?

@ncitron
Copy link
Collaborator

ncitron commented Jul 31, 2024

So an easy way to do this if we have the latest block (let's call this block n) but are missing the prior block n-1, then we can fetch the previous blockhash pointer from block n, ask the rpc for block n-1, hash it, and confirm that it matches the pointer from block n.

@ncitron
Copy link
Collaborator

ncitron commented Oct 26, 2024

Block backfill is not implemented and available in 0.7.0.

Fixed in #391

@ncitron ncitron closed this as completed Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants