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

feat: Optimism L2 Block Validation #31

Merged
merged 16 commits into from Sep 18, 2023
Merged

feat: Optimism L2 Block Validation #31

merged 16 commits into from Sep 18, 2023

Conversation

hashcashier
Copy link
Contributor

@hashcashier hashcashier commented Sep 11, 2023

This PR adds support for validating OP L2 Blocks by passing in the --network=optimism parameter.

The main changes for this feature are:

  • A dedicated op-block guest binary for optimism L2 block validation.
  • A generic ConfiguredBlockBuilder parameterized by a NetworkStrategyBundle that wraps around the BlockBuilder.
    • EthereumBlockBuilder is an alias for ConfiguredBlockBuilder<EthereumStrategyBundle>.
    • OptimismBlockBuilder is an alias for ConfiguredBlockBuilder<OptimismStrategyBundle>.
  • Abstraction of TxEssence and implementation of EthereumTxEssence and OptimismTxEssence.
  • Profiling of guest runs through the --profile argument at runtime rather than a feature flag on compilation.
  • Introduction of the optimal --network parameter with ethereum and optimism as valid arguments.
  • Delegation of the state update logic to the implementation of the DatabaseCommit trait from revm.
  • Introduction of the OptimismTxExecStrategy.

The readme is updated to include a quick optimism test example:

$ RUST_LOG=info ./target/release/zeth \
    --network=optimism \
    --rpc-url="https://opt-mainnet.g.alchemy.com/v2/YOUR_API_KEY" \
    --cache \
    --block-no=107728767

@hashcashier hashcashier changed the title Optimism L2 Block Validation feat: Optimism L2 Block Validation Sep 11, 2023
@hashcashier hashcashier marked this pull request as ready for review September 11, 2023 17:22
@intoverflow
Copy link
Member

intoverflow commented Sep 18, 2023

Tested (and works) on Bonsai.

Block: https://optimistic.etherscan.io/block/107728767

Log output:

$ RUST_LOG=info ./target/release/zeth --cache --network=optimism --block-no=107728767 --submit-to-bonsai
[2023-09-18T20:52:38Z INFO  zeth_lib::host] Initial block: 107728766 (0x3c41ea6e43267510dcbc482866bca3530250466c1478b3f39e69301d8d0e2444)
[2023-09-18T20:52:38Z INFO  zeth_lib::host] Final block number: 107728767 (0x74ba2ecbd7e8d85998c32c446f1dc3616d994b40e23c3bc51344b650f959d31e)
[2023-09-18T20:52:38Z INFO  zeth_lib::host] Transaction count: 15
...
[2023-09-18T20:52:47Z INFO  zeth] Starting session
Bonsai session UUID: cd39188d-446a-4dfd-bd17-fcc0b78dec14
[2023-09-18T21:15:45Z INFO  zeth] Block hash (from Bonsai): 0x74ba2ecbd7e8d85998c32c446f1dc3616d994b40e23c3bc51344b650f959d31e

Copy link
Member

@intoverflow intoverflow left a comment

Choose a reason for hiding this comment

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

Awesome!

@intoverflow intoverflow merged commit 202222a into main Sep 18, 2023
4 checks passed
@intoverflow intoverflow deleted the rkhalil/op branch September 18, 2023 22:07
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.

None yet

2 participants