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
75040ca5
Unverified
Commit
75040ca5
authored
Mar 08, 2022
by
Conner Fromknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add MIN_L1_TX_SIZE configuration
parent
42d02bcc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
3 deletions
+34
-3
gentle-brooms-lick.md
.changeset/gentle-brooms-lick.md
+5
-0
batch_submitter.go
go/batch-submitter/batch_submitter.go
+5
-0
config.go
go/batch-submitter/config.go
+1
-0
driver.go
go/batch-submitter/drivers/sequencer/driver.go
+9
-2
flags.go
go/batch-submitter/flags/flags.go
+8
-0
service.go
go/bss-core/service.go
+5
-1
batch-submitter.env
ops/envs/batch-submitter.env
+1
-0
No files found.
.changeset/gentle-brooms-lick.md
0 → 100644
View file @
75040ca5
---
'
@eth-optimism/batch-submitter-service'
:
patch
---
Adds MIN_L1_TX_SIZE configuration
go/batch-submitter/batch_submitter.go
View file @
75040ca5
...
...
@@ -27,6 +27,10 @@ func Main(gitVersion string) func(ctx *cli.Context) error {
return
err
}
log
.
Info
(
"Config parsed"
,
"min_tx_size"
,
cfg
.
MinL1TxSize
,
"max_tx_size"
,
cfg
.
MaxL1TxSize
)
// The call to defer is done here so that any errors logged from
// this point on are posted to Sentry before exiting.
if
cfg
.
SentryEnable
{
...
...
@@ -121,6 +125,7 @@ func Main(gitVersion string) func(ctx *cli.Context) error {
L1Client
:
l1Client
,
L2Client
:
l2Client
,
BlockOffset
:
cfg
.
BlockOffset
,
MinTxSize
:
cfg
.
MinL1TxSize
,
MaxTxSize
:
cfg
.
MaxL1TxSize
,
CTCAddr
:
ctcAddress
,
ChainID
:
chainID
,
...
...
go/batch-submitter/config.go
View file @
75040ca5
...
...
@@ -197,6 +197,7 @@ func NewConfig(ctx *cli.Context) (Config, error) {
L2EthRpc
:
ctx
.
GlobalString
(
flags
.
L2EthRpcFlag
.
Name
),
CTCAddress
:
ctx
.
GlobalString
(
flags
.
CTCAddressFlag
.
Name
),
SCCAddress
:
ctx
.
GlobalString
(
flags
.
SCCAddressFlag
.
Name
),
MinL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MinL1TxSizeFlag
.
Name
),
MaxL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MaxL1TxSizeFlag
.
Name
),
MaxBatchSubmissionTime
:
ctx
.
GlobalDuration
(
flags
.
MaxBatchSubmissionTimeFlag
.
Name
),
PollInterval
:
ctx
.
GlobalDuration
(
flags
.
PollIntervalFlag
.
Name
),
...
...
go/batch-submitter/drivers/sequencer/driver.go
View file @
75040ca5
...
...
@@ -32,6 +32,7 @@ type Config struct {
L1Client
*
ethclient
.
Client
L2Client
*
l2ethclient
.
Client
BlockOffset
uint64
MinTxSize
uint64
MaxTxSize
uint64
CTCAddr
common
.
Address
ChainID
*
big
.
Int
...
...
@@ -150,7 +151,8 @@ func (d *Driver) GetBatchBlockRange(
// CraftBatchTx transforms the L2 blocks between start and end into a batch
// transaction using the given nonce. A dummy gas price is used in the resulting
// transaction to use for size estimation.
// transaction to use for size estimation. A nil transaction is returned if the
// transaction does not meet the minimum size requirements.
//
// NOTE: This method SHOULD NOT publish the resulting transaction.
func
(
d
*
Driver
)
CraftBatchTx
(
...
...
@@ -211,13 +213,18 @@ func (d *Driver) CraftBatchTx(
batchCallData
:=
append
(
appendSequencerBatchID
,
batchArguments
...
)
// Continue pruning until calldata size is less than configured max.
if
uint64
(
len
(
batchCallData
))
>
d
.
cfg
.
MaxTxSize
{
calldataSize
:=
uint64
(
len
(
batchCallData
))
if
calldataSize
>
d
.
cfg
.
MaxTxSize
{
oldLen
:=
len
(
batchElements
)
newBatchElementsLen
:=
(
oldLen
*
9
)
/
10
batchElements
=
batchElements
[
:
newBatchElementsLen
]
log
.
Info
(
name
+
" pruned batch"
,
"old_num_txs"
,
oldLen
,
"new_num_txs"
,
newBatchElementsLen
)
pruneCount
++
continue
}
else
if
calldataSize
<
d
.
cfg
.
MinTxSize
{
log
.
Info
(
name
+
" batch tx size below minimum"
,
"size"
,
calldataSize
,
"min_tx_size"
,
d
.
cfg
.
MinTxSize
)
return
nil
,
nil
}
d
.
metrics
.
NumElementsPerBatch
()
.
Observe
(
float64
(
len
(
batchElements
)))
...
...
go/batch-submitter/flags/flags.go
View file @
75040ca5
...
...
@@ -52,6 +52,13 @@ var (
Required
:
true
,
EnvVar
:
"SCC_ADDRESS"
,
}
MinL1TxSizeFlag
=
cli
.
Uint64Flag
{
Name
:
"min-l1-tx-size"
,
Usage
:
"Minimum size in bytes of any L1 transaction that gets "
+
"generated by the batch submitter"
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"MIN_L1_TX_SIZE"
),
}
MaxL1TxSizeFlag
=
cli
.
Uint64Flag
{
Name
:
"max-l1-tx-size"
,
Usage
:
"Maximum size in bytes of any L1 transaction that gets "
+
...
...
@@ -231,6 +238,7 @@ var requiredFlags = []cli.Flag{
L2EthRpcFlag
,
CTCAddressFlag
,
SCCAddressFlag
,
MinL1TxSizeFlag
,
MaxL1TxSizeFlag
,
MaxBatchSubmissionTimeFlag
,
PollIntervalFlag
,
...
...
go/bss-core/service.go
View file @
75040ca5
...
...
@@ -46,7 +46,9 @@ type Driver interface {
// CraftBatchTx transforms the L2 blocks between start and end into a batch
// transaction using the given nonce. A dummy gas price is used in the
// resulting transaction to use for size estimation.
// resulting transaction to use for size estimation. The driver may return a
// nil value for transaction if there is no action that needs to be
// performed.
//
// NOTE: This method SHOULD NOT publish the resulting transaction.
CraftBatchTx
(
...
...
@@ -184,6 +186,8 @@ func (s *Service) eventLoop() {
log
.
Error
(
name
+
" unable to craft batch tx"
,
"err"
,
err
)
continue
}
else
if
tx
==
nil
{
continue
}
batchTxBuildTime
:=
time
.
Since
(
batchTxBuildStart
)
/
time
.
Millisecond
s
.
metrics
.
BatchTxBuildTimeMs
()
.
Set
(
float64
(
batchTxBuildTime
))
...
...
ops/envs/batch-submitter.env
View file @
75040ca5
...
...
@@ -4,6 +4,7 @@ ETH_NETWORK_NAME=clique
LOG_LEVEL=debug
BATCH_SUBMITTER_LOG_LEVEL=debug
BATCH_SUBMITTER_LOG_TERMINAL=true
BATCH_SUBMITTER_MIN_L1_TX_SIZE=32
BATCH_SUBMITTER_MAX_L1_TX_SIZE=90000
BATCH_SUBMITTER_MAX_BATCH_SUBMISSION_TIME=0
BATCH_SUBMITTER_POLL_INTERVAL=500ms
...
...
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