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
f7368e09
Commit
f7368e09
authored
Jul 27, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix
chore: fix x
parent
45a7ab80
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
924 deletions
+12
-924
config.yml
.circleci/config.yml
+4
-30
evm_test.go
cannon/mipsevm/evm_test.go
+4
-12
Makefile
op-bindings/Makefile
+1
-2
source_ids.go
op-bindings/bindings/source_ids.go
+0
-772
main.go
op-bindings/gen/main.go
+0
-102
solutil_test.go
op-chain-ops/srcmap/solutil_test.go
+3
-6
No files found.
.circleci/config.yml
View file @
f7368e09
...
...
@@ -717,32 +717,6 @@ jobs:
command
:
make fuzz
working_directory
:
op-chain-ops
op-chain-ops-tests
:
docker
:
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
resource_class
:
xlarge
steps
:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
restore_cache
:
name
:
Restore PNPM Package Cache
keys
:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
run
:
name
:
prep results dir
command
:
mkdir -p /tmp/test-results
-
run
:
name
:
run tests
command
:
|
gotestsum --format=standard-verbose --junitfile=/tmp/test-results/op-chain-ops.xml \
-- -parallel=8 -coverpkg=github.com/ethereum-optimism/optimism/... -coverprofile=coverage.out ./...
working_directory
:
op-chain-ops
-
run
:
name
:
upload coverage
command
:
codecov --verbose --clean --flags bedrock-go-tests
-
store_test_results
:
path
:
/tmp/test-results
fuzz-cannon
:
docker
:
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
...
...
@@ -1257,10 +1231,6 @@ workflows:
-
depcheck
:
requires
:
-
pnpm-monorepo
-
op-chain-ops-tests
:
name
:
op-chain-ops-tests
requires
:
-
pnpm-monorepo
-
devnet
:
name
:
devnet (with deployed contracts)
deploy
:
true
...
...
@@ -1324,6 +1294,9 @@ workflows:
-
go-test
:
name
:
op-bindings-tests
module
:
op-bindings
-
go-test
:
name
:
op-chain-ops-tests
module
:
op-chain-ops
-
go-test
:
name
:
op-node-tests
module
:
op-node
...
...
@@ -1362,6 +1335,7 @@ workflows:
-
op-service-lint
-
op-batcher-tests
-
op-bindings-tests
-
op-chain-ops-tests
-
op-node-tests
-
op-proposer-tests
-
op-challenger-tests
...
...
cannon/mipsevm/evm_test.go
View file @
f7368e09
...
...
@@ -19,7 +19,6 @@ import (
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-chain-ops/srcmap"
)
...
...
@@ -38,19 +37,12 @@ func testContractsSetup(t require.TestingT) (*Contracts, *Addresses) {
}
func
SourceMapTracer
(
t
*
testing
.
T
,
contracts
*
Contracts
,
addrs
*
Addresses
)
vm
.
EVMLogger
{
sources
:=
bindings
.
Sources
contractsDir
:=
"../../packages/contracts-bedrock"
for
i
,
source
:=
range
sources
{
// Add relative path to contracts directory if the source is not
// already relativized.
if
!
strings
.
HasPrefix
(
source
,
".."
)
{
sources
[
i
]
=
path
.
Join
(
contractsDir
,
source
)
}
}
t
.
Fatal
(
"TODO(clabby): The source map tracer is disabled until source IDs have been added to foundry artifacts."
)
mipsSrcMap
,
err
:=
contracts
.
MIPS
.
SourceMap
(
append
([]
string
{
path
.
Join
(
contractsDir
,
"src/cannon/MIPS.sol"
)},
sources
...
))
contractsDir
:=
"../../packages/contracts-bedrock"
mipsSrcMap
,
err
:=
contracts
.
MIPS
.
SourceMap
([]
string
{
path
.
Join
(
contractsDir
,
"src/cannon/MIPS.sol"
)})
require
.
NoError
(
t
,
err
)
oracleSrcMap
,
err
:=
contracts
.
Oracle
.
SourceMap
(
append
([]
string
{
path
.
Join
(
contractsDir
,
"src/cannon/PreimageOracle.sol"
)},
sources
...
)
)
oracleSrcMap
,
err
:=
contracts
.
Oracle
.
SourceMap
(
[]
string
{
path
.
Join
(
contractsDir
,
"src/cannon/PreimageOracle.sol"
)}
)
require
.
NoError
(
t
,
err
)
return
srcmap
.
NewSourceMapTracer
(
map
[
common
.
Address
]
*
srcmap
.
SourceMap
{
addrs
.
MIPS
:
mipsSrcMap
,
addrs
.
Oracle
:
oracleSrcMap
},
os
.
Stdout
)
...
...
op-bindings/Makefile
View file @
f7368e09
...
...
@@ -12,14 +12,13 @@ version:
compile
:
cd
$
(
contracts-dir
)
&&
\
pnpm build
--build-info
pnpm build
bindings
:
compile bindings-build
bindings-build
:
go run ./gen/main.go
\
-forge-artifacts
$
(
contracts-dir
)
/forge-artifacts
\
-forge-build-info
$
(
contracts-dir
)
/artifacts/build-info
\
-out
./bindings
\
-contracts
./artifacts.json
\
-source-maps
MIPS,PreimageOracle
\
...
...
op-bindings/bindings/source_ids.go
deleted
100644 → 0
View file @
45a7ab80
This diff is collapsed.
Click to expand it.
op-bindings/gen/main.go
View file @
f7368e09
...
...
@@ -15,12 +15,10 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/ast"
"github.com/ethereum-optimism/optimism/op-bindings/foundry"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
)
type
flags
struct
{
ForgeArtifacts
string
ForgeBuildInfo
string
Contracts
string
SourceMaps
string
OutDir
string
...
...
@@ -29,7 +27,6 @@ type flags struct {
}
type
data
struct
{
SourceId
uint
Name
string
StorageLayout
string
DeployedBin
string
...
...
@@ -37,17 +34,9 @@ type data struct {
DeployedSourceMap
string
}
type
sourceIdData
struct
{
Package
string
Sources
[]
string
SourceToId
map
[
string
]
uint
IdToSource
map
[
uint
]
string
}
func
main
()
{
var
f
flags
flag
.
StringVar
(
&
f
.
ForgeArtifacts
,
"forge-artifacts"
,
""
,
"Forge artifacts directory, to load sourcemaps from, if available"
)
flag
.
StringVar
(
&
f
.
ForgeBuildInfo
,
"forge-build-info"
,
""
,
"Forge build info directory, to load source IDs from, if available"
)
flag
.
StringVar
(
&
f
.
OutDir
,
"out"
,
""
,
"Output directory to put code in"
)
flag
.
StringVar
(
&
f
.
Contracts
,
"contracts"
,
"artifacts.json"
,
"Path to file containing list of contracts to generate bindings for"
)
flag
.
StringVar
(
&
f
.
SourceMaps
,
"source-maps"
,
""
,
"Comma-separated list of contracts to generate source-maps for"
)
...
...
@@ -208,79 +197,6 @@ func main() {
outfile
.
Close
()
log
.
Printf
(
"wrote file %s
\n
"
,
outfile
.
Name
())
}
mostRecentBuildInfo
,
err
:=
getLargestInDir
(
f
.
ForgeBuildInfo
)
if
err
!=
nil
{
log
.
Fatalf
(
"Error getting most recently modified build info file: %v"
,
err
)
}
buildInfoRaw
,
err
:=
os
.
ReadFile
(
mostRecentBuildInfo
)
if
err
!=
nil
{
log
.
Fatalf
(
"Error reading build info file: %v"
,
err
)
}
var
buildInfo
hardhat
.
BuildInfo
if
err
:=
json
.
Unmarshal
(
buildInfoRaw
,
&
buildInfo
);
err
!=
nil
{
log
.
Fatalf
(
"Error parsing build info file: %v"
,
err
)
}
sourceToId
:=
make
(
map
[
string
]
uint
)
idToSource
:=
make
(
map
[
uint
]
string
)
monorepoBase
,
err
:=
filepath
.
Abs
(
f
.
MonorepoBase
)
if
err
!=
nil
{
log
.
Fatalf
(
"Error getting absolute path of monorepo base: %v"
,
err
)
}
for
k
,
v
:=
range
buildInfo
.
Output
.
Sources
{
// Replace absolute monorepo base with relative path to monorepo root
k
=
strings
.
Replace
(
k
,
monorepoBase
+
"/"
,
"../../"
,
1
)
sourceToId
[
k
]
=
v
.
Id
idToSource
[
v
.
Id
]
=
k
}
fname
:=
filepath
.
Join
(
f
.
OutDir
,
"source_ids.go"
)
outfile
,
err
:=
os
.
OpenFile
(
fname
,
os
.
O_RDWR
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0
o600
,
)
if
err
!=
nil
{
log
.
Fatalf
(
"error opening %s: %v
\n
"
,
fname
,
err
)
}
t
=
template
.
Must
(
template
.
New
(
"source_ids"
)
.
Parse
(
sourceIdTmpl
))
d
:=
sourceIdData
{
Package
:
f
.
Package
,
SourceToId
:
sourceToId
,
IdToSource
:
idToSource
,
}
if
err
:=
t
.
Execute
(
outfile
,
d
);
err
!=
nil
{
log
.
Fatalf
(
"error writing template %s: %v"
,
outfile
.
Name
(),
err
)
}
outfile
.
Close
()
log
.
Printf
(
"wrote file %s
\n
"
,
outfile
.
Name
())
}
// getLargestInDir returns the path of the largest file in a directory.
func
getLargestInDir
(
dirPath
string
)
(
string
,
error
)
{
var
largestFile
string
var
largestSize
int64
err
:=
filepath
.
Walk
(
dirPath
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
return
err
}
// Check if the current path is a regular file and not a directory
if
!
info
.
IsDir
()
{
if
info
.
Size
()
>
largestSize
{
largestFile
=
path
largestSize
=
info
.
Size
()
}
}
return
nil
})
return
largestFile
,
err
}
var
tmpl
=
`// Code generated - DO NOT EDIT.
...
...
@@ -311,21 +227,3 @@ func init() {
deployedBytecodes["{{.Name}}"] = {{.Name}}DeployedBin
}
`
var
sourceIdTmpl
=
`// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package {{.Package}}
var Sources = []string{
{{range $key, $value := .SourceToId}} "{{$key}}",
{{end}}}
var SourceToId = map[string]uint{
{{range $key, $value := .SourceToId}} "{{$key}}": {{$value}},
{{end}}}
var IdToSource = map[uint]string{
{{range $key, $value := .IdToSource}} {{$key}}: "{{$value}}",
{{end}}}
`
op-chain-ops/srcmap/solutil_test.go
View file @
f7368e09
...
...
@@ -12,16 +12,13 @@ import (
)
func
TestSourcemap
(
t
*
testing
.
T
)
{
t
.
Skip
(
"TODO(clabby): This test is disabled until source IDs have been added to foundry artifacts."
)
contractsDir
:=
"../../packages/contracts-bedrock"
sources
:=
[]
string
{
path
.
Join
(
contractsDir
,
"src/cannon/MIPS.sol"
)}
sources
=
append
(
sources
,
bindings
.
Sources
...
)
for
i
,
source
:=
range
sources
{
// Add relative path to contracts directory if the source is not
// already relativized.
if
!
strings
.
HasPrefix
(
source
,
".."
)
{
sources
[
i
]
=
path
.
Join
(
contractsDir
,
source
)
}
}
deployedByteCode
:=
hexutil
.
MustDecode
(
bindings
.
MIPSDeployedBin
)
srcMap
,
err
:=
ParseSourceMap
(
...
...
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