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
f6c7fa5b
Commit
f6c7fa5b
authored
Sep 02, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix offset bug when loading `exited` and `exitCode`
parent
98bfbd81
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
mips.go
op-bindings/bindings/mips.go
+1
-1
mips_more.go
op-bindings/bindings/mips_more.go
+2
-2
MIPS.sol
packages/contracts-bedrock/src/cannon/MIPS.sol
+3
-3
MIPS.t.sol
packages/contracts-bedrock/test/MIPS.t.sol
+2
-2
No files found.
op-bindings/bindings/mips.go
View file @
f6c7fa5b
This diff is collapsed.
Click to expand it.
op-bindings/bindings/mips_more.go
View file @
f6c7fa5b
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/src/cannon/MIPS.sol
View file @
f6c7fa5b
...
...
@@ -103,9 +103,9 @@ contract MIPS {
from, to := copyMem(from, to, 4) // lo
from, to := copyMem(from, to, 4) // hi
from, to := copyMem(from, to, 4) // heap
let exitCode :=
shr(248, mload(from)
)
let exitCode :=
mload(from
)
from, to := copyMem(from, to, 1) // exitCode
let exited :=
shr(248, mload(from)
)
let exited :=
mload(from
)
from, to := copyMem(from, to, 1) // exited
from, to := copyMem(from, to, 8) // step
from := add(from, 32) // offset to registers
...
...
@@ -137,7 +137,7 @@ contract MIPS {
// Compute the hash of the resulting MIPS state
out_ := keccak256(start, sub(to, start))
out_ := or(
shl(248, status), and(not(shl(248, 0xff)), out_
))
out_ := or(
and(not(shl(248, 0xFF)), out_), shl(248, status
))
}
}
...
...
packages/contracts-bedrock/test/MIPS.t.sol
View file @
f6c7fa5b
...
...
@@ -1558,7 +1558,7 @@ contract MIPS_Test is CommonTest {
/// 1. Exited with success (Invalid)
/// 2. Exited with failure (Panic)
/// 3. Unfinished
function vmStatus(MIPS.State memory state) internal pure returns (uint
8
out_) {
function vmStatus(MIPS.State memory state) internal pure returns (uint
256
out_) {
if (state.exited) {
if (state.exitCode == 0) {
return 0;
...
...
@@ -1574,7 +1574,7 @@ contract MIPS_Test is CommonTest {
function outputState(MIPS.State memory state) internal pure returns (bytes32 out_) {
bytes memory enc = encodeState(state);
uint
8
status = vmStatus(state);
uint
256
status = vmStatus(state);
assembly {
out_ := keccak256(add(enc, 0x20), 226)
out_ := or(and(not(shl(248, 0xFF)), out_), shl(248, status))
...
...
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