Skip to content

Commit

Permalink
chore: calculating mmr proofs from payouts batches
Browse files Browse the repository at this point in the history
  • Loading branch information
yahortsaryk committed Nov 28, 2024
1 parent e2bfecf commit b0ff68b
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 124 deletions.
18 changes: 9 additions & 9 deletions pallets/ddc-verification/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use ddc_primitives::{
ActivityHash, BillingReportParams, BucketId, BucketParams, ClusterId, ClusterParams,
ClusterProtocolParams, CustomerCharge, EraValidation, EraValidationStatus, MergeActivityHash,
ClusterProtocolParams, CustomerCharge, EraValidation, EraValidationStatus, MergeMMRHash,
NodeParams, NodePubKey, PayoutState, StorageNodeMode, StorageNodeParams, AVG_SECONDS_MONTH,
DOLLARS as CERE, MAX_PAYOUT_BATCH_SIZE,
};
Expand Down Expand Up @@ -380,17 +380,17 @@ mod benchmarks {
.collect::<Vec<_>>();

let store1 = MemStore::default();
let mut mmr1: MMR<ActivityHash, MergeActivityHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeActivityHash>::new(0, &store1);
let mut mmr1: MMR<ActivityHash, MergeMMRHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeMMRHash>::new(0, &store1);
for activity_hash in activity_hashes {
let _pos: u64 = mmr1.push(activity_hash).unwrap();
}

let batch_root = mmr1.get_root().unwrap();

let store2 = MemStore::default();
let mut mmr2: MMR<ActivityHash, MergeActivityHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeActivityHash>::new(0, &store2);
let mut mmr2: MMR<ActivityHash, MergeMMRHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeMMRHash>::new(0, &store2);
let pos = mmr2.push(batch_root).unwrap();
let payers_merkle_root_hash = mmr2.get_root().unwrap();

Expand Down Expand Up @@ -638,17 +638,17 @@ mod benchmarks {
.collect::<Vec<_>>();

let store1 = MemStore::default();
let mut mmr1: MMR<ActivityHash, MergeActivityHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeActivityHash>::new(0, &store1);
let mut mmr1: MMR<ActivityHash, MergeMMRHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeMMRHash>::new(0, &store1);
for activity_hash in activity_hashes {
let _pos: u64 = mmr1.push(activity_hash).unwrap();
}

let batch_root = mmr1.get_root().unwrap();

let store2 = MemStore::default();
let mut mmr2: MMR<ActivityHash, MergeActivityHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeActivityHash>::new(0, &store2);
let mut mmr2: MMR<ActivityHash, MergeMMRHash, &MemStore<ActivityHash>> =
MemMMR::<ActivityHash, MergeMMRHash>::new(0, &store2);
let pos = mmr2.push(batch_root).unwrap();
let payees_merkle_root_hash = mmr2.get_root().unwrap();

Expand Down
Loading

0 comments on commit b0ff68b

Please sign in to comment.