espresso_types/v0/v0_1/
state.rs

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