anvil_zksync_api_decl/namespaces/
anvil_zks.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use jsonrpsee::core::RpcResult;
use jsonrpsee::proc_macros::rpc;
use zksync_types::{L1BatchNumber, H256};

/// Custom namespace that contains anvil-zksync specific methods.
#[rpc(server, namespace = "anvil_zks")]
pub trait AnvilZksNamespace {
    /// Commit batch's metadata to L1 (if there is one).
    ///
    /// Assumes L1 contracts have no system log verification and no DA input verification.
    ///
    /// # Arguments
    ///
    /// * `batch_number` - Number of the batch to be committed
    ///
    /// # Returns
    /// Finalized L1 transaction's hash that successfully commited the batch.
    #[method(name = "commitBatch")]
    async fn commit_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;

    /// Send batch's proof to L1 (if there is one). Batch needs to be committed first.
    ///
    /// Assumes L1 contracts allow empty proofs (see `TestnetVerifier.sol`).
    ///
    /// # Arguments
    ///
    /// * `batch_number` - Number of the batch to be proved
    ///
    /// # Returns
    /// Finalized L1 transaction's hash that successfully proved the batch.
    #[method(name = "proveBatch")]
    async fn prove_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;

    /// Execute batch on L1 (if there is one). Batch needs to be committed and proved first.
    ///
    /// # Arguments
    ///
    /// * `batch_number` - Number of the batch to be executed
    ///
    /// # Returns
    /// Finalized L1 transaction's hash that successfully executed the batch.
    #[method(name = "executeBatch")]
    async fn execute_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;
}