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
6583a622
Unverified
Commit
6583a622
authored
Jul 27, 2023
by
mergify[bot]
Committed by
GitHub
Jul 27, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into aj/more-cannon-inputs
parents
d0ec7ab5
53798bca
Changes
44
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
865 additions
and
467 deletions
+865
-467
config.yml
.circleci/config.yml
+19
-109
.gitmodules
.gitmodules
+18
-0
erc20_more.go
op-bindings/bindings/erc20_more.go
+1
-1
preimageoracle_more.go
op-bindings/bindings/preimageoracle_more.go
+1
-1
weth9.go
op-bindings/bindings/weth9.go
+1
-1
weth9_more.go
op-bindings/bindings/weth9_more.go
+1
-1
config.go
op-chain-ops/genesis/config.go
+10
-10
test-deploy-config-devnet-l1.json
...in-ops/genesis/testdata/test-deploy-config-devnet-l1.json
+3
-3
test-deploy-config-full.json
op-chain-ops/genesis/testdata/test-deploy-config-full.json
+3
-3
withdrawal_network.go
op-chain-ops/genesis/withdrawal_network.go
+67
-0
withdrawal_network_test.go
op-chain-ops/genesis/withdrawal_network_test.go
+125
-0
provider.go
op-challenger/fault/alphabet/provider.go
+6
-0
executor.go
op-challenger/fault/cannon/executor.go
+77
-7
executor_test.go
op-challenger/fault/cannon/executor_test.go
+86
-0
provider.go
op-challenger/fault/cannon/provider.go
+23
-10
provider_test.go
op-challenger/fault/cannon/provider_test.go
+57
-23
420.json
op-challenger/fault/cannon/test_data/proofs/420.json
+11
-0
421.json
op-challenger/fault/cannon/test_data/proofs/421.json
+11
-0
service.go
op-challenger/fault/service.go
+1
-1
solver.go
op-challenger/fault/solver/solver.go
+15
-8
solver_test.go
op-challenger/fault/solver/solver_test.go
+98
-50
alphabet.go
op-challenger/fault/test/alphabet.go
+18
-1
types.go
op-challenger/fault/types/types.go
+22
-0
types_test.go
op-challenger/fault/types/types_test.go
+23
-0
setup.go
op-e2e/e2eutils/setup.go
+6
-6
setup.go
op-e2e/setup.go
+6
-6
system_test.go
op-e2e/system_test.go
+11
-12
cmd.go
op-node/cmd/genesis/cmd.go
+16
-4
cli.go
op-service/txmgr/cli.go
+1
-1
entrypoint-l1.sh
ops-bedrock/entrypoint-l1.sh
+1
-0
entrypoint-l2.sh
ops-bedrock/entrypoint-l2.sh
+1
-0
Dockerfile.packages
ops/docker/Dockerfile.packages
+4
-0
goerli-forked.json
packages/contracts-bedrock/deploy-config/goerli-forked.json
+0
-40
foundry.toml
packages/contracts-bedrock/foundry.toml
+7
-8
clones-with-immutable-args
packages/contracts-bedrock/lib/clones-with-immutable-args
+1
-0
ds-test
packages/contracts-bedrock/lib/ds-test
+1
-0
forge-std
packages/contracts-bedrock/lib/forge-std
+1
-0
openzeppelin-contracts
packages/contracts-bedrock/lib/openzeppelin-contracts
+1
-0
openzeppelin-contracts-upgradeable
.../contracts-bedrock/lib/openzeppelin-contracts-upgradeable
+1
-0
solmate
packages/contracts-bedrock/lib/solmate
+1
-0
package.json
packages/contracts-bedrock/package.json
+1
-8
SemverLock.s.sol
packages/contracts-bedrock/scripts/SemverLock.s.sol
+43
-0
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+28
-0
pnpm-lock.yaml
pnpm-lock.yaml
+37
-153
No files found.
.circleci/config.yml
View file @
6583a622
...
...
@@ -335,26 +335,8 @@ jobs:
resource_class
:
large
steps
:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
restore_cache
:
name
:
Restore PNPM Package Cache
keys
:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
check-changed
:
patterns
:
contracts-bedrock
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
command
:
|
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
-
run
:
name
:
Install yarn package manager
command
:
|
npm i yarn@1 --global
-
run
:
name
:
print forge version
command
:
forge --version
...
...
@@ -378,26 +360,8 @@ jobs:
resource_class
:
xlarge
steps
:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
restore_cache
:
name
:
Restore PNPM Package Cache
keys
:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
check-changed
:
patterns
:
contracts-bedrock
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
command
:
|
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
-
run
:
name
:
Install yarn package manager
command
:
|
npm i yarn@1 --global
-
run
:
name
:
print forge version
command
:
forge --version
...
...
@@ -416,26 +380,16 @@ jobs:
resource_class
:
xlarge
steps
:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
restore_cache
:
name
:
Restore PNPM Package Cache
keys
:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
check-changed
:
patterns
:
contracts-bedrock
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
command
:
|
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
-
run
:
name
:
Install yarn package manager
command
:
|
npm i yarn@1 --global
name
:
build contracts
command
:
pnpm build
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
lint
command
:
|
...
...
@@ -463,6 +417,12 @@ jobs:
pnpm storage-snapshot
git diff --exit-code .storage-layout || echo "export STORAGE_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
semver lock
command
:
|
pnpm semver-lock
git diff --exit-code semver-lock.json || echo "export SEMVER_LOCK_STATUS=1" >> "$BASH_ENV"
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
invariant docs
command
:
|
...
...
@@ -492,6 +452,10 @@ jobs:
echo "Invariant docs failed, see job output for details."
FAILED=1
fi
if [[ "$SEMVER_LOCK_STATUS" -ne 0 ]]; then
echo "Semver lock failed, see job output for details."
FAILED=1
fi
if [[ "$FAILED" -ne 0 ]]; then
exit 1
fi
...
...
@@ -502,34 +466,12 @@ jobs:
resource_class
:
large
steps
:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
restore_cache
:
name
:
Restore PNPM Package Cache
keys
:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
check-changed
:
patterns
:
contracts-bedrock
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
command
:
|
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
-
run
:
name
:
Install yarn package manager
command
:
|
npm i yarn@1 --global
-
run
:
name
:
slither
command
:
|
slither --version && pnpm slither || echo "export LINT_STATUS=1" >> "$BASH_ENV"
-
run
:
name
:
invariant docs
command
:
pnpm autogen:invariant-docs && git diff --exit-code ./invariant-docs/*.md
working_directory
:
packages/contracts-bedrock
slither --version && pnpm slither || echo "Slither failed"
contracts-bedrock-validate-spaces
:
docker
:
...
...
@@ -543,19 +485,6 @@ jobs:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
check-changed
:
patterns
:
contracts-bedrock
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
command
:
|
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
-
run
:
name
:
Install yarn package manager
command
:
|
npm i yarn@1 --global
-
run
:
name
:
validate spacers
command
:
pnpm validate-spacers
...
...
@@ -568,7 +497,7 @@ jobs:
-
checkout
-
attach_workspace
:
{
at
:
"
."
}
-
check-changed
:
patterns
:
contracts-bedrock
,contracts
patterns
:
contracts-bedrock
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
...
...
@@ -612,20 +541,7 @@ jobs:
keys
:
-
pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }}
-
check-changed
:
patterns
:
contracts-bedrock,contracts
# TODO remove me after ci builder updated
-
run
:
name
:
Install pnpm package manager
command
:
|
npm i pnpm --global
# TODO remove me after ci builder updated
# A github dep clones-with-immutable-args is installed via github
# packages installed via npm via github automatically run postpack scripts
# their postpack script happens to use yarn so we need it here
-
run
:
name
:
Install yarn package manager
command
:
|
npm i yarn@1 --global
patterns
:
contracts-bedrock
-
run
:
name
:
Echidna Fuzz <<parameters.echidna_target>>
command
:
pnpm echidna:<<parameters.echidna_target>>
...
...
@@ -1349,18 +1265,12 @@ workflows:
package_name
:
core-utils
requires
:
-
pnpm-monorepo
-
contracts-bedrock-tests
:
requires
:
-
pnpm-monorepo
-
contracts-bedrock-coverage
:
requires
:
-
pnpm-monorepo
-
contracts-bedrock-tests
-
contracts-bedrock-coverage
-
contracts-bedrock-checks
:
requires
:
-
pnpm-monorepo
-
contracts-bedrock-slither
:
requires
:
-
pnpm-monorepo
-
contracts-bedrock-slither
-
contracts-bedrock-validate-spaces
:
requires
:
-
pnpm-monorepo
...
...
.gitmodules
0 → 100644
View file @
6583a622
[submodule "packages/contracts-bedrock/lib/openzeppelin-contracts-upgradeable"]
path = packages/contracts-bedrock/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "packages/contracts-bedrock/lib/openzeppelin-contracts"]
path = packages/contracts-bedrock/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "packages/contracts-bedrock/lib/solmate"]
path = packages/contracts-bedrock/lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "packages/contracts-bedrock/lib/clones-with-immutable-args"]
path = packages/contracts-bedrock/lib/clones-with-immutable-args
url = https://github.com/Saw-mon-and-Natalie/clones-with-immutable-args
[submodule "packages/contracts-bedrock/lib/ds-test"]
path = packages/contracts-bedrock/lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "packages/contracts-bedrock/lib/forge-std"]
path = packages/contracts-bedrock/lib/forge-std
url = https://github.com/foundry-rs/forge-std
op-bindings/bindings/erc20_more.go
View file @
6583a622
...
...
@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
const
ERC20StorageLayoutJSON
=
"{
\"
storage
\"
:[{
\"
astId
\"
:1000,
\"
contract
\"
:
\"
node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_balances
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_mapping(t_address,t_uint256)
\"
},{
\"
astId
\"
:1001,
\"
contract
\"
:
\"
node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_allowances
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
1
\"
,
\"
type
\"
:
\"
t_mapping(t_address,t_mapping(t_address,t_uint256))
\"
},{
\"
astId
\"
:1002,
\"
contract
\"
:
\"
node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_totalSupply
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
2
\"
,
\"
type
\"
:
\"
t_uint256
\"
},{
\"
astId
\"
:1003,
\"
contract
\"
:
\"
node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_name
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
3
\"
,
\"
type
\"
:
\"
t_string_storage
\"
},{
\"
astId
\"
:1004,
\"
contract
\"
:
\"
node_modules/@openzeppelin
/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_symbol
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
4
\"
,
\"
type
\"
:
\"
t_string_storage
\"
}],
\"
types
\"
:{
\"
t_address
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
address
\"
,
\"
numberOfBytes
\"
:
\"
20
\"
},
\"
t_mapping(t_address,t_mapping(t_address,t_uint256))
\"
:{
\"
encoding
\"
:
\"
mapping
\"
,
\"
label
\"
:
\"
mapping(address =
\u003e
mapping(address =
\u003e
uint256))
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
,
\"
key
\"
:
\"
t_address
\"
,
\"
value
\"
:
\"
t_mapping(t_address,t_uint256)
\"
},
\"
t_mapping(t_address,t_uint256)
\"
:{
\"
encoding
\"
:
\"
mapping
\"
,
\"
label
\"
:
\"
mapping(address =
\u003e
uint256)
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
,
\"
key
\"
:
\"
t_address
\"
,
\"
value
\"
:
\"
t_uint256
\"
},
\"
t_string_storage
\"
:{
\"
encoding
\"
:
\"
bytes
\"
,
\"
label
\"
:
\"
string
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
},
\"
t_uint256
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
uint256
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
}}}"
const
ERC20StorageLayoutJSON
=
"{
\"
storage
\"
:[{
\"
astId
\"
:1000,
\"
contract
\"
:
\"
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_balances
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_mapping(t_address,t_uint256)
\"
},{
\"
astId
\"
:1001,
\"
contract
\"
:
\"
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_allowances
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
1
\"
,
\"
type
\"
:
\"
t_mapping(t_address,t_mapping(t_address,t_uint256))
\"
},{
\"
astId
\"
:1002,
\"
contract
\"
:
\"
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_totalSupply
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
2
\"
,
\"
type
\"
:
\"
t_uint256
\"
},{
\"
astId
\"
:1003,
\"
contract
\"
:
\"
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_name
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
3
\"
,
\"
type
\"
:
\"
t_string_storage
\"
},{
\"
astId
\"
:1004,
\"
contract
\"
:
\"
lib/openzeppelin-contracts
/contracts/token/ERC20/ERC20.sol:ERC20
\"
,
\"
label
\"
:
\"
_symbol
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
4
\"
,
\"
type
\"
:
\"
t_string_storage
\"
}],
\"
types
\"
:{
\"
t_address
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
address
\"
,
\"
numberOfBytes
\"
:
\"
20
\"
},
\"
t_mapping(t_address,t_mapping(t_address,t_uint256))
\"
:{
\"
encoding
\"
:
\"
mapping
\"
,
\"
label
\"
:
\"
mapping(address =
\u003e
mapping(address =
\u003e
uint256))
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
,
\"
key
\"
:
\"
t_address
\"
,
\"
value
\"
:
\"
t_mapping(t_address,t_uint256)
\"
},
\"
t_mapping(t_address,t_uint256)
\"
:{
\"
encoding
\"
:
\"
mapping
\"
,
\"
label
\"
:
\"
mapping(address =
\u003e
uint256)
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
,
\"
key
\"
:
\"
t_address
\"
,
\"
value
\"
:
\"
t_uint256
\"
},
\"
t_string_storage
\"
:{
\"
encoding
\"
:
\"
bytes
\"
,
\"
label
\"
:
\"
string
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
},
\"
t_uint256
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
uint256
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
}}}"
var
ERC20StorageLayout
=
new
(
solc
.
StorageLayout
)
...
...
op-bindings/bindings/preimageoracle_more.go
View file @
6583a622
...
...
@@ -15,7 +15,7 @@ var PreimageOracleStorageLayout = new(solc.StorageLayout)
var
PreimageOracleDeployedBin
=
"0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063e03110e11161005b578063e03110e114610111578063e159261114610139578063fe4ac08e1461014e578063fef2b4ed146101c357600080fd5b806361238bde146100825780638542cf50146100c0578063a57c202c146100fe575b600080fd5b6100ad610090366004610433565b600160209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b6100ee6100ce366004610433565b600260209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100b7565b6100ad61010c36600461049e565b6101e3565b61012461011f366004610433565b610242565b604080519283526020830191909152016100b7565b61014c6101473660046104e0565b610333565b005b61014c61015c36600461052c565b6000838152600260209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558684528252808320968352958152858220939093559283529082905291902055565b6100ad6101d136600461055e565b60006020819052908152604090205481565b60243560c081901b608052600090608881858237207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f0200000000000000000000000000000000000000000000000000000000000000179392505050565b6000828152600260209081526040808320848452909152812054819060ff166102cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b50600083815260208181526040909120546102e78160086105a6565b6102f28560206105a6565b1061031057836103038260086105a6565b61030d91906105bf565b91505b506000938452600160209081526040808620948652939052919092205492909150565b6044356000806008830186111561034957600080fd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b6000806040838503121561044657600080fd5b50508035926020909101359150565b60008083601f84011261046757600080fd5b50813567ffffffffffffffff81111561047f57600080fd5b60208301915083602082850101111561049757600080fd5b9250929050565b600080602083850312156104b157600080fd5b823567ffffffffffffffff8111156104c857600080fd5b6104d485828601610455565b90969095509350505050565b6000806000604084860312156104f557600080fd5b83359250602084013567ffffffffffffffff81111561051357600080fd5b61051f86828701610455565b9497909650939450505050565b6000806000806080858703121561054257600080fd5b5050823594602084013594506040840135936060013592509050565b60006020828403121561057057600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156105b9576105b9610577565b92915050565b818103818111156105b9576105b961057756fea164736f6c6343000813000a"
var
PreimageOracleDeployedSourceMap
=
"144:4615:
32:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;357:68;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;413:25:104;;;401:2;386:18;357:68:32;;;;;;;;501:66;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;614:14:104;;607:22;589:41;;577:2;562:18;501:66:32;449:187:104;2154:850:32;;;;;;:::i;:::-;;:::i;838:564::-;;;;;;:::i;:::-;;:::i;:::-;;;;1581:25:104;;;1637:2;1622:18;;1615:34;;;;1554:18;838:564:32;1407:248:104;3295:1462:32;;;;;;:::i;:::-;;:::i;:::-;;1744:262;;;;;;:::i;:::-;1877:19;;;;:14;:19;;;;;;;;:31;;;;;;;;:38;;;;1911:4;1877:38;;;;;;1925:18;;;;;;;;:30;;;;;;;;;:37;;;;1972:20;;;;;;;;;;:27;1744:262;238:50;;;;;;:::i;:::-;;;;;;;;;;;;;;;2154:850;2321:4;2308:18;2567:3;2563:14;;;2458:4;2551:27;2231:12;;2598:11;2308:18;2718:16;2598:11;2700:41;2840:20;2954:19;2947:27;2976:11;2944:44;;2154:850;-1:-1:-1;;;2154:850:32:o;838:564::-;938:12;991:20;;;:14;:20;;;;;;;;:29;;;;;;;;;938:12;;991:29;;983:62;;;;;;;3101:2:104;983:62:32;;;3083:21:104;3140:2;3120:18;;;3113:30;3179:22;3159:18;;;3152:50;3219:18;;983:62:32;;;;;;;;-1:-1:-1;1176:14:32;1193:21;;;1164:2;1193:21;;;;;;;;1244:10;1193:21;1253:1;1244:10;:::i;:::-;1228:12;:7;1238:2;1228:12;:::i;:::-;:26;1224:87;;1293:7;1280:10;:6;1289:1;1280:10;:::i;:::-;:20;;;;:::i;:::-;1270:30;;1224:87;-1:-1:-1;1367:19:32;;;;:13;:19;;;;;;;;:28;;;;;;;;;;;;838:564;;-1:-1:-1;838:564:32:o;3295:1462::-;3591:4;3578:18;3396:12;;3720:1;3710:12;;3694:29;;3691:77;;;3752:1;3749;3742:12;3691:77;4011:3;4007:14;;;3911:4;3995:27;4042:11;4016:4;4161:16;4042:11;4143:41;4374:29;;;4378:11;4374:29;4368:36;4426:20;;;;4573:19;4566:27;4595:11;4563:44;4626:19;;;;4604:1;4626:19;;;;;;;;:32;;;;;;;;:39;;;;4661:4;4626:39;;;;;;4675:18;;;;;;;;:31;;;;;;;;;:38;;;;4723:20;;;;;;;;;;;:27;;;;-1:-1:-1;;;;3295:1462:32:o;14:248:104:-;82:6;90;143:2;131:9;122:7;118:23;114:32;111:52;;;159:1;156;149:12;111:52;-1:-1:-1;;182:23:104;;;252:2;237:18;;;224:32;;-1:-1:-1;14:248:104:o;641:347::-;692:8;702:6;756:3;749:4;741:6;737:17;733:27;723:55;;774:1;771;764:12;723:55;-1:-1:-1;797:20:104;;840:18;829:30;;826:50;;;872:1;869;862:12;826:50;909:4;901:6;897:17;885:29;;961:3;954:4;945:6;937;933:19;929:30;926:39;923:59;;;978:1;975;968:12;923:59;641:347;;;;;:::o;993:409::-;1063:6;1071;1124:2;1112:9;1103:7;1099:23;1095:32;1092:52;;;1140:1;1137;1130:12;1092:52;1180:9;1167:23;1213:18;1205:6;1202:30;1199:50;;;1245:1;1242;1235:12;1199:50;1284:58;1334:7;1325:6;1314:9;1310:22;1284:58;:::i;:::-;1361:8;;1258:84;;-1:-1:-1;993:409:104;-1:-1:-1;;;;993:409:104:o;1660:477::-;1739:6;1747;1755;1808:2;1796:9;1787:7;1783:23;1779:32;1776:52;;;1824:1;1821;1814:12;1776:52;1860:9;1847:23;1837:33;;1921:2;1910:9;1906:18;1893:32;1948:18;1940:6;1937:30;1934:50;;;1980:1;1977;1970:12;1934:50;2019:58;2069:7;2060:6;2049:9;2045:22;2019:58;:::i;:::-;1660:477;;2096:8;;-1:-1:-1;1993:84:104;;-1:-1:-1;;;;1660:477:104:o;2142:385::-;2228:6;2236;2244;2252;2305:3;2293:9;2284:7;2280:23;2276:33;2273:53;;;2322:1;2319;2312:12;2273:53;-1:-1:-1;;2345:23:104;;;2415:2;2400:18;;2387:32;;-1:-1:-1;2466:2:104;2451:18;;2438:32;;2517:2;2502:18;2489:32;;-1:-1:-1;2142:385:104;-1:-1:-1;2142:385:104:o;2532:180::-;2591:6;2644:2;2632:9;2623:7;2619:23;2615:32;2612:52;;;2660:1;2657;2650:12;2612:52;-1:-1:-1;2683:23:104;;2532:180;-1:-1:-1;2532:180:104
:o;3248:184::-;3300:77;3297:1;3290:88;3397:4;3394:1;3387:15;3421:4;3418:1;3411:15;3437:125;3502:9;;;3523:10;;;3520:36;;;3536:18;;:::i;:::-;3437:125;;;;:::o;3567:128::-;3634:9;;;3655:11;;;3652:37;;;3669:18;;:::i"
var
PreimageOracleDeployedSourceMap
=
"144:4615:
9:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;357:68;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;413:25:81;;;401:2;386:18;357:68:9;;;;;;;;501:66;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;614:14:81;;607:22;589:41;;577:2;562:18;501:66:9;449:187:81;2154:850:9;;;;;;:::i;:::-;;:::i;838:564::-;;;;;;:::i;:::-;;:::i;:::-;;;;1581:25:81;;;1637:2;1622:18;;1615:34;;;;1554:18;838:564:9;1407:248:81;3295:1462:9;;;;;;:::i;:::-;;:::i;:::-;;1744:262;;;;;;:::i;:::-;1877:19;;;;:14;:19;;;;;;;;:31;;;;;;;;:38;;;;1911:4;1877:38;;;;;;1925:18;;;;;;;;:30;;;;;;;;;:37;;;;1972:20;;;;;;;;;;:27;1744:262;238:50;;;;;;:::i;:::-;;;;;;;;;;;;;;;2154:850;2321:4;2308:18;2567:3;2563:14;;;2458:4;2551:27;2231:12;;2598:11;2308:18;2718:16;2598:11;2700:41;2840:20;2954:19;2947:27;2976:11;2944:44;;2154:850;-1:-1:-1;;;2154:850:9:o;838:564::-;938:12;991:20;;;:14;:20;;;;;;;;:29;;;;;;;;;938:12;;991:29;;983:62;;;;;;;3101:2:81;983:62:9;;;3083:21:81;3140:2;3120:18;;;3113:30;3179:22;3159:18;;;3152:50;3219:18;;983:62:9;;;;;;;;-1:-1:-1;1176:14:9;1193:21;;;1164:2;1193:21;;;;;;;;1244:10;1193:21;1253:1;1244:10;:::i;:::-;1228:12;:7;1238:2;1228:12;:::i;:::-;:26;1224:87;;1293:7;1280:10;:6;1289:1;1280:10;:::i;:::-;:20;;;;:::i;:::-;1270:30;;1224:87;-1:-1:-1;1367:19:9;;;;:13;:19;;;;;;;;:28;;;;;;;;;;;;838:564;;-1:-1:-1;838:564:9:o;3295:1462::-;3591:4;3578:18;3396:12;;3720:1;3710:12;;3694:29;;3691:77;;;3752:1;3749;3742:12;3691:77;4011:3;4007:14;;;3911:4;3995:27;4042:11;4016:4;4161:16;4042:11;4143:41;4374:29;;;4378:11;4374:29;4368:36;4426:20;;;;4573:19;4566:27;4595:11;4563:44;4626:19;;;;4604:1;4626:19;;;;;;;;:32;;;;;;;;:39;;;;4661:4;4626:39;;;;;;4675:18;;;;;;;;:31;;;;;;;;;:38;;;;4723:20;;;;;;;;;;;:27;;;;-1:-1:-1;;;;3295:1462:9:o;14:248:81:-;82:6;90;143:2;131:9;122:7;118:23;114:32;111:52;;;159:1;156;149:12;111:52;-1:-1:-1;;182:23:81;;;252:2;237:18;;;224:32;;-1:-1:-1;14:248:81:o;641:347::-;692:8;702:6;756:3;749:4;741:6;737:17;733:27;723:55;;774:1;771;764:12;723:55;-1:-1:-1;797:20:81;;840:18;829:30;;826:50;;;872:1;869;862:12;826:50;909:4;901:6;897:17;885:29;;961:3;954:4;945:6;937;933:19;929:30;926:39;923:59;;;978:1;975;968:12;923:59;641:347;;;;;:::o;993:409::-;1063:6;1071;1124:2;1112:9;1103:7;1099:23;1095:32;1092:52;;;1140:1;1137;1130:12;1092:52;1180:9;1167:23;1213:18;1205:6;1202:30;1199:50;;;1245:1;1242;1235:12;1199:50;1284:58;1334:7;1325:6;1314:9;1310:22;1284:58;:::i;:::-;1361:8;;1258:84;;-1:-1:-1;993:409:81;-1:-1:-1;;;;993:409:81:o;1660:477::-;1739:6;1747;1755;1808:2;1796:9;1787:7;1783:23;1779:32;1776:52;;;1824:1;1821;1814:12;1776:52;1860:9;1847:23;1837:33;;1921:2;1910:9;1906:18;1893:32;1948:18;1940:6;1937:30;1934:50;;;1980:1;1977;1970:12;1934:50;2019:58;2069:7;2060:6;2049:9;2045:22;2019:58;:::i;:::-;1660:477;;2096:8;;-1:-1:-1;1993:84:81;;-1:-1:-1;;;;1660:477:81:o;2142:385::-;2228:6;2236;2244;2252;2305:3;2293:9;2284:7;2280:23;2276:33;2273:53;;;2322:1;2319;2312:12;2273:53;-1:-1:-1;;2345:23:81;;;2415:2;2400:18;;2387:32;;-1:-1:-1;2466:2:81;2451:18;;2438:32;;2517:2;2502:18;2489:32;;-1:-1:-1;2142:385:81;-1:-1:-1;2142:385:81:o;2532:180::-;2591:6;2644:2;2632:9;2623:7;2619:23;2615:32;2612:52;;;2660:1;2657;2650:12;2612:52;-1:-1:-1;2683:23:81;;2532:180;-1:-1:-1;2532:180:81
:o;3248:184::-;3300:77;3297:1;3290:88;3397:4;3394:1;3387:15;3421:4;3418:1;3411:15;3437:125;3502:9;;;3523:10;;;3520:36;;;3536:18;;:::i;:::-;3437:125;;;;:::o;3567:128::-;3634:9;;;3655:11;;;3652:37;;;3669:18;;:::i"
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
PreimageOracleStorageLayoutJSON
),
PreimageOracleStorageLayout
);
err
!=
nil
{
...
...
op-bindings/bindings/weth9.go
View file @
6583a622
This diff is collapsed.
Click to expand it.
op-bindings/bindings/weth9_more.go
View file @
6583a622
...
...
@@ -13,7 +13,7 @@ const WETH9StorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"con
var
WETH9StorageLayout
=
new
(
solc
.
StorageLayout
)
var
WETH9DeployedBin
=
"0x6080604052600436106100bc5760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102cb578063d0e30db0146100bc578063dd62ed3e14610311576100bc565b8063313ce5671461024b57806370a082311461027657806395d89b41146102b6576100bc565b806318160ddd116100a557806318160ddd146101aa57806323b872dd146101d15780632e1a7d4d14610221576100bc565b806306fdde03146100c6578063095ea7b314610150575b6100c4610359565b005b3480156100d257600080fd5b506100db6103a8565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101966004803603604081101561017357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610454565b604080519115158252519081900360200190f35b3480156101b657600080fd5b506101bf6104c7565b60408051918252519081900360200190f35b3480156101dd57600080fd5b50610196600480360360608110156101f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104cb565b34801561022d57600080fd5b506100c46004803603602081101561024457600080fd5b503561066b565b34801561025757600080fd5b50610260610700565b6040805160ff9092168252519081900360200190f35b34801561028257600080fd5b506101bf6004803603602081101561029957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610709565b3480156102c257600080fd5b506100db61071b565b3480156102d757600080fd5b50610196600480360360408110156102ee57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610793565b34801561031d57600080fd5b506101bf6004803603604081101561033457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107a7565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b820191906000526020600020905b81548152906001019060200180831161042f57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120548211156104fd57600080fd5b73ffffffffffffffffffffffffffffffffffffffff84163314801590610573575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105ed5773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020548211156105b557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b3360009081526003602052604090205481111561068757600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f193505050501580156106c6573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b60006107a03384846104cb565b9392505050565b60046020908152600092835260408084209091529082529020548156fea265627a7a72315820
e496abb80c5983b030f680d0bd88f66bf44e261bc3be070d612dd72f9f1f5e9a
64736f6c63430005110032"
var
WETH9DeployedBin
=
"0x6080604052600436106100bc5760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102cb578063d0e30db0146100bc578063dd62ed3e14610311576100bc565b8063313ce5671461024b57806370a082311461027657806395d89b41146102b6576100bc565b806318160ddd116100a557806318160ddd146101aa57806323b872dd146101d15780632e1a7d4d14610221576100bc565b806306fdde03146100c6578063095ea7b314610150575b6100c4610359565b005b3480156100d257600080fd5b506100db6103a8565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101966004803603604081101561017357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610454565b604080519115158252519081900360200190f35b3480156101b657600080fd5b506101bf6104c7565b60408051918252519081900360200190f35b3480156101dd57600080fd5b50610196600480360360608110156101f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104cb565b34801561022d57600080fd5b506100c46004803603602081101561024457600080fd5b503561066b565b34801561025757600080fd5b50610260610700565b6040805160ff9092168252519081900360200190f35b34801561028257600080fd5b506101bf6004803603602081101561029957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610709565b3480156102c257600080fd5b506100db61071b565b3480156102d757600080fd5b50610196600480360360408110156102ee57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610793565b34801561031d57600080fd5b506101bf6004803603604081101561033457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107a7565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b820191906000526020600020905b81548152906001019060200180831161042f57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120548211156104fd57600080fd5b73ffffffffffffffffffffffffffffffffffffffff84163314801590610573575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105ed5773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020548211156105b557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b3360009081526003602052604090205481111561068757600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f193505050501580156106c6573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b60006107a03384846104cb565b9392505050565b60046020908152600092835260408084209091529082529020548156fea265627a7a72315820
98ba7b1460020ec95c67f71a6233138a6370997b42664970db1e9524babba5c6
64736f6c63430005110032"
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
WETH9StorageLayoutJSON
),
WETH9StorageLayout
);
err
!=
nil
{
...
...
op-chain-ops/genesis/config.go
View file @
6583a622
...
...
@@ -99,7 +99,7 @@ type DeployConfig struct {
// L2GenesisRegolithTimeOffset is the number of seconds after genesis block that Regolith hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable regolith.
L2GenesisRegolithTimeOffset
*
hexutil
.
Uint64
`json:"l2GenesisRegolithTimeOffset,omitempty"`
//
C
onfigurable extradata. Will default to []byte("BEDROCK") if left unspecified.
//
L2GenesisBlockExtraData is c
onfigurable extradata. Will default to []byte("BEDROCK") if left unspecified.
L2GenesisBlockExtraData
[]
byte
`json:"l2GenesisBlockExtraData"`
// ProxyAdminOwner represents the owner of the ProxyAdmin predeploy on L2.
ProxyAdminOwner
common
.
Address
`json:"proxyAdminOwner"`
...
...
@@ -124,11 +124,11 @@ type DeployConfig struct {
// SequencerFeeVaultMinimumWithdrawalAmount represents the minimum withdrawal amount for the SequencerFeeVault.
SequencerFeeVaultMinimumWithdrawalAmount
*
hexutil
.
Big
`json:"sequencerFeeVaultMinimumWithdrawalAmount"`
// BaseFeeVaultWithdrawalNetwork represents the withdrawal network for the BaseFeeVault.
BaseFeeVaultWithdrawalNetwork
uint8
`json:"baseFeeVaultWithdrawalNetwork"`
BaseFeeVaultWithdrawalNetwork
WithdrawalNetwork
`json:"baseFeeVaultWithdrawalNetwork"`
// L1FeeVaultWithdrawalNetwork represents the withdrawal network for the L1FeeVault.
L1FeeVaultWithdrawalNetwork
uint8
`json:"l1FeeVaultWithdrawalNetwork"`
L1FeeVaultWithdrawalNetwork
WithdrawalNetwork
`json:"l1FeeVaultWithdrawalNetwork"`
// SequencerFeeVaultWithdrawalNetwork represents the withdrawal network for the SequencerFeeVault.
SequencerFeeVaultWithdrawalNetwork
uint8
`json:"sequencerFeeVaultWithdrawalNetwork"`
SequencerFeeVaultWithdrawalNetwork
WithdrawalNetwork
`json:"sequencerFeeVaultWithdrawalNetwork"`
// L1StandardBridgeProxy represents the address of the L1StandardBridgeProxy on L1 and is used
// as part of building the L2 genesis state.
L1StandardBridgeProxy
common
.
Address
`json:"l1StandardBridgeProxy"`
...
...
@@ -253,13 +253,13 @@ func (d *DeployConfig) Check() error {
if
d
.
SequencerFeeVaultRecipient
==
(
common
.
Address
{})
{
return
fmt
.
Errorf
(
"%w: SequencerFeeVaultRecipient cannot be address(0)"
,
ErrInvalidDeployConfig
)
}
if
d
.
BaseFeeVaultWithdrawalNetwork
>=
2
{
if
!
d
.
BaseFeeVaultWithdrawalNetwork
.
Valid
()
{
return
fmt
.
Errorf
(
"%w: BaseFeeVaultWithdrawalNetwork can only be 0 (L1) or 1 (L2)"
,
ErrInvalidDeployConfig
)
}
if
d
.
L1FeeVaultWithdrawalNetwork
>=
2
{
if
!
d
.
L1FeeVaultWithdrawalNetwork
.
Valid
()
{
return
fmt
.
Errorf
(
"%w: L1FeeVaultWithdrawalNetwork can only be 0 (L1) or 1 (L2)"
,
ErrInvalidDeployConfig
)
}
if
d
.
SequencerFeeVaultWithdrawalNetwork
>=
2
{
if
!
d
.
SequencerFeeVaultWithdrawalNetwork
.
Valid
()
{
return
fmt
.
Errorf
(
"%w: SequencerFeeVaultWithdrawalNetwork can only be 0 (L1) or 1 (L2)"
,
ErrInvalidDeployConfig
)
}
if
d
.
GasPriceOracleOverhead
==
0
{
...
...
@@ -536,17 +536,17 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (immutables.
immutable
[
"SequencerFeeVault"
]
=
immutables
.
ImmutableValues
{
"recipient"
:
config
.
SequencerFeeVaultRecipient
,
"minimumWithdrawalAmount"
:
config
.
SequencerFeeVaultMinimumWithdrawalAmount
,
"withdrawalNetwork"
:
config
.
SequencerFeeVaultWithdrawalNetwork
,
"withdrawalNetwork"
:
config
.
SequencerFeeVaultWithdrawalNetwork
.
ToUint8
()
,
}
immutable
[
"L1FeeVault"
]
=
immutables
.
ImmutableValues
{
"recipient"
:
config
.
L1FeeVaultRecipient
,
"minimumWithdrawalAmount"
:
config
.
L1FeeVaultMinimumWithdrawalAmount
,
"withdrawalNetwork"
:
config
.
L1FeeVaultWithdrawalNetwork
,
"withdrawalNetwork"
:
config
.
L1FeeVaultWithdrawalNetwork
.
ToUint8
()
,
}
immutable
[
"BaseFeeVault"
]
=
immutables
.
ImmutableValues
{
"recipient"
:
config
.
BaseFeeVaultRecipient
,
"minimumWithdrawalAmount"
:
config
.
BaseFeeVaultMinimumWithdrawalAmount
,
"withdrawalNetwork"
:
config
.
BaseFeeVaultWithdrawalNetwork
,
"withdrawalNetwork"
:
config
.
BaseFeeVaultWithdrawalNetwork
.
ToUint8
()
,
}
return
immutable
,
nil
...
...
op-chain-ops/genesis/testdata/test-deploy-config-devnet-l1.json
View file @
6583a622
...
...
@@ -27,9 +27,9 @@
"baseFeeVaultMinimumWithdrawalAmount"
:
"0x8ac7230489e80000"
,
"l1FeeVaultMinimumWithdrawalAmount"
:
"0x8ac7230489e80000"
,
"sequencerFeeVaultMinimumWithdrawalAmount"
:
"0x8ac7230489e80000"
,
"baseFeeVaultWithdrawalNetwork"
:
0
,
"l1FeeVaultWithdrawalNetwork"
:
0
,
"sequencerFeeVaultWithdrawalNetwork"
:
0
,
"baseFeeVaultWithdrawalNetwork"
:
"local"
,
"l1FeeVaultWithdrawalNetwork"
:
"local"
,
"sequencerFeeVaultWithdrawalNetwork"
:
"local"
,
"l1ERC721BridgeProxy"
:
"0xff000000000000000000000000000000000000ff"
,
"l1StandardBridgeProxy"
:
"0xff000000000000000000000000000000000000fd"
,
...
...
op-chain-ops/genesis/testdata/test-deploy-config-full.json
View file @
6583a622
...
...
@@ -44,9 +44,9 @@
"baseFeeVaultMinimumWithdrawalAmount"
:
"0x8ac7230489e80000"
,
"l1FeeVaultMinimumWithdrawalAmount"
:
"0x8ac7230489e80000"
,
"sequencerFeeVaultMinimumWithdrawalAmount"
:
"0x8ac7230489e80000"
,
"baseFeeVaultWithdrawalNetwork"
:
0
,
"l1FeeVaultWithdrawalNetwork"
:
0
,
"sequencerFeeVaultWithdrawalNetwork"
:
0
,
"baseFeeVaultWithdrawalNetwork"
:
"remote"
,
"l1FeeVaultWithdrawalNetwork"
:
"local"
,
"sequencerFeeVaultWithdrawalNetwork"
:
"local"
,
"l1StandardBridgeProxy"
:
"0x42000000000000000000000000000000000000f8"
,
"l1CrossDomainMessengerProxy"
:
"0x42000000000000000000000000000000000000f9"
,
"l1ERC721BridgeProxy"
:
"0x4200000000000000000000000000000000000060"
,
...
...
op-chain-ops/genesis/withdrawal_network.go
0 → 100644
View file @
6583a622
package
genesis
import
(
"encoding/json"
"fmt"
"strconv"
)
// WithdrawalNetwork represents the network that withdrawals are sent to.
// Its value when marshalled in json is intended to be a consistent with its
// internal string type but is backwards-compatible with uint8 values.
// That is, WithdrawalNetwork can be unmarshalled from a JSON field into a uint8.
type
WithdrawalNetwork
string
// Valid returns if the withdrawal network is valid.
func
(
w
*
WithdrawalNetwork
)
Valid
()
bool
{
switch
*
w
{
case
"local"
,
"remote"
:
return
true
default
:
return
false
}
}
// ToUint8 converts a WithdrawalNetwork to a uint8.
func
(
w
*
WithdrawalNetwork
)
ToUint8
()
uint8
{
switch
*
w
{
case
"remote"
:
return
0
default
:
return
1
}
}
// FromUint8 converts a uint8 to a WithdrawalNetwork.
func
FromUint8
(
i
uint8
)
WithdrawalNetwork
{
switch
i
{
case
0
:
return
WithdrawalNetwork
(
"remote"
)
case
1
:
return
WithdrawalNetwork
(
"local"
)
default
:
return
WithdrawalNetwork
(
strconv
.
Itoa
(
int
(
i
)))
}
}
// UnmarshalJSON implements the json.Unmarshaler interface, which
// allows us to ingest values of any json type as an int and run our custom conversion
func
(
w
*
WithdrawalNetwork
)
UnmarshalJSON
(
b
[]
byte
)
error
{
var
s
WithdrawalNetwork
if
b
[
0
]
==
'"'
{
if
err
:=
json
.
Unmarshal
(
b
,
(
*
string
)(
&
s
));
err
!=
nil
{
return
err
}
}
else
{
var
i
uint8
if
err
:=
json
.
Unmarshal
(
b
,
&
i
);
err
!=
nil
{
return
err
}
s
=
FromUint8
(
i
)
}
if
!
s
.
Valid
()
{
return
fmt
.
Errorf
(
"invalid withdrawal network: %v"
,
s
)
}
*
w
=
s
return
nil
}
op-chain-ops/genesis/withdrawal_network_test.go
0 → 100644
View file @
6583a622
package
genesis
import
(
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
// TestWithdrawalNetworkValid checks that valid withdrawal networks are detected.
func
TestWithdrawalNetworkValid
(
t
*
testing
.
T
)
{
localWithdrawalNetwork
:=
WithdrawalNetwork
(
"local"
)
require
.
True
(
t
,
localWithdrawalNetwork
.
Valid
())
remoteWithdrawalNetwork
:=
WithdrawalNetwork
(
"remote"
)
require
.
True
(
t
,
remoteWithdrawalNetwork
.
Valid
())
invalidWithdrawalNetwork
:=
WithdrawalNetwork
(
"invalid"
)
require
.
False
(
t
,
invalidWithdrawalNetwork
.
Valid
())
}
// TestWithdrawalNetworkToUint8 checks that withdrawal networks are converted to uint8 correctly.
func
TestWithdrawalNetworkToUint8
(
t
*
testing
.
T
)
{
localWithdrawalNetwork
:=
WithdrawalNetwork
(
"local"
)
require
.
EqualValues
(
t
,
1
,
localWithdrawalNetwork
.
ToUint8
())
remoteWithdrawalNetwork
:=
WithdrawalNetwork
(
"remote"
)
require
.
EqualValues
(
t
,
0
,
remoteWithdrawalNetwork
.
ToUint8
())
invalidWithdrawalNetwork
:=
WithdrawalNetwork
(
"invalid"
)
require
.
EqualValues
(
t
,
1
,
invalidWithdrawalNetwork
.
ToUint8
())
}
// TestWithdrawalNetworkFromUint8 checks that uint8s are converted to withdrawal networks correctly.
func
TestWithdrawalNetworkFromUint8
(
t
*
testing
.
T
)
{
require
.
EqualValues
(
t
,
"local"
,
FromUint8
(
1
))
require
.
EqualValues
(
t
,
"remote"
,
FromUint8
(
0
))
// invalid uint8s are converted to their uint8 string representation
// this will be caught by the Valid() check
require
.
EqualValues
(
t
,
"2"
,
FromUint8
(
2
))
}
// TestWithdrawalNetworkUnmarshalJSON checks that withdrawal networks are unmarshalled correctly.
func
TestWithdrawalNetworkUnmarshalJSON
(
t
*
testing
.
T
)
{
t
.
Run
(
"LocalInt"
,
func
(
t
*
testing
.
T
)
{
var
w
WithdrawalNetwork
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
`1`
),
&
w
))
require
.
EqualValues
(
t
,
"local"
,
w
)
})
t
.
Run
(
"RemoteInt"
,
func
(
t
*
testing
.
T
)
{
var
w
WithdrawalNetwork
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
`0`
),
&
w
))
require
.
EqualValues
(
t
,
"remote"
,
w
)
})
t
.
Run
(
"InvalidInt"
,
func
(
t
*
testing
.
T
)
{
var
w
WithdrawalNetwork
require
.
Error
(
t
,
json
.
Unmarshal
([]
byte
(
`2`
),
&
w
))
})
t
.
Run
(
"LocalString"
,
func
(
t
*
testing
.
T
)
{
var
w
WithdrawalNetwork
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
`"local"`
),
&
w
))
require
.
EqualValues
(
t
,
"local"
,
w
)
})
t
.
Run
(
"RemoteString"
,
func
(
t
*
testing
.
T
)
{
var
w
WithdrawalNetwork
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
`"remote"`
),
&
w
))
require
.
EqualValues
(
t
,
"remote"
,
w
)
})
t
.
Run
(
"InvalidString"
,
func
(
t
*
testing
.
T
)
{
var
w
WithdrawalNetwork
require
.
Error
(
t
,
json
.
Unmarshal
([]
byte
(
`"invalid"`
),
&
w
))
})
}
// TestWithdrawalNetworkInlineJSON tests unmarshalling of withdrawal networks in inline JSON.
func
TestWithdrawalNetworkInlineJSON
(
t
*
testing
.
T
)
{
type
tempNetworks
struct
{
BaseFeeVaultWithdrawalNetwork
WithdrawalNetwork
`json:"baseFeeVaultWithdrawalNetwork"`
L1FeeVaultWithdrawalNetwork
WithdrawalNetwork
`json:"l1FeeVaultWithdrawalNetwork"`
SequencerFeeVaultWithdrawalNetwork
WithdrawalNetwork
`json:"sequencerFeeVaultWithdrawalNetwork"`
}
jsonString
:=
`{
"baseFeeVaultWithdrawalNetwork": "remote",
"l1FeeVaultWithdrawalNetwork": "local",
"sequencerFeeVaultWithdrawalNetwork": "local"
}`
t
.
Run
(
"StringMarshaling"
,
func
(
t
*
testing
.
T
)
{
decoded
:=
new
(
tempNetworks
)
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
jsonString
),
decoded
))
require
.
Equal
(
t
,
WithdrawalNetwork
(
"remote"
),
decoded
.
BaseFeeVaultWithdrawalNetwork
)
require
.
Equal
(
t
,
WithdrawalNetwork
(
"local"
),
decoded
.
L1FeeVaultWithdrawalNetwork
)
require
.
Equal
(
t
,
WithdrawalNetwork
(
"local"
),
decoded
.
SequencerFeeVaultWithdrawalNetwork
)
encoded
,
err
:=
json
.
Marshal
(
decoded
)
require
.
NoError
(
t
,
err
)
require
.
JSONEq
(
t
,
jsonString
,
string
(
encoded
))
})
t
.
Run
(
"IntMarshaling"
,
func
(
t
*
testing
.
T
)
{
intJsonString
:=
`{
"baseFeeVaultWithdrawalNetwork": 0,
"l1FeeVaultWithdrawalNetwork": 1,
"sequencerFeeVaultWithdrawalNetwork": 1
}`
decoded
:=
new
(
tempNetworks
)
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
intJsonString
),
decoded
))
require
.
Equal
(
t
,
WithdrawalNetwork
(
"remote"
),
decoded
.
BaseFeeVaultWithdrawalNetwork
)
require
.
Equal
(
t
,
WithdrawalNetwork
(
"local"
),
decoded
.
L1FeeVaultWithdrawalNetwork
)
require
.
Equal
(
t
,
WithdrawalNetwork
(
"local"
),
decoded
.
SequencerFeeVaultWithdrawalNetwork
)
encoded
,
err
:=
json
.
Marshal
(
decoded
)
require
.
NoError
(
t
,
err
)
require
.
JSONEq
(
t
,
jsonString
,
string
(
encoded
))
})
}
op-challenger/fault/alphabet/provider.go
View file @
6583a622
...
...
@@ -5,6 +5,7 @@ import (
"math/big"
"strings"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
...
...
@@ -28,6 +29,11 @@ func NewAlphabetProvider(state string, depth uint64) *AlphabetProvider {
}
}
// GetOracleData should not return any preimage oracle data for the alphabet provider.
func
(
p
*
AlphabetProvider
)
GetOracleData
(
i
uint64
)
(
*
types
.
PreimageOracleData
,
error
)
{
return
&
types
.
PreimageOracleData
{},
nil
}
// GetPreimage returns the preimage for the given hash.
func
(
ap
*
AlphabetProvider
)
GetPreimage
(
i
uint64
)
([]
byte
,
[]
byte
,
error
)
{
// The index cannot be larger than the maximum index as computed by the depth.
...
...
op-challenger/fault/cannon/executor.go
View file @
6583a622
package
cannon
import
(
"errors"
"fmt"
"os"
"path/filepath"
"regexp"
"strconv"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum/go-ethereum/log"
)
type
executor
struct
{
logger
log
.
Logger
const
snapsDir
=
"snapshots"
var
snapshotNameRegexp
=
regexp
.
MustCompile
(
`^[0-9]+\.json$`
)
const
snapshotFrequency
=
10
_000
type
snapshotSelect
func
(
logger
log
.
Logger
,
dir
string
,
absolutePreState
string
,
i
uint64
)
(
string
,
error
)
type
Executor
struct
{
logger
log
.
Logger
l1
string
l2
string
cannon
string
absolutePreState
string
dataDir
string
selectSnapshot
snapshotSelect
}
func
newExecutor
(
logger
log
.
Logger
)
Executor
{
return
&
executor
{
logger
:
logger
,
func
NewExecutor
(
logger
log
.
Logger
,
cfg
*
config
.
Config
)
*
Executor
{
return
&
Executor
{
logger
:
logger
,
l1
:
cfg
.
L1EthRpc
,
l2
:
cfg
.
CannonL2
,
cannon
:
cfg
.
CannonBin
,
absolutePreState
:
cfg
.
CannonAbsolutePreState
,
dataDir
:
cfg
.
CannonDatadir
,
selectSnapshot
:
findStartingSnapshot
,
}
}
func
(
e
*
executor
)
GenerateProof
(
dir
string
,
i
uint64
)
error
{
return
fmt
.
Errorf
(
"please execute cannon with --proof-at %v --proof-fmt %v/%v/%%d.json"
,
i
,
dir
,
proofsDir
)
func
(
e
*
Executor
)
GenerateProof
(
dir
string
,
i
uint64
)
error
{
start
,
err
:=
e
.
selectSnapshot
(
e
.
logger
,
filepath
.
Join
(
e
.
dataDir
,
snapsDir
),
e
.
absolutePreState
,
i
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"find starting snapshot: %w"
,
err
)
}
return
fmt
.
Errorf
(
"please execute cannon with --input %v --proof-at %v --proof-fmt %v/%v/%%d.json --snapshot-at %%%d --snapshot-fmt '%v/%v/%%d.json"
,
start
,
i
,
dir
,
proofsDir
,
snapshotFrequency
,
dir
,
snapsDir
)
}
// findStartingSnapshot finds the closest snapshot before the specified traceIndex in snapDir.
// If no suitable snapshot can be found it returns absolutePreState.
func
findStartingSnapshot
(
logger
log
.
Logger
,
snapDir
string
,
absolutePreState
string
,
traceIndex
uint64
)
(
string
,
error
)
{
// Find the closest snapshot to start from
entries
,
err
:=
os
.
ReadDir
(
snapDir
)
if
err
!=
nil
{
if
errors
.
Is
(
err
,
os
.
ErrNotExist
)
{
return
absolutePreState
,
nil
}
return
""
,
fmt
.
Errorf
(
"list snapshots in %v: %w"
,
snapDir
,
err
)
}
bestSnap
:=
uint64
(
0
)
for
_
,
entry
:=
range
entries
{
if
entry
.
IsDir
()
{
logger
.
Warn
(
"Unexpected directory in snapshots dir: %v/%v"
,
snapDir
,
entry
.
Name
())
continue
}
name
:=
entry
.
Name
()
if
!
snapshotNameRegexp
.
MatchString
(
name
)
{
logger
.
Warn
(
"Unexpected file in snapshots dir: %v/%v"
,
snapDir
,
entry
.
Name
())
continue
}
index
,
err
:=
strconv
.
ParseUint
(
name
[
0
:
len
(
name
)
-
len
(
".json"
)],
10
,
64
)
if
err
!=
nil
{
logger
.
Error
(
"Unable to parse trace index of snapshot file: %v/%v"
,
snapDir
,
entry
.
Name
())
continue
}
if
index
>
bestSnap
&&
index
<
traceIndex
{
bestSnap
=
index
}
}
if
bestSnap
==
0
{
return
absolutePreState
,
nil
}
startFrom
:=
fmt
.
Sprintf
(
"%v/%v.json"
,
snapDir
,
bestSnap
)
return
startFrom
,
nil
}
op-challenger/fault/cannon/executor_test.go
0 → 100644
View file @
6583a622
package
cannon
import
(
"fmt"
"os"
"path/filepath"
"testing"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
const
execTestCannonPrestate
=
"/foo/pre.json"
func
TestFindStartingSnapshot
(
t
*
testing
.
T
)
{
logger
:=
testlog
.
Logger
(
t
,
log
.
LvlInfo
)
withSnapshots
:=
func
(
t
*
testing
.
T
,
files
...
string
)
string
{
dir
:=
t
.
TempDir
()
for
_
,
file
:=
range
files
{
require
.
NoError
(
t
,
os
.
WriteFile
(
fmt
.
Sprintf
(
"%v/%v"
,
dir
,
file
),
nil
,
0
o644
))
}
return
dir
}
t
.
Run
(
"UsePrestateWhenSnapshotsDirDoesNotExist"
,
func
(
t
*
testing
.
T
)
{
dir
:=
t
.
TempDir
()
snapshot
,
err
:=
findStartingSnapshot
(
logger
,
filepath
.
Join
(
dir
,
"doesNotExist"
),
execTestCannonPrestate
,
1200
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
execTestCannonPrestate
,
snapshot
)
})
t
.
Run
(
"UsePrestateWhenSnapshotsDirEmpty"
,
func
(
t
*
testing
.
T
)
{
dir
:=
withSnapshots
(
t
)
snapshot
,
err
:=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
1200
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
execTestCannonPrestate
,
snapshot
)
})
t
.
Run
(
"UsePrestateWhenNoSnapshotBeforeTraceIndex"
,
func
(
t
*
testing
.
T
)
{
dir
:=
withSnapshots
(
t
,
"100.json"
,
"200.json"
)
snapshot
,
err
:=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
99
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
execTestCannonPrestate
,
snapshot
)
snapshot
,
err
=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
100
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
execTestCannonPrestate
,
snapshot
)
})
t
.
Run
(
"UseClosestAvailableSnapshot"
,
func
(
t
*
testing
.
T
)
{
dir
:=
withSnapshots
(
t
,
"100.json"
,
"123.json"
,
"250.json"
)
snapshot
,
err
:=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
101
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"100.json"
),
snapshot
)
snapshot
,
err
=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
123
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"100.json"
),
snapshot
)
snapshot
,
err
=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
124
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"123.json"
),
snapshot
)
snapshot
,
err
=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
256
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"250.json"
),
snapshot
)
})
t
.
Run
(
"IgnoreDirectories"
,
func
(
t
*
testing
.
T
)
{
dir
:=
withSnapshots
(
t
,
"100.json"
)
require
.
NoError
(
t
,
os
.
Mkdir
(
filepath
.
Join
(
dir
,
"120.json"
),
0
o777
))
snapshot
,
err
:=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
150
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"100.json"
),
snapshot
)
})
t
.
Run
(
"IgnoreUnexpectedFiles"
,
func
(
t
*
testing
.
T
)
{
dir
:=
withSnapshots
(
t
,
".file"
,
"100.json"
,
"foo"
,
"bar.json"
)
snapshot
,
err
:=
findStartingSnapshot
(
logger
,
dir
,
execTestCannonPrestate
,
150
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
filepath
.
Join
(
dir
,
"100.json"
),
snapshot
)
})
}
op-challenger/fault/cannon/
cannon_
provider.go
→
op-challenger/fault/cannon/provider.go
View file @
6583a622
...
...
@@ -7,6 +7,8 @@ import (
"os"
"path/filepath"
"github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -17,28 +19,39 @@ const (
)
type
proofData
struct
{
ClaimValue
hexutil
.
Bytes
`json:"post"`
StateData
hexutil
.
Bytes
`json:"state-data"`
ProofData
hexutil
.
Bytes
`json:"proof-data"`
ClaimValue
hexutil
.
Bytes
`json:"post"`
StateData
hexutil
.
Bytes
`json:"state-data"`
ProofData
hexutil
.
Bytes
`json:"proof-data"`
OracleKey
hexutil
.
Bytes
`json:"oracle-key,omitempty"`
OracleValue
hexutil
.
Bytes
`json:"oracle-value,omitempty"`
}
type
Execu
tor
interface
{
type
ProofGenera
tor
interface
{
// GenerateProof executes cannon to generate a proof at the specified trace index in dataDir.
GenerateProof
(
dataDir
string
,
proofAt
uint64
)
error
}
type
CannonTraceProvider
struct
{
dir
string
executor
Execu
tor
dir
string
generator
ProofGenera
tor
}
func
NewCannonTraceProvider
(
logger
log
.
Logger
,
dataDir
strin
g
)
*
CannonTraceProvider
{
func
NewCannonTraceProvider
(
logger
log
.
Logger
,
cfg
*
config
.
Confi
g
)
*
CannonTraceProvider
{
return
&
CannonTraceProvider
{
dir
:
dataD
ir
,
executor
:
newExecutor
(
logger
),
dir
:
cfg
.
CannonDatad
ir
,
generator
:
NewExecutor
(
logger
,
cfg
),
}
}
func
(
p
*
CannonTraceProvider
)
GetOracleData
(
i
uint64
)
(
*
types
.
PreimageOracleData
,
error
)
{
proof
,
err
:=
p
.
loadProof
(
i
)
if
err
!=
nil
{
return
nil
,
err
}
data
:=
types
.
NewPreimageOracleData
(
proof
.
OracleKey
,
proof
.
OracleValue
)
return
&
data
,
nil
}
func
(
p
*
CannonTraceProvider
)
Get
(
i
uint64
)
(
common
.
Hash
,
error
)
{
proof
,
err
:=
p
.
loadProof
(
i
)
if
err
!=
nil
{
...
...
@@ -76,7 +89,7 @@ func (p *CannonTraceProvider) loadProof(i uint64) (*proofData, error) {
path
:=
filepath
.
Join
(
p
.
dir
,
proofsDir
,
fmt
.
Sprintf
(
"%d.json"
,
i
))
file
,
err
:=
os
.
Open
(
path
)
if
errors
.
Is
(
err
,
os
.
ErrNotExist
)
{
if
err
:=
p
.
execu
tor
.
GenerateProof
(
p
.
dir
,
i
);
err
!=
nil
{
if
err
:=
p
.
genera
tor
.
GenerateProof
(
p
.
dir
,
i
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"generate cannon trace with proof at %v: %w"
,
i
,
err
)
}
// Try opening the file again now and it should exist.
...
...
op-challenger/fault/cannon/
cannon_
provider_test.go
→
op-challenger/fault/cannon/provider_test.go
View file @
6583a622
...
...
@@ -17,73 +17,107 @@ var testData embed.FS
func
TestGet
(
t
*
testing
.
T
)
{
dataDir
:=
setupTestData
(
t
)
t
.
Run
(
"ExistingProof"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
value
,
err
:=
provider
.
Get
(
0
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
common
.
HexToHash
(
"0x45fd9aa59768331c726e719e76aa343e73123af888804604785ae19506e65e87"
),
value
)
require
.
Empty
(
t
,
execu
tor
.
generated
)
require
.
Empty
(
t
,
genera
tor
.
generated
)
})
t
.
Run
(
"ProofUnavailable"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
_
,
err
:=
provider
.
Get
(
7
)
require
.
ErrorIs
(
t
,
err
,
os
.
ErrNotExist
)
require
.
Contains
(
t
,
execu
tor
.
generated
,
7
,
"should have tried to generate the proof"
)
require
.
Contains
(
t
,
genera
tor
.
generated
,
7
,
"should have tried to generate the proof"
)
})
t
.
Run
(
"MissingPostHash"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
_
,
err
:=
provider
.
Get
(
1
)
require
.
ErrorContains
(
t
,
err
,
"missing post hash"
)
require
.
Empty
(
t
,
execu
tor
.
generated
)
require
.
Empty
(
t
,
genera
tor
.
generated
)
})
t
.
Run
(
"IgnoreUnknownFields"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
value
,
err
:=
provider
.
Get
(
2
)
require
.
NoError
(
t
,
err
)
expected
:=
common
.
HexToHash
(
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
)
require
.
Equal
(
t
,
expected
,
value
)
require
.
Empty
(
t
,
executor
.
generated
)
require
.
Empty
(
t
,
generator
.
generated
)
})
}
func
TestGetOracleData
(
t
*
testing
.
T
)
{
dataDir
:=
setupTestData
(
t
)
t
.
Run
(
"ExistingProof"
,
func
(
t
*
testing
.
T
)
{
provider
,
generator
:=
setupWithTestData
(
dataDir
)
oracleData
,
err
:=
provider
.
GetOracleData
(
420
)
require
.
NoError
(
t
,
err
)
require
.
False
(
t
,
oracleData
.
IsLocal
)
expectedKey
:=
common
.
Hex2Bytes
(
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
)
require
.
Equal
(
t
,
expectedKey
,
oracleData
.
OracleKey
)
expectedData
:=
common
.
Hex2Bytes
(
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
)
require
.
Equal
(
t
,
expectedData
,
oracleData
.
OracleData
)
require
.
Empty
(
t
,
generator
.
generated
)
})
t
.
Run
(
"ProofUnavailable"
,
func
(
t
*
testing
.
T
)
{
provider
,
generator
:=
setupWithTestData
(
dataDir
)
_
,
err
:=
provider
.
GetOracleData
(
7
)
require
.
ErrorIs
(
t
,
err
,
os
.
ErrNotExist
)
require
.
Contains
(
t
,
generator
.
generated
,
7
,
"should have tried to generate the proof"
)
})
t
.
Run
(
"IgnoreUnknownFields"
,
func
(
t
*
testing
.
T
)
{
provider
,
generator
:=
setupWithTestData
(
dataDir
)
oracleData
,
err
:=
provider
.
GetOracleData
(
421
)
require
.
NoError
(
t
,
err
)
require
.
False
(
t
,
oracleData
.
IsLocal
)
expectedKey
:=
common
.
Hex2Bytes
(
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
)
require
.
Equal
(
t
,
expectedKey
,
oracleData
.
OracleKey
)
expectedData
:=
common
.
Hex2Bytes
(
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
)
require
.
Equal
(
t
,
expectedData
,
oracleData
.
OracleData
)
require
.
Empty
(
t
,
generator
.
generated
)
})
}
func
TestGetPreimage
(
t
*
testing
.
T
)
{
dataDir
:=
setupTestData
(
t
)
t
.
Run
(
"ExistingProof"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
value
,
proof
,
err
:=
provider
.
GetPreimage
(
0
)
require
.
NoError
(
t
,
err
)
expected
:=
common
.
Hex2Bytes
(
"b8f068de604c85ea0e2acd437cdb47add074a2d70b81d018390c504b71fe26f400000000000000000000000000000000000000000000000000000000000000000000000000"
)
require
.
Equal
(
t
,
expected
,
value
)
expectedProof
:=
common
.
Hex2Bytes
(
"08028e3c0000000000000000000000003c01000a24210b7c00200008000000008fa40004"
)
require
.
Equal
(
t
,
expectedProof
,
proof
)
require
.
Empty
(
t
,
execu
tor
.
generated
)
require
.
Empty
(
t
,
genera
tor
.
generated
)
})
t
.
Run
(
"ProofUnavailable"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
_
,
_
,
err
:=
provider
.
GetPreimage
(
7
)
require
.
ErrorIs
(
t
,
err
,
os
.
ErrNotExist
)
require
.
Contains
(
t
,
execu
tor
.
generated
,
7
,
"should have tried to generate the proof"
)
require
.
Contains
(
t
,
genera
tor
.
generated
,
7
,
"should have tried to generate the proof"
)
})
t
.
Run
(
"MissingStateData"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
_
,
_
,
err
:=
provider
.
GetPreimage
(
1
)
require
.
ErrorContains
(
t
,
err
,
"missing state data"
)
require
.
Empty
(
t
,
execu
tor
.
generated
)
require
.
Empty
(
t
,
genera
tor
.
generated
)
})
t
.
Run
(
"IgnoreUnknownFields"
,
func
(
t
*
testing
.
T
)
{
provider
,
execu
tor
:=
setupWithTestData
(
dataDir
)
provider
,
genera
tor
:=
setupWithTestData
(
dataDir
)
value
,
proof
,
err
:=
provider
.
GetPreimage
(
2
)
require
.
NoError
(
t
,
err
)
expected
:=
common
.
Hex2Bytes
(
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
)
require
.
Equal
(
t
,
expected
,
value
)
expectedProof
:=
common
.
Hex2Bytes
(
"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
)
require
.
Equal
(
t
,
expectedProof
,
proof
)
require
.
Empty
(
t
,
execu
tor
.
generated
)
require
.
Empty
(
t
,
genera
tor
.
generated
)
})
}
...
...
@@ -103,19 +137,19 @@ func setupTestData(t *testing.T) string {
return
dataDir
}
func
setupWithTestData
(
dataDir
string
)
(
*
CannonTraceProvider
,
*
stub
Execu
tor
)
{
executor
:=
&
stubExecu
tor
{}
func
setupWithTestData
(
dataDir
string
)
(
*
CannonTraceProvider
,
*
stub
Genera
tor
)
{
generator
:=
&
stubGenera
tor
{}
return
&
CannonTraceProvider
{
dir
:
dataDir
,
executor
:
execu
tor
,
},
execu
tor
dir
:
dataDir
,
generator
:
genera
tor
,
},
genera
tor
}
type
stub
Execu
tor
struct
{
type
stub
Genera
tor
struct
{
generated
[]
int
// Using int makes assertions easier
}
func
(
e
*
stub
Execu
tor
)
GenerateProof
(
dir
string
,
i
uint64
)
error
{
func
(
e
*
stub
Genera
tor
)
GenerateProof
(
dir
string
,
i
uint64
)
error
{
e
.
generated
=
append
(
e
.
generated
,
int
(
i
))
return
nil
}
op-challenger/fault/cannon/test_data/proofs/420.json
0 → 100644
View file @
6583a622
{
"step"
:
0
,
"pre"
:
"0x71f9eb93ff904e5c03c3425228ef75766db0c906ad239df9a7a7f0d9c6a89705"
,
"post"
:
"0x45fd9aa59768331c726e719e76aa343e73123af888804604785ae19506e65e87"
,
"state-data"
:
"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
,
"proof-data"
:
"0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
,
"step-input"
:
"0xf8e0cb960000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014200000000000000000000000000000000000000000000000000000000000000e2b8f068de604c85ea0e2acd437cdb47add074a2d70b81d018390c504b71fe26f4000000000000000000000000000000000000000000000000000000000000000000000000000a3900000a39040000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fffd0000000000000000000000000000000000000000000000000000000000000000000000000000000070008028e3c0000000000000000000000003c01000a24210b7c00200008000000008fa40004240210960000000c0000003403e00008000000008fa100040000102571c0e460346a89963488f904199fc7b4dc3dce2ddadfe484510463ae5014a79df9d922ef2cb84325e4e13ad98828ed29937c1440d8ea9eb19cab7474243c2d0b1a83646e420529153298f3a914a2550658c930f5e519b1d8dd151cf828116697d27264e6fad331820ecf3855adcc68dc529acfc33ecfa45a3a33c9ac766edc1f437988f2abab9dce36d3bac27b0f7b58a06d125acd50a1bf14bb8c7f6c1618465a532f945043b5a9ebc800d7336673019654eb76f8c10cff4f794ee586dc9992c318cef3dfa57032e2dd2fc5cb2dcfebd05551301704dd37a7c169448ec02574f706e38c20963616dae4e03cc91f39a4c3f9608119212965b72948f0ee15feb48b758f050691197816dc3ca919bbb3b50624d195c82d644025647ac8ba07206e5eb830799dfa896506743e81856edf8a31fef737fb4f44501dc71f019bdb12ed9cf0b9fba40ef98e5091b70484ba4f6af7711ec8b0ba4f4f2c4b11455a9e071f465817724159ddeea1170f4dd912c3a5a10ec6b046aa3c4a9febddfeeaa47e3ef06e1758694515562c958dc1b018149c7e4fcd91b9033ee216fea2ea498acd065e61fd436f26c31654bfd27c13ab67707384ad7a84a4b085e890e998e8a9655da954db3d279d598343a4706a2272fca526caeddb017627ecaf0138f1446c82e16d0926c0c510773e2b439c2c71414deb9b739fa370c010380d9ed5927fd7f4bb84ac22747f1bd405830b65d9e04c5efddc2c4dc89ba294c7568b9952193172d75ed8ea3e0fe57c8ad6636da54921ab52a8a0f54920d124f43b9fd3577690140cb46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0c65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2f4418588ed35a2458cffeb39b93d26f18d2ab13bdce6aee58e7b99359ec2dfd95a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e3774df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652cdc72595f74c7b1043d0e1ffbab734648c838dfb0527d971b602bc216c9619ef6834d8ef8faaf96b7b45235297538a266eb882b8b5680f621aab3417d43cdc2eb8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
,
"oracle-input"
:
"0x"
,
"oracle-key"
:
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
,
"oracle-value"
:
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
op-challenger/fault/cannon/test_data/proofs/421.json
0 → 100644
View file @
6583a622
{
"foo"
:
0
,
"bar"
:
"0x71f9eb93ff904e5c03c3425228ef75766db0c906ad239df9a7a7f0d9c6a89705"
,
"post"
:
"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
,
"state-data"
:
"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
,
"proof-data"
:
"0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
,
"step-input"
:
"0xf8e0cb960000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014200000000000000000000000000000000000000000000000000000000000000e2b8f068de604c85ea0e2acd437cdb47add074a2d70b81d018390c504b71fe26f4000000000000000000000000000000000000000000000000000000000000000000000000000a3900000a39040000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fffd0000000000000000000000000000000000000000000000000000000000000000000000000000000070008028e3c0000000000000000000000003c01000a24210b7c00200008000000008fa40004240210960000000c0000003403e00008000000008fa100040000102571c0e460346a89963488f904199fc7b4dc3dce2ddadfe484510463ae5014a79df9d922ef2cb84325e4e13ad98828ed29937c1440d8ea9eb19cab7474243c2d0b1a83646e420529153298f3a914a2550658c930f5e519b1d8dd151cf828116697d27264e6fad331820ecf3855adcc68dc529acfc33ecfa45a3a33c9ac766edc1f437988f2abab9dce36d3bac27b0f7b58a06d125acd50a1bf14bb8c7f6c1618465a532f945043b5a9ebc800d7336673019654eb76f8c10cff4f794ee586dc9992c318cef3dfa57032e2dd2fc5cb2dcfebd05551301704dd37a7c169448ec02574f706e38c20963616dae4e03cc91f39a4c3f9608119212965b72948f0ee15feb48b758f050691197816dc3ca919bbb3b50624d195c82d644025647ac8ba07206e5eb830799dfa896506743e81856edf8a31fef737fb4f44501dc71f019bdb12ed9cf0b9fba40ef98e5091b70484ba4f6af7711ec8b0ba4f4f2c4b11455a9e071f465817724159ddeea1170f4dd912c3a5a10ec6b046aa3c4a9febddfeeaa47e3ef06e1758694515562c958dc1b018149c7e4fcd91b9033ee216fea2ea498acd065e61fd436f26c31654bfd27c13ab67707384ad7a84a4b085e890e998e8a9655da954db3d279d598343a4706a2272fca526caeddb017627ecaf0138f1446c82e16d0926c0c510773e2b439c2c71414deb9b739fa370c010380d9ed5927fd7f4bb84ac22747f1bd405830b65d9e04c5efddc2c4dc89ba294c7568b9952193172d75ed8ea3e0fe57c8ad6636da54921ab52a8a0f54920d124f43b9fd3577690140cb46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0c65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2f4418588ed35a2458cffeb39b93d26f18d2ab13bdce6aee58e7b99359ec2dfd95a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e3774df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652cdc72595f74c7b1043d0e1ffbab734648c838dfb0527d971b602bc216c9619ef6834d8ef8faaf96b7b45235297538a266eb882b8b5680f621aab3417d43cdc2eb8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
,
"oracle-input"
:
"0x"
,
"oracle-key"
:
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
,
"oracle-value"
:
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
op-challenger/fault/service.go
View file @
6583a622
...
...
@@ -56,7 +56,7 @@ func NewService(ctx context.Context, logger log.Logger, cfg *config.Config) (*se
var
trace
types
.
TraceProvider
switch
cfg
.
TraceType
{
case
config
.
TraceTypeCannon
:
trace
=
cannon
.
NewCannonTraceProvider
(
logger
,
cfg
.
CannonDatadir
)
trace
=
cannon
.
NewCannonTraceProvider
(
logger
,
cfg
)
case
config
.
TraceTypeAlphabet
:
trace
=
alphabet
.
NewAlphabetProvider
(
cfg
.
AlphabetTrace
,
uint64
(
cfg
.
GameDepth
))
default
:
...
...
op-challenger/fault/solver/solver.go
View file @
6583a622
...
...
@@ -47,10 +47,11 @@ func (s *Solver) NextMove(claim types.Claim, agreeWithClaimLevel bool) (*types.C
}
type
StepData
struct
{
LeafClaim
types
.
Claim
IsAttack
bool
PreState
[]
byte
ProofData
[]
byte
LeafClaim
types
.
Claim
IsAttack
bool
PreState
[]
byte
ProofData
[]
byte
OracleData
types
.
PreimageOracleData
}
// AttemptStep determines what step should occur for a given leaf claim.
...
...
@@ -83,11 +84,17 @@ func (s *Solver) AttemptStep(claim types.Claim, agreeWithClaimLevel bool) (StepD
}
}
oracleData
,
err
:=
s
.
trace
.
GetOracleData
(
index
)
if
err
!=
nil
{
return
StepData
{},
err
}
return
StepData
{
LeafClaim
:
claim
,
IsAttack
:
!
claimCorrect
,
PreState
:
preState
,
ProofData
:
proofData
,
LeafClaim
:
claim
,
IsAttack
:
!
claimCorrect
,
PreState
:
preState
,
ProofData
:
proofData
,
OracleData
:
*
oracleData
,
},
nil
}
...
...
op-challenger/fault/solver/solver_test.go
View file @
6583a622
package
solver_test
import
(
"
fmt
"
"
errors
"
"testing"
"github.com/ethereum-optimism/optimism/op-challenger/fault/solver"
...
...
@@ -103,62 +103,78 @@ func TestNextMove(t *testing.T) {
func
TestAttemptStep
(
t
*
testing
.
T
)
{
maxDepth
:=
3
builder
:=
test
.
NewAlphabetClaimBuilder
(
t
,
maxDepth
)
alphabetSolver
:=
solver
.
NewSolver
(
maxDepth
,
builder
.
CorrectTraceProvider
())
// Last accessible leaf is the second last trace index
// The root node is used for the last trace index and can only be attacked.
lastLeafTraceIndex
:=
uint64
(
1
<<
maxDepth
-
2
)
errProvider
:=
errors
.
New
(
"provider error"
)
tests
:=
[]
struct
{
name
string
claim
types
.
Claim
agreeWithLevel
bool
expectedErr
error
expectAttack
bool
expectPreState
[]
byte
expectProofData
[]
byte
name
string
claim
types
.
Claim
agreeWithLevel
bool
expectedErr
error
expectAttack
bool
expectPreState
[]
byte
expectProofData
[]
byte
expectedLocal
bool
expectedOracleKey
[]
byte
expectedOracleData
[]
byte
}{
{
name
:
"AttackFirstTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
0
,
false
),
expectAttack
:
true
,
expectPreState
:
builder
.
CorrectTraceProvider
()
.
AbsolutePreState
(),
expectProofData
:
nil
,
name
:
"AttackFirstTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
0
,
false
),
expectAttack
:
true
,
expectPreState
:
builder
.
CorrectTraceProvider
()
.
AbsolutePreState
(),
expectProofData
:
nil
,
expectedOracleKey
:
[]
byte
{
byte
(
0
)},
expectedOracleData
:
[]
byte
{
byte
(
0
)},
},
{
name
:
"DefendFirstTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
0
,
true
),
expectAttack
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
0
),
expectProofData
:
builder
.
CorrectProofData
(
0
),
name
:
"DefendFirstTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
0
,
true
),
expectAttack
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
0
),
expectProofData
:
builder
.
CorrectProofData
(
0
),
expectedOracleKey
:
[]
byte
{
byte
(
0
)},
expectedOracleData
:
[]
byte
{
byte
(
0
)},
},
{
name
:
"AttackMiddleTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
4
,
false
),
expectAttack
:
true
,
expectPreState
:
builder
.
CorrectPreState
(
3
),
expectProofData
:
builder
.
CorrectProofData
(
3
),
name
:
"AttackMiddleTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
4
,
false
),
expectAttack
:
true
,
expectPreState
:
builder
.
CorrectPreState
(
3
),
expectProofData
:
builder
.
CorrectProofData
(
3
),
expectedOracleKey
:
[]
byte
{
byte
(
3
)},
expectedOracleData
:
[]
byte
{
byte
(
3
)},
},
{
name
:
"DefendMiddleTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
4
,
true
),
expectAttack
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
4
),
expectProofData
:
builder
.
CorrectProofData
(
4
),
name
:
"DefendMiddleTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
4
,
true
),
expectAttack
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
4
),
expectProofData
:
builder
.
CorrectProofData
(
4
),
expectedOracleKey
:
[]
byte
{
byte
(
4
)},
expectedOracleData
:
[]
byte
{
byte
(
4
)},
},
{
name
:
"AttackLastTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
lastLeafTraceIndex
,
false
),
expectAttack
:
true
,
expectPreState
:
builder
.
CorrectPreState
(
lastLeafTraceIndex
-
1
),
expectProofData
:
builder
.
CorrectProofData
(
lastLeafTraceIndex
-
1
),
name
:
"AttackLastTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
lastLeafTraceIndex
,
false
),
expectAttack
:
true
,
expectPreState
:
builder
.
CorrectPreState
(
lastLeafTraceIndex
-
1
),
expectProofData
:
builder
.
CorrectProofData
(
lastLeafTraceIndex
-
1
),
expectedOracleKey
:
[]
byte
{
byte
(
5
)},
expectedOracleData
:
[]
byte
{
byte
(
5
)},
},
{
name
:
"DefendLastTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
lastLeafTraceIndex
,
true
),
expectAttack
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
lastLeafTraceIndex
),
expectProofData
:
builder
.
CorrectProofData
(
lastLeafTraceIndex
),
name
:
"DefendLastTraceIndex"
,
claim
:
builder
.
CreateLeafClaim
(
lastLeafTraceIndex
,
true
),
expectAttack
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
lastLeafTraceIndex
),
expectProofData
:
builder
.
CorrectProofData
(
lastLeafTraceIndex
),
expectedOracleKey
:
[]
byte
{
byte
(
6
)},
expectedOracleData
:
[]
byte
{
byte
(
6
)},
},
{
name
:
"CannotStepNonLeaf"
,
...
...
@@ -171,21 +187,53 @@ func TestAttemptStep(t *testing.T) {
agreeWithLevel
:
true
,
expectedErr
:
solver
.
ErrStepNonLeafNode
,
},
{
name
:
"CannotStepAgreedNode"
,
claim
:
builder
.
Seq
(
false
)
.
Attack
(
false
)
.
Get
(),
agreeWithLevel
:
true
,
expectedErr
:
solver
.
ErrStepNonLeafNode
,
},
{
name
:
"AttackLocalOracleData"
,
claim
:
builder
.
Seq
(
false
)
.
Attack
(
false
)
.
Attack
(
true
)
.
Defend
(
false
)
.
Get
(),
expectAttack
:
true
,
agreeWithLevel
:
false
,
expectPreState
:
builder
.
CorrectPreState
(
1
),
expectProofData
:
builder
.
CorrectProofData
(
1
),
expectedLocal
:
true
,
expectedOracleKey
:
[]
byte
{
0x01
},
expectedOracleData
:
[]
byte
{
0x01
},
expectedErr
:
nil
,
},
{
name
:
"AttackStepOracleError"
,
claim
:
builder
.
Seq
(
false
)
.
Attack
(
false
)
.
Attack
(
false
)
.
Attack
(
false
)
.
Get
(),
agreeWithLevel
:
false
,
expectedErr
:
errProvider
,
},
}
for
_
,
test
:=
range
tests
{
test
:=
test
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
fmt
.
Printf
(
"%v
\n
"
,
test
.
claim
.
Position
.
TraceIndex
(
maxDepth
))
step
,
err
:=
alphabetSolver
.
AttemptStep
(
test
.
claim
,
test
.
agreeWithLevel
)
if
test
.
expectedErr
==
nil
{
for
_
,
tableTest
:=
range
tests
{
tableTest
:=
tableTest
t
.
Run
(
tableTest
.
name
,
func
(
t
*
testing
.
T
)
{
alphabetProvider
:=
test
.
NewAlphabetWithProofProvider
(
t
,
maxDepth
,
nil
)
if
errors
.
Is
(
tableTest
.
expectedErr
,
errProvider
)
{
alphabetProvider
=
test
.
NewAlphabetWithProofProvider
(
t
,
maxDepth
,
errProvider
)
}
builder
=
test
.
NewClaimBuilder
(
t
,
maxDepth
,
alphabetProvider
)
alphabetSolver
:=
solver
.
NewSolver
(
maxDepth
,
builder
.
CorrectTraceProvider
())
step
,
err
:=
alphabetSolver
.
AttemptStep
(
tableTest
.
claim
,
tableTest
.
agreeWithLevel
)
if
tableTest
.
expectedErr
==
nil
{
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
test
.
claim
,
step
.
LeafClaim
)
require
.
Equal
(
t
,
test
.
expectAttack
,
step
.
IsAttack
)
require
.
Equal
(
t
,
test
.
expectPreState
,
step
.
PreState
)
require
.
Equal
(
t
,
test
.
expectProofData
,
step
.
ProofData
)
require
.
Equal
(
t
,
tableTest
.
claim
,
step
.
LeafClaim
)
require
.
Equal
(
t
,
tableTest
.
expectAttack
,
step
.
IsAttack
)
require
.
Equal
(
t
,
tableTest
.
expectPreState
,
step
.
PreState
)
require
.
Equal
(
t
,
tableTest
.
expectProofData
,
step
.
ProofData
)
require
.
Equal
(
t
,
tableTest
.
expectedLocal
,
step
.
OracleData
.
IsLocal
)
require
.
Equal
(
t
,
tableTest
.
expectedOracleKey
,
step
.
OracleData
.
OracleKey
)
require
.
Equal
(
t
,
tableTest
.
expectedOracleData
,
step
.
OracleData
.
OracleData
)
}
else
{
require
.
ErrorIs
(
t
,
err
,
test
.
expectedErr
)
require
.
ErrorIs
(
t
,
err
,
t
ableT
est
.
expectedErr
)
require
.
Equal
(
t
,
solver
.
StepData
{},
step
)
}
})
...
...
op-challenger/fault/test/alphabet.go
View file @
6583a622
...
...
@@ -4,15 +4,24 @@ import (
"testing"
"github.com/ethereum-optimism/optimism/op-challenger/fault/alphabet"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
)
func
NewAlphabetWithProofProvider
(
t
*
testing
.
T
,
maxDepth
int
,
oracleError
error
)
*
alphabetWithProofProvider
{
return
&
alphabetWithProofProvider
{
alphabet
.
NewAlphabetProvider
(
"abcdefghijklmnopqrstuvwxyz"
,
uint64
(
maxDepth
)),
oracleError
,
}
}
func
NewAlphabetClaimBuilder
(
t
*
testing
.
T
,
maxDepth
int
)
*
ClaimBuilder
{
alphabetProvider
:=
&
alphabetWithProofProvider
{
alphabet
.
NewAlphabetProvider
(
"abcdefghijklmnopqrstuvwxyz"
,
uint64
(
maxDepth
))}
alphabetProvider
:=
NewAlphabetWithProofProvider
(
t
,
maxDepth
,
nil
)
return
NewClaimBuilder
(
t
,
maxDepth
,
alphabetProvider
)
}
type
alphabetWithProofProvider
struct
{
*
alphabet
.
AlphabetProvider
OracleError
error
}
func
(
a
*
alphabetWithProofProvider
)
GetPreimage
(
i
uint64
)
([]
byte
,
[]
byte
,
error
)
{
...
...
@@ -22,3 +31,11 @@ func (a *alphabetWithProofProvider) GetPreimage(i uint64) ([]byte, []byte, error
}
return
preimage
,
[]
byte
{
byte
(
i
)},
nil
}
func
(
a
*
alphabetWithProofProvider
)
GetOracleData
(
i
uint64
)
(
*
types
.
PreimageOracleData
,
error
)
{
if
a
.
OracleError
!=
nil
{
return
&
types
.
PreimageOracleData
{},
a
.
OracleError
}
data
:=
types
.
NewPreimageOracleData
([]
byte
{
byte
(
i
)},
[]
byte
{
byte
(
i
)})
return
&
data
,
nil
}
op-challenger/fault/types/types.go
View file @
6583a622
...
...
@@ -18,6 +18,23 @@ const (
GameStatusDefenderWon
)
// PreimageOracleData encapsulates the preimage oracle data
// to load into the onchain oracle.
type
PreimageOracleData
struct
{
IsLocal
bool
OracleKey
[]
byte
OracleData
[]
byte
}
// NewPreimageOracleData creates a new [PreimageOracleData] instance.
func
NewPreimageOracleData
(
key
[]
byte
,
data
[]
byte
)
PreimageOracleData
{
return
PreimageOracleData
{
IsLocal
:
len
(
key
)
>
0
&&
key
[
0
]
==
byte
(
1
),
OracleKey
:
key
,
OracleData
:
data
,
}
}
// StepCallData encapsulates the data needed to perform a step.
type
StepCallData
struct
{
ClaimIndex
uint64
...
...
@@ -32,6 +49,11 @@ type TraceProvider interface {
// Get(i) = Keccak256(GetPreimage(i))
Get
(
i
uint64
)
(
common
.
Hash
,
error
)
// GetOracleData returns preimage oracle data that can be submitted to the pre-image
// oracle and the dispute game contract. This function accepts a trace index for
// which the provider returns needed preimage data.
GetOracleData
(
i
uint64
)
(
*
PreimageOracleData
,
error
)
// GetPreimage returns the pre-image for a claim at the specified trace index, along
// with any associated proof data to assist in its verification.
GetPreimage
(
i
uint64
)
(
preimage
[]
byte
,
proofData
[]
byte
,
err
error
)
...
...
op-challenger/fault/types/types_test.go
0 → 100644
View file @
6583a622
package
types
import
(
"testing"
"github.com/stretchr/testify/require"
)
func
TestNewPreimageOracleData
(
t
*
testing
.
T
)
{
t
.
Run
(
"LocalData"
,
func
(
t
*
testing
.
T
)
{
data
:=
NewPreimageOracleData
([]
byte
{
1
,
2
,
3
},
[]
byte
{
4
,
5
,
6
})
require
.
True
(
t
,
data
.
IsLocal
)
require
.
Equal
(
t
,
[]
byte
{
1
,
2
,
3
},
data
.
OracleKey
)
require
.
Equal
(
t
,
[]
byte
{
4
,
5
,
6
},
data
.
OracleData
)
})
t
.
Run
(
"GlobalData"
,
func
(
t
*
testing
.
T
)
{
data
:=
NewPreimageOracleData
([]
byte
{
0
,
2
,
3
},
[]
byte
{
4
,
5
,
6
})
require
.
False
(
t
,
data
.
IsLocal
)
require
.
Equal
(
t
,
[]
byte
{
0
,
2
,
3
},
data
.
OracleKey
)
require
.
Equal
(
t
,
[]
byte
{
4
,
5
,
6
},
data
.
OracleData
)
})
}
op-e2e/e2eutils/setup.go
View file @
6583a622
...
...
@@ -105,12 +105,12 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
SequencerFeeVaultRecipient
:
common
.
Address
{
19
:
1
},
BaseFeeVaultRecipient
:
common
.
Address
{
19
:
2
},
L1FeeVaultRecipient
:
common
.
Address
{
19
:
3
},
BaseFeeVaultMinimumWithdrawalAmount
:
uint64ToBig
(
1000
_000_000
),
// 1 gwei
L1FeeVaultMinimumWithdrawalAmount
:
uint64ToBig
(
1000
_000_000
),
// 1 gwei
SequencerFeeVaultMinimumWithdrawalAmount
:
uint64ToBig
(
1000
_000_000
),
// 1 gwei
BaseFeeVaultWithdrawalNetwork
:
uint8
(
1
),
// L2 withdrawal network
L1FeeVaultWithdrawalNetwork
:
uint8
(
1
),
// L2 withdrawal network
SequencerFeeVaultWithdrawalNetwork
:
uint8
(
1
),
// L2 withdrawal network
BaseFeeVaultMinimumWithdrawalAmount
:
uint64ToBig
(
1000
_000_000
),
// 1 gwei
L1FeeVaultMinimumWithdrawalAmount
:
uint64ToBig
(
1000
_000_000
),
// 1 gwei
SequencerFeeVaultMinimumWithdrawalAmount
:
uint64ToBig
(
1000
_000_000
),
// 1 gwei
BaseFeeVaultWithdrawalNetwork
:
genesis
.
WithdrawalNetwork
(
"local"
),
// L2 withdrawal network
L1FeeVaultWithdrawalNetwork
:
genesis
.
WithdrawalNetwork
(
"local"
),
// L2 withdrawal network
SequencerFeeVaultWithdrawalNetwork
:
genesis
.
WithdrawalNetwork
(
"local"
),
// L2 withdrawal network
EIP1559Elasticity
:
10
,
EIP1559Denominator
:
50
,
...
...
op-e2e/setup.go
View file @
6583a622
...
...
@@ -128,12 +128,12 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
SequencerFeeVaultRecipient
:
common
.
Address
{
19
:
1
},
BaseFeeVaultRecipient
:
common
.
Address
{
19
:
2
},
L1FeeVaultRecipient
:
common
.
Address
{
19
:
3
},
BaseFeeVaultMinimumWithdrawalAmount
:
uint642big
(
1000
_000_000
),
// 1 gwei
L1FeeVaultMinimumWithdrawalAmount
:
uint642big
(
1000
_000_000
),
// 1 gwei
SequencerFeeVaultMinimumWithdrawalAmount
:
uint642big
(
1000
_000_000
),
// 1 gwei
BaseFeeVaultWithdrawalNetwork
:
uint8
(
1
),
// L2 withdrawal network
L1FeeVaultWithdrawalNetwork
:
uint8
(
1
),
// L2 withdrawal network
SequencerFeeVaultWithdrawalNetwork
:
uint8
(
1
),
// L2 withdrawal network
BaseFeeVaultMinimumWithdrawalAmount
:
uint642big
(
1000
_000_000
),
// 1 gwei
L1FeeVaultMinimumWithdrawalAmount
:
uint642big
(
1000
_000_000
),
// 1 gwei
SequencerFeeVaultMinimumWithdrawalAmount
:
uint642big
(
1000
_000_000
),
// 1 gwei
BaseFeeVaultWithdrawalNetwork
:
genesis
.
WithdrawalNetwork
(
"local"
),
// L2 withdrawal network
L1FeeVaultWithdrawalNetwork
:
genesis
.
WithdrawalNetwork
(
"local"
),
// L2 withdrawal network
SequencerFeeVaultWithdrawalNetwork
:
genesis
.
WithdrawalNetwork
(
"local"
),
// L2 withdrawal network
DeploymentWaitConfirmations
:
1
,
...
...
op-e2e/system_test.go
View file @
6583a622
...
...
@@ -1351,22 +1351,21 @@ func TestBatcherMultiTx(t *testing.T) {
err
=
sys
.
BatchSubmitter
.
Start
()
require
.
Nil
(
t
,
err
)
// wait for 3 L1 blocks
_
,
err
=
waitForBlock
(
big
.
NewInt
(
int64
(
l1Number
)
+
3
),
l1Client
,
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
*
5
)
*
time
.
Second
)
require
.
Nil
(
t
,
err
,
"Waiting for l1 blocks"
)
// count the number of transactions submitted to L1 in the last 3 blocks
ctx
,
cancel
=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
defer
cancel
()
totalTxCount
:=
0
for
i
:=
int64
(
0
);
i
<
3
;
i
++
{
block
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
big
.
NewInt
(
int64
(
l1Number
)
+
i
+
1
))
require
.
Nil
(
t
,
err
)
// wait for up to 10 L1 blocks, usually only 3 is required, but it's
// possible additional L1 blocks will be created before the batcher starts,
// so we wait additional blocks.
for
i
:=
int64
(
0
);
i
<
10
;
i
++
{
block
,
err
:=
waitForBlock
(
big
.
NewInt
(
int64
(
l1Number
)
+
i
),
l1Client
,
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
*
5
)
*
time
.
Second
)
require
.
Nil
(
t
,
err
,
"Waiting for l1 blocks"
)
totalTxCount
+=
len
(
block
.
Transactions
())
if
totalTxCount
>=
10
{
return
}
}
// expect at least 10 batcher transactions, given 10 L2 blocks were generated above
require
.
GreaterOrEqual
(
t
,
totalTxCount
,
10
)
t
.
Fatal
(
"Expected at least 10 transactions from the batcher"
)
}
func
safeAddBig
(
a
*
big
.
Int
,
b
*
big
.
Int
)
*
big
.
Int
{
...
...
op-node/cmd/genesis/cmd.go
View file @
6583a622
...
...
@@ -3,6 +3,7 @@ package genesis
import
(
"context"
"encoding/json"
"errors"
"fmt"
"math/big"
"os"
...
...
@@ -12,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
...
...
@@ -91,11 +93,11 @@ var Subcommands = cli.Commands{
},
&
cli
.
StringFlag
{
Name
:
"deploy-config"
,
Usage
:
"Path to
hardhat
deploy config file"
,
Usage
:
"Path to deploy config file"
,
},
&
cli
.
StringFlag
{
Name
:
"deployment-dir"
,
Usage
:
"Path to deployment directory"
,
Usage
:
"Path to
network
deployment directory"
,
},
&
cli
.
StringFlag
{
Name
:
"outfile.l2"
,
...
...
@@ -108,12 +110,19 @@ var Subcommands = cli.Commands{
},
Action
:
func
(
ctx
*
cli
.
Context
)
error
{
deployConfig
:=
ctx
.
String
(
"deploy-config"
)
log
.
Info
(
"Deploy config"
,
"path"
,
deployConfig
)
config
,
err
:=
genesis
.
NewDeployConfig
(
deployConfig
)
if
err
!=
nil
{
return
err
}
depPath
,
network
:=
filepath
.
Split
(
ctx
.
String
(
"deployment-dir"
))
deployDir
:=
ctx
.
String
(
"deployment-dir"
)
if
deployDir
==
""
{
return
errors
.
New
(
"Must specify --deployment-dir"
)
}
log
.
Info
(
"Deployment directory"
,
"path"
,
deployDir
)
depPath
,
network
:=
filepath
.
Split
(
deployDir
)
hh
,
err
:=
hardhat
.
New
(
network
,
nil
,
[]
string
{
depPath
})
if
err
!=
nil
{
return
err
...
...
@@ -134,7 +143,9 @@ var Subcommands = cli.Commands{
}
var
l1StartBlock
*
types
.
Block
if
config
.
L1StartingBlockTag
.
BlockHash
!=
nil
{
if
config
.
L1StartingBlockTag
==
nil
{
l1StartBlock
,
err
=
client
.
BlockByNumber
(
context
.
Background
(),
nil
)
}
else
if
config
.
L1StartingBlockTag
.
BlockHash
!=
nil
{
l1StartBlock
,
err
=
client
.
BlockByHash
(
context
.
Background
(),
*
config
.
L1StartingBlockTag
.
BlockHash
)
}
else
if
config
.
L1StartingBlockTag
.
BlockNumber
!=
nil
{
l1StartBlock
,
err
=
client
.
BlockByNumber
(
context
.
Background
(),
big
.
NewInt
(
config
.
L1StartingBlockTag
.
BlockNumber
.
Int64
()))
...
...
@@ -142,6 +153,7 @@ var Subcommands = cli.Commands{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error getting l1 start block: %w"
,
err
)
}
log
.
Info
(
"Using L1 Start Block"
,
"number"
,
l1StartBlock
.
Number
(),
"hash"
,
l1StartBlock
.
Hash
()
.
Hex
())
// Build the developer L2 genesis block
l2Genesis
,
err
:=
genesis
.
BuildL2Genesis
(
config
,
l1StartBlock
)
...
...
op-service/txmgr/cli.go
View file @
6583a622
...
...
@@ -52,7 +52,7 @@ var (
defaultNumConfirmations
=
uint64
(
10
)
defaultSafeAbortNonceTooLowCount
=
uint64
(
3
)
defaultResubmissionTimeout
=
48
*
time
.
Second
defaultNetworkTimeout
=
2
*
time
.
Second
defaultNetworkTimeout
=
10
*
time
.
Second
defaultTxSendTimeout
=
0
*
time
.
Second
defaultTxNotInMempoolTimeout
=
2
*
time
.
Minute
defaultReceiptQueryInterval
=
12
*
time
.
Second
...
...
ops-bedrock/entrypoint-l1.sh
View file @
6583a622
...
...
@@ -60,6 +60,7 @@ exec geth \
--miner
.etherbase
=
$BLOCK_SIGNER_ADDRESS
\
--password
=
"
$GETH_DATA_DIR
"
/password
\
--allow-insecure-unlock
\
--rpc
.allow-unprotected-txs
\
--authrpc
.addr
=
"0.0.0.0"
\
--authrpc
.port
=
"8551"
\
--authrpc
.vhosts
=
"*"
\
...
...
ops-bedrock/entrypoint-l2.sh
View file @
6583a622
...
...
@@ -40,6 +40,7 @@ exec geth \
--nodiscover
\
--maxpeers
=
0
\
--networkid
=
$CHAIN_ID
\
--rpc
.allow-unprotected-txs
\
--authrpc
.addr
=
"0.0.0.0"
\
--authrpc
.port
=
"8551"
\
--authrpc
.vhosts
=
"*"
\
...
...
ops/docker/Dockerfile.packages
View file @
6583a622
...
...
@@ -73,6 +73,10 @@ RUN pnpm install --frozen-lockfile
COPY ./packages ./packages
COPY .git/ ./.git
COPY .gitmodules ./.gitmodules
RUN git submodule update --init --recursive
RUN pnpm build
FROM base as replica-healthcheck
...
...
packages/contracts-bedrock/deploy-config/goerli-forked.json
deleted
100644 → 0
View file @
d0ec7ab5
{
"finalSystemOwner"
:
"0x62790eFcB3a5f3A5D398F95B47930A9Addd83807"
,
"portalGuardian"
:
"0x62790eFcB3a5f3A5D398F95B47930A9Addd83807"
,
"controller"
:
"0x2d30335B0b807bBa1682C487BaAFD2Ad6da5D675"
,
"l1StartingBlockTag"
:
"0x4104895a540d87127ff11eef0d51d8f63ce00a6fc211db751a45a4b3a61a9c83"
,
"l1ChainID"
:
5
,
"l2ChainID"
:
420
,
"l2BlockTime"
:
2
,
"maxSequencerDrift"
:
1200
,
"sequencerWindowSize"
:
3600
,
"channelTimeout"
:
120
,
"p2pSequencerAddress"
:
"0xCBABF46d40982B4530c0EAc9889f6e44e17f0383"
,
"batchInboxAddress"
:
"0xff00000000000000000000000000000000000420"
,
"batchSenderAddress"
:
"0x3a2baA0160275024A50C1be1FC677375E7DB4Bd7"
,
"l2OutputOracleSubmissionInterval"
:
20
,
"l2OutputOracleStartingTimestamp"
:
1670625264
,
"l2OutputOracleStartingBlockNumber"
:
3324764
,
"l2OutputOracleProposer"
:
"0x88BCa4Af3d950625752867f826E073E337076581"
,
"l2OutputOracleChallenger"
:
"0x88BCa4Af3d950625752867f826E073E337076581"
,
"finalizationPeriodSeconds"
:
2
,
"proxyAdminOwner"
:
"0x62790eFcB3a5f3A5D398F95B47930A9Addd83807"
,
"enableGovernance"
:
true
,
"governanceTokenName"
:
"Optimism"
,
"governanceTokenSymbol"
:
"OP"
,
"governanceTokenOwner"
:
"0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76"
,
"l2GenesisBlockGasLimit"
:
"0x17D7840"
,
"l2GenesisBlockBaseFeePerGas"
:
"0x3b9aca00"
,
"gasPriceOracleOverhead"
:
2100
,
"gasPriceOracleScalar"
:
1000000
,
"eip1559Denominator"
:
50
,
"eip1559Elasticity"
:
10
}
packages/contracts-bedrock/foundry.toml
View file @
6583a622
...
...
@@ -5,12 +5,12 @@ optimizer = true
optimizer_runs
=
999999
remappings
=
[
'@openzeppelin/contracts-upgradeable/=
node_modules/@openzeppelin/contracts-upgradeable/
'
,
'@openzeppelin/contracts/=
node_modules/@openzeppelin/contracts/
'
,
'@rari-capital/solmate/=
node_modules/@rari-capital
/solmate'
,
"@cwia/=
node_modules
/clones-with-immutable-args/src"
,
'forge-std/=
node_modules
/forge-std/src'
,
'ds-test/=
node_modules
/ds-test/src'
'@openzeppelin/contracts-upgradeable/=
lib/openzeppelin-contracts-upgradeable/contracts
'
,
'@openzeppelin/contracts/=
lib/openzeppelin-contracts/contracts
'
,
'@rari-capital/solmate/=
lib
/solmate'
,
"@cwia/=
lib
/clones-with-immutable-args/src"
,
'forge-std/=
lib
/forge-std/src'
,
'ds-test/=
lib
/ds-test/src'
]
extra_output
=
[
'devdoc'
,
'userdoc'
,
'metadata'
,
'storageLayout'
]
bytecode_hash
=
'none'
...
...
@@ -18,8 +18,6 @@ build_info = true
build_info_path
=
'artifacts/build-info'
ffi
=
true
fuzz_runs
=
16
# PNPM symlinks all node_modules from the monorepo root
allow_paths
=
[
"../../node_modules"
,
"./**"
]
fs_permissions
=
[
{
'access'='read-write'
,
'path'='./.resource-metering.csv'
}
,
...
...
@@ -27,6 +25,7 @@ fs_permissions = [
{
'access'='read'
,
'path'='./deploy-config/'
}
,
{
'access'='read'
,
'path'='./broadcast/'
}
,
{
access
=
'read'
,
path
=
'./forge-artifacts/'
}
,
{
'access'='write'
,
'path'='./semver-lock.json'
}
,
]
[profile.ci]
...
...
clones-with-immutable-args
@
105efee1
Subproject commit 105efee1b9127ed7f6fedf139e1fc796ce8791f2
ds-test
@
c9ce3f25
Subproject commit c9ce3f25bde29fc5eb9901842bf02850dfd2d084
forge-std
@
e8a047e3
Subproject commit e8a047e3f40f13fa37af6fe14e6e06283d9a060e
openzeppelin-contracts
@
ecd2ca2c
Subproject commit ecd2ca2cd7cac116f7a37d0e474bbb3d7d5e1c4d
openzeppelin-contracts-upgradeable
@
0a2cb9a4
Subproject commit 0a2cb9a445c365870ed7a8ab461b12acf3e27d63
solmate
@
8f9b23f8
Subproject commit 8f9b23f8838670afda0fd8983f2c41e8037ae6bc
packages/contracts-bedrock/package.json
View file @
6583a622
...
...
@@ -24,6 +24,7 @@
"coverage:lcov"
:
"pnpm build:differential && pnpm build:fuzz && forge coverage --report lcov"
,
"gas-snapshot"
:
"pnpm build:differential && pnpm build:fuzz && forge snapshot --no-match-test 'testDiff|testFuzz|invariant|generateArtifact'"
,
"storage-snapshot"
:
"./scripts/storage-snapshot.sh"
,
"semver-lock"
:
"forge script scripts/SemverLock.s.sol"
,
"validate-deploy-configs"
:
"./scripts/validate-deploy-configs.sh"
,
"validate-spacers"
:
"forge build && npx ts-node scripts/validate-spacers.ts"
,
"slither"
:
"./scripts/slither.sh"
,
...
...
@@ -39,17 +40,9 @@
"lint:fix"
:
"pnpm lint:contracts:fix && pnpm lint:ts:fix"
,
"lint"
:
"pnpm lint:fix && pnpm lint:check"
},
"dependencies"
:
{
"@openzeppelin/contracts"
:
"4.7.3"
,
"@openzeppelin/contracts-upgradeable"
:
"4.7.3"
,
"@rari-capital/solmate"
:
"github:transmissions11/solmate#8f9b23f8838670afda0fd8983f2c41e8037ae6bc"
,
"clones-with-immutable-args"
:
"github:Saw-mon-and-Natalie/clones-with-immutable-args#105efee1b9127ed7f6fedf139e1fc796ce8791f2"
},
"devDependencies"
:
{
"@typescript-eslint/eslint-plugin"
:
"^5.60.1"
,
"@typescript-eslint/parser"
:
"^5.60.1"
,
"ds-test"
:
"github:dapphub/ds-test#c9ce3f25bde29fc5eb9901842bf02850dfd2d084"
,
"forge-std"
:
"github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e"
,
"solhint"
:
"^3.4.1"
,
"solhint-plugin-prettier"
:
"^0.0.5"
,
"ts-node"
:
"^10.9.1"
,
...
...
packages/contracts-bedrock/scripts/SemverLock.s.sol
0 → 100644
View file @
6583a622
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";
contract SemverLock is Script {
function run() public {
// First, find all contracts with a Semver inheritance.
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[1] = "-c";
commands[2] = "grep -rl '@custom:semver' contracts | jq -Rs 'split(\"\\n\") | map(select(length > 0))'";
string memory rawFiles = string(vm.ffi(commands));
string[] memory files = vm.parseJsonStringArray(rawFiles, "");
writeSemverLock(files);
}
/// @dev Writes a Semver lockfile
function writeSemverLock(string[] memory _files) internal {
string memory out;
for (uint256 i; i < _files.length; i++) {
// Use FFI to read the file to remove the need for FS permissions in the foundry.toml.
string[] memory commands = new string[](2);
commands[0] = "cat";
commands[1] = _files[i];
string memory fileContents = string(vm.ffi(commands));
// Serialize the source hash in JSON.
string memory j = vm.serializeBytes32(out, _files[i], keccak256(abi.encodePacked(fileContents)));
// If this is the last file, set the output.
if (i == _files.length - 1) {
out = j;
}
}
// Write the semver lockfile.
vm.writeJson(out, "semver-lock.json");
console.logString("Wrote semver lock file to \"semver-lock.json\".");
}
}
packages/contracts-bedrock/semver-lock.json
0 → 100644
View file @
6583a622
{
"contracts/L1/L1CrossDomainMessenger.sol"
:
"0xa043f901e98a24be71a4ec79d5e730e8e56ec616bb79793fc191138924c5e4b5"
,
"contracts/L1/L1ERC721Bridge.sol"
:
"0x4983a413d0c6d1d83cf6463cd44e1adeb3d1bd49b5de3bacfceba04fc717caa2"
,
"contracts/L1/L1StandardBridge.sol"
:
"0x6e361f923509eb35a74391770dad9529db7deae751cfc36506e7ef40f39d5351"
,
"contracts/L1/L2OutputOracle.sol"
:
"0x2b285a897d3285975bd47e89bd5ec7025369931384f9f02a20f48254dbfca181"
,
"contracts/L1/OptimismPortal.sol"
:
"0xd5abaa3d1093c41f8e81b3cd298d4a35f90d103d9bca566a47ca562635f2f943"
,
"contracts/L1/SystemConfig.sol"
:
"0xbd2be6c19e6e85eae73ddf3cd6304a395e2a41d86aee1c15b6b0f044bf54232e"
,
"contracts/L2/BaseFeeVault.sol"
:
"0xc7bf7c43dd5362f6474fc3da8bb38d1c616ed2a3396486446482acf62cacfc2f"
,
"contracts/L2/GasPriceOracle.sol"
:
"0x712134045fba966b0d0cc28019f5c2bd298d999649f387d989f744b274020a82"
,
"contracts/L2/L1Block.sol"
:
"0x64d2517a595a5b5af7eef1070920eb90aa595871ec55ba8b6d6aa323043ac000"
,
"contracts/L2/L1FeeVault.sol"
:
"0x49f6a1a89e83467e84110232f9e3c5fb2d0fad373f12afeef6b15d135a605659"
,
"contracts/L2/L2CrossDomainMessenger.sol"
:
"0xd1e057fe1889e0701f447af8016e4a201febdc28f640138878435746b3c6f647"
,
"contracts/L2/L2ERC721Bridge.sol"
:
"0x2a0c241efb516161a12625e23d1e5aa32da815892e4fcc52f3b12d41cdff53b2"
,
"contracts/L2/L2StandardBridge.sol"
:
"0x8ee5257e03ae4ba8555d9f7d13374c8a388315d62c16107bb4cadd450bfeb3d3"
,
"contracts/L2/L2ToL1MessagePasser.sol"
:
"0x7e35c3c4f1dd3d131dd71db07676301f7c477f02b6d6bf0ec468ecf2bed8325b"
,
"contracts/L2/SequencerFeeVault.sol"
:
"0x17b30ccaed8b8dbe965c892cb8aae7f594fb4a87e0edd3ca6cd8f94559b86df9"
,
"contracts/legacy/DeployerWhitelist.sol"
:
"0x47277d9c8409d517501d172db6697d55090d3d3a9e4bb2b1adea83471d793b6b"
,
"contracts/legacy/L1BlockNumber.sol"
:
"0x1a1690b8b5ab53cf2b5c8e85fb86028b4078ae656286ae482cabe68374334f2a"
,
"contracts/legacy/LegacyMessagePasser.sol"
:
"0xc7f42e6165507b4c50a5169a950f66602e6b4b8cff17f5d95994e121abb18390"
,
"contracts/periphery/op-nft/AttestationStation.sol"
:
"0xe8a905953896b45bb5ece6598c12c8234ee78e57bdb6022ee0e6c4771fd36b7e"
,
"contracts/periphery/op-nft/Optimist.sol"
:
"0x7fe55cdb30c6f00d8058abc949e441743ac41c8f345ad92711e5348c515790f0"
,
"contracts/periphery/op-nft/OptimistAllowlist.sol"
:
"0x1c4d648ccee99e3d1849b362117de2b6ff215b685fd81e529641afbd0f7eda37"
,
"contracts/periphery/op-nft/OptimistInviter.sol"
:
"0xf465cf89f1b71dad3698a3e7626bf6b7ee9172cfdadba0ca3542a5b0150d38d5"
,
"contracts/universal/OptimismMintableERC20.sol"
:
"0xadcb9f22ae05f8dd05202de210faf56d44c5af4fd9ccdc049f116fc7d2499ff7"
,
"contracts/universal/OptimismMintableERC20Factory.sol"
:
"0x1d48aaec29c6732e5d25652a568c4f58a9606656711a14ef98c7cdd5768d9677"
,
"contracts/universal/OptimismMintableERC721.sol"
:
"0x72c9c204caddf5a48b6a704621363926714162c2453392b922091d80aa73924f"
,
"contracts/universal/OptimismMintableERC721Factory.sol"
:
"0x138d1cecb3c0daa85c73617a1c5d0956544bf65153c13dc11529a71f4b70fb3b"
}
\ No newline at end of file
pnpm-lock.yaml
View file @
6583a622
This diff is collapsed.
Click to expand it.
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