zksecurity / stark-evm-adapter

Adapt your STARK stone proofs for verifications on Ethereum
https://zksecurity.github.io/stark-evm-adapter/stark_evm_adapter/index.html
17 stars 4 forks source link

Refactors for L1 contract interactions #16

Closed katat closed 11 months ago

katat commented 11 months ago

This PR refactors the API to directly interact with the L1 contract interfaces, so there is no need to use these custom serde functions anymore, instead it uses the ethers ABI API to handle the encoding/decoding of the contract arguments.

The key structs are MainProof, MerkleStatement, FRIMerkleStatement. Each struct has implementations for constructing and calling the relevant L1 contract functions. The AnnotatedProof will result in these key structs.

There is a example demonstrating the full cycle of splitting proof from an empty bootloader proof, and verify the split proof via the L1 verifier.

To run the demo: MAINNET_RPC=... cargo run --example verify_stone_proof You can either provide the FORKED_MAINNET_RPC env for it to to a forked mainnet node (such as tenderly forked node), or MAINNET_RPC env for mainnet node (such as an infura node) from which the anvil local node will fork for testing.

For now, I have disabled the split proof function in the CLI, since it seems not useful anymore when the API can support directly interacting with the L1 contracts. We may instead need to consider adding the sub command for L1 contract interactions for the split proofs.