From 17dfcf1597e7ffc8d72c56d89233a2f97f6e06d4 Mon Sep 17 00:00:00 2001 From: ben-chain Date: Thu, 15 Oct 2020 23:08:20 -0400 Subject: [PATCH] Fix JUMPI inputs ordering (#21) * fix jumpi inputs ordering * fix comment --- .../OVM/execution/OVM_SafetyChecker.sol | 4 ++-- .../contracts/test/data/json/safety-checker.test.json | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol index 250bfcd9ff5a..0288b5d74e64 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol @@ -116,8 +116,8 @@ contract OVM_SafetyChecker is iOVM_SafetyChecker { if ((firstOps >> 192) == 0x3350600060045af1) { _pc += 8; // Call EM and abort execution if instructed - // CALLER PUSH1 0x00 SWAP1 GAS CALL PC PUSH1 0x1d ADD EQ JUMPI RETURNDATASIZE PUSH1 0x00 DUP1 RETURNDATACOPY PUSH1 0x00 REVERT JUMPDEST PUSH1 0x01 PUSH1 0x00 RETURN JUMPDEST - } else if (firstOps == 0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b6001 && secondOps == 0x6000f35b) { + // CALLER PUSH1 0x00 SWAP1 GAS CALL PC PUSH1 0x1d ADD JUMPI RETURNDATASIZE PUSH1 0x01 EQ PC PUSH1 0x0c ADD JUMPI RETURNDATASIZE PUSH1 0x00 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x00 REVERT JUMPDEST PUSH1 0x01 PUSH1 0x00 RETURN JUMPDEST + } else if (firstOps == 0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b6001 && secondOps == 0x6000f35b) { _pc += 36; } else { return false; diff --git a/packages/contracts/test/data/json/safety-checker.test.json b/packages/contracts/test/data/json/safety-checker.test.json index 2601beca76e5..3a36d655023f 100644 --- a/packages/contracts/test/data/json/safety-checker.test.json +++ b/packages/contracts/test/data/json/safety-checker.test.json @@ -1073,7 +1073,7 @@ "out": false }, "valid EM call": { - "in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f35b", + "in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f35b", "out": true }, "valid identity precompile call": { @@ -1081,15 +1081,15 @@ "out": true }, "valid EM call, then valid identity precompile call": { - "in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f35b3350600060045af1", + "in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f35b3350600060045af1", "out": true }, "valid EM call, then invalid identity precompile call": { - "in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f35b3350600060035af1", + "in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f35b3350600060035af1", "out": false }, "valid EM call, then invalid opcode (SLOAD)": { - "in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f35b54", + "in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f35b54", "out": false }, "valid identity precompile call, then invalid opcode (SLOAD)": { @@ -1097,7 +1097,7 @@ "out": false }, "invalid EM call (missing final byte)": { - "in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f3", + "in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f3", "out": false }, "invalid identity precompile call (missing final byte)": {