diff --git a/etc/eth-contracts/contracts/EvmErc20.sol b/etc/eth-contracts/contracts/EvmErc20.sol index ecd7a78fa..c9759c4e3 100644 --- a/etc/eth-contracts/contracts/EvmErc20.sol +++ b/etc/eth-contracts/contracts/EvmErc20.sol @@ -36,7 +36,7 @@ contract EvmErc20 is Context, ERC20, AdminControlled, IExit { uint input_size = 1 + 32 + recipient.length; assembly { - let res := staticcall(gas(), 0xe9217bc70b7ed1f598ddd3199e80b093fa71124f, add(input, 32), input_size, 0, 32) + let res := call(gas(), 0xe9217bc70b7ed1f598ddd3199e80b093fa71124f, 0, add(input, 32), input_size, 0, 32) } } @@ -49,7 +49,7 @@ contract EvmErc20 is Context, ERC20, AdminControlled, IExit { uint input_size = 1 + 32 + 20; assembly { - let res := staticcall(gas(), 0xb0bd02f6a392af548bdf1cfaee5dfa0eefcc8eab, add(input, 32), input_size, 0, 32) + let res := call(gas(), 0xb0bd02f6a392af548bdf1cfaee5dfa0eefcc8eab, 0, add(input, 32), input_size, 0, 32) } } } diff --git a/src/precompiles/native.rs b/src/precompiles/native.rs index 74a9ae88b..a24202443 100644 --- a/src/precompiles/native.rs +++ b/src/precompiles/native.rs @@ -83,20 +83,16 @@ impl Precompile for ExitToNear { target_gas: u64, context: &Context, state: &mut S, - _is_static: bool, + is_static: bool, ) -> PrecompileResult { if Self::required_gas(input)? > target_gas { return Err(ExitError::OutOfGas); } - // TODO(MarX): After calling directly function withdraw in Tester.sol - // This function is called with is_static = true - // Figure out if this needs to be fixed in EVM, or the way - // that is being used to determine if a function is called in static - // mode is incorrect. - // if is_static { - // return Err(ExitError::Other(Cow::from("ERR_INVALID_IN_STATIC"))); - // } + // It's not allowed to call exit precompiles in static mode + if is_static { + return Err(ExitError::Other(Cow::from("ERR_INVALID_IN_STATIC"))); + } // First byte of the input is a flag, selecting the behavior to be triggered: // 0x0 -> Eth transfer @@ -227,20 +223,16 @@ impl Precompile for ExitToEthereum { target_gas: u64, context: &Context, state: &mut S, - _is_static: bool, + is_static: bool, ) -> PrecompileResult { if Self::required_gas(input)? > target_gas { return Err(ExitError::OutOfGas); } - // TODO(MarX): After calling directly function withdraw in Tester.sol - // This function is called with is_static = true - // Figure out if this needs to be fixed in EVM, or the way - // that is being used to determine if a function is called in static - // mode is incorrect. - // if is_static { - // return Err(ExitError::Other(Cow::from("ERR_INVALID_IN_STATIC"))); - // } + // It's not allowed to call exit precompiles in static mode + if is_static { + return Err(ExitError::Other(Cow::from("ERR_INVALID_IN_STATIC"))); + } // First byte of the input is a flag, selecting the behavior to be triggered: // 0x0 -> Eth transfer