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
b2bf141a
Unverified
Commit
b2bf141a
authored
Nov 13, 2023
by
Mark Tyneway
Committed by
GitHub
Nov 13, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8122 from roberto-bayardo/config-var-naming
improve naming consistency of Config struct variables
parents
c4ebe7fb
d5f62324
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
33 deletions
+33
-33
driver.go
op-batcher/batcher/driver.go
+17
-17
service.go
op-batcher/batcher/service.go
+16
-16
No files found.
op-batcher/batcher/driver.go
View file @
b2bf141a
...
...
@@ -37,15 +37,15 @@ type RollupClient interface {
// DriverSetup is the collection of input/output interfaces and configuration that the driver operates on.
type
DriverSetup
struct
{
Log
log
.
Logger
Metr
metrics
.
Metricer
RollupC
fg
*
rollup
.
Config
C
fg
BatcherConfig
Txmgr
txmgr
.
TxManager
L1Client
L1Client
L2Client
L2Client
RollupClient
RollupClient
Channel
ChannelConfig
Log
log
.
Logger
Metr
metrics
.
Metricer
RollupC
onfig
*
rollup
.
Config
C
onfig
BatcherConfig
Txmgr
txmgr
.
TxManager
L1Client
L1Client
L2Client
L2Client
RollupClient
RollupClient
Channel
Config
ChannelConfig
}
// BatchSubmitter encapsulates a service responsible for submitting L2 tx
...
...
@@ -74,7 +74,7 @@ type BatchSubmitter struct {
func
NewBatchSubmitter
(
setup
DriverSetup
)
*
BatchSubmitter
{
return
&
BatchSubmitter
{
DriverSetup
:
setup
,
state
:
NewChannelManager
(
setup
.
Log
,
setup
.
Metr
,
setup
.
Channel
,
setup
.
RollupCf
g
),
state
:
NewChannelManager
(
setup
.
Log
,
setup
.
Metr
,
setup
.
Channel
Config
,
setup
.
RollupConfi
g
),
}
}
...
...
@@ -171,7 +171,7 @@ func (l *BatchSubmitter) loadBlocksIntoState(ctx context.Context) error {
latestBlock
=
block
}
l2ref
,
err
:=
derive
.
L2BlockToBlockRef
(
latestBlock
,
&
l
.
RollupC
f
g
.
Genesis
)
l2ref
,
err
:=
derive
.
L2BlockToBlockRef
(
latestBlock
,
&
l
.
RollupC
onfi
g
.
Genesis
)
if
err
!=
nil
{
l
.
Log
.
Warn
(
"Invalid L2 block loaded into state"
,
"err"
,
err
)
return
err
...
...
@@ -183,7 +183,7 @@ func (l *BatchSubmitter) loadBlocksIntoState(ctx context.Context) error {
// loadBlockIntoState fetches & stores a single block into `state`. It returns the block it loaded.
func
(
l
*
BatchSubmitter
)
loadBlockIntoState
(
ctx
context
.
Context
,
blockNumber
uint64
)
(
*
types
.
Block
,
error
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
l
.
C
f
g
.
NetworkTimeout
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
l
.
C
onfi
g
.
NetworkTimeout
)
defer
cancel
()
block
,
err
:=
l
.
L2Client
.
BlockByNumber
(
ctx
,
new
(
big
.
Int
)
.
SetUint64
(
blockNumber
))
if
err
!=
nil
{
...
...
@@ -201,7 +201,7 @@ func (l *BatchSubmitter) loadBlockIntoState(ctx context.Context, blockNumber uin
// calculateL2BlockRangeToStore determines the range (start,end] that should be loaded into the local state.
// It also takes care of initializing some local state (i.e. will modify l.lastStoredBlock in certain conditions)
func
(
l
*
BatchSubmitter
)
calculateL2BlockRangeToStore
(
ctx
context
.
Context
)
(
eth
.
BlockID
,
eth
.
BlockID
,
error
)
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
l
.
C
f
g
.
NetworkTimeout
)
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
l
.
C
onfi
g
.
NetworkTimeout
)
defer
cancel
()
syncStatus
,
err
:=
l
.
RollupClient
.
SyncStatus
(
ctx
)
// Ensure that we have the sync status
...
...
@@ -244,11 +244,11 @@ func (l *BatchSubmitter) calculateL2BlockRangeToStore(ctx context.Context) (eth.
func
(
l
*
BatchSubmitter
)
loop
()
{
defer
l
.
wg
.
Done
()
ticker
:=
time
.
NewTicker
(
l
.
C
f
g
.
PollInterval
)
ticker
:=
time
.
NewTicker
(
l
.
C
onfi
g
.
PollInterval
)
defer
ticker
.
Stop
()
receiptsCh
:=
make
(
chan
txmgr
.
TxReceipt
[
txData
])
queue
:=
txmgr
.
NewQueue
[
txData
](
l
.
killCtx
,
l
.
Txmgr
,
l
.
C
f
g
.
MaxPendingTransactions
)
queue
:=
txmgr
.
NewQueue
[
txData
](
l
.
killCtx
,
l
.
Txmgr
,
l
.
C
onfi
g
.
MaxPendingTransactions
)
for
{
select
{
...
...
@@ -347,7 +347,7 @@ func (l *BatchSubmitter) sendTransaction(txdata txData, queue *txmgr.Queue[txDat
}
candidate
:=
txmgr
.
TxCandidate
{
To
:
&
l
.
RollupC
f
g
.
BatchInboxAddress
,
To
:
&
l
.
RollupC
onfi
g
.
BatchInboxAddress
,
TxData
:
data
,
GasLimit
:
intrinsicGas
,
}
...
...
@@ -387,7 +387,7 @@ func (l *BatchSubmitter) recordConfirmedTx(id txID, receipt *types.Receipt) {
// l1Tip gets the current L1 tip as a L1BlockRef. The passed context is assumed
// to be a lifetime context, so it is internally wrapped with a network timeout.
func
(
l
*
BatchSubmitter
)
l1Tip
(
ctx
context
.
Context
)
(
eth
.
L1BlockRef
,
error
)
{
tctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
l
.
C
f
g
.
NetworkTimeout
)
tctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
l
.
C
onfi
g
.
NetworkTimeout
)
defer
cancel
()
head
,
err
:=
l
.
L1Client
.
HeaderByNumber
(
tctx
,
nil
)
if
err
!=
nil
{
...
...
op-batcher/batcher/service.go
View file @
b2bf141a
...
...
@@ -48,7 +48,7 @@ type BatcherService struct {
RollupConfig
*
rollup
.
Config
// Channel builder parameters
Channel
ChannelConfig
Channel
Config
ChannelConfig
driver
*
BatchSubmitter
...
...
@@ -90,7 +90,7 @@ func (bs *BatcherService) initFromCLIConfig(ctx context.Context, version string,
if
err
:=
bs
.
initRPCClients
(
ctx
,
cfg
);
err
!=
nil
{
return
err
}
if
err
:=
bs
.
initRollupC
f
g
(
ctx
);
err
!=
nil
{
if
err
:=
bs
.
initRollupC
onfi
g
(
ctx
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to load rollup config: %w"
,
err
)
}
if
err
:=
bs
.
initChannelConfig
(
cfg
);
err
!=
nil
{
...
...
@@ -153,12 +153,12 @@ func (bs *BatcherService) initBalanceMonitor(cfg *CLIConfig) {
}
}
func
(
bs
*
BatcherService
)
initRollupC
f
g
(
ctx
context
.
Context
)
error
{
rollupC
f
g
,
err
:=
bs
.
RollupNode
.
RollupConfig
(
ctx
)
func
(
bs
*
BatcherService
)
initRollupC
onfi
g
(
ctx
context
.
Context
)
error
{
rollupC
onfi
g
,
err
:=
bs
.
RollupNode
.
RollupConfig
(
ctx
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to retrieve rollup config: %w"
,
err
)
}
bs
.
RollupConfig
=
rollupC
f
g
bs
.
RollupConfig
=
rollupC
onfi
g
if
err
:=
bs
.
RollupConfig
.
Check
();
err
!=
nil
{
return
fmt
.
Errorf
(
"invalid rollup config: %w"
,
err
)
}
...
...
@@ -166,7 +166,7 @@ func (bs *BatcherService) initRollupCfg(ctx context.Context) error {
}
func
(
bs
*
BatcherService
)
initChannelConfig
(
cfg
*
CLIConfig
)
error
{
bs
.
Channel
=
ChannelConfig
{
bs
.
Channel
Config
=
ChannelConfig
{
SeqWindowSize
:
bs
.
RollupConfig
.
SeqWindowSize
,
ChannelTimeout
:
bs
.
RollupConfig
.
ChannelTimeout
,
MaxChannelDuration
:
cfg
.
MaxChannelDuration
,
...
...
@@ -175,7 +175,7 @@ func (bs *BatcherService) initChannelConfig(cfg *CLIConfig) error {
CompressorConfig
:
cfg
.
CompressorConfig
.
Config
(),
BatchType
:
cfg
.
BatchType
,
}
if
err
:=
bs
.
Channel
.
Check
();
err
!=
nil
{
if
err
:=
bs
.
Channel
Config
.
Check
();
err
!=
nil
{
return
fmt
.
Errorf
(
"invalid channel configuration: %w"
,
err
)
}
return
nil
...
...
@@ -225,15 +225,15 @@ func (bs *BatcherService) initMetricsServer(cfg *CLIConfig) error {
func
(
bs
*
BatcherService
)
initDriver
()
{
bs
.
driver
=
NewBatchSubmitter
(
DriverSetup
{
Log
:
bs
.
Log
,
Metr
:
bs
.
Metrics
,
RollupC
fg
:
bs
.
RollupConfig
,
C
fg
:
bs
.
BatcherConfig
,
Txmgr
:
bs
.
TxManager
,
L1Client
:
bs
.
L1Client
,
L2Client
:
bs
.
L2Client
,
RollupClient
:
bs
.
RollupNode
,
Channel
:
bs
.
Channel
,
Log
:
bs
.
Log
,
Metr
:
bs
.
Metrics
,
RollupC
onfig
:
bs
.
RollupConfig
,
C
onfig
:
bs
.
BatcherConfig
,
Txmgr
:
bs
.
TxManager
,
L1Client
:
bs
.
L1Client
,
L2Client
:
bs
.
L2Client
,
RollupClient
:
bs
.
RollupNode
,
Channel
Config
:
bs
.
ChannelConfig
,
})
}
...
...
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