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
9055d49a
Commit
9055d49a
authored
Mar 27, 2023
by
Joshua Gutow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Remove From field
parent
6265b3e9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
93 deletions
+7
-93
batch_submitter.go
op-batcher/batcher/batch_submitter.go
+1
-1
config.go
op-batcher/batcher/config.go
+1
-3
driver.go
op-batcher/batcher/driver.go
+3
-4
driver_test.go
op-batcher/batcher/driver_test.go
+0
-81
l2_output_submitter.go
op-proposer/proposer/l2_output_submitter.go
+2
-4
No files found.
op-batcher/batcher/batch_submitter.go
View file @
9055d49a
...
@@ -73,7 +73,7 @@ func Main(version string, cliCtx *cli.Context) error {
...
@@ -73,7 +73,7 @@ func Main(version string, cliCtx *cli.Context) error {
l
.
Error
(
"error starting metrics server"
,
err
)
l
.
Error
(
"error starting metrics server"
,
err
)
}
}
}()
}()
m
.
StartBalanceMetrics
(
ctx
,
l
,
batchSubmitter
.
L1Client
,
batchSubmitter
.
From
)
m
.
StartBalanceMetrics
(
ctx
,
l
,
batchSubmitter
.
L1Client
,
batchSubmitter
.
TxManager
.
From
()
)
}
}
rpcCfg
:=
cfg
.
RPCConfig
rpcCfg
:=
cfg
.
RPCConfig
...
...
op-batcher/batcher/config.go
View file @
9055d49a
...
@@ -3,7 +3,6 @@ package batcher
...
@@ -3,7 +3,6 @@ package batcher
import
(
import
(
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"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/urfave/cli"
"github.com/urfave/cli"
...
@@ -25,10 +24,9 @@ type Config struct {
...
@@ -25,10 +24,9 @@ type Config struct {
L1Client
*
ethclient
.
Client
L1Client
*
ethclient
.
Client
L2Client
*
ethclient
.
Client
L2Client
*
ethclient
.
Client
RollupNode
*
sources
.
RollupClient
RollupNode
*
sources
.
RollupClient
TxManager
txmgr
.
TxManager
PollInterval
time
.
Duration
PollInterval
time
.
Duration
From
common
.
Address
TxManager
txmgr
.
TxManager
// RollupConfig is queried at startup
// RollupConfig is queried at startup
Rollup
*
rollup
.
Config
Rollup
*
rollup
.
Config
...
...
op-batcher/batcher/driver.go
View file @
9055d49a
...
@@ -80,7 +80,6 @@ func NewBatchSubmitterFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metri
...
@@ -80,7 +80,6 @@ func NewBatchSubmitterFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metri
RollupNode
:
rollupClient
,
RollupNode
:
rollupClient
,
PollInterval
:
cfg
.
PollInterval
,
PollInterval
:
cfg
.
PollInterval
,
TxManager
:
txManager
,
TxManager
:
txManager
,
From
:
txManager
.
From
(),
Rollup
:
rcfg
,
Rollup
:
rcfg
,
Channel
:
ChannelConfig
{
Channel
:
ChannelConfig
{
SeqWindowSize
:
rcfg
.
SeqWindowSize
,
SeqWindowSize
:
rcfg
.
SeqWindowSize
,
...
@@ -105,13 +104,13 @@ func NewBatchSubmitterFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metri
...
@@ -105,13 +104,13 @@ func NewBatchSubmitterFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metri
// NewBatchSubmitter initializes the BatchSubmitter, gathering any resources
// NewBatchSubmitter initializes the BatchSubmitter, gathering any resources
// that will be needed during operation.
// that will be needed during operation.
func
NewBatchSubmitter
(
ctx
context
.
Context
,
cfg
Config
,
l
log
.
Logger
,
m
metrics
.
Metricer
)
(
*
BatchSubmitter
,
error
)
{
func
NewBatchSubmitter
(
ctx
context
.
Context
,
cfg
Config
,
l
log
.
Logger
,
m
metrics
.
Metricer
)
(
*
BatchSubmitter
,
error
)
{
balance
,
err
:=
cfg
.
L1Client
.
BalanceAt
(
ctx
,
cfg
.
From
,
nil
)
balance
,
err
:=
cfg
.
L1Client
.
BalanceAt
(
ctx
,
cfg
.
TxManager
.
From
()
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
cfg
.
log
=
l
cfg
.
log
=
l
cfg
.
log
.
Info
(
"creating batch submitter"
,
"submitter_addr"
,
cfg
.
From
,
"submitter_bal"
,
balance
)
cfg
.
log
.
Info
(
"creating batch submitter"
,
"submitter_addr"
,
cfg
.
TxManager
.
From
()
,
"submitter_bal"
,
balance
)
cfg
.
metr
=
m
cfg
.
metr
=
m
...
@@ -349,7 +348,7 @@ func (l *BatchSubmitter) sendTransaction(ctx context.Context, data []byte) (*typ
...
@@ -349,7 +348,7 @@ func (l *BatchSubmitter) sendTransaction(ctx context.Context, data []byte) (*typ
if
receipt
,
err
:=
l
.
txMgr
.
Send
(
ctx
,
txmgr
.
TxCandidate
{
if
receipt
,
err
:=
l
.
txMgr
.
Send
(
ctx
,
txmgr
.
TxCandidate
{
To
:
l
.
Rollup
.
BatchInboxAddress
,
To
:
l
.
Rollup
.
BatchInboxAddress
,
TxData
:
data
,
TxData
:
data
,
From
:
l
.
From
,
From
:
l
.
txMgr
.
From
()
,
GasLimit
:
intrinsicGas
,
GasLimit
:
intrinsicGas
,
});
err
!=
nil
{
});
err
!=
nil
{
l
.
log
.
Warn
(
"unable to publish tx"
,
"err"
,
err
,
"data_size"
,
len
(
data
))
l
.
log
.
Warn
(
"unable to publish tx"
,
"err"
,
err
,
"data_size"
,
len
(
data
))
...
...
op-batcher/batcher/driver_test.go
deleted
100644 → 0
View file @
6265b3e9
package
batcher
import
(
"context"
"math/big"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum-optimism/optimism/op-service/txmgr/mocks"
)
// TestBatchSubmitter_SendTransaction tests the driver's
// [SendTransaction] external facing function.
func
TestBatchSubmitter_SendTransaction
(
t
*
testing
.
T
)
{
log
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
txMgr
:=
mocks
.
TxManager
{}
batcherInboxAddress
:=
common
.
HexToAddress
(
"0x42000000000000000000000000000000000000ff"
)
chainID
:=
big
.
NewInt
(
1
)
sender
:=
common
.
HexToAddress
(
"0xdeadbeef"
)
bs
:=
BatchSubmitter
{
Config
:
Config
{
log
:
log
,
From
:
sender
,
Rollup
:
&
rollup
.
Config
{
L1ChainID
:
chainID
,
BatchInboxAddress
:
batcherInboxAddress
,
},
},
txMgr
:
&
txMgr
,
}
txData
:=
[]
byte
{
0x00
,
0x01
,
0x02
}
gasTipCap
:=
big
.
NewInt
(
136
)
gasFeeCap
:=
big
.
NewInt
(
137
)
gas
:=
uint64
(
1337
)
// Candidate gas should be calculated with [core.IntrinsicGas]
intrinsicGas
,
err
:=
core
.
IntrinsicGas
(
txData
,
nil
,
false
,
true
,
true
,
false
)
require
.
NoError
(
t
,
err
)
candidate
:=
txmgr
.
TxCandidate
{
To
:
batcherInboxAddress
,
TxData
:
txData
,
From
:
sender
,
GasLimit
:
intrinsicGas
,
}
tx
:=
types
.
NewTx
(
&
types
.
DynamicFeeTx
{
ChainID
:
chainID
,
Nonce
:
0
,
GasTipCap
:
gasTipCap
,
GasFeeCap
:
gasFeeCap
,
Gas
:
gas
,
To
:
&
batcherInboxAddress
,
Data
:
txData
,
})
txHash
:=
tx
.
Hash
()
expectedReceipt
:=
types
.
Receipt
{
Type
:
1
,
PostState
:
[]
byte
{},
Status
:
uint64
(
1
),
CumulativeGasUsed
:
gas
,
TxHash
:
txHash
,
GasUsed
:
gas
,
}
txMgr
.
On
(
"Send"
,
mock
.
Anything
,
candidate
)
.
Return
(
&
expectedReceipt
,
nil
)
receipt
,
err
:=
bs
.
sendTransaction
(
context
.
Background
(),
tx
.
Data
())
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
receipt
,
&
expectedReceipt
)
}
op-proposer/proposer/l2_output_submitter.go
View file @
9055d49a
...
@@ -137,8 +137,6 @@ type L2OutputSubmitter struct {
...
@@ -137,8 +137,6 @@ type L2OutputSubmitter struct {
// is never valid on an alternative L1 chain that would produce different L2 data.
// is never valid on an alternative L1 chain that would produce different L2 data.
// This option is not necessary when higher proposal latency is acceptable and L1 is healthy.
// This option is not necessary when higher proposal latency is acceptable and L1 is healthy.
allowNonFinalized
bool
allowNonFinalized
bool
// From is the address to send transactions from
from
common
.
Address
// How frequently to poll L2 for new finalized outputs
// How frequently to poll L2 for new finalized outputs
pollInterval
time
.
Duration
pollInterval
time
.
Duration
}
}
...
@@ -250,7 +248,7 @@ func (l *L2OutputSubmitter) FetchNextOutputInfo(ctx context.Context) (*eth.Outpu
...
@@ -250,7 +248,7 @@ func (l *L2OutputSubmitter) FetchNextOutputInfo(ctx context.Context) (*eth.Outpu
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
defaultDialTimeout
)
defer
cancel
()
defer
cancel
()
callOpts
:=
&
bind
.
CallOpts
{
callOpts
:=
&
bind
.
CallOpts
{
From
:
l
.
from
,
From
:
l
.
txMgr
.
From
()
,
Context
:
cCtx
,
Context
:
cCtx
,
}
}
nextCheckpointBlock
,
err
:=
l
.
l2ooContract
.
NextBlockNumber
(
callOpts
)
nextCheckpointBlock
,
err
:=
l
.
l2ooContract
.
NextBlockNumber
(
callOpts
)
...
@@ -336,7 +334,7 @@ func (l *L2OutputSubmitter) sendTransaction(ctx context.Context, output *eth.Out
...
@@ -336,7 +334,7 @@ func (l *L2OutputSubmitter) sendTransaction(ctx context.Context, output *eth.Out
TxData
:
data
,
TxData
:
data
,
To
:
l
.
l2ooContractAddr
,
To
:
l
.
l2ooContractAddr
,
GasLimit
:
0
,
GasLimit
:
0
,
From
:
l
.
from
,
From
:
l
.
txMgr
.
From
()
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
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