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
ad4590fb
Commit
ad4590fb
authored
Aug 17, 2023
by
Joshua Gutow
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into jg/backoff_to_retry
parents
392dbdde
d6961602
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
150 additions
and
79 deletions
+150
-79
wet-geese-cover.md
.changeset/wet-geese-cover.md
+5
-0
config.yml
.circleci/config.yml
+2
-11
mergify.yml
.github/mergify.yml
+54
-6
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
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
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
script.sh
op-node/cmd/batch_decoder/script.sh
+3
-0
sync_client.go
op-node/sources/sync_client.go
+3
-3
strategies.go
op-service/retry/strategies.go
+14
-15
strategies_test.go
op-service/retry/strategies_test.go
+4
-4
logger.ts
packages/common-ts/src/common/logger.ts
+1
-1
slither.sh
packages/contracts-bedrock/scripts/slither.sh
+1
-1
verify-foundry-install.sh
packages/contracts-bedrock/scripts/verify-foundry-install.sh
+1
-1
README.md
packages/web3js-plugin/README.md
+8
-2
pnpm-lock.yaml
pnpm-lock.yaml
+9
-15
No files found.
.changeset/wet-geese-cover.md
0 → 100644
View file @
ad4590fb
---
'
@eth-optimism/web3.js-plugin'
:
patch
---
Update code exmaples in README
.circleci/config.yml
View file @
ad4590fb
...
@@ -945,17 +945,8 @@ jobs:
...
@@ -945,17 +945,8 @@ jobs:
name
:
Bring up the stack
name
:
Bring up the stack
command
:
make devnet-up
command
:
make devnet-up
-
run
:
-
run
:
name
:
Check L2 config
name
:
Test the stack
command
:
go run cmd/check-l2/main.go --l2-rpc-url http://localhost:9545 --l1-rpc-url http://localhost:8545
command
:
make devnet-test
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
-
run
:
-
run
:
name
:
Dump op-node logs
name
:
Dump op-node logs
command
:
|
command
:
|
...
...
.github/mergify.yml
View file @
ad4590fb
...
@@ -221,17 +221,14 @@ pull_request_rules:
...
@@ -221,17 +221,14 @@ pull_request_rules:
label
:
label
:
add
:
add
:
-
A-ops
-
A-ops
-
name
:
Add A-pkg-
sdk label and ecopod reviewers
-
name
:
Add A-pkg-
chain-mon label
conditions
:
conditions
:
-
'
files~=^packages/
sdk
/'
-
'
files~=^packages/
chain-mon
/'
-
'
#label<5'
-
'
#label<5'
actions
:
actions
:
label
:
label
:
add
:
add
:
-
A-pkg-sdk
-
A-pkg-chain-mon
request_reviews
:
users
:
-
roninjin10
-
name
:
Add A-pkg-common-ts label and ecopod reviewers
-
name
:
Add A-pkg-common-ts label and ecopod reviewers
conditions
:
conditions
:
-
'
files~=^packages/common-ts/'
-
'
files~=^packages/common-ts/'
...
@@ -250,6 +247,57 @@ pull_request_rules:
...
@@ -250,6 +247,57 @@ pull_request_rules:
label
:
label
:
add
:
add
:
-
A-pkg-contracts-bedrock
-
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
-
name
:
Add M-docs label
conditions
:
conditions
:
-
'
files~=^(technical-documents|specs)\/'
-
'
files~=^(technical-documents|specs)\/'
...
...
Makefile
View file @
ad4590fb
...
@@ -96,6 +96,10 @@ devnet-up:
...
@@ -96,6 +96,10 @@ devnet-up:
# alias for devnet-up
# alias for devnet-up
devnet-up-deploy
:
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
:
devnet-down
:
@
(
cd
./ops-bedrock
&&
GENESIS_TIMESTAMP
=
$(
shell
date
+%s
)
docker-compose stop
)
@
(
cd
./ops-bedrock
&&
GENESIS_TIMESTAMP
=
$(
shell
date
+%s
)
docker-compose stop
)
.PHONY
:
devnet-down
.PHONY
:
devnet-down
...
...
bedrock-devnet/devnet/__init__.py
View file @
ad4590fb
...
@@ -18,6 +18,7 @@ pjoin = os.path.join
...
@@ -18,6 +18,7 @@ pjoin = os.path.join
parser
=
argparse
.
ArgumentParser
(
description
=
'Bedrock devnet launcher'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Bedrock devnet launcher'
)
parser
.
add_argument
(
'--monorepo-dir'
,
help
=
'Directory of the monorepo'
,
default
=
os
.
getcwd
())
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
(
'--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
()
log
=
logging
.
getLogger
()
...
@@ -57,6 +58,8 @@ def main():
...
@@ -57,6 +58,8 @@ def main():
ops_bedrock_dir
=
pjoin
(
monorepo_dir
,
'ops-bedrock'
)
ops_bedrock_dir
=
pjoin
(
monorepo_dir
,
'ops-bedrock'
)
deploy_config_dir
=
pjoin
(
contracts_bedrock_dir
,
'deploy-config'
),
deploy_config_dir
=
pjoin
(
contracts_bedrock_dir
,
'deploy-config'
),
devnet_config_path
=
pjoin
(
contracts_bedrock_dir
,
'deploy-config'
,
'devnetL1.json'
)
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
(
paths
=
Bunch
(
mono_repo_dir
=
monorepo_dir
,
mono_repo_dir
=
monorepo_dir
,
...
@@ -68,6 +71,8 @@ def main():
...
@@ -68,6 +71,8 @@ def main():
devnet_config_path
=
devnet_config_path
,
devnet_config_path
=
devnet_config_path
,
op_node_dir
=
op_node_dir
,
op_node_dir
=
op_node_dir
,
ops_bedrock_dir
=
ops_bedrock_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_l1_path
=
pjoin
(
devnet_dir
,
'genesis-l1.json'
),
genesis_l2_path
=
pjoin
(
devnet_dir
,
'genesis-l2.json'
),
genesis_l2_path
=
pjoin
(
devnet_dir
,
'genesis-l2.json'
),
allocs_path
=
pjoin
(
devnet_dir
,
'allocs-l1.json'
),
allocs_path
=
pjoin
(
devnet_dir
,
'allocs-l1.json'
),
...
@@ -76,6 +81,11 @@ def main():
...
@@ -76,6 +81,11 @@ def main():
rollup_config_path
=
pjoin
(
devnet_dir
,
'rollup.json'
)
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
)
os
.
makedirs
(
devnet_dir
,
exist_ok
=
True
)
if
args
.
allocs
:
if
args
.
allocs
:
...
@@ -250,8 +260,26 @@ def wait_for_rpc_server(url):
...
@@ -250,8 +260,26 @@ def wait_for_rpc_server(url):
log
.
info
(
f
'Waiting for RPC server at {url}'
)
log
.
info
(
f
'Waiting for RPC server at {url}'
)
time
.
sleep
(
1
)
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
{}
env
=
env
if
env
else
{}
return
subprocess
.
run
(
return
subprocess
.
run
(
args
,
args
,
...
@@ -261,7 +289,8 @@ def run_command(args, check=True, shell=False, cwd=None, env=None):
...
@@ -261,7 +289,8 @@ def run_command(args, check=True, shell=False, cwd=None, env=None):
**
os
.
environ
,
**
os
.
environ
,
**
env
**
env
},
},
cwd
=
cwd
cwd
=
cwd
,
timeout
=
timeout
)
)
...
...
go.mod
View file @
ad4590fb
...
@@ -24,7 +24,6 @@ require (
...
@@ -24,7 +24,6 @@ require (
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/jackc/pgtype v1.14.0
github.com/jackc/pgtype v1.14.0
github.com/jackc/pgx/v5 v5.4.3
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 v0.27.8
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/libp2p/go-libp2p-testing v0.12.0
github.com/libp2p/go-libp2p-testing v0.12.0
...
...
go.sum
View file @
ad4590fb
...
@@ -429,8 +429,6 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
...
@@ -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/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 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
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/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.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
...
...
indexer/config/config.go
View file @
ad4590fb
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/BurntSushi/toml"
"github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
geth_log
"github.com/ethereum/go-ethereum/log"
geth_log
"github.com/ethereum/go-ethereum/log"
"github.com/joho/godotenv"
)
)
// in future presets can just be onchain config and fetched on initialization
// in future presets can just be onchain config and fetched on initialization
...
@@ -89,13 +88,7 @@ type MetricsConfig struct {
...
@@ -89,13 +88,7 @@ type MetricsConfig struct {
// LoadConfig loads the `indexer.toml` config file from a given path
// LoadConfig loads the `indexer.toml` config file from a given path
func
LoadConfig
(
logger
geth_log
.
Logger
,
path
string
)
(
Config
,
error
)
{
func
LoadConfig
(
logger
geth_log
.
Logger
,
path
string
)
(
Config
,
error
)
{
if
err
:=
godotenv
.
Load
();
err
!=
nil
{
logger
.
Info
(
"Loading config file"
,
"path"
,
path
)
logger
.
Warn
(
"Unable to load .env file"
,
err
)
logger
.
Info
(
"Continuing without .env file"
)
}
else
{
logger
.
Info
(
"Loaded .env file"
)
}
var
conf
Config
var
conf
Config
data
,
err
:=
os
.
ReadFile
(
path
)
data
,
err
:=
os
.
ReadFile
(
path
)
...
@@ -105,6 +98,8 @@ func LoadConfig(logger geth_log.Logger, path string) (Config, error) {
...
@@ -105,6 +98,8 @@ func LoadConfig(logger geth_log.Logger, path string) (Config, error) {
data
=
[]
byte
(
os
.
ExpandEnv
(
string
(
data
)))
data
=
[]
byte
(
os
.
ExpandEnv
(
string
(
data
)))
logger
.
Debug
(
"Decoding config file"
,
"data"
,
string
(
data
))
if
_
,
err
:=
toml
.
Decode
(
string
(
data
),
&
conf
);
err
!=
nil
{
if
_
,
err
:=
toml
.
Decode
(
string
(
data
),
&
conf
);
err
!=
nil
{
logger
.
Info
(
"Failed to decode config file"
,
"message"
,
err
)
logger
.
Info
(
"Failed to decode config file"
,
"message"
,
err
)
return
conf
,
err
return
conf
,
err
...
...
op-bindings/Makefile
View file @
ad4590fb
SHELL
:=
/
bin/
bash
SHELL
:=
/
usr/bin/env
bash
pkg
:=
bindings
pkg
:=
bindings
monorepo-base
:=
$(
shell
dirname
$
(
realpath
.
))
monorepo-base
:=
$(
shell
dirname
$
(
realpath
.
))
...
...
op-chain-ops/crossdomain/testdata/trace.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
HASH
=
$1
HASH
=
$1
...
...
op-challenger/scripts/alphabet/charlie.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
set
-euo
pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
...
...
op-challenger/scripts/alphabet/init_game.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
set
-euo
pipefail
...
...
op-challenger/scripts/alphabet/mallory.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
set
-euo
pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
...
...
op-challenger/scripts/parallel.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
# set -x
# set -x
...
...
op-challenger/scripts/visualize.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
set
-euo
pipefail
...
...
op-node/cmd/batch_decoder/script.sh
0 → 100755
View file @
ad4590fb
echo
$1
jq
'.frames[] | {timestamp, inclusion_block}'
$1
jq
'.batches[]|.Timestamp'
$1
op-node/sources/sync_client.go
View file @
ad4590fb
...
@@ -131,9 +131,9 @@ func (s *SyncClient) eventLoop() {
...
@@ -131,9 +131,9 @@ func (s *SyncClient) eventLoop() {
s
.
log
.
Info
(
"Starting sync client event loop"
)
s
.
log
.
Info
(
"Starting sync client event loop"
)
backoffStrategy
:=
&
retry
.
ExponentialStrategy
{
backoffStrategy
:=
&
retry
.
ExponentialStrategy
{
Min
:
1000
,
Min
:
1000
*
time
.
Millisecond
,
Max
:
20
_000
,
Max
:
20
_000
*
time
.
Millisecond
,
MaxJitter
:
250
,
MaxJitter
:
250
*
time
.
Millisecond
,
}
}
for
{
for
{
...
...
op-service/retry/strategies.go
View file @
ad4590fb
...
@@ -16,35 +16,34 @@ type Strategy interface {
...
@@ -16,35 +16,34 @@ type Strategy interface {
// ExponentialStrategy performs exponential backoff. The exponential backoff
// ExponentialStrategy performs exponential backoff. The exponential backoff
// function is min(e.Min + (2^attempt * 1000) + randBetween(0, e.MaxJitter), e.Max)
// function is min(e.Min + (2^attempt * 1000) + randBetween(0, e.MaxJitter), e.Max)
type
ExponentialStrategy
struct
{
type
ExponentialStrategy
struct
{
// Min is the minimum amount of time to wait between attempts
in ms
.
// Min is the minimum amount of time to wait between attempts.
Min
float64
Min
time
.
Duration
// Max is the maximum amount of time to wait between attempts
in ms
.
// Max is the maximum amount of time to wait between attempts.
Max
float64
Max
time
.
Duration
// MaxJitter is the maximum amount of random jitter to insert between
// MaxJitter is the maximum amount of random jitter to insert between attempts.
// attempts in ms.
MaxJitter
time
.
Duration
MaxJitter
int
}
}
func
(
e
*
ExponentialStrategy
)
Duration
(
attempt
int
)
time
.
Duration
{
func
(
e
*
ExponentialStrategy
)
Duration
(
attempt
int
)
time
.
Duration
{
var
jitter
int
var
jitter
time
.
Duration
if
e
.
MaxJitter
>
0
{
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
:=
e
.
Min
+
time
.
Duration
(
int
(
math
.
Pow
(
2
,
float64
(
attempt
))
*
1000
))
*
time
.
Millisecond
dur
+=
float64
(
jitter
)
dur
+=
jitter
if
dur
>
e
.
Max
{
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
{
func
Exponential
()
Strategy
{
return
&
ExponentialStrategy
{
return
&
ExponentialStrategy
{
Max
:
10000
,
Max
:
time
.
Duration
(
10000
*
time
.
Millisecond
)
,
MaxJitter
:
250
,
MaxJitter
:
time
.
Duration
(
250
*
time
.
Millisecond
)
,
}
}
}
}
...
...
op-service/retry/strategies_test.go
View file @
ad4590fb
...
@@ -9,13 +9,13 @@ import (
...
@@ -9,13 +9,13 @@ import (
func
TestExponential
(
t
*
testing
.
T
)
{
func
TestExponential
(
t
*
testing
.
T
)
{
strategy
:=
&
ExponentialStrategy
{
strategy
:=
&
ExponentialStrategy
{
Min
:
3000
,
Min
:
3000
*
time
.
Millisecond
,
Max
:
10000
,
Max
:
10000
*
time
.
Millisecond
,
MaxJitter
:
0
,
MaxJitter
:
0
,
}
}
durations
:=
[]
int
{
4
,
5
,
7
,
10
,
10
}
durations
:=
[]
time
.
Duration
{
4
,
5
,
7
,
10
,
10
}
for
i
,
dur
:=
range
durations
{
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
))
}
}
}
}
packages/common-ts/src/common/logger.ts
View file @
ad4590fb
...
@@ -11,7 +11,7 @@ export const logLevels = [
...
@@ -11,7 +11,7 @@ export const logLevels = [
'
error
'
,
'
error
'
,
'
fatal
'
,
'
fatal
'
,
]
as
const
]
as
const
export
type
LogLevel
=
typeof
logLevels
[
number
]
export
type
LogLevel
=
(
typeof
logLevels
)
[
number
]
export
interface
LoggerOptions
{
export
interface
LoggerOptions
{
name
:
string
name
:
string
...
...
packages/contracts-bedrock/scripts/slither.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
rm
-rf
artifacts forge-artifacts
rm
-rf
artifacts forge-artifacts
...
...
packages/contracts-bedrock/scripts/verify-foundry-install.sh
View file @
ad4590fb
#!/
bin/
bash
#!/
usr/bin/env
bash
if
!
command
-v
forge &> /dev/null
if
!
command
-v
forge &> /dev/null
then
then
...
...
packages/web3js-plugin/README.md
View file @
ad4590fb
...
@@ -28,10 +28,10 @@ yarn add @eth-optimism/web3.js-plugin
...
@@ -28,10 +28,10 @@ yarn add @eth-optimism/web3.js-plugin
```
typescript
```
typescript
import
Web3
from
'
web3
'
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
'
)
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`
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)
...
@@ -76,12 +76,15 @@ async estimateFees(transaction: Transaction, returnFormat?: ReturnFormat)
```
typescript
```
typescript
import
Web3
from
'
web3
'
import
Web3
from
'
web3
'
import
{
OptimismPlugin
}
from
'
@eth-optimism/web3.js-plugin
'
import
{
import
{
l2StandardBridgeABI
,
l2StandardBridgeABI
,
l2StandardBridgeAddress
,
l2StandardBridgeAddress
,
}
from
'
@eth-optimism/contracts-ts
'
}
from
'
@eth-optimism/contracts-ts
'
const
web3
=
new
Web3
(
'
https://mainnet.optimism.io
'
)
const
web3
=
new
Web3
(
'
https://mainnet.optimism.io
'
)
web3
.
registerPlugin
(
new
OptimismPlugin
())
const
l2BridgeContract
=
new
web3
.
eth
.
Contract
(
const
l2BridgeContract
=
new
web3
.
eth
.
Contract
(
l2StandardBridgeABI
,
l2StandardBridgeABI
,
optimistAddress
[
420
]
optimistAddress
[
420
]
...
@@ -117,12 +120,15 @@ console.log(totalFee) // 26608988767659n
...
@@ -117,12 +120,15 @@ console.log(totalFee) // 26608988767659n
```
typescript
```
typescript
import
Web3
from
'
web3
'
import
Web3
from
'
web3
'
import
{
OptimismPlugin
}
from
'
@eth-optimism/web3.js-plugin
'
import
{
import
{
l2StandardBridgeABI
,
l2StandardBridgeABI
,
l2StandardBridgeAddress
,
l2StandardBridgeAddress
,
}
from
'
@eth-optimism/contracts-ts
'
}
from
'
@eth-optimism/contracts-ts
'
const
web3
=
new
Web3
(
'
https://mainnet.optimism.io
'
)
const
web3
=
new
Web3
(
'
https://mainnet.optimism.io
'
)
web3
.
registerPlugin
(
new
OptimismPlugin
())
const
l2BridgeContract
=
new
web3
.
eth
.
Contract
(
const
l2BridgeContract
=
new
web3
.
eth
.
Contract
(
l2StandardBridgeABI
,
l2StandardBridgeABI
,
optimistAddress
[
420
]
optimistAddress
[
420
]
...
...
pnpm-lock.yaml
View file @
ad4590fb
...
@@ -77,7 +77,7 @@ importers:
...
@@ -77,7 +77,7 @@ importers:
version
:
1.2.3(eslint@8.47.0)
version
:
1.2.3(eslint@8.47.0)
eslint-plugin-prettier
:
eslint-plugin-prettier
:
specifier
:
^4.0.0
specifier
:
^4.0.0
version
:
4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.
1
)
version
:
4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.
8
)
eslint-plugin-promise
:
eslint-plugin-promise
:
specifier
:
^5.1.0
specifier
:
^5.1.0
version
:
5.2.0(eslint@8.47.0)
version
:
5.2.0(eslint@8.47.0)
...
@@ -119,10 +119,10 @@ importers:
...
@@ -119,10 +119,10 @@ importers:
version
:
6.4.7
version
:
6.4.7
prettier
:
prettier
:
specifier
:
^2.8.0
specifier
:
^2.8.0
version
:
2.8.
1
version
:
2.8.
8
prettier-plugin-solidity
:
prettier-plugin-solidity
:
specifier
:
^1.0.0-beta.13
specifier
:
^1.0.0-beta.13
version
:
1.0.0-beta.18(prettier@2.8.
1
)
version
:
1.0.0-beta.18(prettier@2.8.
8
)
rimraf
:
rimraf
:
specifier
:
^5.0.1
specifier
:
^5.0.1
version
:
5.0.1
version
:
5.0.1
...
@@ -1012,7 +1012,7 @@ packages:
...
@@ -1012,7 +1012,7 @@ packages:
fs-extra
:
7.0.1
fs-extra
:
7.0.1
lodash.startcase
:
4.4.0
lodash.startcase
:
4.4.0
outdent
:
0.5.0
outdent
:
0.5.0
prettier
:
2.8.
1
prettier
:
2.8.
8
resolve-from
:
5.0.0
resolve-from
:
5.0.0
semver
:
5.7.2
semver
:
5.7.2
dev
:
false
dev
:
false
...
@@ -1198,7 +1198,7 @@ packages:
...
@@ -1198,7 +1198,7 @@ packages:
'
@changesets/types'
:
5.2.1
'
@changesets/types'
:
5.2.1
fs-extra
:
7.0.1
fs-extra
:
7.0.1
human-id
:
1.0.2
human-id
:
1.0.2
prettier
:
2.8.
1
prettier
:
2.8.
8
dev
:
false
dev
:
false
/@codechecks/client@0.1.11(typescript@5.1.6)
:
/@codechecks/client@0.1.11(typescript@5.1.6)
:
...
@@ -8366,7 +8366,7 @@ packages:
...
@@ -8366,7 +8366,7 @@ packages:
eslint
:
8.47.0
eslint
:
8.47.0
dev
:
true
dev
:
true
/eslint-plugin-prettier@4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.
1
)
:
/eslint-plugin-prettier@4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.
8
)
:
resolution
:
{
integrity
:
sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==
}
resolution
:
{
integrity
:
sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==
}
engines
:
{
node
:
'
>=6.0.0'
}
engines
:
{
node
:
'
>=6.0.0'
}
peerDependencies
:
peerDependencies
:
...
@@ -8379,7 +8379,7 @@ packages:
...
@@ -8379,7 +8379,7 @@ packages:
dependencies
:
dependencies
:
eslint
:
8.47.0
eslint
:
8.47.0
eslint-config-prettier
:
8.3.0(eslint@8.47.0)
eslint-config-prettier
:
8.3.0(eslint@8.47.0)
prettier
:
2.8.
1
prettier
:
2.8.
8
prettier-linter-helpers
:
1.0.0
prettier-linter-helpers
:
1.0.0
dev
:
true
dev
:
true
...
@@ -13768,7 +13768,7 @@ packages:
...
@@ -13768,7 +13768,7 @@ packages:
fast-diff
:
1.2.0
fast-diff
:
1.2.0
dev
:
true
dev
:
true
/prettier-plugin-solidity@1.0.0-beta.18(prettier@2.8.
1
)
:
/prettier-plugin-solidity@1.0.0-beta.18(prettier@2.8.
8
)
:
resolution
:
{
integrity
:
sha512-ezWdsG/jIeClmYBzg8V9Voy8jujt+VxWF8OS3Vld+C3c+3cPVib8D9l8ahTod7O5Df1anK9zo+WiiS5wb1mLmg==
}
resolution
:
{
integrity
:
sha512-ezWdsG/jIeClmYBzg8V9Voy8jujt+VxWF8OS3Vld+C3c+3cPVib8D9l8ahTod7O5Df1anK9zo+WiiS5wb1mLmg==
}
engines
:
{
node
:
'
>=12'
}
engines
:
{
node
:
'
>=12'
}
peerDependencies
:
peerDependencies
:
...
@@ -13777,22 +13777,16 @@ packages:
...
@@ -13777,22 +13777,16 @@ packages:
'
@solidity-parser/parser'
:
0.13.2
'
@solidity-parser/parser'
:
0.13.2
emoji-regex
:
9.2.2
emoji-regex
:
9.2.2
escape-string-regexp
:
4.0.0
escape-string-regexp
:
4.0.0
prettier
:
2.8.
1
prettier
:
2.8.
8
semver
:
7.5.3
semver
:
7.5.3
solidity-comments-extractor
:
0.0.7
solidity-comments-extractor
:
0.0.7
string-width
:
4.2.3
string-width
:
4.2.3
dev
:
true
dev
:
true
/prettier@2.8.1
:
resolution
:
{
integrity
:
sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==
}
engines
:
{
node
:
'
>=10.13.0'
}
hasBin
:
true
/prettier@2.8.8
:
/prettier@2.8.8
:
resolution
:
{
integrity
:
sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
}
resolution
:
{
integrity
:
sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
}
engines
:
{
node
:
'
>=10.13.0'
}
engines
:
{
node
:
'
>=10.13.0'
}
hasBin
:
true
hasBin
:
true
dev
:
true
/pretty-format@27.5.1
:
/pretty-format@27.5.1
:
resolution
:
{
integrity
:
sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==
}
resolution
:
{
integrity
:
sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==
}
...
...
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