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

verifiedIndex in rollup_getInfo always 0 #3974

Closed
quickchase opened this issue Nov 10, 2022 · 9 comments
Closed

verifiedIndex in rollup_getInfo always 0 #3974

quickchase opened this issue Nov 10, 2022 · 9 comments
Assignees
Labels
A-cannon Area: cannon C-question User questions that are neither feature requests nor bug reports

Comments

@quickchase
Copy link

According to documentation:
https://community.optimism.io/docs/developers/build/json-rpc/#rollup-getinfo

rollup_getInfo
Returns useful L2-specific information about the current node.
verifiedIndex: QUANTITY - Index of the last tx that was ingested from a batch that was posted to L1

As far as I can tell the verifiedIndex value is ALWAYS 0

Why? What purpose does this value serve? What is the significance of it always being 0? When is it not 0?

@smartcontracts smartcontracts added C-question User questions that are neither feature requests nor bug reports A-cannon Area: cannon labels Nov 11, 2022
@smartcontracts
Copy link
Contributor

Are you running a node syncing from L1 or from L2? I believe this always returns zero when syncing from L2.

@smartcontracts
Copy link
Contributor

This is a result of the weird split we currently have between nodes that sync entirely from L1 and nodes that sync entirely from L2. At least with Bedrock nodes will sync from both at the same time and you'll be able to filter out L1 blocks by looking for the latest "safe" head.

@quickchase
Copy link
Author

Sorry, but can you explain it like I'm 5 lol

Under what circumstance is the value populated?

No RPC provider seems to populate this field.

@quickchase
Copy link
Author

Also I take it by the Bedrock comment that this is a "Bedrock Fixes This" issue? 🙂

@smartcontracts
Copy link
Contributor

smartcontracts commented Nov 11, 2022

Yeah this is definitely a "bedrock fixes this" issue but more in the sense that "bedrock makes this issue go away by removing that RPC endpoint entirely".

Basically there are two types of Optimism nodes right now, nodes that sync from L1 and nodes that sync from L2 (directly from the sequencer). Nodes that sync from L2 will always return zero. Nodes that sync from L1 will return an increasing value as the node syncs.

You always get zero from infra providers because they're running nodes that sync directly from the sequencer. They need to do this because otherwise they would have to wait for blocks to be published to L1 which means they would be behind the sequencer by quite a bit.

In Bedrock we get rid of this distinction between L1 nodes and L2 nodes. Nodes will sync from both L1 and from L2 (via p2p network instead of directly from sequencer). Blocks that are confirmed on L1 will be marked as "safe".

@quickchase
Copy link
Author

Is there a way to determine which L2 block number has been "finalized" on the L1 chain without this value being populated?

In other words: If I call eth_getBlockByNumber("finalized") on Ethereum - I get back the finalized L1 block, and it's number. How do I then get the "finalized" L2 block (the last block number committed to L1 at that time)?

@smartcontracts
Copy link
Contributor

I don't know if nodes that sync from L2 currently have this ability. After Bedrock you will be able to use "safe" and "finalized" to accomplish this.

@quickchase
Copy link
Author

Thanks, Matthew Slipper told me I could query getTotalElements in the L1 contract. Seems to give me what I want. You can close this if you want.

@smartcontracts
Copy link
Contributor

Ok! Great. Glad you were able to figure this out. Closing. Feel free to open additional issues if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cannon Area: cannon C-question User questions that are neither feature requests nor bug reports
Projects
None yet
Development

No branches or pull requests

3 participants