risc0 / zeth

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

Add support for ganache #107

Closed intoverflow closed 2 months ago

intoverflow commented 7 months ago

This PR adds support for Ganache in both Merge and Shanghai configurations.

Testing

I performed this procedure for both merge and shanghai:

$ ganache --miner.blockTime 12 --chain.hardfork merge

...
Available Accounts
==================
...
(9) 0x0C6083AC0459Fdbf182429e6af8D2601536aE712 (1000 ETH)

Private Keys
==================
(0) 0x752517b8b110ae59ba32ed5450c0c48caf226f0066684734895afd65faf97340

...
$ cast send 0x0C6083AC0459Fdbf182429e6af8D2601536aE712 --value 0.5ether --private-key 0x752517b8b110ae59ba32ed5450c0c48caf226f0066684734895afd65faf97340

...
blockHash               0x8b39bff9f95c0027c29633ab505b3ce6590a53695aace343a8a9b703cd9458ba
blockNumber             2
...
$ RUST_LOG=info ./target/release/zeth run \
                                      --network=ganache-merge \
                                      --block-number=2 \
                                      --eth-rpc-url=http://127.0.0.1:8545

...

[2024-04-18T01:58:37Z INFO  zeth::operations::build] Verifying final state using provider data ...
[2024-04-18T01:58:37Z INFO  zeth::operations::build] Final block hash derived successfully. 0x8b39bff9f95c0027c29633ab505b3ce6590a53695aace343a8a9b703cd9458ba
[2024-04-18T01:58:37Z INFO  zeth::operations] Running the executor...
[2024-04-18T01:58:37Z INFO  tracing::span] executor;
[2024-04-18T01:58:37Z INFO  risc0_zkvm::host::server::exec::executor] execution time: 117.7ms
[2024-04-18T01:58:37Z INFO  risc0_zkvm::host::server::session] number of segments: 5
[2024-04-18T01:58:37Z INFO  risc0_zkvm::host::server::session] total cycles: 4456448
[2024-04-18T01:58:37Z INFO  risc0_zkvm::host::server::session] user cycles: 3078410
[2024-04-18T01:58:37Z INFO  risc0_zkvm::host::server::session] cycle efficiency: 69%
intoverflow commented 2 months ago

Closing to de-clutter