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
b1b5f085
Unverified
Commit
b1b5f085
authored
Jun 16, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cannon: integrate into monorepo
parent
d45a659b
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
29 additions
and
22 deletions
+29
-22
load_elf.go
cannon/cmd/load_elf.go
+1
-1
matcher.go
cannon/cmd/matcher.go
+1
-1
run.go
cannon/cmd/run.go
+2
-2
README.md
cannon/docs/README.md
+2
-2
go.mod
cannon/example/claim/go.mod
+2
-2
main.go
cannon/example/claim/main.go
+1
-1
go.mod
cannon/go.mod
+3
-3
main.go
cannon/main.go
+1
-1
evm.go
cannon/mipsevm/evm.go
+1
-2
evm_test.go
cannon/mipsevm/evm_test.go
+2
-2
solutil_test.go
cannon/mipsevm/solutil_test.go
+2
-2
state_test.go
cannon/mipsevm/state_test.go
+1
-1
witness.go
cannon/mipsevm/witness.go
+1
-1
README.md
op-preimage/README.md
+8
-0
filechan.go
op-preimage/filechan.go
+0
-0
go.mod
op-preimage/go.mod
+1
-1
go.sum
op-preimage/go.sum
+0
-0
hash.go
op-preimage/hash.go
+0
-0
hints.go
op-preimage/hints.go
+0
-0
hints_test.go
op-preimage/hints_test.go
+0
-0
iface.go
op-preimage/iface.go
+0
-0
oracle.go
op-preimage/oracle.go
+0
-0
oracle_test.go
op-preimage/oracle_test.go
+0
-0
MIPS.sol
packages/contracts-bedrock/contracts/cannon/MIPS.sol
+0
-0
Oracle.sol
packages/contracts-bedrock/contracts/cannon/Oracle.sol
+0
-0
No files found.
cannon/cmd/load_elf.go
View file @
b1b5f085
...
...
@@ -6,7 +6,7 @@ import (
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/cannon/mipsevm"
"github.com/ethereum-optimism/
optimism/
cannon/mipsevm"
)
var
(
...
...
cannon/cmd/matcher.go
View file @
b1b5f085
...
...
@@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"github.com/ethereum-optimism/cannon/mipsevm"
"github.com/ethereum-optimism/
optimism/
cannon/mipsevm"
)
type
StepMatcher
func
(
st
*
mipsevm
.
State
)
bool
...
...
cannon/cmd/run.go
View file @
b1b5f085
...
...
@@ -14,8 +14,8 @@ import (
"github.com/pkg/profile"
"github.com/ethereum-optimism/cannon/mipsevm"
"github.com/ethereum-optimism/
cannon/
preimage"
"github.com/ethereum-optimism/
optimism/
cannon/mipsevm"
"github.com/ethereum-optimism/
optimism/op-
preimage"
)
var
(
...
...
cannon/docs/README.md
View file @
b1b5f085
...
...
@@ -40,7 +40,7 @@ to emulate the delayed `PC` changes after delay-slot execution.
There are 3 types of witness data involved in onchain execution:
-
[
Packed State
](
#packed-state
)
-
[
Memory proofs
](
#memory-proofs
)
-
[
Memory proofs
](
#memory-proofs
)
-
[
Pre-image data
](
#pre-image-data
)
### Packed State
...
...
@@ -131,7 +131,7 @@ since all sibling data that is combined with the new leaf value was already auth
### Pre-image data
Pre-image data is accessed through syscalls exclusively.
The OP-stack fault-proof
[
Pre-image Oracle specs
](
https://github.com/ethereum-optimism/optimism/blob/develop
/specs/fault-proof.md#pre-image-oracle
)
The OP-stack fault-proof
[
Pre-image Oracle specs
](
../..
/specs/fault-proof.md#pre-image-oracle
)
define the ABI for communicating pre-images.
This ABI is implemented by the VM by intercepting the
`read`
/
`write`
syscalls to specific file descriptors:
...
...
cannon/example/claim/go.mod
View file @
b1b5f085
...
...
@@ -2,11 +2,11 @@ module claim
go 1.20
require github.com/ethereum-optimism/
cannon/
preimage v0.0.0
require github.com/ethereum-optimism/
optimism/op-
preimage v0.0.0
require (
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/sys v0.7.0 // indirect
)
replace github.com/ethereum-optimism/
cannon/preimage v0.0.0 => ../../
preimage
replace github.com/ethereum-optimism/
optimism/op-preimage v0.0.0 => ../../../op-
preimage
cannon/example/claim/main.go
View file @
b1b5f085
...
...
@@ -5,7 +5,7 @@ import (
"fmt"
"os"
"github.com/ethereum-optimism/
cannon/
preimage"
"github.com/ethereum-optimism/
optimism/op-
preimage"
)
type
rawHint
string
...
...
cannon/go.mod
View file @
b1b5f085
module github.com/ethereum-optimism/cannon
module github.com/ethereum-optimism/
optimism/
cannon
go 1.20
require (
github.com/ethereum-optimism/
cannon/
preimage v0.0.0
github.com/ethereum-optimism/
optimism/op-
preimage v0.0.0
github.com/ethereum/go-ethereum v1.11.5
github.com/pkg/profile v1.7.0
github.com/stretchr/testify v1.8.2
...
...
@@ -66,4 +66,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace github.com/ethereum-optimism/
cannon/preimage v0.0.0 => ./
preimage
replace github.com/ethereum-optimism/
optimism/op-preimage v0.0.0 => ../op-
preimage
cannon/main.go
View file @
b1b5f085
...
...
@@ -10,7 +10,7 @@ import (
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/cannon/cmd"
"github.com/ethereum-optimism/
optimism/
cannon/cmd"
)
func
main
()
{
...
...
cannon/mipsevm/evm.go
View file @
b1b5f085
...
...
@@ -42,8 +42,7 @@ func LoadContracts() (*Contracts, error) {
}
func
LoadContract
(
name
string
)
(
*
Contract
,
error
)
{
// TODO change to forge build output
dat
,
err
:=
os
.
ReadFile
(
fmt
.
Sprintf
(
"../contracts/out/%s.sol/%s.json"
,
name
,
name
))
dat
,
err
:=
os
.
ReadFile
(
fmt
.
Sprintf
(
"../../packages/contracts-bedrock/forge-artifacts/%s.sol/%s.json"
,
name
,
name
))
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to read contract JSON definition of %q: %w"
,
name
,
err
)
}
...
...
cannon/mipsevm/evm_test.go
View file @
b1b5f085
...
...
@@ -21,9 +21,9 @@ func testContractsSetup(t *testing.T) (*Contracts, *Addresses, *SourceMapTracer)
contracts
,
err
:=
LoadContracts
()
require
.
NoError
(
t
,
err
)
mipsSrcMap
,
err
:=
contracts
.
MIPS
.
SourceMap
([]
string
{
"../
contracts/src
/MIPS.sol"
})
mipsSrcMap
,
err
:=
contracts
.
MIPS
.
SourceMap
([]
string
{
"../
../packages/contracts-bedrock/contracts/cannon
/MIPS.sol"
})
require
.
NoError
(
t
,
err
)
oracleSrcMap
,
err
:=
contracts
.
Oracle
.
SourceMap
([]
string
{
"../
contracts/src
/Oracle.sol"
})
oracleSrcMap
,
err
:=
contracts
.
Oracle
.
SourceMap
([]
string
{
"../
../packages/contracts-bedrock/contracts/cannon
/Oracle.sol"
})
require
.
NoError
(
t
,
err
)
addrs
:=
&
Addresses
{
...
...
cannon/mipsevm/solutil_test.go
View file @
b1b5f085
...
...
@@ -10,11 +10,11 @@ import (
func
TestSourcemap
(
t
*
testing
.
T
)
{
contract
,
err
:=
LoadContract
(
"MIPS"
)
require
.
NoError
(
t
,
err
)
srcMap
,
err
:=
contract
.
SourceMap
([]
string
{
"../
contracts/src
/MIPS.sol"
})
srcMap
,
err
:=
contract
.
SourceMap
([]
string
{
"../
../packages/contracts-bedrock/contracts/cannon
/MIPS.sol"
})
require
.
NoError
(
t
,
err
)
for
i
:=
0
;
i
<
len
(
contract
.
DeployedBytecode
.
Object
);
i
++
{
info
:=
srcMap
.
FormattedInfo
(
uint64
(
i
))
if
!
strings
.
HasPrefix
(
info
,
"generated:"
)
&&
!
strings
.
HasPrefix
(
info
,
"../
contracts/src
/MIPS.sol"
)
{
if
!
strings
.
HasPrefix
(
info
,
"generated:"
)
&&
!
strings
.
HasPrefix
(
info
,
"../
../packages/contracts-bedrock/contracts/cannon
/MIPS.sol"
)
{
t
.
Fatalf
(
"unexpected info: %q"
,
info
)
}
}
...
...
cannon/mipsevm/state_test.go
View file @
b1b5f085
...
...
@@ -16,7 +16,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/
cannon/
preimage"
"github.com/ethereum-optimism/
optimism/op-
preimage"
)
// 0xbf_c0_00_00 ... baseAddrEnd is used in tests to write the results to
...
...
cannon/mipsevm/witness.go
View file @
b1b5f085
...
...
@@ -5,7 +5,7 @@ import (
"errors"
"fmt"
"github.com/ethereum-optimism/
cannon/
preimage"
"github.com/ethereum-optimism/
optimism/op-
preimage"
)
type
StepWitness
struct
{
...
...
op-preimage/README.md
0 → 100644
View file @
b1b5f085
# op-preimage
`op-preimage`
offers 0-dependency Go bindings to interact as client or sever over the Pre-image Oracle ABI.
Read more about the Preimage Oracle in the
[
specs
](
../specs/fault-proof.md
)
.
See
[
op-program
](
../op-program
)
and
[
Cannon client examples
](
../cannon/example
)
for client-side usage.
See
[
Cannon `mipsevm`
](
../cannon/mipsevm
)
for server-side usage.
cannon/
preimage/filechan.go
→
op-
preimage/filechan.go
View file @
b1b5f085
File moved
cannon/
preimage/go.mod
→
op-
preimage/go.mod
View file @
b1b5f085
module github.com/ethereum-optimism/
cannon/
preimage
module github.com/ethereum-optimism/
optimism/op-
preimage
go 1.20
...
...
cannon/
preimage/go.sum
→
op-
preimage/go.sum
View file @
b1b5f085
File moved
cannon/
preimage/hash.go
→
op-
preimage/hash.go
View file @
b1b5f085
File moved
cannon/
preimage/hints.go
→
op-
preimage/hints.go
View file @
b1b5f085
File moved
cannon/
preimage/hints_test.go
→
op-
preimage/hints_test.go
View file @
b1b5f085
File moved
cannon/
preimage/iface.go
→
op-
preimage/iface.go
View file @
b1b5f085
File moved
cannon/
preimage/oracle.go
→
op-
preimage/oracle.go
View file @
b1b5f085
File moved
cannon/
preimage/oracle_test.go
→
op-
preimage/oracle_test.go
View file @
b1b5f085
File moved
cannon/contracts/src
/MIPS.sol
→
packages/contracts-bedrock/contracts/cannon
/MIPS.sol
View file @
b1b5f085
File moved
cannon/contracts/src
/Oracle.sol
→
packages/contracts-bedrock/contracts/cannon
/Oracle.sol
View file @
b1b5f085
File moved
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