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
0d754217
Unverified
Commit
0d754217
authored
Sep 10, 2022
by
Matthew Slipper
Committed by
GitHub
Sep 10, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into fix/remove-x
parents
cf613a35
25b088f9
Changes
83
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
83 changed files
with
345 additions
and
951 deletions
+345
-951
gorgeous-waves-allow.md
.changeset/gorgeous-waves-allow.md
+5
-0
serious-deers-end.md
.changeset/serious-deers-end.md
+5
-0
batch_submitter.go
op-batcher/batch_submitter.go
+6
-6
main.go
op-batcher/cmd/main.go
+2
-3
config.go
op-batcher/config.go
+4
-7
flags.go
op-batcher/flags/flags.go
+2
-1
driver.go
op-batcher/sequencer/driver.go
+2
-2
system_test.go
op-e2e/system_test.go
+3
-3
rpc.go
op-node/client/rpc.go
+2
-1
cmd.go
op-node/cmd/genesis/cmd.go
+6
-8
main.go
op-node/cmd/main.go
+5
-10
ssz_test.go
op-node/eth/ssz_test.go
+1
-1
sync_status.go
op-node/eth/sync_status.go
+27
-0
types.go
op-node/eth/types.go
+2
-2
service_test.go
op-node/heartbeat/service_test.go
+2
-1
metrics.go
op-node/metrics/metrics.go
+5
-6
api.go
op-node/node/api.go
+2
-3
comms.go
op-node/node/comms.go
+2
-1
log.go
op-node/node/log.go
+2
-1
node.go
op-node/node/node.go
+1
-3
server.go
op-node/node/server.go
+1
-5
server_test.go
op-node/node/server_test.go
+12
-20
config.go
op-node/p2p/config.go
+6
-5
discovery.go
op-node/p2p/discovery.go
+5
-4
gossip.go
op-node/p2p/gossip.go
+7
-8
host.go
op-node/p2p/host.go
+2
-2
host_test.go
op-node/p2p/host_test.go
+8
-9
node.go
op-node/p2p/node.go
+5
-5
notifications.go
op-node/p2p/notifications.go
+2
-1
prepared.go
op-node/p2p/prepared.go
+2
-3
rpc_api.go
op-node/p2p/rpc_api.go
+2
-1
rpc_client.go
op-node/p2p/rpc_client.go
+2
-1
rpc_server.go
op-node/p2p/rpc_server.go
+6
-6
signer.go
op-node/p2p/signer.go
+2
-1
attributes_queue_test.go
op-node/rollup/derive/attributes_queue_test.go
+2
-1
attributes_test.go
op-node/rollup/derive/attributes_test.go
+2
-1
batch.go
op-node/rollup/derive/batch.go
+0
-1
batch_queue_test.go
op-node/rollup/derive/batch_queue_test.go
+2
-2
batch_test.go
op-node/rollup/derive/batch_test.go
+2
-2
batches_test.go
op-node/rollup/derive/batches_test.go
+5
-5
calldata_source_test.go
op-node/rollup/derive/calldata_source_test.go
+2
-1
channel_bank_test.go
op-node/rollup/derive/channel_bank_test.go
+2
-1
deposit_log.go
op-node/rollup/derive/deposit_log.go
+2
-1
deposit_log_test.go
op-node/rollup/derive/deposit_log_test.go
+3
-2
engine_queue.go
op-node/rollup/derive/engine_queue.go
+1
-0
engine_queue_test.go
op-node/rollup/derive/engine_queue_test.go
+2
-1
fuzz_parsers_test.go
op-node/rollup/derive/fuzz_parsers_test.go
+3
-2
l1_block_info.go
op-node/rollup/derive/l1_block_info.go
+1
-2
l1_block_info_test.go
op-node/rollup/derive/l1_block_info_test.go
+3
-2
l1_retrieval_test.go
op-node/rollup/derive/l1_retrieval_test.go
+3
-2
l1_traversal_test.go
op-node/rollup/derive/l1_traversal_test.go
+2
-1
payloads_queue_test.go
op-node/rollup/derive/payloads_queue_test.go
+2
-1
pipeline_test.go
op-node/rollup/derive/pipeline_test.go
+2
-1
conf_depth_test.go
op-node/rollup/driver/conf_depth_test.go
+2
-1
driver.go
op-node/rollup/driver/driver.go
+1
-1
state.go
op-node/rollup/driver/state.go
+7
-30
step.go
op-node/rollup/driver/step.go
+0
-1
start_test.go
op-node/rollup/sync/start_test.go
+2
-1
types_test.go
op-node/rollup/types_test.go
+2
-1
service.go
op-node/service.go
+5
-7
batching.go
op-node/sources/batching.go
+2
-1
batching_test.go
op-node/sources/batching_test.go
+1
-1
eth_client_test.go
op-node/sources/eth_client_test.go
+3
-2
limit.go
op-node/sources/limit.go
+0
-1
receipts.go
op-node/sources/receipts.go
+1
-3
rollupclient.go
op-node/sources/rollupclient.go
+43
-0
types.go
op-node/sources/types.go
+2
-3
fake_chain.go
op-node/testutils/fake_chain.go
+2
-4
mock_eth_client.go
op-node/testutils/mock_eth_client.go
+2
-1
random.go
op-node/testutils/random.go
+1
-2
main.go
op-proposer/cmd/main.go
+3
-5
config.go
op-proposer/config.go
+3
-4
driver.go
op-proposer/drivers/l2output/driver.go
+3
-2
flags.go
op-proposer/flags/flags.go
+2
-1
l2_output_submitter.go
op-proposer/l2_output_submitter.go
+8
-9
rollupclient.go
op-proposer/rollupclient/rollupclient.go
+6
-36
send_state_test.go
op-proposer/txmgr/send_state_test.go
+2
-1
txmgr_test.go
op-proposer/txmgr/txmgr_test.go
+2
-1
.storage-layout
packages/contracts-bedrock/.storage-layout
+46
-42
genesis-l1.ts
packages/contracts-bedrock/tasks/genesis-l1.ts
+0
-112
genesis-l2.ts
packages/contracts-bedrock/tasks/genesis-l2.ts
+0
-517
index.ts
packages/contracts-bedrock/tasks/index.ts
+0
-2
chain-constants.ts
packages/sdk/src/utils/chain-constants.ts
+5
-0
No files found.
.changeset/gorgeous-waves-allow.md
0 → 100644
View file @
0d754217
---
'
@eth-optimism/sdk'
:
patch
---
Add wsteth support for DAI bridge to sdk
.changeset/serious-deers-end.md
0 → 100644
View file @
0d754217
---
'
@eth-optimism/contracts-bedrock'
:
patch
---
Delete hardhat genesis tasks
op-batcher/batch_submitter.go
View file @
0d754217
...
@@ -16,16 +16,17 @@ import (
...
@@ -16,16 +16,17 @@ import (
"syscall"
"syscall"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-node/sources"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
"github.com/ethereum/go-ethereum/rpc"
hdwallet
"github.com/miguelmota/go-ethereum-hdwallet"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-batcher/sequencer"
"github.com/ethereum-optimism/optimism/op-batcher/sequencer"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -34,8 +35,7 @@ import (
...
@@ -34,8 +35,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
hdwallet
"github.com/miguelmota/go-ethereum-hdwallet"
"github.com/ethereum/go-ethereum/rpc"
"github.com/urfave/cli"
)
)
const
(
const
(
...
@@ -491,7 +491,7 @@ func dialEthClientWithTimeout(ctx context.Context, url string) (
...
@@ -491,7 +491,7 @@ func dialEthClientWithTimeout(ctx context.Context, url string) (
// dialRollupClientWithTimeout attempts to dial the RPC provider using the provided
// dialRollupClientWithTimeout attempts to dial the RPC provider using the provided
// URL. If the dial doesn't complete within defaultDialTimeout seconds, this
// URL. If the dial doesn't complete within defaultDialTimeout seconds, this
// method will return an error.
// method will return an error.
func
dialRollupClientWithTimeout
(
ctx
context
.
Context
,
url
string
)
(
*
rollupclient
.
RollupClient
,
error
)
{
func
dialRollupClientWithTimeout
(
ctx
context
.
Context
,
url
string
)
(
*
sources
.
RollupClient
,
error
)
{
ctxt
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
ctxt
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
defer
cancel
()
defer
cancel
()
...
@@ -500,7 +500,7 @@ func dialRollupClientWithTimeout(ctx context.Context, url string) (*rollupclient
...
@@ -500,7 +500,7 @@ func dialRollupClientWithTimeout(ctx context.Context, url string) (*rollupclient
return
nil
,
err
return
nil
,
err
}
}
return
rollupclient
.
NewRollupClient
(
client
),
nil
return
sources
.
NewRollupClient
(
client
),
nil
}
}
// parseAddress parses an ETH address from a hex string. This method will fail if
// parseAddress parses an ETH address from a hex string. This method will fail if
...
...
op-batcher/cmd/main.go
View file @
0d754217
...
@@ -4,13 +4,12 @@ import (
...
@@ -4,13 +4,12 @@ import (
"fmt"
"fmt"
"os"
"os"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"
"github.com/urfave/cli"
batcher
"github.com/ethereum-optimism/optimism/op-batcher"
batcher
"github.com/ethereum-optimism/optimism/op-batcher"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/log"
)
)
var
(
var
(
...
...
op-batcher/config.go
View file @
0d754217
...
@@ -3,16 +3,13 @@ package op_batcher
...
@@ -3,16 +3,13 @@ package op_batcher
import
(
import
(
"time"
"time"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
"github.com/urfave/cli"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-batcher/flags"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
)
)
type
Config
struct
{
type
Config
struct
{
...
...
op-batcher/flags/flags.go
View file @
0d754217
package
flags
package
flags
import
(
import
(
"github.com/urfave/cli"
opservice
"github.com/ethereum-optimism/optimism/op-service"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
"github.com/urfave/cli"
)
)
const
envVarPrefix
=
"OP_BATCHER"
const
envVarPrefix
=
"OP_BATCHER"
...
...
op-batcher/sequencer/driver.go
View file @
0d754217
...
@@ -5,7 +5,7 @@ import (
...
@@ -5,7 +5,7 @@ import (
"math/big"
"math/big"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-
proposer/rollupclient
"
"github.com/ethereum-optimism/optimism/op-
node/sources
"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
...
@@ -22,7 +22,7 @@ type Config struct {
...
@@ -22,7 +22,7 @@ type Config struct {
// API to hit for batch data
// API to hit for batch data
L2Client
*
ethclient
.
Client
L2Client
*
ethclient
.
Client
RollupNode
*
rollupclient
.
RollupClient
RollupNode
*
sources
.
RollupClient
// Limit the size of txs
// Limit the size of txs
MinL1TxSize
uint64
MinL1TxSize
uint64
...
...
op-e2e/system_test.go
View file @
0d754217
...
@@ -18,9 +18,9 @@ import (
...
@@ -18,9 +18,9 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/withdrawals"
"github.com/ethereum-optimism/optimism/op-node/withdrawals"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
...
@@ -168,7 +168,7 @@ func TestL2OutputSubmitter(t *testing.T) {
...
@@ -168,7 +168,7 @@ func TestL2OutputSubmitter(t *testing.T) {
rollupRPCClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
cfg
.
Nodes
[
"sequencer"
]
.
RPC
.
HttpEndpoint
())
rollupRPCClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
cfg
.
Nodes
[
"sequencer"
]
.
RPC
.
HttpEndpoint
())
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
rollupClient
:=
rollupclient
.
NewRollupClient
(
rollupRPCClient
)
rollupClient
:=
sources
.
NewRollupClient
(
rollupRPCClient
)
// OutputOracle is already deployed
// OutputOracle is already deployed
l2OutputOracle
,
err
:=
bindings
.
NewL2OutputOracleCaller
(
sys
.
L2OOContractAddr
,
l1Client
)
l2OutputOracle
,
err
:=
bindings
.
NewL2OutputOracleCaller
(
sys
.
L2OOContractAddr
,
l1Client
)
...
@@ -330,7 +330,7 @@ func TestSystemE2E(t *testing.T) {
...
@@ -330,7 +330,7 @@ func TestSystemE2E(t *testing.T) {
rollupRPCClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
cfg
.
Nodes
[
"sequencer"
]
.
RPC
.
HttpEndpoint
())
rollupRPCClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
cfg
.
Nodes
[
"sequencer"
]
.
RPC
.
HttpEndpoint
())
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
rollupClient
:=
rollupclient
.
NewRollupClient
(
rollupRPCClient
)
rollupClient
:=
sources
.
NewRollupClient
(
rollupRPCClient
)
// basic check that sync status works
// basic check that sync status works
seqStatus
,
err
:=
rollupClient
.
SyncStatus
(
context
.
Background
())
seqStatus
,
err
:=
rollupClient
.
SyncStatus
(
context
.
Background
())
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
...
...
op-node/client/rpc.go
View file @
0d754217
...
@@ -3,9 +3,10 @@ package client
...
@@ -3,9 +3,10 @@ package client
import
(
import
(
"context"
"context"
"github.com/prometheus/client_golang/prometheus"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/prometheus/client_golang/prometheus"
)
)
type
RPC
interface
{
type
RPC
interface
{
...
...
op-node/cmd/genesis/cmd.go
View file @
0d754217
...
@@ -8,19 +8,17 @@ import (
...
@@ -8,19 +8,17 @@ import (
"os"
"os"
"path/filepath"
"path/filepath"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
)
)
var
Subcommands
=
cli
.
Commands
{
var
Subcommands
=
cli
.
Commands
{
...
...
op-node/cmd/main.go
View file @
0d754217
...
@@ -9,22 +9,17 @@ import (
...
@@ -9,22 +9,17 @@ import (
"syscall"
"syscall"
"time"
"time"
"github.com/
ethereum-optimism/optimism/op-node/heartbeat
"
"github.com/
urfave/cli
"
opnode
"github.com/ethereum-optimism/optimism/op-node"
"github.com/ethereum-optimism/optimism/op-node/cmd/genesis"
"github.com/ethereum-optimism/optimism/op-node/cmd/genesis"
"github.com/ethereum-optimism/optimism/op-node/cmd/p2p"
"github.com/ethereum-optimism/optimism/op-node/cmd/p2p"
"github.com/ethereum-optimism/optimism/op-node/metrics"
opnode
"github.com/ethereum-optimism/optimism/op-node"
"github.com/ethereum-optimism/optimism/op-node/version"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/heartbeat"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/node"
"github.com/ethereum-optimism/optimism/op-node/node"
"github.com/ethereum-optimism/optimism/op-node/version"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"
)
)
var
(
var
(
...
...
op-node/eth/ssz_test.go
View file @
0d754217
...
@@ -5,10 +5,10 @@ import (
...
@@ -5,10 +5,10 @@ import (
"encoding/binary"
"encoding/binary"
"testing"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/google/go-cmp/cmp"
)
)
// FuzzExecutionPayloadUnmarshal checks that our SSZ decoding never panics
// FuzzExecutionPayloadUnmarshal checks that our SSZ decoding never panics
...
...
op-node/eth/sync_status.go
0 → 100644
View file @
0d754217
package
eth
// SyncStatus is a snapshot of the driver.
// Values may be zeroed if not yet initialized.
type
SyncStatus
struct
{
// CurrentL1 is the block that the derivation process is currently at,
// this may not be fully derived into L2 data yet.
// If the node is synced, this matches the HeadL1, minus the verifier confirmation distance.
CurrentL1
L1BlockRef
`json:"current_l1"`
// HeadL1 is the perceived head of the L1 chain, no confirmation distance.
// The head is not guaranteed to build on the other L1 sync status fields,
// as the node may be in progress of resetting to adapt to a L1 reorg.
HeadL1
L1BlockRef
`json:"head_l1"`
SafeL1
L1BlockRef
`json:"safe_l1"`
FinalizedL1
L1BlockRef
`json:"finalized_l1"`
// UnsafeL2 is the absolute tip of the L2 chain,
// pointing to block data that has not been submitted to L1 yet.
// The sequencer is building this, and verifiers may also be ahead of the
// SafeL2 block if they sync blocks via p2p or other offchain sources.
UnsafeL2
L2BlockRef
`json:"unsafe_l2"`
// SafeL2 points to the L2 block that was derived from the L1 chain.
// This point may still reorg if the L1 chain reorgs.
SafeL2
L2BlockRef
`json:"safe_l2"`
// FinalizedL2 points to the L2 block that was derived fully from
// finalized L1 information, thus irreversible.
FinalizedL2
L2BlockRef
`json:"finalized_l2"`
}
op-node/eth/types.go
View file @
0d754217
...
@@ -8,13 +8,13 @@ import (
...
@@ -8,13 +8,13 @@ import (
"math/big"
"math/big"
"reflect"
"reflect"
"github.com/
ethereum/go-ethereum/trie
"
"github.com/
holiman/uint256
"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/beacon"
"github.com/ethereum/go-ethereum/core/beacon"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/
holiman/uint256
"
"github.com/
ethereum/go-ethereum/trie
"
)
)
type
ErrorCode
int
type
ErrorCode
int
...
...
op-node/heartbeat/service_test.go
View file @
0d754217
...
@@ -8,8 +8,9 @@ import (
...
@@ -8,8 +8,9 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/log"
)
)
const
expHeartbeat
=
`{
const
expHeartbeat
=
`{
...
...
op-node/metrics/metrics.go
View file @
0d754217
...
@@ -10,16 +10,15 @@ import (
...
@@ -10,16 +10,15 @@ import (
"strconv"
"strconv"
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
)
const
(
const
(
...
...
op-node/node/api.go
View file @
0d754217
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/version"
"github.com/ethereum-optimism/optimism/op-node/version"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -23,7 +22,7 @@ type l2EthClient interface {
...
@@ -23,7 +22,7 @@ type l2EthClient interface {
}
}
type
driverClient
interface
{
type
driverClient
interface
{
SyncStatus
(
ctx
context
.
Context
)
(
*
driver
.
SyncStatus
,
error
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
ResetDerivationPipeline
(
context
.
Context
)
error
ResetDerivationPipeline
(
context
.
Context
)
error
}
}
...
@@ -97,7 +96,7 @@ func (n *nodeAPI) OutputAtBlock(ctx context.Context, number rpc.BlockNumber) ([]
...
@@ -97,7 +96,7 @@ func (n *nodeAPI) OutputAtBlock(ctx context.Context, number rpc.BlockNumber) ([]
return
[]
eth
.
Bytes32
{
l2OutputRootVersion
,
l2OutputRoot
},
nil
return
[]
eth
.
Bytes32
{
l2OutputRootVersion
,
l2OutputRoot
},
nil
}
}
func
(
n
*
nodeAPI
)
SyncStatus
(
ctx
context
.
Context
)
(
*
driver
.
SyncStatus
,
error
)
{
func
(
n
*
nodeAPI
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
{
recordDur
:=
n
.
m
.
RecordRPCServerRequest
(
"optimism_syncStatus"
)
recordDur
:=
n
.
m
.
RecordRPCServerRequest
(
"optimism_syncStatus"
)
defer
recordDur
()
defer
recordDur
()
return
n
.
dr
.
SyncStatus
(
ctx
)
return
n
.
dr
.
SyncStatus
(
ctx
)
...
...
op-node/node/comms.go
View file @
0d754217
...
@@ -3,8 +3,9 @@ package node
...
@@ -3,8 +3,9 @@ package node
import
(
import
(
"context"
"context"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/ethereum-optimism/optimism/op-node/eth"
)
)
// Tracer configures the OpNode to share events
// Tracer configures the OpNode to share events
...
...
op-node/node/log.go
View file @
0d754217
...
@@ -5,8 +5,9 @@ import (
...
@@ -5,8 +5,9 @@ import (
"os"
"os"
"strings"
"strings"
"github.com/ethereum/go-ethereum/log"
"golang.org/x/term"
"golang.org/x/term"
"github.com/ethereum/go-ethereum/log"
)
)
type
LogConfig
struct
{
type
LogConfig
struct
{
...
...
op-node/node/node.go
View file @
0d754217
...
@@ -5,9 +5,8 @@ import (
...
@@ -5,9 +5,8 @@ import (
"fmt"
"fmt"
"time"
"time"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-multierror"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
...
@@ -15,7 +14,6 @@ import (
...
@@ -15,7 +14,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
...
op-node/node/server.go
View file @
0d754217
...
@@ -7,14 +7,10 @@ import (
...
@@ -7,14 +7,10 @@ import (
"net/http"
"net/http"
"strconv"
"strconv"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
...
...
op-node/node/server_test.go
View file @
0d754217
...
@@ -4,29 +4,21 @@ import (
...
@@ -4,29 +4,21 @@ import (
"context"
"context"
"encoding/json"
"encoding/json"
"math/rand"
"math/rand"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/version"
"testing"
"testing"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/stretchr/testify/mock"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/version"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/
stretchr/testify/assert
"
"github.com/
ethereum/go-ethereum/rpc
"
)
)
func
TestOutputAtBlock
(
t
*
testing
.
T
)
{
func
TestOutputAtBlock
(
t
*
testing
.
T
)
{
...
@@ -149,7 +141,7 @@ func TestSyncStatus(t *testing.T) {
...
@@ -149,7 +141,7 @@ func TestSyncStatus(t *testing.T) {
l2Client
:=
&
testutils
.
MockL2Client
{}
l2Client
:=
&
testutils
.
MockL2Client
{}
drClient
:=
&
mockDriverClient
{}
drClient
:=
&
mockDriverClient
{}
rng
:=
rand
.
New
(
rand
.
NewSource
(
1234
))
rng
:=
rand
.
New
(
rand
.
NewSource
(
1234
))
status
:=
driver
.
SyncStatus
{
status
:=
eth
.
SyncStatus
{
CurrentL1
:
testutils
.
RandomBlockRef
(
rng
),
CurrentL1
:
testutils
.
RandomBlockRef
(
rng
),
HeadL1
:
testutils
.
RandomBlockRef
(
rng
),
HeadL1
:
testutils
.
RandomBlockRef
(
rng
),
UnsafeL2
:
testutils
.
RandomL2BlockRef
(
rng
),
UnsafeL2
:
testutils
.
RandomL2BlockRef
(
rng
),
...
@@ -173,7 +165,7 @@ func TestSyncStatus(t *testing.T) {
...
@@ -173,7 +165,7 @@ func TestSyncStatus(t *testing.T) {
client
,
err
:=
dialRPCClientWithBackoff
(
context
.
Background
(),
log
,
"http://"
+
server
.
Addr
()
.
String
())
client
,
err
:=
dialRPCClientWithBackoff
(
context
.
Background
(),
log
,
"http://"
+
server
.
Addr
()
.
String
())
assert
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
var
out
*
driver
.
SyncStatus
var
out
*
eth
.
SyncStatus
err
=
client
.
CallContext
(
context
.
Background
(),
&
out
,
"optimism_syncStatus"
)
err
=
client
.
CallContext
(
context
.
Background
(),
&
out
,
"optimism_syncStatus"
)
assert
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
&
status
,
out
)
assert
.
Equal
(
t
,
&
status
,
out
)
...
@@ -183,8 +175,8 @@ type mockDriverClient struct {
...
@@ -183,8 +175,8 @@ type mockDriverClient struct {
mock
.
Mock
mock
.
Mock
}
}
func
(
c
*
mockDriverClient
)
SyncStatus
(
ctx
context
.
Context
)
(
*
driver
.
SyncStatus
,
error
)
{
func
(
c
*
mockDriverClient
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
{
return
c
.
Mock
.
MethodCalled
(
"SyncStatus"
)
.
Get
(
0
)
.
(
*
driver
.
SyncStatus
),
nil
return
c
.
Mock
.
MethodCalled
(
"SyncStatus"
)
.
Get
(
0
)
.
(
*
eth
.
SyncStatus
),
nil
}
}
func
(
c
*
mockDriverClient
)
ResetDerivationPipeline
(
ctx
context
.
Context
)
error
{
func
(
c
*
mockDriverClient
)
ResetDerivationPipeline
(
ctx
context
.
Context
)
error
{
...
...
op-node/p2p/config.go
View file @
0d754217
...
@@ -11,11 +11,6 @@ import (
...
@@ -11,11 +11,6 @@ import (
"strings"
"strings"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
ds
"github.com/ipfs/go-datastore"
ds
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/sync"
"github.com/ipfs/go-datastore/sync"
leveldb
"github.com/ipfs/go-ds-leveldb"
leveldb
"github.com/ipfs/go-ds-leveldb"
...
@@ -34,6 +29,12 @@ import (
...
@@ -34,6 +29,12 @@ import (
tls
"github.com/libp2p/go-libp2p/p2p/security/tls"
tls
"github.com/libp2p/go-libp2p/p2p/security/tls"
"github.com/multiformats/go-multiaddr"
"github.com/multiformats/go-multiaddr"
"github.com/urfave/cli"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
)
)
// SetupP2P provides a host and discovery service for usage in the rollup node.
// SetupP2P provides a host and discovery service for usage in the rollup node.
...
...
op-node/p2p/discovery.go
View file @
0d754217
...
@@ -13,6 +13,11 @@ import (
...
@@ -13,6 +13,11 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2"
decredSecp
"github.com/decred/dcrd/dcrec/secp256k1/v4"
decredSecp
"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/multiformats/go-multiaddr"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
gcrypto
"github.com/ethereum/go-ethereum/crypto"
gcrypto
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
@@ -20,10 +25,6 @@ import (
...
@@ -20,10 +25,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/enr"
"github.com/ethereum/go-ethereum/p2p/enr"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/multiformats/go-multiaddr"
)
)
const
(
const
(
...
...
op-node/p2p/gossip.go
View file @
0d754217
...
@@ -9,19 +9,18 @@ import (
...
@@ -9,19 +9,18 @@ import (
"sync"
"sync"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
lru
"github.com/hashicorp/golang-lru"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/golang/snappy"
"github.com/golang/snappy"
lru
"github.com/hashicorp/golang-lru"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peer"
pubsub
"github.com/libp2p/go-libp2p-pubsub"
pubsub
"github.com/libp2p/go-libp2p-pubsub"
pb
"github.com/libp2p/go-libp2p-pubsub/pb"
pb
"github.com/libp2p/go-libp2p-pubsub/pb"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
)
)
func
init
()
{
func
init
()
{
...
...
op-node/p2p/host.go
View file @
0d754217
...
@@ -6,9 +6,7 @@ import (
...
@@ -6,9 +6,7 @@ import (
"net"
"net"
"time"
"time"
"github.com/ethereum/go-ethereum/log"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-peerstore/pstoreds"
"github.com/libp2p/go-libp2p-peerstore/pstoreds"
...
@@ -17,6 +15,8 @@ import (
...
@@ -17,6 +15,8 @@ import (
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
ma
"github.com/multiformats/go-multiaddr"
ma
"github.com/multiformats/go-multiaddr"
madns
"github.com/multiformats/go-multiaddr-dns"
madns
"github.com/multiformats/go-multiaddr-dns"
"github.com/ethereum/go-ethereum/log"
)
)
type
ExtraHostFeatures
interface
{
type
ExtraHostFeatures
interface
{
...
...
op-node/p2p/host_test.go
View file @
0d754217
...
@@ -8,15 +8,6 @@ import (
...
@@ -8,15 +8,6 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc"
ds
"github.com/ipfs/go-datastore"
ds
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/sync"
"github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/connmgr"
...
@@ -28,6 +19,14 @@ import (
...
@@ -28,6 +19,14 @@ import (
mocknet
"github.com/libp2p/go-libp2p/p2p/net/mock"
mocknet
"github.com/libp2p/go-libp2p/p2p/net/mock"
tswarm
"github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
tswarm
"github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc"
)
)
func
TestingConfig
(
t
*
testing
.
T
)
*
Config
{
func
TestingConfig
(
t
*
testing
.
T
)
*
Config
{
...
...
op-node/p2p/node.go
View file @
0d754217
...
@@ -6,17 +6,17 @@ import (
...
@@ -6,17 +6,17 @@ import (
"fmt"
"fmt"
"strconv"
"strconv"
"github.com/hashicorp/go-multierror"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/host"
pubsub
"github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/p2p/protocol/identify"
ma
"github.com/multiformats/go-multiaddr"
ma
"github.com/multiformats/go-multiaddr"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/hashicorp/go-multierror"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/host"
pubsub
"github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/p2p/protocol/identify"
)
)
type
NodeP2P
struct
{
type
NodeP2P
struct
{
...
...
op-node/p2p/notifications.go
View file @
0d754217
package
p2p
package
p2p
import
(
import
(
"github.com/ethereum/go-ethereum/log"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/network"
ma
"github.com/multiformats/go-multiaddr"
ma
"github.com/multiformats/go-multiaddr"
"github.com/ethereum/go-ethereum/log"
)
)
// TODO: add metrics here as well
// TODO: add metrics here as well
...
...
op-node/p2p/prepared.go
View file @
0d754217
...
@@ -4,14 +4,13 @@ import (
...
@@ -4,14 +4,13 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"github.com/
ethereum/go-ethereum/p2p/enr
"
"github.com/
libp2p/go-libp2p-core/host
"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/
libp2p/go-libp2p-core/host
"
"github.com/
ethereum/go-ethereum/p2p/enr
"
)
)
// Prepared provides a p2p host and discv5 service that is already set up.
// Prepared provides a p2p host and discv5 service that is already set up.
...
...
op-node/p2p/rpc_api.go
View file @
0d754217
...
@@ -5,9 +5,10 @@ import (
...
@@ -5,9 +5,10 @@ import (
"net"
"net"
"time"
"time"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/ethereum/go-ethereum/p2p/enode"
)
)
type
PeerInfo
struct
{
type
PeerInfo
struct
{
...
...
op-node/p2p/rpc_client.go
View file @
0d754217
...
@@ -4,9 +4,10 @@ import (
...
@@ -4,9 +4,10 @@ import (
"context"
"context"
"net"
"net"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/libp2p/go-libp2p-core/peer"
)
)
var
NamespaceRPC
=
"opp2p"
var
NamespaceRPC
=
"opp2p"
...
...
op-node/p2p/rpc_server.go
View file @
0d754217
...
@@ -7,13 +7,7 @@ import (
...
@@ -7,13 +7,7 @@ import (
"net"
"net"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-node/metrics"
decredSecp
"github.com/decred/dcrd/dcrec/secp256k1/v4"
decredSecp
"github.com/decred/dcrd/dcrec/secp256k1/v4"
gcrypto
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/host"
...
@@ -22,6 +16,12 @@ import (
...
@@ -22,6 +16,12 @@ import (
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/peerstore"
pubsub
"github.com/libp2p/go-libp2p-pubsub"
pubsub
"github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p-testing/netutil"
"github.com/libp2p/go-libp2p-testing/netutil"
"github.com/ethereum-optimism/optimism/op-node/metrics"
gcrypto
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
)
)
// TODO: dynamic peering
// TODO: dynamic peering
...
...
op-node/p2p/signer.go
View file @
0d754217
...
@@ -8,11 +8,12 @@ import (
...
@@ -8,11 +8,12 @@ import (
"io"
"io"
"math/big"
"math/big"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/urfave/cli"
)
)
var
SigningDomainBlocksV1
=
[
32
]
byte
{}
var
SigningDomainBlocksV1
=
[
32
]
byte
{}
...
...
op-node/rollup/derive/attributes_queue_test.go
View file @
0d754217
...
@@ -7,13 +7,14 @@ import (
...
@@ -7,13 +7,14 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
type
MockAttributesQueueOutput
struct
{
type
MockAttributesQueueOutput
struct
{
...
...
op-node/rollup/derive/attributes_test.go
View file @
0d754217
...
@@ -8,12 +8,13 @@ import (
...
@@ -8,12 +8,13 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/require"
)
)
func
TestPreparePayloadAttributes
(
t
*
testing
.
T
)
{
func
TestPreparePayloadAttributes
(
t
*
testing
.
T
)
{
...
...
op-node/rollup/derive/batch.go
View file @
0d754217
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"sync"
"sync"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
...
...
op-node/rollup/derive/batch_queue_test.go
View file @
0d754217
...
@@ -7,15 +7,15 @@ import (
...
@@ -7,15 +7,15 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/
ethereum/go-ethereum/common
"
"github.com/
stretchr/testify/require
"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
// fakeBatchQueueOutput fakes the next stage (receive only) for the batch queue
// fakeBatchQueueOutput fakes the next stage (receive only) for the batch queue
...
...
op-node/rollup/derive/batch_test.go
View file @
0d754217
...
@@ -3,10 +3,10 @@ package derive
...
@@ -3,10 +3,10 @@ package derive
import
(
import
(
"testing"
"testing"
"github.com/
ethereum/go-ethereum/common
"
"github.com/
stretchr/testify/assert
"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/stretchr/testify/assert"
)
)
func
TestBatchRoundTrip
(
t
*
testing
.
T
)
{
func
TestBatchRoundTrip
(
t
*
testing
.
T
)
{
...
...
op-node/rollup/derive/batches_test.go
View file @
0d754217
...
@@ -4,16 +4,16 @@ import (
...
@@ -4,16 +4,16 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
)
)
type
ValidBatchTestCase
struct
{
type
ValidBatchTestCase
struct
{
...
...
op-node/rollup/derive/calldata_source_test.go
View file @
0d754217
...
@@ -9,6 +9,8 @@ import (
...
@@ -9,6 +9,8 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
...
@@ -18,7 +20,6 @@ import (
...
@@ -18,7 +20,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/stretchr/testify/require"
)
)
type
testTx
struct
{
type
testTx
struct
{
...
...
op-node/rollup/derive/channel_bank_test.go
View file @
0d754217
...
@@ -8,12 +8,13 @@ import (
...
@@ -8,12 +8,13 @@ import (
"strings"
"strings"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
type
MockChannelBankOutput
struct
{
type
MockChannelBankOutput
struct
{
...
...
op-node/rollup/derive/deposit_log.go
View file @
0d754217
...
@@ -5,10 +5,11 @@ import (
...
@@ -5,10 +5,11 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/holiman/uint256"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
)
)
var
(
var
(
...
...
op-node/rollup/derive/deposit_log_test.go
View file @
0d754217
...
@@ -5,11 +5,12 @@ import (
...
@@ -5,11 +5,12 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
)
func
TestUnmarshalLogEvent
(
t
*
testing
.
T
)
{
func
TestUnmarshalLogEvent
(
t
*
testing
.
T
)
{
...
...
op-node/rollup/derive/engine_queue.go
View file @
0d754217
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
...
...
op-node/rollup/derive/engine_queue_test.go
View file @
0d754217
...
@@ -4,13 +4,14 @@ import (
...
@@ -4,13 +4,14 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
func
TestEngineQueue_Finalize
(
t
*
testing
.
T
)
{
func
TestEngineQueue_Finalize
(
t
*
testing
.
T
)
{
...
...
op-node/rollup/derive/fuzz_parsers_test.go
View file @
0d754217
...
@@ -5,6 +5,9 @@ import (
...
@@ -5,6 +5,9 @@ import (
"math/big"
"math/big"
"testing"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
...
@@ -14,8 +17,6 @@ import (
...
@@ -14,8 +17,6 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm/runtime"
"github.com/ethereum/go-ethereum/core/vm/runtime"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
)
)
var
(
var
(
...
...
op-node/rollup/derive/l1_block_info.go
View file @
0d754217
...
@@ -6,9 +6,8 @@ import (
...
@@ -6,9 +6,8 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
...
...
op-node/rollup/derive/l1_block_info_test.go
View file @
0d754217
...
@@ -5,11 +5,12 @@ import (
...
@@ -5,11 +5,12 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
)
var
_
eth
.
BlockInfo
=
(
*
testutils
.
MockBlockInfo
)(
nil
)
var
_
eth
.
BlockInfo
=
(
*
testutils
.
MockBlockInfo
)(
nil
)
...
...
op-node/rollup/derive/l1_retrieval_test.go
View file @
0d754217
...
@@ -5,12 +5,13 @@ import (
...
@@ -5,12 +5,13 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
)
type
MockDataSource
struct
{
type
MockDataSource
struct
{
...
...
op-node/rollup/derive/l1_traversal_test.go
View file @
0d754217
...
@@ -5,11 +5,12 @@ import (
...
@@ -5,11 +5,12 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
func
TestL1Traversal_Step
(
t
*
testing
.
T
)
{
func
TestL1Traversal_Step
(
t
*
testing
.
T
)
{
...
...
op-node/rollup/derive/payloads_queue_test.go
View file @
0d754217
...
@@ -4,8 +4,9 @@ import (
...
@@ -4,8 +4,9 @@ import (
"container/heap"
"container/heap"
"testing"
"testing"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
)
)
func
TestPayloadsByNumber
(
t
*
testing
.
T
)
{
func
TestPayloadsByNumber
(
t
*
testing
.
T
)
{
...
...
op-node/rollup/derive/pipeline_test.go
View file @
0d754217
...
@@ -5,9 +5,10 @@ import (
...
@@ -5,9 +5,10 @@ import (
"io"
"io"
"testing"
"testing"
"github.com/stretchr/testify/mock"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/stretchr/testify/mock"
)
)
var
_
Engine
=
(
*
testutils
.
MockEngine
)(
nil
)
var
_
Engine
=
(
*
testutils
.
MockEngine
)(
nil
)
...
...
op-node/rollup/driver/conf_depth_test.go
View file @
0d754217
...
@@ -4,10 +4,11 @@ import (
...
@@ -4,10 +4,11 @@ import (
"context"
"context"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/stretchr/testify/require"
)
)
type
confTest
struct
{
type
confTest
struct
{
...
...
op-node/rollup/driver/driver.go
View file @
0d754217
...
@@ -106,7 +106,7 @@ func (d *Driver) ResetDerivationPipeline(ctx context.Context) error {
...
@@ -106,7 +106,7 @@ func (d *Driver) ResetDerivationPipeline(ctx context.Context) error {
return
d
.
s
.
ResetDerivationPipeline
(
ctx
)
return
d
.
s
.
ResetDerivationPipeline
(
ctx
)
}
}
func
(
d
*
Driver
)
SyncStatus
(
ctx
context
.
Context
)
(
*
SyncStatus
,
error
)
{
func
(
d
*
Driver
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
{
return
d
.
s
.
SyncStatus
(
ctx
)
return
d
.
s
.
SyncStatus
(
ctx
)
}
}
...
...
op-node/rollup/driver/state.go
View file @
0d754217
...
@@ -16,31 +16,8 @@ import (
...
@@ -16,31 +16,8 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
)
)
// SyncStatus is a snapshot of the driver.
// Deprecated: use eth.SyncStatus instead.
// Values may be zeroed if not yet initialized.
type
SyncStatus
=
eth
.
SyncStatus
type
SyncStatus
struct
{
// CurrentL1 is the block that the derivation process is currently at,
// this may not be fully derived into L2 data yet.
// If the node is synced, this matches the HeadL1, minus the verifier confirmation distance.
CurrentL1
eth
.
L1BlockRef
`json:"current_l1"`
// HeadL1 is the perceived head of the L1 chain, no confirmation distance.
// The head is not guaranteed to build on the other L1 sync status fields,
// as the node may be in progress of resetting to adapt to a L1 reorg.
HeadL1
eth
.
L1BlockRef
`json:"head_l1"`
SafeL1
eth
.
L1BlockRef
`json:"safe_l1"`
FinalizedL1
eth
.
L1BlockRef
`json:"finalized_l1"`
// UnsafeL2 is the absolute tip of the L2 chain,
// pointing to block data that has not been submitted to L1 yet.
// The sequencer is building this, and verifiers may also be ahead of the
// SafeL2 block if they sync blocks via p2p or other offchain sources.
UnsafeL2
eth
.
L2BlockRef
`json:"unsafe_l2"`
// SafeL2 points to the L2 block that was derived from the L1 chain.
// This point may still reorg if the L1 chain reorgs.
SafeL2
eth
.
L2BlockRef
`json:"safe_l2"`
// FinalizedL2 points to the L2 block that was derived fully from
// finalized L1 information, thus irreversible.
FinalizedL2
eth
.
L2BlockRef
`json:"finalized_l2"`
}
type
state
struct
{
type
state
struct
{
// Latest recorded head, safe block and finalized block of the L1 Chain, independent of derivation work
// Latest recorded head, safe block and finalized block of the L1 Chain, independent of derivation work
...
@@ -56,7 +33,7 @@ type state struct {
...
@@ -56,7 +33,7 @@ type state struct {
idleDerivation
bool
idleDerivation
bool
// Requests for sync status. Synchronized with event loop to avoid reading an inconsistent sync status.
// Requests for sync status. Synchronized with event loop to avoid reading an inconsistent sync status.
syncStatusReq
chan
chan
SyncStatus
syncStatusReq
chan
chan
eth
.
SyncStatus
// Upon receiving a channel in this channel, the derivation pipeline is forced to be reset.
// Upon receiving a channel in this channel, the derivation pipeline is forced to be reset.
// It tells the caller that the reset occurred by closing the passed in channel.
// It tells the caller that the reset occurred by closing the passed in channel.
...
@@ -101,7 +78,7 @@ func NewState(driverCfg *Config, log log.Logger, snapshotLog log.Logger, config
...
@@ -101,7 +78,7 @@ func NewState(driverCfg *Config, log log.Logger, snapshotLog log.Logger, config
return
&
state
{
return
&
state
{
derivation
:
derivationPipeline
,
derivation
:
derivationPipeline
,
idleDerivation
:
false
,
idleDerivation
:
false
,
syncStatusReq
:
make
(
chan
chan
SyncStatus
,
10
),
syncStatusReq
:
make
(
chan
chan
eth
.
SyncStatus
,
10
),
forceReset
:
make
(
chan
chan
struct
{},
10
),
forceReset
:
make
(
chan
chan
struct
{},
10
),
Config
:
config
,
Config
:
config
,
DriverConfig
:
driverCfg
,
DriverConfig
:
driverCfg
,
...
@@ -472,7 +449,7 @@ func (s *state) eventLoop() {
...
@@ -472,7 +449,7 @@ func (s *state) eventLoop() {
reqStep
()
// continue with the next step if we can
reqStep
()
// continue with the next step if we can
}
}
case
respCh
:=
<-
s
.
syncStatusReq
:
case
respCh
:=
<-
s
.
syncStatusReq
:
respCh
<-
SyncStatus
{
respCh
<-
eth
.
SyncStatus
{
CurrentL1
:
s
.
derivation
.
Progress
()
.
Origin
,
CurrentL1
:
s
.
derivation
.
Progress
()
.
Origin
,
HeadL1
:
s
.
l1Head
,
HeadL1
:
s
.
l1Head
,
SafeL1
:
s
.
l1Safe
,
SafeL1
:
s
.
l1Safe
,
...
@@ -510,8 +487,8 @@ func (s *state) ResetDerivationPipeline(ctx context.Context) error {
...
@@ -510,8 +487,8 @@ func (s *state) ResetDerivationPipeline(ctx context.Context) error {
}
}
}
}
func
(
s
*
state
)
SyncStatus
(
ctx
context
.
Context
)
(
*
SyncStatus
,
error
)
{
func
(
s
*
state
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
{
respCh
:=
make
(
chan
SyncStatus
)
respCh
:=
make
(
chan
eth
.
SyncStatus
)
select
{
select
{
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
return
nil
,
ctx
.
Err
()
return
nil
,
ctx
.
Err
()
...
...
op-node/rollup/driver/step.go
View file @
0d754217
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
)
)
...
...
op-node/rollup/sync/start_test.go
View file @
0d754217
...
@@ -4,13 +4,14 @@ import (
...
@@ -4,13 +4,14 @@ import (
"context"
"context"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
var
_
L1Chain
=
(
*
testutils
.
FakeChainSource
)(
nil
)
var
_
L1Chain
=
(
*
testutils
.
FakeChainSource
)(
nil
)
...
...
op-node/rollup/types_test.go
View file @
0d754217
...
@@ -7,9 +7,10 @@ import (
...
@@ -7,9 +7,10 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/stretchr/testify/assert"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
)
)
func
randConfig
()
*
Config
{
func
randConfig
()
*
Config
{
...
...
op-node/service.go
View file @
0d754217
...
@@ -8,18 +8,16 @@ import (
...
@@ -8,18 +8,16 @@ import (
"os"
"os"
"strings"
"strings"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/urfave/cli"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/flags"
"github.com/ethereum-optimism/optimism/op-node/node"
"github.com/ethereum-optimism/optimism/op-node/node"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/p2p"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
)
)
// NewConfig creates a Config from the provided flags or environment variables.
// NewConfig creates a Config from the provided flags or environment variables.
...
...
op-node/sources/batching.go
View file @
0d754217
...
@@ -7,8 +7,9 @@ import (
...
@@ -7,8 +7,9 @@ import (
"sync"
"sync"
"sync/atomic"
"sync/atomic"
"github.com/ethereum/go-ethereum/rpc"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-multierror"
"github.com/ethereum/go-ethereum/rpc"
)
)
// IterativeBatchCall is an util to create a job to fetch many RPC requests in batches,
// IterativeBatchCall is an util to create a job to fetch many RPC requests in batches,
...
...
op-node/sources/batching_test.go
View file @
0d754217
...
@@ -8,10 +8,10 @@ import (
...
@@ -8,10 +8,10 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/stretchr/testify/mock"
)
)
type
elemCall
struct
{
type
elemCall
struct
{
...
...
op-node/sources/eth_client_test.go
View file @
0d754217
...
@@ -6,6 +6,9 @@ import (
...
@@ -6,6 +6,9 @@ import (
"math/rand"
"math/rand"
"testing"
"testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
...
@@ -13,8 +16,6 @@ import (
...
@@ -13,8 +16,6 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
)
type
mockRPC
struct
{
type
mockRPC
struct
{
...
...
op-node/sources/limit.go
View file @
0d754217
...
@@ -5,7 +5,6 @@ import (
...
@@ -5,7 +5,6 @@ import (
"sync"
"sync"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
)
)
...
...
op-node/sources/receipts.go
View file @
0d754217
...
@@ -4,12 +4,10 @@ import (
...
@@ -4,12 +4,10 @@ import (
"fmt"
"fmt"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/core/types"
)
)
func
makeReceiptsFn
(
block
eth
.
BlockID
,
receiptHash
common
.
Hash
)
func
(
txHashes
[]
common
.
Hash
,
receipts
[]
*
types
.
Receipt
)
(
types
.
Receipts
,
error
)
{
func
makeReceiptsFn
(
block
eth
.
BlockID
,
receiptHash
common
.
Hash
)
func
(
txHashes
[]
common
.
Hash
,
receipts
[]
*
types
.
Receipt
)
(
types
.
Receipts
,
error
)
{
...
...
op-node/sources/rollupclient.go
0 → 100644
View file @
0d754217
package
sources
import
(
"context"
"math/big"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
)
type
RollupClient
struct
{
rpc
*
rpc
.
Client
}
func
NewRollupClient
(
rpc
*
rpc
.
Client
)
*
RollupClient
{
return
&
RollupClient
{
rpc
}
}
func
(
r
*
RollupClient
)
OutputAtBlock
(
ctx
context
.
Context
,
blockNum
*
big
.
Int
)
([]
eth
.
Bytes32
,
error
)
{
var
output
[]
eth
.
Bytes32
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_outputAtBlock"
,
hexutil
.
EncodeBig
(
blockNum
))
return
output
,
err
}
func
(
r
*
RollupClient
)
SyncStatus
(
ctx
context
.
Context
)
(
*
eth
.
SyncStatus
,
error
)
{
var
output
*
eth
.
SyncStatus
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_syncStatus"
)
return
output
,
err
}
func
(
r
*
RollupClient
)
RollupConfig
(
ctx
context
.
Context
)
(
*
rollup
.
Config
,
error
)
{
var
output
*
rollup
.
Config
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_rollupConfig"
)
return
output
,
err
}
func
(
r
*
RollupClient
)
Version
(
ctx
context
.
Context
)
(
string
,
error
)
{
var
output
string
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_version"
)
return
output
,
err
}
op-node/sources/types.go
View file @
0d754217
...
@@ -5,14 +5,13 @@ import (
...
@@ -5,14 +5,13 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/holiman/uint256"
"github.com/holiman/uint256"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie"
)
)
...
...
op-node/testutils/fake_chain.go
View file @
0d754217
...
@@ -6,13 +6,11 @@ import (
...
@@ -6,13 +6,11 @@ import (
"fmt"
"fmt"
"math/big"
"math/big"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
)
)
func
FakeGenesis
(
l1
rune
,
l2
rune
,
l1GenesisNumber
int
)
rollup
.
Genesis
{
func
FakeGenesis
(
l1
rune
,
l2
rune
,
l1GenesisNumber
int
)
rollup
.
Genesis
{
...
...
op-node/testutils/mock_eth_client.go
View file @
0d754217
...
@@ -3,11 +3,12 @@ package testutils
...
@@ -3,11 +3,12 @@ package testutils
import
(
import
(
"context"
"context"
"github.com/stretchr/testify/mock"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/stretchr/testify/mock"
)
)
type
MockEthClient
struct
{
type
MockEthClient
struct
{
...
...
op-node/testutils/random.go
View file @
0d754217
...
@@ -6,9 +6,8 @@ import (
...
@@ -6,9 +6,8 @@ import (
"math/rand"
"math/rand"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
)
func
RandomHash
(
rng
*
rand
.
Rand
)
(
out
common
.
Hash
)
{
func
RandomHash
(
rng
*
rand
.
Rand
)
(
out
common
.
Hash
)
{
...
...
op-proposer/cmd/main.go
View file @
0d754217
...
@@ -4,14 +4,12 @@ import (
...
@@ -4,14 +4,12 @@ import (
"fmt"
"fmt"
"os"
"os"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
proposer
"github.com/ethereum-optimism/optimism/op-proposer"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"
"github.com/urfave/cli"
proposer
"github.com/ethereum-optimism/optimism/op-proposer"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum/go-ethereum/log"
)
)
var
(
var
(
...
...
op-proposer/config.go
View file @
0d754217
...
@@ -3,14 +3,13 @@ package op_proposer
...
@@ -3,14 +3,13 @@ package op_proposer
import
(
import
(
"time"
"time"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-proposer/flags"
)
)
type
Config
struct
{
type
Config
struct
{
...
...
op-proposer/drivers/l2output/driver.go
View file @
0d754217
...
@@ -7,9 +7,10 @@ import (
...
@@ -7,9 +7,10 @@ import (
"math/big"
"math/big"
"strings"
"strings"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -27,7 +28,7 @@ type Config struct {
...
@@ -27,7 +28,7 @@ type Config struct {
Name
string
Name
string
L1Client
*
ethclient
.
Client
L1Client
*
ethclient
.
Client
L2Client
*
ethclient
.
Client
L2Client
*
ethclient
.
Client
RollupClient
*
rollupclient
.
RollupClient
RollupClient
*
sources
.
RollupClient
L2OOAddr
common
.
Address
L2OOAddr
common
.
Address
ChainID
*
big
.
Int
ChainID
*
big
.
Int
PrivKey
*
ecdsa
.
PrivateKey
PrivKey
*
ecdsa
.
PrivateKey
...
...
op-proposer/flags/flags.go
View file @
0d754217
package
flags
package
flags
import
(
import
(
"github.com/urfave/cli"
opservice
"github.com/ethereum-optimism/optimism/op-service"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
"github.com/urfave/cli"
)
)
const
envVarPrefix
=
"OP_PROPOSER"
const
envVarPrefix
=
"OP_PROPOSER"
...
...
op-proposer/l2_output_submitter.go
View file @
0d754217
...
@@ -12,23 +12,22 @@ import (
...
@@ -12,23 +12,22 @@ import (
"syscall"
"syscall"
"time"
"time"
"github.com/ethereum/go-ethereum/crypto"
hdwallet
"github.com/miguelmota/go-ethereum-hdwallet"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-node/sources"
"github.com/ethereum-optimism/optimism/op-proposer/drivers/l2output"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
"github.com/ethereum-optimism/optimism/op-proposer/drivers/l2output"
"github.com/ethereum-optimism/optimism/op-proposer/rollupclient"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
hdwallet
"github.com/miguelmota/go-ethereum-hdwallet"
"github.com/urfave/cli"
)
)
const
(
const
(
...
@@ -247,7 +246,7 @@ func dialEthClientWithTimeout(ctx context.Context, url string) (
...
@@ -247,7 +246,7 @@ func dialEthClientWithTimeout(ctx context.Context, url string) (
// dialRollupClientWithTimeout attempts to dial the RPC provider using the provided
// dialRollupClientWithTimeout attempts to dial the RPC provider using the provided
// URL. If the dial doesn't complete within defaultDialTimeout seconds, this
// URL. If the dial doesn't complete within defaultDialTimeout seconds, this
// method will return an error.
// method will return an error.
func
dialRollupClientWithTimeout
(
ctx
context
.
Context
,
url
string
)
(
*
rollupclient
.
RollupClient
,
error
)
{
func
dialRollupClientWithTimeout
(
ctx
context
.
Context
,
url
string
)
(
*
sources
.
RollupClient
,
error
)
{
ctxt
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
ctxt
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
defer
cancel
()
defer
cancel
()
...
@@ -256,7 +255,7 @@ func dialRollupClientWithTimeout(ctx context.Context, url string) (*rollupclient
...
@@ -256,7 +255,7 @@ func dialRollupClientWithTimeout(ctx context.Context, url string) (*rollupclient
return
nil
,
err
return
nil
,
err
}
}
return
rollupclient
.
NewRollupClient
(
client
),
nil
return
sources
.
NewRollupClient
(
client
),
nil
}
}
// parseAddress parses an ETH address from a hex string. This method will fail if
// parseAddress parses an ETH address from a hex string. This method will fail if
...
...
op-proposer/rollupclient/rollupclient.go
View file @
0d754217
package
rollupclient
package
rollupclient
import
(
import
(
"context"
"github.com/ethereum-optimism/optimism/op-node/sources"
"math/big"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/driver"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
)
)
type
RollupClient
struct
{
// Deprecated: use sources.RollupClient instead
rpc
*
rpc
.
Client
type
RollupClient
=
sources
.
RollupClient
}
func
NewRollupClient
(
rpc
*
rpc
.
Client
)
*
RollupClient
{
return
&
RollupClient
{
rpc
}
}
func
(
r
*
RollupClient
)
OutputAtBlock
(
ctx
context
.
Context
,
blockNum
*
big
.
Int
)
([]
eth
.
Bytes32
,
error
)
{
var
output
[]
eth
.
Bytes32
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_outputAtBlock"
,
hexutil
.
EncodeBig
(
blockNum
))
return
output
,
err
}
func
(
r
*
RollupClient
)
SyncStatus
(
ctx
context
.
Context
)
(
*
driver
.
SyncStatus
,
error
)
{
var
output
*
driver
.
SyncStatus
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_syncStatus"
)
return
output
,
err
}
func
(
r
*
RollupClient
)
RollupConfig
(
ctx
context
.
Context
)
(
*
rollup
.
Config
,
error
)
{
var
output
*
rollup
.
Config
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_rollupConfig"
)
return
output
,
err
}
func
(
r
*
RollupClient
)
Version
(
ctx
context
.
Context
)
(
string
,
error
)
{
// Deprecated: use sources.NewRollupClient instead
var
output
string
func
NewRollupClient
(
rpc
*
rpc
.
Client
)
*
sources
.
RollupClient
{
err
:=
r
.
rpc
.
CallContext
(
ctx
,
&
output
,
"optimism_version"
)
return
sources
.
NewRollupClient
(
rpc
)
return
output
,
err
}
}
op-proposer/txmgr/send_state_test.go
View file @
0d754217
...
@@ -4,10 +4,11 @@ import (
...
@@ -4,10 +4,11 @@ import (
"errors"
"errors"
"testing"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/stretchr/testify/require"
)
)
const
testSafeAbortNonceTooLowCount
=
3
const
testSafeAbortNonceTooLowCount
=
3
...
...
op-proposer/txmgr/txmgr_test.go
View file @
0d754217
...
@@ -8,12 +8,13 @@ import (
...
@@ -8,12 +8,13 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum-optimism/optimism/op-proposer/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require"
)
)
// testHarness houses the necessary resources to test the SimpleTxManager.
// testHarness houses the necessary resources to test the SimpleTxManager.
...
...
packages/contracts-bedrock/.storage-layout
View file @
0d754217
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/tasks/genesis-l1.ts
deleted
100644 → 0
View file @
cf613a35
import
fs
from
'
fs
'
import
{
ethers
}
from
'
ethers
'
import
{
task
,
types
}
from
'
hardhat/config
'
import
{
Genesis
,
State
}
from
'
@eth-optimism/core-utils
'
import
'
@eth-optimism/hardhat-deploy-config
'
task
(
'
genesis-l1
'
,
'
create a genesis config
'
)
.
addOptionalParam
(
'
outfile
'
,
'
The file to write the output JSON to
'
,
'
genesis.json
'
)
.
addOptionalParam
(
'
l1GenesisBlockTimestamp
'
,
'
Timestamp to embed in L1 genesis block, current time will be used if the timestamp is zero
'
,
0
,
types
.
int
)
.
setAction
(
async
(
args
,
hre
)
=>
{
const
{
deployConfig
}
=
hre
const
alloc
:
State
=
{}
const
l1GenesisBlockTimestamp
=
args
.
l1GenesisBlockTimestamp
===
0
?
Math
.
floor
(
Date
.
now
()
/
1000
)
:
args
.
l1GenesisBlockTimestamp
// Give each predeploy a single wei
for
(
let
i
=
0
;
i
<=
0xff
;
i
++
)
{
const
buf
=
Buffer
.
alloc
(
2
)
buf
.
writeUInt16BE
(
i
,
0
)
const
addr
=
ethers
.
utils
.
hexConcat
([
'
0x000000000000000000000000000000000000
'
,
ethers
.
utils
.
hexZeroPad
(
buf
,
2
),
])
alloc
[
addr
]
=
{
balance
:
'
0x1
'
,
}
}
const
accounts
=
[
'
0x14dC79964da2C08b23698B3D3cc7Ca32193d9955
'
,
'
0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65
'
,
'
0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec
'
,
'
0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f
'
,
'
0x2546BcD3c84621e976D8185a91A922aE77ECEc30
'
,
'
0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
'
,
'
0x70997970C51812dc3A010C7d01b50e0d17dc79C8
'
,
'
0x71bE63f3384f5fb98995898A86B02Fb2426c5788
'
,
'
0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199
'
,
'
0x90F79bf6EB2c4f870365E785982E1f101E93b906
'
,
'
0x976EA74026E726554dB657fA54763abd0C3a0aa9
'
,
'
0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc
'
,
'
0xBcd4042DE499D14e55001CcbB24a551F3b954096
'
,
'
0xFABB0ac9d68B0B445fB7357272Ff202C5651694a
'
,
'
0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
'
,
'
0xbDA5747bFD65F08deb54cb465eB87D40e51B197E
'
,
'
0xcd3B766CCDd6AE721141F452C550Ca635964ce71
'
,
'
0xdD2FD4581271e230360230F9337D5c0430Bf44C0
'
,
'
0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097
'
,
'
0xde3829a23df1479438622a08a116e8eb3f620bb5
'
,
'
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
'
,
]
for
(
const
account
of
accounts
)
{
alloc
[
ethers
.
utils
.
getAddress
(
account
)]
=
{
balance
:
'
0x200000000000000000000000000000000000000000000000000000000000000
'
,
}
}
const
genesis
:
Genesis
=
{
config
:
{
chainId
:
deployConfig
.
l1ChainID
,
homesteadBlock
:
0
,
eip150Block
:
0
,
eip150Hash
:
ethers
.
constants
.
HashZero
,
eip155Block
:
0
,
eip158Block
:
0
,
byzantiumBlock
:
0
,
constantinopleBlock
:
0
,
petersburgBlock
:
0
,
istanbulBlock
:
0
,
muirGlacierBlock
:
0
,
berlinBlock
:
0
,
londonBlock
:
0
,
clique
:
{
period
:
deployConfig
.
l1BlockTime
,
epoch
:
30000
,
},
},
nonce
:
deployConfig
.
l1GenesisBlockNonce
,
timestamp
:
ethers
.
BigNumber
.
from
(
l1GenesisBlockTimestamp
).
toHexString
(),
extraData
:
ethers
.
utils
.
hexConcat
([
ethers
.
constants
.
HashZero
,
deployConfig
.
cliqueSignerAddress
,
ethers
.
utils
.
hexZeroPad
(
'
0x
'
,
65
),
]),
gasLimit
:
deployConfig
.
l1GenesisBlockGasLimit
,
difficulty
:
deployConfig
.
l1GenesisBlockDifficulty
,
mixHash
:
deployConfig
.
l1GenesisBlockMixHash
,
coinbase
:
deployConfig
.
l1GenesisBlockCoinbase
,
alloc
,
number
:
deployConfig
.
l1GenesisBlockNumber
,
gasUsed
:
deployConfig
.
l1GenesisBlockGasUsed
,
parentHash
:
deployConfig
.
l1GenesisBlockParentHash
,
baseFeePerGas
:
deployConfig
.
l1GenesisBlockBaseFeePerGas
,
}
fs
.
writeFileSync
(
args
.
outfile
,
JSON
.
stringify
(
genesis
,
null
,
2
))
})
packages/contracts-bedrock/tasks/genesis-l2.ts
deleted
100644 → 0
View file @
cf613a35
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/tasks/index.ts
View file @
0d754217
import
'
./genesis-l1
'
import
'
./genesis-l2
'
import
'
./deposits
'
import
'
./deposits
'
import
'
./rekey
'
import
'
./rekey
'
import
'
./rollup-config
'
import
'
./rollup-config
'
...
...
packages/sdk/src/utils/chain-constants.ts
View file @
0d754217
...
@@ -153,6 +153,11 @@ export const BRIDGE_ADAPTER_DATA: {
...
@@ -153,6 +153,11 @@ export const BRIDGE_ADAPTER_DATA: {
[
ChainID
in
L2ChainID
]?:
BridgeAdapterData
[
ChainID
in
L2ChainID
]?:
BridgeAdapterData
}
=
{
}
=
{
[
L2ChainID
.
OPTIMISM
]:
{
[
L2ChainID
.
OPTIMISM
]:
{
wstETH
:
{
Adapter
:
DAIBridgeAdapter
,
l1Bridge
:
'
0x76943C0D61395d8F2edF9060e1533529cAe05dE6
'
as
const
,
l2Bridge
:
'
0x8E01013243a96601a86eb3153F0d9Fa4fbFb6957
'
as
const
,
},
BitBTC
:
{
BitBTC
:
{
Adapter
:
StandardBridgeAdapter
,
Adapter
:
StandardBridgeAdapter
,
l1Bridge
:
'
0xaBA2c5F108F7E820C049D5Af70B16ac266c8f128
'
as
const
,
l1Bridge
:
'
0xaBA2c5F108F7E820C049D5Af70B16ac266c8f128
'
as
const
,
...
...
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