In our case, validators are providing multiple different services and I want to restrict them from un-staking or making unbound calls until they have completed the job.
I can set a BaseCall filter to restrict extrinsic calls but Is there a way to conditionally filter accounts that can make extrinsic calls?
let is_stake_unbound_call = matches!(call, RuntimeCall::Staking(pallet_staking::Call::unbond { value }));
if is_stake_unbound_call {
let has_job = pallet_job::PendingJob::contains_key(account_id)?;
// return true if all jobs are completed else false
}
Other possible Approach:
- Block un-bound call and let job-pallet make unbound (internally calling pallet-staking::unbound).
Is there a better way to handle such cases? Any help or advice is much appreciated