anvil_zksync_api_decl/namespaces/
anvil_zks.rs

1use jsonrpsee::core::RpcResult;
2use jsonrpsee::proc_macros::rpc;
3use zksync_types::web3::Bytes;
4use zksync_types::{L1BatchNumber, H256};
5
6/// Custom namespace that contains anvil-zksync specific methods.
7#[rpc(server, namespace = "anvil_zks")]
8pub trait AnvilZksNamespace {
9    /// Commit batch's metadata to L1 (if there is one).
10    ///
11    /// Assumes L1 contracts have no system log verification and no DA input verification.
12    ///
13    /// # Arguments
14    ///
15    /// * `batch_number` - Number of the batch to be committed
16    ///
17    /// # Returns
18    /// Finalized L1 transaction's hash that successfully commited the batch.
19    #[method(name = "commitBatch")]
20    async fn commit_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;
21
22    /// Send batch's proof to L1 (if there is one). Batch needs to be committed first.
23    ///
24    /// Assumes L1 contracts allow empty proofs (see `TestnetVerifier.sol`).
25    ///
26    /// # Arguments
27    ///
28    /// * `batch_number` - Number of the batch to be proved
29    ///
30    /// # Returns
31    /// Finalized L1 transaction's hash that successfully proved the batch.
32    #[method(name = "proveBatch")]
33    async fn prove_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;
34
35    /// Execute batch on L1 (if there is one). Batch needs to be committed and proved first.
36    ///
37    /// # Arguments
38    ///
39    /// * `batch_number` - Number of the batch to be executed
40    ///
41    /// # Returns
42    /// Finalized L1 transaction's hash that successfully executed the batch.
43    #[method(name = "executeBatch")]
44    async fn execute_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;
45
46    /// Returns the witness for a given batch.
47    ///
48    /// # Arguments
49    ///
50    /// * `batch_number` - Number of the batch to return witness for
51    ///
52    /// # Returns
53    /// Bytes with the witness that can be passed to proving system.
54    #[method(name = "getBoojumWitness")]
55    async fn get_boojum_witness(&self, batch_number: L1BatchNumber) -> RpcResult<Bytes>;
56}