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
8a64179f
Unverified
Commit
8a64179f
authored
Apr 10, 2023
by
Michael de Hoog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add concurrent sends to batcher
parent
392b8872
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
33 deletions
+61
-33
config.go
op-batcher/batcher/config.go
+19
-13
driver.go
op-batcher/batcher/driver.go
+35
-20
flags.go
op-batcher/flags/flags.go
+7
-0
No files found.
op-batcher/batcher/config.go
View file @
8a64179f
...
...
@@ -28,6 +28,7 @@ type Config struct {
NetworkTimeout
time
.
Duration
PollInterval
time
.
Duration
MaxPendingTransactions
uint64
// RollupConfig is queried at startup
Rollup
*
rollup
.
Config
...
...
@@ -76,6 +77,10 @@ type CLIConfig struct {
// and creating a new batch.
PollInterval
time
.
Duration
// MaxPendingTransactions is the maximum number of concurrent pending
// transactions sent to the transaction manager.
MaxPendingTransactions
uint64
// MaxL1TxSize is the maximum size of a batch tx submitted to L1.
MaxL1TxSize
uint64
...
...
@@ -128,6 +133,7 @@ func NewConfig(ctx *cli.Context) CLIConfig {
PollInterval
:
ctx
.
GlobalDuration
(
flags
.
PollIntervalFlag
.
Name
),
/* Optional Flags */
MaxPendingTransactions
:
ctx
.
GlobalUint64
(
flags
.
MaxPendingTransactionsFlag
.
Name
),
MaxChannelDuration
:
ctx
.
GlobalUint64
(
flags
.
MaxChannelDurationFlag
.
Name
),
MaxL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MaxL1TxSizeBytesFlag
.
Name
),
TargetL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
TargetL1TxSizeBytesFlag
.
Name
),
...
...
op-batcher/batcher/driver.go
View file @
8a64179f
...
...
@@ -79,6 +79,7 @@ func NewBatchSubmitterFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metri
L2Client
:
l2Client
,
RollupNode
:
rollupClient
,
PollInterval
:
cfg
.
PollInterval
,
MaxPendingTransactions
:
cfg
.
MaxPendingTransactions
,
NetworkTimeout
:
cfg
.
TxMgrConfig
.
NetworkTimeout
,
TxManager
:
txManager
,
Rollup
:
rcfg
,
...
...
@@ -301,6 +302,11 @@ func (l *BatchSubmitter) loop() {
// publishStateToL1 loops through the block data loaded into `state` and
// submits the associated data to the L1 in the form of channel frames.
func
(
l
*
BatchSubmitter
)
publishStateToL1
(
ctx
context
.
Context
)
{
maxPending
:=
l
.
MaxPendingTransactions
if
maxPending
==
0
{
maxPending
=
1
<<
64
-
1
}
for
{
// Attempt to gracefully terminate the current channel, ensuring that no new frames will be
// produced. Any remaining frames must still be published to the L1 to prevent stalling.
...
...
@@ -326,7 +332,10 @@ func (l *BatchSubmitter) publishStateToL1(ctx context.Context) {
l
.
recordL1Tip
(
l1tip
)
// Collect next transaction data
txdata
,
err
:=
l
.
state
.
TxData
(
l1tip
.
ID
())
var
wg
sync
.
WaitGroup
for
i
:=
uint64
(
0
);
i
<
maxPending
;
i
++
{
var
txdata
txData
txdata
,
err
=
l
.
state
.
TxData
(
l1tip
.
ID
())
if
err
==
io
.
EOF
{
l
.
log
.
Trace
(
"no transaction data available"
)
break
...
...
@@ -334,12 +343,18 @@ func (l *BatchSubmitter) publishStateToL1(ctx context.Context) {
l
.
log
.
Error
(
"unable to get tx data"
,
"err"
,
err
)
break
}
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
// Record TX Status
if
receipt
,
err
:=
l
.
sendTransaction
(
ctx
,
txdata
.
Bytes
());
err
!=
nil
{
l
.
recordFailedTx
(
txdata
.
ID
(),
err
)
}
else
{
l
.
recordConfirmedTx
(
txdata
.
ID
(),
receipt
)
}
}()
}
wg
.
Wait
()
}
}
...
...
op-batcher/flags/flags.go
View file @
8a64179f
...
...
@@ -48,6 +48,12 @@ var (
}
// Optional flags
MaxPendingTransactionsFlag
=
cli
.
Uint64Flag
{
Name
:
"max-pending-tx"
,
Usage
:
"The maximum number of pending transactions. 0 for no limit."
,
Value
:
1
,
EnvVar
:
opservice
.
PrefixEnvVar
(
envVarPrefix
,
"MAX_PENDING_TX"
),
}
MaxChannelDurationFlag
=
cli
.
Uint64Flag
{
Name
:
"max-channel-duration"
,
Usage
:
"The maximum duration of L1-blocks to keep a channel open. 0 to disable."
,
...
...
@@ -96,6 +102,7 @@ var requiredFlags = []cli.Flag{
}
var
optionalFlags
=
[]
cli
.
Flag
{
MaxPendingTransactionsFlag
,
MaxChannelDurationFlag
,
MaxL1TxSizeBytesFlag
,
TargetL1TxSizeBytesFlag
,
...
...
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