|
1 | 1 | use miden_objects::{ |
2 | | - ACCOUNT_TREE_DEPTH, Digest, |
| 2 | + Digest, |
3 | 3 | batch::ProvenBatch, |
4 | 4 | block::{ |
5 | | - BlockAccountUpdate, BlockHeader, BlockNoteIndex, BlockNoteTree, OutputNoteBatch, |
6 | | - ProvenBlock, |
| 5 | + AccountTree, BlockAccountUpdate, BlockHeader, BlockNoteIndex, BlockNoteTree, |
| 6 | + OutputNoteBatch, ProvenBlock, |
7 | 7 | }, |
8 | | - crypto::merkle::{Mmr, SimpleSmt}, |
| 8 | + crypto::merkle::Mmr, |
9 | 9 | note::Nullifier, |
10 | 10 | transaction::{OrderedTransactionHeaders, OutputNote}, |
11 | 11 | }; |
@@ -34,7 +34,9 @@ pub async fn build_expected_block_header( |
34 | 34 | let new_account_root = { |
35 | 35 | let mut store_accounts = store.accounts.read().await.clone(); |
36 | 36 | for (&account_id, update) in updated_accounts { |
37 | | - store_accounts.insert(account_id.into(), update.final_state_commitment().into()); |
| 37 | + store_accounts |
| 38 | + .insert(account_id, update.final_state_commitment()) |
| 39 | + .expect("account IDs should be unique"); |
38 | 40 | } |
39 | 41 |
|
40 | 42 | store_accounts.root() |
@@ -71,7 +73,7 @@ pub async fn build_expected_block_header( |
71 | 73 |
|
72 | 74 | #[derive(Debug)] |
73 | 75 | pub struct MockBlockBuilder { |
74 | | - store_accounts: SimpleSmt<ACCOUNT_TREE_DEPTH>, |
| 76 | + store_accounts: AccountTree, |
75 | 77 | store_chain_mmr: Mmr, |
76 | 78 | last_block_header: BlockHeader, |
77 | 79 |
|
@@ -105,7 +107,8 @@ impl MockBlockBuilder { |
105 | 107 | pub fn account_updates(mut self, updated_accounts: Vec<BlockAccountUpdate>) -> Self { |
106 | 108 | for update in &updated_accounts { |
107 | 109 | self.store_accounts |
108 | | - .insert(update.account_id().into(), update.final_state_commitment().into()); |
| 110 | + .insert(update.account_id(), update.final_state_commitment()) |
| 111 | + .expect("account IDs should be unique"); |
109 | 112 | } |
110 | 113 |
|
111 | 114 | self.updated_accounts = Some(updated_accounts); |
|
0 commit comments