ITADN

Refactors for L1 contract interactions

#16Pull Requestkatat 创建于 2023-12-19已合并
K
katatcommented
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](https://github.com/zksecurity/stark-evm-adapter/blob/f4f2c88bd30c157423f67564d9ea3481b70c0a3c/examples/verify_stone_proof.rs#L19) 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.
合并状态:已合并 合并于 2023-12-21 关闭于 2023-12-21 0 条评论