Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow "ANY proxy" to call to any EVM address #2098

Merged
merged 2 commits into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,32 +827,7 @@ impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType {
) -> bool {
use pallet_evm::PrecompileSet as _;
match self {
ProxyType::Any => {
match PrecompileName::from_address(call.to.0) {
// Any precompile that can execute a subcall should be forbidden here,
// to ensure that unauthorized smart contract can't be called
// indirectly.
// To be safe, we only allow the precompiles we need.
Some(
PrecompileName::AuthorMappingPrecompile
| PrecompileName::ParachainStakingPrecompile,
) => true,
Some(ref precompile) if is_governance_precompile(precompile) => true,
// All non-whitelisted precompiles are forbidden
Some(_) => false,
// Allow evm transfer to "simple" account (no code nor precompile)
// For the moment, no smart contract other than precompiles is allowed.
// In the future, we may create a dynamic whitelist to authorize some audited
// smart contracts through governance.
None => {
// If the address is not recognized, allow only evm transfert to "simple"
// accounts (no code nor precompile).
// Note: Checking the presence of the code is not enough because some
// precompiles have no code.
!recipient_has_code && !PrecompilesValue::get().is_precompile(call.to.0)
}
}
}
ProxyType::Any => true,
ProxyType::NonTransfer => {
call.value == U256::zero()
&& match PrecompileName::from_address(call.to.0) {
Expand Down