Closed boundless-forest closed 3 years ago
let valid_call = info.pays_fee == Pays::Yes && info.class == DispatchClass::Normal;
if !valid_call {
return Err(ExitError::Other("invalid call".into()));
}
if let Some(gas) = target_gas {
let valid_weight = info.weight <= T::GasWeightMapping::gas_to_weight(gas);
if !valid_weight {
return Err(ExitError::OutOfGas);
}
}
The check above prevents infinite loop calls between solidity contracts and dispatch precompile.
Comes from https://github.com/darwinia-network/darwinia-common/issues/639#issue-899470271 point 3