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
30f96ecf
Unverified
Commit
30f96ecf
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 08-17-feat_indexer_Add_logging_to_config/config.go
parents
88c7e239
685dc8c9
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
134 additions
and
52 deletions
+134
-52
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
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
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
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
No files found.
.changeset/wet-geese-cover.md
0 → 100644
View file @
30f96ecf
---
'
@eth-optimism/web3.js-plugin'
:
patch
---
Update code exmaples in README
.circleci/config.yml
View file @
30f96ecf
...
...
@@ -945,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 @
30f96ecf
...
...
@@ -221,17 +221,14 @@ pull_request_rules:
label
:
add
:
-
A-ops
-
name
:
Add A-pkg-
sdk label and ecopod reviewers
-
name
:
Add A-pkg-
chain-mon label
conditions
:
-
'
files~=^packages/
sdk
/'
-
'
files~=^packages/
chain-mon
/'
-
'
#label<5'
actions
:
label
:
add
:
-
A-pkg-sdk
request_reviews
:
users
:
-
roninjin10
-
A-pkg-chain-mon
-
name
:
Add A-pkg-common-ts label and ecopod reviewers
conditions
:
-
'
files~=^packages/common-ts/'
...
...
@@ -250,6 +247,57 @@ 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|specs)\/'
...
...
Makefile
View file @
30f96ecf
...
...
@@ -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 @
30f96ecf
...
...
@@ -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
)
...
...
op-bindings/Makefile
View file @
30f96ecf
SHELL
:=
/
bin/
bash
SHELL
:=
/
usr/bin/env
bash
pkg
:=
bindings
monorepo-base
:=
$(
shell
dirname
$
(
realpath
.
))
...
...
op-chain-ops/crossdomain/testdata/trace.sh
View file @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
HASH
=
$1
...
...
op-challenger/scripts/alphabet/charlie.sh
View file @
30f96ecf
#!/
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 @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
...
...
op-challenger/scripts/alphabet/mallory.sh
View file @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
SOURCE_DIR
=
$(
cd
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
&&
pwd
)
...
...
op-challenger/scripts/parallel.sh
View file @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
# set -x
...
...
op-challenger/scripts/visualize.sh
View file @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-euo
pipefail
...
...
op-node/sources/sync_client.go
View file @
30f96ecf
...
...
@@ -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 @
30f96ecf
...
...
@@ -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 @
30f96ecf
...
...
@@ -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
))
}
}
packages/contracts-bedrock/scripts/slither.sh
View file @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
rm
-rf
artifacts forge-artifacts
...
...
packages/contracts-bedrock/scripts/verify-foundry-install.sh
View file @
30f96ecf
#!/
bin/
bash
#!/
usr/bin/env
bash
if
!
command
-v
forge &> /dev/null
then
...
...
packages/web3js-plugin/README.md
View file @
30f96ecf
...
...
@@ -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