Skip to content

Commit

Permalink
Update and allow switching independent to shared profile (#452)
Browse files Browse the repository at this point in the history
* Update and allow switching independent - profile

* fix: benchmarking.rs errors

* fix: jobs/benchmarking.rs errors

* fix: jobs/benchmarking.rs errors

* Break tests up to individual cases, add active profile switching tests
  • Loading branch information
drewstone authored Jan 30, 2024
1 parent 420c8eb commit 60990ee
Show file tree
Hide file tree
Showing 12 changed files with 507 additions and 59 deletions.
15 changes: 9 additions & 6 deletions pallets/jobs/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ benchmarks! {
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let job = JobSubmissionOf::<T> {
expiry: 100u32.into(),
job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![caller.clone(), caller.clone()], threshold: 1, permitted_caller: None, role_type : ThresholdSignatureRoleType::TssGG20 }),
ttl: 100u32.into(),
job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![caller.clone(), caller.clone()], threshold: 1, permitted_caller: None, role_type : Default::default() }),
};

}: _(RawOrigin::Signed(caller.clone()), job.clone())
Expand All @@ -33,10 +34,11 @@ benchmarks! {
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let job = JobSubmissionOf::<T> {
expiry: 100u32.into(),
job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![caller.clone(), validator2], threshold: 1, permitted_caller: None, role_type : ThresholdSignatureRoleType::TssGG20 }),
ttl: 100u32.into(),
job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![caller.clone(), validator2], threshold: 1, permitted_caller: None, role_type : Default::default() }),
};
let _ = Pallet::<T>::submit_job(RawOrigin::Signed(caller.clone()).into(), job);
let job_key: RoleType = RoleType::Tss(ThresholdSignatureRoleType::TssGG20);
let job_key: RoleType = RoleType::Tss(Default::default());
let job_id: JobId = 0;
let result = JobResult::DKGPhaseOne(DKGTSSKeySubmissionResult {
signatures: vec![],
Expand Down Expand Up @@ -64,10 +66,11 @@ benchmarks! {
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let job = JobSubmissionOf::<T> {
expiry: 100u32.into(),
job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![caller.clone(), validator2, validator3], threshold: 2, permitted_caller: None, role_type : ThresholdSignatureRoleType::TssGG20 }),
};
ttl: 100u32.into(),
job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![caller.clone(), validator2, validator3], threshold: 2, permitted_caller: None, role_type : Default::default() }),
};
let _ = Pallet::<T>::submit_job(RawOrigin::Signed(caller.clone()).into(), job);
let job_key: RoleType = RoleType::Tss(ThresholdSignatureRoleType::TssGG20);
let job_key: RoleType = RoleType::Tss(Default::default());
let job_id: JobId = 0;
}: _(RawOrigin::Signed(caller.clone()), job_key.clone(), job_id.clone(), caller.clone(), ValidatorOffenceType::Inactivity, vec![])
}
Expand Down
4 changes: 2 additions & 2 deletions pallets/jobs/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ impl pallet_session::historical::Config for Runtime {
pub struct BaseFilter;
impl Contains<RuntimeCall> for BaseFilter {
fn contains(call: &RuntimeCall) -> bool {
let is_stake_unbound_call =
let is_stake_unbond_call =
matches!(call, RuntimeCall::Staking(pallet_staking::Call::unbond { .. }));

if is_stake_unbound_call {
if is_stake_unbond_call {
// no unbond call
return false
}
Expand Down
Loading

0 comments on commit 60990ee

Please sign in to comment.