Skip to content

Commit

Permalink
feat(core): adds a get proof endpoint in zks namespace to http endpoi…
Browse files Browse the repository at this point in the history
…nt on main node (#504)

## What ❔

Support for `zks_getProof` was accedentally only implemented for WS apis
in #455, this PR deploys them also to HTTP endpoints.
  • Loading branch information
montekki authored Nov 16, 2023
1 parent f9ae0ad commit 0ac4a4d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 9 additions & 1 deletion core/lib/web3_decl/src/namespaces/zks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use jsonrpsee::{core::RpcResult, proc_macros::rpc};

use zksync_types::{
api::{
BlockDetails, BridgeAddresses, L1BatchDetails, L2ToL1LogProof, ProtocolVersion,
BlockDetails, BridgeAddresses, L1BatchDetails, L2ToL1LogProof, Proof, ProtocolVersion,
TransactionDetails,
},
fee::Fee,
Expand Down Expand Up @@ -110,4 +110,12 @@ pub trait ZksNamespace {

#[method(name = "getLogsWithVirtualBlocks")]
async fn get_logs_with_virtual_blocks(&self, filter: Filter) -> RpcResult<Vec<Log>>;

#[method(name = "getProof")]
async fn get_proof(
&self,
address: Address,
keys: Vec<H256>,
l1_batch_number: L1BatchNumber,
) -> RpcResult<Proof>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::HashMap;

use zksync_types::{
api::{
BlockDetails, BridgeAddresses, L1BatchDetails, L2ToL1LogProof, ProtocolVersion,
BlockDetails, BridgeAddresses, L1BatchDetails, L2ToL1LogProof, Proof, ProtocolVersion,
TransactionDetails,
},
fee::Fee,
Expand Down Expand Up @@ -158,4 +158,15 @@ impl<G: L1GasPriceProvider + Send + Sync + 'static> ZksNamespaceServer for ZksNa
.await
.map_err(into_jsrpc_error)
}

async fn get_proof(
&self,
address: Address,
keys: Vec<H256>,
l1_batch_number: L1BatchNumber,
) -> RpcResult<Proof> {
self.get_proofs_impl(address, keys, l1_batch_number)
.await
.map_err(into_jsrpc_error)
}
}

0 comments on commit 0ac4a4d

Please sign in to comment.