Skip to content

Commit

Permalink
Update Corporate Ballot pallet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neopallium committed Dec 20, 2024
1 parent 2b52dd5 commit 57c00ea
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 147 deletions.
12 changes: 6 additions & 6 deletions pallets/corporate-actions/src/ballot/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ benchmarks! {
let (owner, ca_id) = setup_ca::<T>(CAKind::IssuerNotice);
}: _(owner.origin(), ca_id, RANGE, meta, true)
verify {
assert_eq!(TimeRanges::get(ca_id), Some(RANGE), "ballot not created");
assert_eq!(TimeRanges::<T>::get(ca_id), Some(RANGE), "ballot not created");
}

vote {
Expand All @@ -85,14 +85,14 @@ benchmarks! {
let results = votes.iter().map(|v| v.power).collect::<Vec<_>>();
}: _(owner.origin(), ca_id, votes)
verify {
assert_eq!(Results::get(ca_id), results, "voting results are wrong")
assert_eq!(Results::<T>::get(ca_id), results, "voting results are wrong")
}

change_end {
let (owner, ca_id) = attach::<T>(0, 0);
}: _(owner.origin(), ca_id, 5000)
verify {
assert_eq!(TimeRanges::get(ca_id).unwrap().end, 5000, "range not changed");
assert_eq!(TimeRanges::<T>::get(ca_id).unwrap().end, 5000, "range not changed");
}

change_meta {
Expand All @@ -103,20 +103,20 @@ benchmarks! {
let meta2 = meta.clone();
}: _(owner.origin(), ca_id, meta)
verify {
assert_eq!(Metas::get(ca_id).unwrap(), meta2, "meta not changed");
assert_eq!(Metas::<T>::get(ca_id).unwrap(), meta2, "meta not changed");
}

change_rcv {
let (owner, ca_id) = attach::<T>(0, 0);
}: _(owner.origin(), ca_id, false)
verify {
assert!(!RCV::get(ca_id), "RCV not changed");
assert!(!RCV::<T>::get(ca_id), "RCV not changed");
}

remove_ballot {
let (owner, ca_id) = attach::<T>(0, 0);
}: _(owner.origin(), ca_id)
verify {
assert_eq!(TimeRanges::get(ca_id), None, "ballot not removed");
assert_eq!(TimeRanges::<T>::get(ca_id), None, "ballot not removed");
}
}
Loading

0 comments on commit 57c00ea

Please sign in to comment.