espresso_types/v0/v0_1/
state.rs

1use committable::Commitment;
2use jf_merkle_tree_compat::{
3    prelude::{LightWeightSHA3MerkleTree, Sha3Digest, Sha3Node},
4    universal_merkle_tree::UniversalMerkleTree,
5    MerkleTreeScheme,
6};
7
8use super::{FeeAccount, FeeAmount};
9use crate::Header;
10
11pub const BLOCK_MERKLE_TREE_HEIGHT: usize = 32;
12pub const FEE_MERKLE_TREE_HEIGHT: usize = 20;
13const FEE_MERKLE_TREE_ARITY: usize = 256;
14
15// The block merkle tree accumulates header commitments. However, since the underlying
16// representation of the commitment type remains the same even while the header itself changes,
17// using the underlying type `[u8; 32]` allows us to use the same state type across minor versions.
18pub type BlockMerkleTree = LightWeightSHA3MerkleTree<Commitment<Header>>;
19pub type BlockMerkleCommitment = <BlockMerkleTree as MerkleTreeScheme>::Commitment;
20
21pub type FeeMerkleTree =
22    UniversalMerkleTree<FeeAmount, Sha3Digest, FeeAccount, FEE_MERKLE_TREE_ARITY, Sha3Node>;
23pub type FeeMerkleCommitment = <FeeMerkleTree as MerkleTreeScheme>::Commitment;