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
e3744430
Unverified
Commit
e3744430
authored
Sep 12, 2024
by
wissyLeeei
Committed by
GitHub
Sep 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the error usage in cannon (#11368)
parent
7ff5e6ed
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
run.go
cannon/cmd/run.go
+2
-1
patch.go
cannon/mipsevm/program/patch.go
+2
-1
mips.go
cannon/mipsevm/testutil/mips.go
+1
-1
No files found.
cannon/cmd/run.go
View file @
e3744430
...
...
@@ -2,6 +2,7 @@ package cmd
import
(
"context"
"errors"
"fmt"
"os"
"os/exec"
...
...
@@ -375,7 +376,7 @@ func Run(ctx *cli.Context) error {
debugProgram
:=
ctx
.
Bool
(
RunDebugFlag
.
Name
)
if
debugProgram
{
if
metaPath
:=
ctx
.
Path
(
RunMetaFlag
.
Name
);
metaPath
==
""
{
return
fmt
.
Errorf
(
"cannot enable debug mode without a metadata file"
)
return
errors
.
New
(
"cannot enable debug mode without a metadata file"
)
}
if
err
:=
vm
.
InitDebug
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to initialize debug mode: %w"
,
err
)
...
...
cannon/mipsevm/program/patch.go
View file @
e3744430
...
...
@@ -4,6 +4,7 @@ import (
"bytes"
"debug/elf"
"encoding/binary"
"errors"
"fmt"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
...
...
@@ -57,7 +58,7 @@ func PatchStack(st mipsevm.FPVMState) error {
sp
:=
uint32
(
0x7f
_ff_d0_00
)
// allocate 1 page for the initial stack data, and 16KB = 4 pages for the stack to grow
if
err
:=
st
.
GetMemory
()
.
SetMemoryRange
(
sp
-
4
*
memory
.
PageSize
,
bytes
.
NewReader
(
make
([]
byte
,
5
*
memory
.
PageSize
)));
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to allocate page for stack content"
)
return
errors
.
New
(
"failed to allocate page for stack content"
)
}
st
.
GetRegistersRef
()[
29
]
=
sp
...
...
cannon/mipsevm/testutil/mips.go
View file @
e3744430
...
...
@@ -123,7 +123,7 @@ func EncodePreimageOracleInput(t *testing.T, wit *mipsevm.StepWitness, localCont
return
input
,
nil
case
preimage
.
PrecompileKeyType
:
if
localOracle
==
nil
{
return
nil
,
fmt
.
Errorf
(
"local oracle is required for precompile preimages"
)
return
nil
,
errors
.
New
(
"local oracle is required for precompile preimages"
)
}
preimage
:=
localOracle
.
GetPreimage
(
preimage
.
Keccak256Key
(
wit
.
PreimageKey
)
.
PreimageKey
())
precompile
:=
common
.
BytesToAddress
(
preimage
[
:
20
])
...
...
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