risc0 / zeth

A "Type 0" zkEVM. Prove validity of Ethereum blocks using RISC Zero's zkVM
Apache License 2.0
382 stars 68 forks source link

feat: Optimism L2 Block Validation #31

Closed hashcashier closed 1 year ago

hashcashier commented 1 year ago

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

The main changes for this feature are:

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
intoverflow commented 1 year ago

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