-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(merkle tree): Expose Merkle tree API (#209)
# What ❔ Expose API allowing to query Merkle proofs for a list of hashed keys at a specific tree version (= L1 batch number). ## Why ❔ - This is one of components for recovering a node from a snapshot; it will be used to authenticate snapshot chunks. - In the future, it could be used for `eth_getProof`. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [x] Code has been formatted via `zk fmt` and `zk lint`.
- Loading branch information
Showing
13 changed files
with
679 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// Everywhere in this module the word "block" actually means "miniblock". | ||
|
||
pub mod contract_verification; | ||
pub mod execution_sandbox; | ||
pub mod healthcheck; | ||
pub mod tree; | ||
pub mod tx_sender; | ||
pub mod web3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//! Metrics for the Merkle tree API. | ||
|
||
use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics, Unit}; | ||
|
||
use std::time::Duration; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EncodeLabelValue, EncodeLabelSet)] | ||
#[metrics(label = "method", rename_all = "snake_case")] | ||
pub(super) enum MerkleTreeApiMethod { | ||
Info, | ||
GetProofs, | ||
} | ||
|
||
/// Metrics for Merkle tree API. | ||
#[derive(Debug, Metrics)] | ||
#[metrics(prefix = "server_merkle_tree_api")] | ||
pub(super) struct MerkleTreeApiMetrics { | ||
/// Server latency of the Merkle tree API methods. | ||
#[metrics(buckets = Buckets::LATENCIES, unit = Unit::Seconds)] | ||
pub latency: Family<MerkleTreeApiMethod, Histogram<Duration>>, | ||
} | ||
|
||
#[vise::register] | ||
pub(super) static API_METRICS: vise::Global<MerkleTreeApiMetrics> = vise::Global::new(); |
Oops, something went wrong.