Skip to content

Commit

Permalink
fuzzer conflicts resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgunozerk committed Aug 21, 2024
1 parent 8282f88 commit 069d718
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 138 deletions.
1 change: 0 additions & 1 deletion evm-template/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 0 additions & 68 deletions evm-template/template-fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,71 +314,3 @@ fn main() {
process_input(&accounts, &genesis, data);
});
}

fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
match call {
//recursion
RuntimeCall::Sudo(
pallet_sudo::Call::sudo { call }
| pallet_sudo::Call::sudo_unchecked_weight { call, weight: _ },
) if origin == 0 => recursive_call_filter(call, origin),
RuntimeCall::Utility(
pallet_utility::Call::with_weight { call, weight: _ }
| pallet_utility::Call::dispatch_as { as_origin: _, call }
| pallet_utility::Call::as_derivative { index: _, call },
) => recursive_call_filter(call, origin),
RuntimeCall::Utility(
pallet_utility::Call::force_batch { calls }
| pallet_utility::Call::batch { calls }
| pallet_utility::Call::batch_all { calls },
) => calls.iter().map(|call| recursive_call_filter(call, origin)).all(|e| e),
RuntimeCall::Scheduler(
pallet_scheduler::Call::schedule_named_after {
id: _,
after: _,
maybe_periodic: _,
priority: _,
call,
}
| pallet_scheduler::Call::schedule { when: _, maybe_periodic: _, priority: _, call }
| pallet_scheduler::Call::schedule_named {
when: _,
id: _,
maybe_periodic: _,
priority: _,
call,
}
| pallet_scheduler::Call::schedule_after {
after: _,
maybe_periodic: _,
priority: _,
call,
},
) => recursive_call_filter(call, origin),
RuntimeCall::Multisig(
pallet_multisig::Call::as_multi_threshold_1 { other_signatories: _, call }
| pallet_multisig::Call::as_multi {
threshold: _,
other_signatories: _,
maybe_timepoint: _,
call,
max_weight: _,
},
) => recursive_call_filter(call, origin),
RuntimeCall::Whitelist(
pallet_whitelist::Call::dispatch_whitelisted_call_with_preimage { call },
) => recursive_call_filter(call, origin),

// restrictions
RuntimeCall::Sudo(_) if origin != 0 => false,
RuntimeCall::System(
frame_system::Call::set_code { .. } | frame_system::Call::kill_prefix { .. },
) => false,
RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { max },
) => *max < MaxCandidates::get(),
RuntimeCall::Balances(pallet_balances::Call::force_adjust_total_issuance { .. }) => false,

_ => true,
}
}
1 change: 0 additions & 1 deletion generic-template/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 0 additions & 68 deletions generic-template/template-fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,71 +310,3 @@ fn main() {
process_input(&accounts, &genesis, data);
});
}

fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
match call {
//recursion
RuntimeCall::Sudo(
pallet_sudo::Call::sudo { call }
| pallet_sudo::Call::sudo_unchecked_weight { call, weight: _ },
) if origin == 0 => recursive_call_filter(call, origin),
RuntimeCall::Utility(
pallet_utility::Call::with_weight { call, weight: _ }
| pallet_utility::Call::dispatch_as { as_origin: _, call }
| pallet_utility::Call::as_derivative { index: _, call },
) => recursive_call_filter(call, origin),
RuntimeCall::Utility(
pallet_utility::Call::force_batch { calls }
| pallet_utility::Call::batch { calls }
| pallet_utility::Call::batch_all { calls },
) => calls.iter().map(|call| recursive_call_filter(call, origin)).all(|e| e),
RuntimeCall::Scheduler(
pallet_scheduler::Call::schedule_named_after {
id: _,
after: _,
maybe_periodic: _,
priority: _,
call,
}
| pallet_scheduler::Call::schedule { when: _, maybe_periodic: _, priority: _, call }
| pallet_scheduler::Call::schedule_named {
when: _,
id: _,
maybe_periodic: _,
priority: _,
call,
}
| pallet_scheduler::Call::schedule_after {
after: _,
maybe_periodic: _,
priority: _,
call,
},
) => recursive_call_filter(call, origin),
RuntimeCall::Multisig(
pallet_multisig::Call::as_multi_threshold_1 { other_signatories: _, call }
| pallet_multisig::Call::as_multi {
threshold: _,
other_signatories: _,
maybe_timepoint: _,
call,
max_weight: _,
},
) => recursive_call_filter(call, origin),
RuntimeCall::Whitelist(
pallet_whitelist::Call::dispatch_whitelisted_call_with_preimage { call },
) => recursive_call_filter(call, origin),

// restrictions
RuntimeCall::Sudo(_) if origin != 0 => false,
RuntimeCall::System(
frame_system::Call::set_code { .. } | frame_system::Call::kill_prefix { .. },
) => false,
RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { max },
) => *max < MaxCandidates::get(),
RuntimeCall::Balances(pallet_balances::Call::force_adjust_total_issuance { .. }) => false,

_ => true,
}
}

0 comments on commit 069d718

Please sign in to comment.