Skip to content

Commit

Permalink
Fix JUMPI inputs ordering (#21)
Browse files Browse the repository at this point in the history
* fix jumpi inputs ordering

* fix comment
  • Loading branch information
ben-chain authored Oct 16, 2020
1 parent 2032929 commit 17dfcf1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions packages/contracts/test/data/json/safety-checker.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,31 +1073,31 @@
"out": false
},
"valid EM call": {
"in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f35b",
"in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f35b",
"out": true
},
"valid identity precompile call": {
"in": "0x3350600060045af1",
"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)": {
"in": "0x3350600060045af154",
"out": false
},
"invalid EM call (missing final byte)": {
"in": "0x336000905af158601d0157586012013d600114573d6000803e3d6000fd5b60016000f3",
"in": "0x336000905af158601d01573d60011458600c01573d6000803e3d6000FD5b60016000f3",
"out": false
},
"invalid identity precompile call (missing final byte)": {
Expand Down

0 comments on commit 17dfcf1

Please sign in to comment.