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
378f3aa5
Unverified
Commit
378f3aa5
authored
Aug 17, 2023
by
mergify[bot]
Committed by
GitHub
Aug 17, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into dependabot/npm_and_yarn/prettier-2.8.8
parents
d032e268
0d7f352c
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
453 additions
and
180 deletions
+453
-180
wet-geese-cover.md
.changeset/wet-geese-cover.md
+5
-0
config.yml
.circleci/config.yml
+2
-22
mergify.yml
.github/mergify.yml
+181
-30
Makefile
Makefile
+4
-0
__init__.py
bedrock-devnet/devnet/__init__.py
+31
-2
go.mod
go.mod
+0
-1
go.sum
go.sum
+0
-2
Dockerfile
indexer/Dockerfile
+1
-1
config.go
indexer/config/config.go
+3
-8
Makefile
op-bindings/Makefile
+1
-1
trace.sh
op-chain-ops/crossdomain/testdata/trace.sh
+1
-1
config.go
op-chain-ops/genesis/config.go
+18
-0
test-deploy-config-full.json
op-chain-ops/genesis/testdata/test-deploy-config-full.json
+4
-1
caller.go
op-challenger/fault/caller.go
+4
-18
monitor.go
op-challenger/fault/monitor.go
+4
-3
monitor_test.go
op-challenger/fault/monitor_test.go
+4
-8
types.go
op-challenger/fault/types/types.go
+14
-0
charlie.sh
op-challenger/scripts/alphabet/charlie.sh
+1
-1
init_game.sh
op-challenger/scripts/alphabet/init_game.sh
+1
-1
mallory.sh
op-challenger/scripts/alphabet/mallory.sh
+1
-1
parallel.sh
op-challenger/scripts/parallel.sh
+1
-1
visualize.sh
op-challenger/scripts/visualize.sh
+1
-1
sync_client.go
op-node/sources/sync_client.go
+3
-3
strategies.go
op-service/backoff/strategies.go
+14
-15
strategies_test.go
op-service/backoff/strategies_test.go
+4
-4
main.py
ops/check-changed/main.py
+5
-1
OptimismMintableERC20Factory.json
...rock/deployments/goerli/OptimismMintableERC20Factory.json
+126
-32
slither.sh
packages/contracts-bedrock/scripts/slither.sh
+1
-1
Multichain.s.sol
packages/contracts-bedrock/scripts/upgrades/Multichain.s.sol
+9
-3
validate-deploy-configs.sh
...ages/contracts-bedrock/scripts/validate-deploy-configs.sh
+0
-15
verify-foundry-install.sh
packages/contracts-bedrock/scripts/verify-foundry-install.sh
+1
-1
README.md
packages/web3js-plugin/README.md
+8
-2
No files found.
.changeset/wet-geese-cover.md
0 → 100644
View file @
378f3aa5
---
'
@eth-optimism/web3.js-plugin'
:
patch
---
Update code exmaples in README
.circleci/config.yml
View file @
378f3aa5
...
...
@@ -397,13 +397,6 @@ jobs:
FOUNDRY_PROFILE
:
ci
working_directory
:
packages/contracts-bedrock
no_output_timeout
:
15m
-
run
:
name
:
validate deploy configs
command
:
|
pnpm validate-deploy-configs || echo "export DEPLOY_CONFIG_STATUS=1" >> "$BASH_ENV"
environment
:
FOUNDRY_PROFILE
:
ci
working_directory
:
packages/contracts-bedrock
-
run
:
name
:
storage snapshot
command
:
|
...
...
@@ -433,10 +426,6 @@ jobs:
FAILED=1
echo "Gas snapshot failed, see job output for details."
fi
if [[ "$DEPLOY_CONFIG_STATUS" -ne 0 ]]; then
FAILED=1
echo "Deploy configs invalid, see job output for details."
fi
if [[ "$STORAGE_SNAPSHOT_STATUS" -ne 0 ]]; then
echo "Storage snapshot failed, see job output for details."
FAILED=1
...
...
@@ -956,17 +945,8 @@ jobs:
name
:
Bring up the stack
command
:
make devnet-up
-
run
:
name
:
Check L2 config
command
:
go run cmd/check-l2/main.go --l2-rpc-url http://localhost:9545 --l1-rpc-url http://localhost:8545
working_directory
:
op-chain-ops
-
run
:
name
:
Deposit ERC20 through the bridge
command
:
timeout 8m npx hardhat deposit-erc20 --network devnetL1 --l1-contracts-json-path ../../.devnet/addresses.json
working_directory
:
packages/sdk
-
run
:
name
:
Deposit ETH through the bridge
command
:
timeout 8m npx hardhat deposit-eth --network devnetL1 --l1-contracts-json-path ../../.devnet/addresses.json
working_directory
:
packages/sdk
name
:
Test the stack
command
:
make devnet-test
-
run
:
name
:
Dump op-node logs
command
:
|
...
...
.github/mergify.yml
View file @
378f3aa5
...
...
@@ -74,9 +74,17 @@ pull_request_rules:
More details can be found on the `Queue: Embarked in merge train`
check-run.
-
name
:
Add A-cannon label
conditions
:
-
'
files~=^cannon/'
actions
:
label
:
add
:
-
A-cannon
-
name
:
Add A-indexer label and ecopod reviewers
conditions
:
-
'
files~=^indexer/'
-
'
#label<5'
actions
:
label
:
add
:
...
...
@@ -84,47 +92,81 @@ pull_request_rules:
request_reviews
:
users
:
-
roninjin10
-
name
:
Add A-
pkg-sdk label and ecopod reviewers
-
name
:
Add A-
op-batcher label
conditions
:
-
'
files~=^
packages/sdk
/'
-
'
files~=^
op-batcher
/'
actions
:
label
:
add
:
-
A-pkg-sdk
request_reviews
:
users
:
-
roninjin10
-
name
:
Add A-pkg-common-ts label and ecopod reviewers
-
A-op-batcher
-
name
:
Add A-op-bindings label
conditions
:
-
'
files~=^
packages/common-t
s/'
-
'
files~=^
op-binding
s/'
actions
:
label
:
add
:
-
A-pkg-common-ts
request_reviews
:
users
:
-
roninjin10
-
name
:
Add A-op-node label
-
A-op-bindings
-
name
:
Add A-op-bootnode label
conditions
:
-
'
files~=^op-node/'
-
'
files~=^op-bootnode/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-node
-
name
:
Add A-op-
batcher
label
-
A-op-
boot
node
-
name
:
Add A-op-
chain-ops
label
conditions
:
-
'
files~=^op-
batcher
/'
-
'
files~=^op-
chain-ops
/'
actions
:
label
:
add
:
-
A-op-
batcher
-
name
:
Add A-
cannon
label
-
A-op-
chain-ops
-
name
:
Add A-
op-challenger
label
conditions
:
-
'
files~=^
cannon
/'
-
'
files~=^
op-challenger
/'
actions
:
label
:
add
:
-
A-cannon
-
A-op-challenger
-
name
:
Add A-op-e2e label
conditions
:
-
'
files~=^op-e2e/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-e2e
-
name
:
Add A-op-exporter label
conditions
:
-
'
files~=^op-exporter/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-exporter
-
name
:
Add A-op-heartbeat label
conditions
:
-
'
files~=^op-heartbeat/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-heartbeat
-
name
:
Add A-op-node label
conditions
:
-
'
files~=^op-node/'
actions
:
label
:
add
:
-
A-op-node
-
name
:
Add A-op-preimage label
conditions
:
-
'
files~=^op-preimage/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-preimage
-
name
:
Add A-op-program label
conditions
:
-
'
files~=^op-program/'
...
...
@@ -132,13 +174,72 @@ pull_request_rules:
label
:
add
:
-
A-op-program
-
name
:
Add A-op-
challeng
er label
-
name
:
Add A-op-
propos
er label
conditions
:
-
'
files~=^op-
challeng
er/'
-
'
files~=^op-
propos
er/'
actions
:
label
:
add
:
-
A-op-challenger
-
A-op-proposer
-
name
:
Add A-op-service label
conditions
:
-
'
files~=^op-service/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-service
-
name
:
Add A-op-signer label
conditions
:
-
'
files~=^op-signer/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-signer
-
name
:
Add A-op-wheel label
conditions
:
-
'
files~=^op-wheel/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-op-wheel
-
name
:
Add A-ops-bedrock label
conditions
:
-
'
files~=^ops-bedrock/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-ops-bedrock
-
name
:
Add A-ops label
conditions
:
-
'
files~=^ops/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-ops
-
name
:
Add A-pkg-chain-mon label
conditions
:
-
'
files~=^packages/chain-mon/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-chain-mon
-
name
:
Add A-pkg-common-ts label and ecopod reviewers
conditions
:
-
'
files~=^packages/common-ts/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-common-ts
request_reviews
:
users
:
-
roninjin10
-
name
:
Add A-pkg-contracts-bedrock label
conditions
:
-
'
files~=^packages/contracts-bedrock/'
...
...
@@ -146,14 +247,65 @@ pull_request_rules:
label
:
add
:
-
A-pkg-contracts-bedrock
-
name
:
Add A-pkg-contracts-ts label
conditions
:
-
'
files~=^packages/contracts-ts/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-contracts-ts
-
name
:
Add A-pkg-core-utils label
conditions
:
-
'
files~=^packages/core-utils/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-core-utils
-
name
:
Add A-pkg-fee-estimation label
conditions
:
-
'
files~=^packages/fee-estimation/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-fee-estimation
-
name
:
Add A-pkg-sdk label and ecopod reviewers
conditions
:
-
'
files~=^packages/sdk/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-sdk
request_reviews
:
users
:
-
roninjin10
-
name
:
Add A-pkg-web3js-plugin label
conditions
:
-
'
files~=^packages/web3js-plugin/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-web3js-plugin
-
name
:
Add A-proxyd label
conditions
:
-
'
files~=^proxyd/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-proxyd
-
name
:
Add M-docs label
conditions
:
-
'
files~=^
technical-documents
/'
-
'
files~=^specs/
'
-
'
files~=^
(technical-documents|specs)\
/'
-
'
#label<5
'
actions
:
label
:
add
:
-
A-pkg-contracts-bedrock
-
M-docs
-
name
:
Add M-deletion label when files are removed
conditions
:
-
'
removed-files~=^/'
...
...
@@ -163,9 +315,8 @@ pull_request_rules:
-
M-deletion
-
name
:
Add M-ci label when ci files are modified
conditions
:
-
'
files~=^.github/'
-
'
files~=^.circleci/'
-
'
files~=^.husky/'
-
'
files~=^\.(github|circleci|husky)\/'
-
'
#label<5'
actions
:
label
:
add
:
...
...
Makefile
View file @
378f3aa5
...
...
@@ -96,6 +96,10 @@ devnet-up:
# alias for devnet-up
devnet-up-deploy
:
devnet-up
devnet-test
:
PYTHONPATH
=
./bedrock-devnet python3 ./bedrock-devnet/main.py
--monorepo-dir
=
.
--test
.PHONY
:
devnet-test
devnet-down
:
@
(
cd
./ops-bedrock
&&
GENESIS_TIMESTAMP
=
$(
shell
date
+%s
)
docker-compose stop
)
.PHONY
:
devnet-down
...
...
bedrock-devnet/devnet/__init__.py
View file @
378f3aa5
...
...
@@ -18,6 +18,7 @@ pjoin = os.path.join
parser
=
argparse
.
ArgumentParser
(
description
=
'Bedrock devnet launcher'
)
parser
.
add_argument
(
'--monorepo-dir'
,
help
=
'Directory of the monorepo'
,
default
=
os
.
getcwd
())
parser
.
add_argument
(
'--allocs'
,
help
=
'Only create the allocs and exit'
,
type
=
bool
,
action
=
argparse
.
BooleanOptionalAction
)
parser
.
add_argument
(
'--test'
,
help
=
'Tests the deployment, must already be deployed'
,
type
=
bool
,
action
=
argparse
.
BooleanOptionalAction
)
log
=
logging
.
getLogger
()
...
...
@@ -57,6 +58,8 @@ def main():
ops_bedrock_dir
=
pjoin
(
monorepo_dir
,
'ops-bedrock'
)
deploy_config_dir
=
pjoin
(
contracts_bedrock_dir
,
'deploy-config'
),
devnet_config_path
=
pjoin
(
contracts_bedrock_dir
,
'deploy-config'
,
'devnetL1.json'
)
ops_chain_ops
=
pjoin
(
monorepo_dir
,
'op-chain-ops'
)
sdk_dir
=
pjoin
(
monorepo_dir
,
'packages'
,
'sdk'
)
paths
=
Bunch
(
mono_repo_dir
=
monorepo_dir
,
...
...
@@ -68,6 +71,8 @@ def main():
devnet_config_path
=
devnet_config_path
,
op_node_dir
=
op_node_dir
,
ops_bedrock_dir
=
ops_bedrock_dir
,
ops_chain_ops
=
ops_chain_ops
,
sdk_dir
=
sdk_dir
,
genesis_l1_path
=
pjoin
(
devnet_dir
,
'genesis-l1.json'
),
genesis_l2_path
=
pjoin
(
devnet_dir
,
'genesis-l2.json'
),
allocs_path
=
pjoin
(
devnet_dir
,
'allocs-l1.json'
),
...
...
@@ -76,6 +81,11 @@ def main():
rollup_config_path
=
pjoin
(
devnet_dir
,
'rollup.json'
)
)
if
args
.
test
:
log
.
info
(
'Testing deployed devnet'
)
devnet_test
(
paths
)
return
os
.
makedirs
(
devnet_dir
,
exist_ok
=
True
)
if
args
.
allocs
:
...
...
@@ -250,8 +260,26 @@ def wait_for_rpc_server(url):
log
.
info
(
f
'Waiting for RPC server at {url}'
)
time
.
sleep
(
1
)
def
devnet_test
(
paths
):
# Check the L2 config
run_command
(
[
'go'
,
'run'
,
'cmd/check-l2/main.go'
,
'--l2-rpc-url'
,
'http://localhost:9545'
,
'--l1-rpc-url'
,
'http://localhost:8545'
],
cwd
=
paths
.
ops_chain_ops
,
)
run_command
(
[
'npx'
,
'hardhat'
,
'deposit-erc20'
,
'--network'
,
'devnetL1'
,
'--l1-contracts-json-path'
,
paths
.
addresses_json_path
],
cwd
=
paths
.
sdk_dir
,
timeout
=
8
*
60
,
)
run_command
(
[
'npx'
,
'hardhat'
,
'deposit-eth'
,
'--network'
,
'devnetL1'
,
'--l1-contracts-json-path'
,
paths
.
addresses_json_path
],
cwd
=
paths
.
sdk_dir
,
timeout
=
8
*
60
,
)
def
run_command
(
args
,
check
=
True
,
shell
=
False
,
cwd
=
None
,
env
=
None
):
def
run_command
(
args
,
check
=
True
,
shell
=
False
,
cwd
=
None
,
env
=
None
,
timeout
=
None
):
env
=
env
if
env
else
{}
return
subprocess
.
run
(
args
,
...
...
@@ -261,7 +289,8 @@ def run_command(args, check=True, shell=False, cwd=None, env=None):
**
os
.
environ
,
**
env
},
cwd
=
cwd
cwd
=
cwd
,
timeout
=
timeout
)
...
...
go.mod
View file @
378f3aa5
...
...
@@ -24,7 +24,6 @@ require (
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/jackc/pgtype v1.14.0
github.com/jackc/pgx/v5 v5.4.3
github.com/joho/godotenv v1.5.1
github.com/libp2p/go-libp2p v0.27.8
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/libp2p/go-libp2p-testing v0.12.0
...
...
go.sum
View file @
378f3aa5
...
...
@@ -429,8 +429,6 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
...
...
indexer/Dockerfile
View file @
378f3aa5
...
...
@@ -22,4 +22,4 @@ FROM alpine:3.16
COPY
--from=builder /app/indexer/indexer /usr/local/bin
CMD
["indexer"]
CMD
["indexer"
, "--config", "/app/indexer/indexer.toml"
]
indexer/config/config.go
View file @
378f3aa5
...
...
@@ -8,7 +8,6 @@ import (
"github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum/common"
geth_log
"github.com/ethereum/go-ethereum/log"
"github.com/joho/godotenv"
)
// in future presets can just be onchain config and fetched on initialization
...
...
@@ -89,13 +88,7 @@ type MetricsConfig struct {
// LoadConfig loads the `indexer.toml` config file from a given path
func
LoadConfig
(
logger
geth_log
.
Logger
,
path
string
)
(
Config
,
error
)
{
if
err
:=
godotenv
.
Load
();
err
!=
nil
{
logger
.
Warn
(
"Unable to load .env file"
,
err
)
logger
.
Info
(
"Continuing without .env file"
)
}
else
{
logger
.
Info
(
"Loaded .env file"
)
}
logger
.
Info
(
"Loading config file"
,
"path"
,
path
)
var
conf
Config
data
,
err
:=
os
.
ReadFile
(
path
)
...
...
@@ -105,6 +98,8 @@ func LoadConfig(logger geth_log.Logger, path string) (Config, error) {
data
=
[]
byte
(
os
.
ExpandEnv
(
string
(
data
)))
logger
.
Debug
(
"Decoding config file"
,
"data"
,
string
(
data
))
if
_
,
err
:=
toml
.
Decode
(
string
(
data
),
&
conf
);
err
!=
nil
{
logger
.
Info
(
"Failed to decode config file"
,
"message"
,
err
)
return
conf
,
err
...
...
op-bindings/Makefile
View file @
378f3aa5
SHELL
:=
/
bin/
bash
SHELL
:=
/
usr/bin/env
bash
pkg
:=
bindings
monorepo-base
:=
$(
shell
dirname
$
(
realpath
.
))
...
...
op-chain-ops/crossdomain/testdata/trace.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
HASH
=
$1
...
...
op-chain-ops/genesis/config.go
View file @
378f3aa5
...
...
@@ -175,6 +175,24 @@ type DeployConfig struct {
// FundDevAccounts configures whether or not to fund the dev accounts. Should only be used
// during devnet deployments.
FundDevAccounts
bool
`json:"fundDevAccounts"`
// FaultGameAbsolutePrestate is the absolute prestate of Cannon. This is computed
// by generating a proof from the 0th -> 1st instruction and grabbing the prestate from
// the output JSON. All honest challengers should agree on the setup state of the program.
// TODO(clabby): Right now, the build of the `op-program` is nondeterministic, meaning that
// the binary must be distributed in order for honest actors to agree. In the future, we'll
// look to make the build deterministic so that users may build Cannon / the `op-program`
// from source.
FaultGameAbsolutePrestate
common
.
Hash
`json:"faultGameAbsolutePrestate"`
// FaultGameMaxDepth is the maximum depth of the position tree within the fault dispute game.
// `2^{FaultGameMaxDepth}` is how many instructions the execution trace bisection game
// supports. Ideally, this should be conservatively set so that there is always enough
// room for a full Cannon trace.
FaultGameMaxDepth
uint64
`json:"faultGameMaxDepth"`
// FaultGameMaxDuration is the maximum amount of time (in seconds) that the fault dispute
// game can run for before it is ready to be resolved. Each side receives half of this value
// on their chess clock at the inception of the dispute.
FaultGameMaxDuration
uint64
`json:"faultGameMaxDuration"`
}
// Copy will deeply copy the DeployConfig. This does a JSON roundtrip to copy
...
...
op-chain-ops/genesis/testdata/test-deploy-config-full.json
View file @
378f3aa5
...
...
@@ -63,5 +63,8 @@
"deploymentWaitConfirmations"
:
1
,
"eip1559Denominator"
:
8
,
"eip1559Elasticity"
:
2
,
"fundDevAccounts"
:
true
"fundDevAccounts"
:
true
,
"faultGameAbsolutePrestate"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
,
"faultGameMaxDepth"
:
63
,
"faultGameMaxDuration"
:
604800
}
op-challenger/fault/caller.go
View file @
378f3aa5
...
...
@@ -4,13 +4,13 @@ import (
"context"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
)
type
FaultDisputeGameCaller
interface
{
...
...
@@ -53,7 +53,7 @@ func (fc *FaultCaller) LogGameInfo(ctx context.Context) {
fc
.
log
.
Error
(
"failed to get claim count"
,
"err"
,
err
)
return
}
fc
.
log
.
Info
(
"Game info"
,
"claims"
,
claimLen
,
"status"
,
GameStatusString
(
status
)
)
fc
.
log
.
Info
(
"Game info"
,
"claims"
,
claimLen
,
"status"
,
status
)
}
// GetGameStatus returns the current game status.
...
...
@@ -78,17 +78,3 @@ func (fc *FaultCaller) LogClaimDataLength(ctx context.Context) {
}
fc
.
log
.
Info
(
"Number of claims"
,
"length"
,
claimLen
)
}
// GameStatusString returns the current game status as a string.
func
GameStatusString
(
status
types
.
GameStatus
)
string
{
switch
status
{
case
types
.
GameStatusInProgress
:
return
"In Progress"
case
types
.
GameStatusChallengerWon
:
return
"Challenger Won"
case
types
.
GameStatusDefenderWon
:
return
"Defender Won"
default
:
return
"Unknown"
}
}
op-challenger/fault/monitor.go
View file @
378f3aa5
...
...
@@ -4,8 +4,9 @@ import (
"context"
"time"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
)
type
GameInfo
interface
{
...
...
@@ -51,9 +52,9 @@ func progressGame(ctx context.Context, logger log.Logger, agreeWithProposedOutpu
expectedStatus
=
types
.
GameStatusDefenderWon
}
if
expectedStatus
==
status
{
logger
.
Info
(
"Game won"
,
"status"
,
GameStatusString
(
status
)
)
logger
.
Info
(
"Game won"
,
"status"
,
status
)
}
else
{
logger
.
Error
(
"Game lost"
,
"status"
,
GameStatusString
(
status
)
)
logger
.
Error
(
"Game lost"
,
"status"
,
status
)
}
return
true
}
else
{
...
...
op-challenger/fault/monitor_test.go
View file @
378f3aa5
...
...
@@ -5,10 +5,11 @@ import (
"errors"
"testing"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-challenger/fault/types"
"github.com/ethereum-optimism/optimism/op-node/testlog"
)
func
TestMonitorExitsWhenContextDone
(
t
*
testing
.
T
)
{
...
...
@@ -48,7 +49,6 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
agreeWithOutput
bool
logLevel
log
.
Lvl
logMsg
string
statusText
string
}{
{
name
:
"GameLostAsDefender"
,
...
...
@@ -56,7 +56,6 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
agreeWithOutput
:
false
,
logLevel
:
log
.
LvlError
,
logMsg
:
"Game lost"
,
statusText
:
"Challenger Won"
,
},
{
name
:
"GameLostAsChallenger"
,
...
...
@@ -64,7 +63,6 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
agreeWithOutput
:
true
,
logLevel
:
log
.
LvlError
,
logMsg
:
"Game lost"
,
statusText
:
"Defender Won"
,
},
{
name
:
"GameWonAsDefender"
,
...
...
@@ -72,7 +70,6 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
agreeWithOutput
:
false
,
logLevel
:
log
.
LvlInfo
,
logMsg
:
"Game won"
,
statusText
:
"Defender Won"
,
},
{
name
:
"GameWonAsChallenger"
,
...
...
@@ -80,7 +77,6 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
agreeWithOutput
:
true
,
logLevel
:
log
.
LvlInfo
,
logMsg
:
"Game won"
,
statusText
:
"Challenger Won"
,
},
}
for
_
,
test
:=
range
tests
{
...
...
@@ -94,7 +90,7 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
require
.
Equal
(
t
,
0
,
gameInfo
.
logCount
,
"should not log latest game state"
)
errLog
:=
handler
.
FindLog
(
test
.
logLevel
,
test
.
logMsg
)
require
.
NotNil
(
t
,
errLog
,
"should log game result"
)
require
.
Equal
(
t
,
test
.
status
Text
,
errLog
.
GetContextValue
(
"status"
))
require
.
Equal
(
t
,
test
.
status
,
errLog
.
GetContextValue
(
"status"
))
})
}
}
...
...
op-challenger/fault/types/types.go
View file @
378f3aa5
...
...
@@ -20,6 +20,20 @@ const (
GameStatusDefenderWon
)
// String returns the string representation of the game status.
func
(
s
GameStatus
)
String
()
string
{
switch
s
{
case
GameStatusInProgress
:
return
"In Progress"
case
GameStatusChallengerWon
:
return
"Challenger Won"
case
GameStatusDefenderWon
:
return
"Defender Won"
default
:
return
"Unknown"
}
}
// PreimageOracleData encapsulates the preimage oracle data
// to load into the onchain oracle.
type
PreimageOracleData
struct
{
...
...
op-challenger/scripts/alphabet/charlie.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
...
...
op-challenger/scripts/alphabet/init_game.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
...
...
op-challenger/scripts/alphabet/mallory.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
...
...
op-challenger/scripts/parallel.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
# set -x
...
...
op-challenger/scripts/visualize.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
...
...
op-node/sources/sync_client.go
View file @
378f3aa5
...
...
@@ -131,9 +131,9 @@ func (s *SyncClient) eventLoop() {
s
.
log
.
Info
(
"Starting sync client event loop"
)
backoffStrategy
:=
&
backoff
.
ExponentialStrategy
{
Min
:
1000
,
Max
:
20
_000
,
MaxJitter
:
250
,
Min
:
1000
*
time
.
Millisecond
,
Max
:
20
_000
*
time
.
Millisecond
,
MaxJitter
:
250
*
time
.
Millisecond
,
}
for
{
...
...
op-service/backoff/strategies.go
View file @
378f3aa5
...
...
@@ -16,35 +16,34 @@ type Strategy interface {
// ExponentialStrategy performs exponential backoff. The exponential backoff
// function is min(e.Min + (2^attempt * 1000) + randBetween(0, e.MaxJitter), e.Max)
type
ExponentialStrategy
struct
{
// Min is the minimum amount of time to wait between attempts
in ms
.
Min
float64
// Min is the minimum amount of time to wait between attempts.
Min
time
.
Duration
// Max is the maximum amount of time to wait between attempts
in ms
.
Max
float64
// Max is the maximum amount of time to wait between attempts.
Max
time
.
Duration
// MaxJitter is the maximum amount of random jitter to insert between
// attempts in ms.
MaxJitter
int
// MaxJitter is the maximum amount of random jitter to insert between attempts.
MaxJitter
time
.
Duration
}
func
(
e
*
ExponentialStrategy
)
Duration
(
attempt
int
)
time
.
Duration
{
var
jitter
int
var
jitter
time
.
Duration
if
e
.
MaxJitter
>
0
{
jitter
=
rand
.
Intn
(
e
.
MaxJitter
)
jitter
=
time
.
Duration
(
rand
.
Int63n
(
e
.
MaxJitter
.
Nanoseconds
())
)
}
dur
:=
e
.
Min
+
(
math
.
Pow
(
2
,
float64
(
attempt
))
*
1000
)
dur
+=
float64
(
jitter
)
dur
:=
e
.
Min
+
time
.
Duration
(
int
(
math
.
Pow
(
2
,
float64
(
attempt
))
*
1000
))
*
time
.
Millisecond
dur
+=
jitter
if
dur
>
e
.
Max
{
return
time
.
Millisecond
*
time
.
Duration
(
e
.
Max
)
return
e
.
Max
}
return
time
.
Millisecond
*
time
.
Duration
(
dur
)
return
dur
}
func
Exponential
()
Strategy
{
return
&
ExponentialStrategy
{
Max
:
10000
,
MaxJitter
:
250
,
Max
:
time
.
Duration
(
10000
*
time
.
Millisecond
)
,
MaxJitter
:
time
.
Duration
(
250
*
time
.
Millisecond
)
,
}
}
...
...
op-service/backoff/strategies_test.go
View file @
378f3aa5
...
...
@@ -9,13 +9,13 @@ import (
func
TestExponential
(
t
*
testing
.
T
)
{
strategy
:=
&
ExponentialStrategy
{
Min
:
3000
,
Max
:
10000
,
Min
:
3000
*
time
.
Millisecond
,
Max
:
10000
*
time
.
Millisecond
,
MaxJitter
:
0
,
}
durations
:=
[]
int
{
4
,
5
,
7
,
10
,
10
}
durations
:=
[]
time
.
Duration
{
4
,
5
,
7
,
10
,
10
}
for
i
,
dur
:=
range
durations
{
require
.
Equal
(
t
,
time
.
Millisecond
*
time
.
Duration
(
dur
*
1000
)
,
strategy
.
Duration
(
i
))
require
.
Equal
(
t
,
dur
*
time
.
Second
,
strategy
.
Duration
(
i
))
}
}
ops/check-changed/main.py
View file @
378f3aa5
...
...
@@ -56,7 +56,11 @@ log = logging.getLogger(__name__)
def
main
():
patterns
=
sys
.
argv
[
1
]
.
split
(
','
)
patterns
=
patterns
+
REBUILD_ALL_PATTERNS
# temporarily only run indexer tests if indexer is changed because the tests are flaky
if
len
(
patterns
)
!=
1
or
patterns
[
0
]
!=
"indexer"
:
patterns
=
patterns
+
REBUILD_ALL_PATTERNS
fp
=
os
.
path
.
realpath
(
__file__
)
monorepo_path
=
os
.
path
.
realpath
(
os
.
path
.
join
(
fp
,
'..'
,
'..'
))
...
...
packages/contracts-bedrock/deployments/goerli/OptimismMintableERC20Factory.json
View file @
378f3aa5
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/scripts/slither.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
rm
-rf
artifacts forge-artifacts
...
...
packages/contracts-bedrock/scripts/upgrades/Multichain.s.sol
View file @
378f3aa5
...
...
@@ -67,7 +67,7 @@ contract Multichain is SafeBuilder {
/// @notice L2OutputOracle implementation to upgrade to
address internal constant L2OutputOracleImplementation = 0xaBd96C062c6B640d5670455E9d1cD98383Dd23CA;
/// @notice OptimismMintableERC20Factory to upgrade to
address internal constant OptimismMintableERC20FactoryImplementation = 0x
E220F7D7fF39837003A1835fCefFa8bCA4098582
;
address internal constant OptimismMintableERC20FactoryImplementation = 0x
dfe97868233d1aa22e815a266982f2cf17685a27
;
/// @notice OptimismPortal implementation to upgrade to
address internal constant OptimismPortalImplementation = 0x345D27c7B6C90fef5beA9631037C36119f4bF93e;
/// @notice SystemConfig implementation to upgrade to
...
...
@@ -82,7 +82,7 @@ contract Multichain is SafeBuilder {
string internal constant L1CrossDomainMessengerVersion = "1.5.1";
string internal constant L1StandardBridgeVersion = "1.2.1";
string internal constant L2OutputOracleVersion = "1.4.1";
string internal constant OptimismMintableERC20FactoryVersion = "1.
1.2
";
string internal constant OptimismMintableERC20FactoryVersion = "1.
3.0
";
string internal constant OptimismPortalVersion = "1.8.1";
string internal constant SystemConfigVersion = "1.6.0";
string internal constant L1ERC721BridgeVersion = "1.2.1";
...
...
@@ -393,7 +393,13 @@ contract Multichain is SafeBuilder {
target: _proxyAdmin,
allowFailure: false,
callData: abi.encodeCall(
ProxyAdmin.upgrade, (payable(prox.OptimismMintableERC20Factory), OptimismMintableERC20FactoryImplementation)
ProxyAdmin.upgradeAndCall,
(
payable(prox.OptimismMintableERC20Factory), // proxy
OptimismMintableERC20FactoryImplementation, // implementation
abi.encodeCall( // data
OptimismMintableERC20Factory.initialize, (prox.L1StandardBridge))
)
)
});
...
...
packages/contracts-bedrock/scripts/validate-deploy-configs.sh
deleted
100755 → 0
View file @
d032e268
#!/usr/bin/env bash
set
-e
dir
=
$(
dirname
"
$0
"
)
echo
"Validating deployment configurations...
\n
"
for
config
in
$dir
/../deploy-config/
*
.json
do
echo
"Found file:
$config
\n
"
git diff
--exit-code
$config
done
echo
"Deployment configs in
$dir
/../deploy-config validated!
\n
"
packages/contracts-bedrock/scripts/verify-foundry-install.sh
View file @
378f3aa5
#!/
bin/
bash
#!/
usr/bin/env
bash
if
!
command
-v
forge &> /dev/null
then
...
...
packages/web3js-plugin/README.md
View file @
378f3aa5
...
...
@@ -28,10 +28,10 @@ yarn add @eth-optimism/web3.js-plugin
```
typescript
import
Web3
from
'
web3
'
import
OptimismFeeEstimationPlugin
from
'
@eth-optimism/web3.js-plugin
'
import
{
OptimismPlugin
}
from
'
@eth-optimism/web3.js-plugin
'
const
web3
=
new
Web3
(
'
http://yourProvider.com
'
)
web3
.
registerPlugin
(
new
Optimism
FeeEstimation
Plugin
())
web3
.
registerPlugin
(
new
OptimismPlugin
())
```
You will now have access to the following functions under the
`op`
namespace, i.e.
`web3.op.someMethod`
...
...
@@ -76,12 +76,15 @@ async estimateFees(transaction: Transaction, returnFormat?: ReturnFormat)
```
typescript
import
Web3
from
'
web3
'
import
{
OptimismPlugin
}
from
'
@eth-optimism/web3.js-plugin
'
import
{
l2StandardBridgeABI
,
l2StandardBridgeAddress
,
}
from
'
@eth-optimism/contracts-ts
'
const
web3
=
new
Web3
(
'
https://mainnet.optimism.io
'
)
web3
.
registerPlugin
(
new
OptimismPlugin
())
const
l2BridgeContract
=
new
web3
.
eth
.
Contract
(
l2StandardBridgeABI
,
optimistAddress
[
420
]
...
...
@@ -117,12 +120,15 @@ console.log(totalFee) // 26608988767659n
```
typescript
import
Web3
from
'
web3
'
import
{
OptimismPlugin
}
from
'
@eth-optimism/web3.js-plugin
'
import
{
l2StandardBridgeABI
,
l2StandardBridgeAddress
,
}
from
'
@eth-optimism/contracts-ts
'
const
web3
=
new
Web3
(
'
https://mainnet.optimism.io
'
)
web3
.
registerPlugin
(
new
OptimismPlugin
())
const
l2BridgeContract
=
new
web3
.
eth
.
Contract
(
l2StandardBridgeABI
,
optimistAddress
[
420
]
...
...
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