Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
beb5d874
Unverified
Commit
beb5d874
authored
Jul 29, 2024
by
Inphi
Committed by
GitHub
Jul 29, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cannon: Fix exitCode for invalid cloneargs in MIPS2 contract (#11275)
parent
5b13bad9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
9 deletions
+7
-9
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+2
-2
MIPS2.sol
packages/contracts-bedrock/src/cannon/MIPS2.sol
+4
-6
MIPS2.t.sol
packages/contracts-bedrock/test/cannon/MIPS2.t.sol
+1
-1
No files found.
packages/contracts-bedrock/semver-lock.json
View file @
beb5d874
...
@@ -128,8 +128,8 @@
...
@@ -128,8 +128,8 @@
"sourceCodeHash"
:
"0xe28a16aad04ebcadba631a1920cac6e492c18f0d866836610be22779f3f04bfc"
"sourceCodeHash"
:
"0xe28a16aad04ebcadba631a1920cac6e492c18f0d866836610be22779f3f04bfc"
},
},
"src/cannon/MIPS2.sol"
:
{
"src/cannon/MIPS2.sol"
:
{
"initCodeHash"
:
"0x
dcd3bd4bbf8c119ca2d8a435da322ecc5c55a9e2a308789064bf19105933aa6c
"
,
"initCodeHash"
:
"0x
e496b3d41f51ae6cc6e7d4fb00ca0851b0e77f9b324420f88c09385ea85b1685
"
,
"sourceCodeHash"
:
"0x
a1406c94c785b094432aed8af2e1c5b42644e2a0878d48f89b488138e079ee66
"
"sourceCodeHash"
:
"0x
ce3bacc0e571fa3a63b61dde8b7aeadefa65e02bbb6de0177222d539c6721c92
"
},
},
"src/cannon/PreimageOracle.sol"
:
{
"src/cannon/PreimageOracle.sol"
:
{
"initCodeHash"
:
"0xe5db668fe41436f53995e910488c7c140766ba8745e19743773ebab508efd090"
,
"initCodeHash"
:
"0xe5db668fe41436f53995e910488c7c140766ba8745e19743773ebab508efd090"
,
...
...
packages/contracts-bedrock/src/cannon/MIPS2.sol
View file @
beb5d874
...
@@ -7,6 +7,7 @@ import { MIPSMemory } from "src/cannon/libraries/MIPSMemory.sol";
...
@@ -7,6 +7,7 @@ import { MIPSMemory } from "src/cannon/libraries/MIPSMemory.sol";
import { MIPSSyscalls as sys } from "src/cannon/libraries/MIPSSyscalls.sol";
import { MIPSSyscalls as sys } from "src/cannon/libraries/MIPSSyscalls.sol";
import { MIPSState as st } from "src/cannon/libraries/MIPSState.sol";
import { MIPSState as st } from "src/cannon/libraries/MIPSState.sol";
import { MIPSInstructions as ins } from "src/cannon/libraries/MIPSInstructions.sol";
import { MIPSInstructions as ins } from "src/cannon/libraries/MIPSInstructions.sol";
import { VMStatuses } from "src/dispute/lib/Types.sol";
/// @title MIPS2
/// @title MIPS2
/// @notice The MIPS2 contract emulates a single MIPS instruction.
/// @notice The MIPS2 contract emulates a single MIPS instruction.
...
@@ -50,8 +51,8 @@ contract MIPS2 is ISemver {
...
@@ -50,8 +51,8 @@ contract MIPS2 is ISemver {
}
}
/// @notice The semantic version of the MIPS2 contract.
/// @notice The semantic version of the MIPS2 contract.
/// @custom:semver 0.0.
1
-beta
/// @custom:semver 0.0.
2
-beta
string public constant version = "0.0.
1
-beta";
string public constant version = "0.0.
2
-beta";
/// @notice The preimage oracle contract.
/// @notice The preimage oracle contract.
IPreimageOracle internal immutable ORACLE;
IPreimageOracle internal immutable ORACLE;
...
@@ -71,9 +72,6 @@ contract MIPS2 is ISemver {
...
@@ -71,9 +72,6 @@ contract MIPS2 is ISemver {
// ThreadState memory offset allocated during step
// ThreadState memory offset allocated during step
uint256 internal constant TC_MEM_OFFSET = 0x220;
uint256 internal constant TC_MEM_OFFSET = 0x220;
// VM Status Panic exit code
uint8 internal constant VM_STATUS_PANIC = 0x3;
/// @param _oracle The address of the preimage oracle contract.
/// @param _oracle The address of the preimage oracle contract.
constructor(IPreimageOracle _oracle) {
constructor(IPreimageOracle _oracle) {
ORACLE = _oracle;
ORACLE = _oracle;
...
@@ -262,7 +260,7 @@ contract MIPS2 is ISemver {
...
@@ -262,7 +260,7 @@ contract MIPS2 is ISemver {
} else if (syscall_no == sys.SYS_CLONE) {
} else if (syscall_no == sys.SYS_CLONE) {
if (sys.VALID_SYS_CLONE_FLAGS != a0) {
if (sys.VALID_SYS_CLONE_FLAGS != a0) {
state.exited = true;
state.exited = true;
state.exitCode = VM
_STATUS_PANIC
;
state.exitCode = VM
Statuses.PANIC.raw()
;
return outputState();
return outputState();
}
}
v0 = state.nextThreadID;
v0 = state.nextThreadID;
...
...
packages/contracts-bedrock/test/cannon/MIPS2.t.sol
View file @
beb5d874
...
@@ -322,7 +322,7 @@ contract MIPS2_Test is CommonTest {
...
@@ -322,7 +322,7 @@ contract MIPS2_Test is CommonTest {
expect.step = state.step + 1;
expect.step = state.step + 1;
expect.stepsSinceLastContextSwitch = state.step + 1;
expect.stepsSinceLastContextSwitch = state.step + 1;
expect.exited = true;
expect.exited = true;
expect.exitCode =
0x3
;
expect.exitCode =
VMStatuses.PANIC.raw()
;
bytes32 postState = mips.step(encodeState(state), bytes.concat(threadWitness, memProof), 0);
bytes32 postState = mips.step(encodeState(state), bytes.concat(threadWitness, memProof), 0);
assertEq(postState, outputState(expect), "unexpected post state");
assertEq(postState, outputState(expect), "unexpected post state");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment