Skip to content

Commit

Permalink
chore: migration for verification pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
yahortsaryk committed Jan 22, 2025
1 parent 92f07e7 commit 53c5a6a
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 602 deletions.
43 changes: 0 additions & 43 deletions pallets/ddc-verification/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,38 +188,6 @@ mod benchmarks {
);
}

#[benchmark]
fn set_prepare_era_for_payout(b: Linear<1, 5>) {
let validator = create_validator_account::<T>();
let cluster_id = ClusterId::from([1; 20]);
let era = EraActivity { id: 1, start: 1000, end: 2000 };

let payers_merkle_root_hash = H256(blake2_256(&1.encode()));
let payees_merkle_root_hash = H256(blake2_256(&2.encode()));

let mut payers_batch_merkle_root_hashes = vec![];
let mut payees_batch_merkle_root_hashes = vec![];

for i in 0..b {
payers_batch_merkle_root_hashes.push(H256(blake2_256(&(i + 10).encode())));
payees_batch_merkle_root_hashes.push(H256(blake2_256(&(i + 100).encode())))
}

#[extrinsic_call]
set_prepare_era_for_payout(
RawOrigin::Signed(validator),
cluster_id,
era,
payers_merkle_root_hash,
payees_merkle_root_hash,
payers_batch_merkle_root_hashes,
payees_batch_merkle_root_hashes,
);

assert!(<EraValidations<T>>::contains_key(cluster_id, era.id));
assert_has_event::<T>(Event::EraValidationReady { cluster_id, era_id: era.id }.into());
}

#[benchmark]
fn set_validator_key() {
let validator = create_account::<T>("new_validator_account", 0, 0);
Expand Down Expand Up @@ -933,15 +901,4 @@ mod benchmarks {
#[extrinsic_call]
emit_consensus_errors(RawOrigin::Signed(validator.clone()), errros);
}

#[benchmark]
fn set_era_validations() {
let cluster_id = ClusterId::from([1; 20]);
let era_id: DdcEra = 1;

#[extrinsic_call]
set_era_validations(RawOrigin::Root, cluster_id, era_id);

<EraValidations<T>>::contains_key(cluster_id, era_id);
}
}
Loading

0 comments on commit 53c5a6a

Please sign in to comment.