Skip to content

Commit c40df8f

Browse files
committed
Make aggregator prover fail when trying to add key to the merkle tree
Before it allowed to add new keys to the merkle tree, making it create proofs based on a different merkle root than the one signed in the last certificate. Even more worrisome this merkle tree would be then returned modified to its mkpool, making this corruption persist until the pool is refreshed.
1 parent 617003d commit c40df8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mithril-aggregator/src/services/prover.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl ProverService for MithrilProverService {
141141

142142
// 4 - Enrich the Merkle map with the block ranges Merkle trees
143143
for (block_range, mk_tree) in mk_trees {
144-
mk_map.insert(block_range, mk_tree.into())?;
144+
mk_map.replace(block_range, mk_tree.into())?;
145145
}
146146

147147
// 5 - Compute the proof for all transactions
@@ -167,7 +167,8 @@ impl ProverService for MithrilProverService {
167167
let pool_size = self.mk_map_pool.size();
168168
info!(
169169
self.logger,
170-
"Prover starts computing the Merkle map pool resource of size {pool_size}"
170+
"Prover starts computing the Merkle map pool resource of size {pool_size}";
171+
"up_to_block_number" => up_to,
171172
);
172173
let mk_map_cache = self
173174
.block_range_root_retriever

0 commit comments

Comments
 (0)