diff --git a/system-contracts/contracts/EvmGasManager.sol b/system-contracts/contracts/EvmGasManager.sol index 0afce4ba8..44f4dc920 100644 --- a/system-contracts/contracts/EvmGasManager.sol +++ b/system-contracts/contracts/EvmGasManager.sol @@ -130,7 +130,7 @@ contract EvmGasManager is ISystemContract { evmStackFrames.push(frame); } - function consumeEvmFrame() external returns (uint256 passGas, bool isStatic) { + function consumeEvmFrame() onlySystemCall onlySystemEvm external returns (uint256 passGas, bool isStatic) { if (evmStackFrames.length == 0) return (INF_PASS_GAS, false); EVMStackFrameInfo memory frameInfo = evmStackFrames[evmStackFrames.length - 1]; diff --git a/system-contracts/contracts/EvmInterpreterFunctions.template.yul b/system-contracts/contracts/EvmInterpreterFunctions.template.yul index d7bb75f76..8dc816ae4 100644 --- a/system-contracts/contracts/EvmInterpreterFunctions.template.yul +++ b/system-contracts/contracts/EvmInterpreterFunctions.template.yul @@ -298,13 +298,28 @@ function consumeEvmFrame() -> passGas, isStatic, callerEVM { // function consumeEvmFrame() external returns (uint256 passGas, bool isStatic) mstore(0, 0x04C14E9E00000000000000000000000000000000000000000000000000000000) - let success := call(gas(), EVM_GAS_MANAGER_CONTRACT(), 0, 0, 4, 0, 64) + let farCallAbi := getFarCallABI( + 0, + 0, + 0, + 4, + gas(), + // Only rollup is supported for now + 0, + 0, + 0, + 1 + ) + let to := EVM_GAS_MANAGER_CONTRACT() + let success := verbatim_6i_1o("system_call", to, farCallAbi, 0, 0, 0, 0) if iszero(success) { // Should never happen revert(0, 0) } + returndatacopy(0,0,64) + passGas := mload(0) isStatic := mload(32) diff --git a/system-contracts/contracts/EvmInterpreterPreprocessed.yul b/system-contracts/contracts/EvmInterpreterPreprocessed.yul index ac72375f5..9a6dfd844 100644 --- a/system-contracts/contracts/EvmInterpreterPreprocessed.yul +++ b/system-contracts/contracts/EvmInterpreterPreprocessed.yul @@ -367,13 +367,28 @@ object "EVMInterpreter" { // function consumeEvmFrame() external returns (uint256 passGas, bool isStatic) mstore(0, 0x04C14E9E00000000000000000000000000000000000000000000000000000000) - let success := call(gas(), EVM_GAS_MANAGER_CONTRACT(), 0, 0, 4, 0, 64) + let farCallAbi := getFarCallABI( + 0, + 0, + 0, + 4, + gas(), + // Only rollup is supported for now + 0, + 0, + 0, + 1 + ) + let to := EVM_GAS_MANAGER_CONTRACT() + let success := verbatim_6i_1o("system_call", to, farCallAbi, 0, 0, 0, 0) if iszero(success) { // Should never happen revert(0, 0) } + returndatacopy(0,0,64) + passGas := mload(0) isStatic := mload(32) @@ -3419,13 +3434,28 @@ object "EVMInterpreter" { // function consumeEvmFrame() external returns (uint256 passGas, bool isStatic) mstore(0, 0x04C14E9E00000000000000000000000000000000000000000000000000000000) - let success := call(gas(), EVM_GAS_MANAGER_CONTRACT(), 0, 0, 4, 0, 64) + let farCallAbi := getFarCallABI( + 0, + 0, + 0, + 4, + gas(), + // Only rollup is supported for now + 0, + 0, + 0, + 1 + ) + let to := EVM_GAS_MANAGER_CONTRACT() + let success := verbatim_6i_1o("system_call", to, farCallAbi, 0, 0, 0, 0) if iszero(success) { // Should never happen revert(0, 0) } + returndatacopy(0,0,64) + passGas := mload(0) isStatic := mload(32)