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
ad90e01f
Unverified
Commit
ad90e01f
authored
Mar 18, 2022
by
Matthew Slipper
Committed by
GitHub
Mar 18, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2340 from cfromknecht/bss-min-state-root-count
feat: add Min/MaxStateRootElements configurations
parents
32d69199
9678b357
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
28 deletions
+64
-28
real-seals-return.md
.changeset/real-seals-return.md
+5
-0
batch_submitter.go
go/batch-submitter/batch_submitter.go
+10
-9
config.go
go/batch-submitter/config.go
+10
-4
driver.go
go/batch-submitter/drivers/proposer/driver.go
+21
-15
flags.go
go/batch-submitter/flags/flags.go
+16
-0
batch-submitter.env
ops/envs/batch-submitter.env
+2
-0
No files found.
.changeset/real-seals-return.md
0 → 100644
View file @
ad90e01f
---
'
@eth-optimism/batch-submitter-service'
:
patch
---
Add Min/MaxStateRootElements configuration
go/batch-submitter/batch_submitter.go
View file @
ad90e01f
...
@@ -152,7 +152,8 @@ func Main(gitVersion string) func(ctx *cli.Context) error {
...
@@ -152,7 +152,8 @@ func Main(gitVersion string) func(ctx *cli.Context) error {
L1Client
:
l1Client
,
L1Client
:
l1Client
,
L2Client
:
l2Client
,
L2Client
:
l2Client
,
BlockOffset
:
cfg
.
BlockOffset
,
BlockOffset
:
cfg
.
BlockOffset
,
MaxTxSize
:
cfg
.
MaxL1TxSize
,
MinStateRootElements
:
cfg
.
MinStateRootElements
,
MaxStateRootElements
:
cfg
.
MaxStateRootElements
,
SCCAddr
:
sccAddress
,
SCCAddr
:
sccAddress
,
CTCAddr
:
ctcAddress
,
CTCAddr
:
ctcAddress
,
ChainID
:
chainID
,
ChainID
:
chainID
,
...
...
go/batch-submitter/config.go
View file @
ad90e01f
...
@@ -74,14 +74,18 @@ type Config struct {
...
@@ -74,14 +74,18 @@ type Config struct {
// by the batch submitter.
// by the batch submitter.
MaxL1TxSize
uint64
MaxL1TxSize
uint64
// MinStateRootElements is the minimum number of state root elements that
// can be submitted in single proposer batch.
MinStateRootElements
uint64
// MaxStateRootElements is the maximum number of state root elements that
// can be submitted in single proposer batch.
MaxStateRootElements
uint64
// MaxTxBatchCount is the maximum number of L2 transactions that can ever be
// MaxTxBatchCount is the maximum number of L2 transactions that can ever be
// in a batch.
// in a batch.
MaxTxBatchCount
uint64
MaxTxBatchCount
uint64
// MaxStateBatchCount is the maximum number of L2 state roots that can ever
// be in a batch.
MaxStateBatchCount
uint64
// MaxBatchSubmissionTime is the maximum amount of time that we will
// MaxBatchSubmissionTime is the maximum amount of time that we will
// wait before submitting an under-sized batch.
// wait before submitting an under-sized batch.
MaxBatchSubmissionTime
time
.
Duration
MaxBatchSubmissionTime
time
.
Duration
...
@@ -199,6 +203,8 @@ func NewConfig(ctx *cli.Context) (Config, error) {
...
@@ -199,6 +203,8 @@ func NewConfig(ctx *cli.Context) (Config, error) {
SCCAddress
:
ctx
.
GlobalString
(
flags
.
SCCAddressFlag
.
Name
),
SCCAddress
:
ctx
.
GlobalString
(
flags
.
SCCAddressFlag
.
Name
),
MinL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MinL1TxSizeFlag
.
Name
),
MinL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MinL1TxSizeFlag
.
Name
),
MaxL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MaxL1TxSizeFlag
.
Name
),
MaxL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MaxL1TxSizeFlag
.
Name
),
MinStateRootElements
:
ctx
.
GlobalUint64
(
flags
.
MinStateRootElementsFlag
.
Name
),
MaxStateRootElements
:
ctx
.
GlobalUint64
(
flags
.
MinStateRootElementsFlag
.
Name
),
MaxBatchSubmissionTime
:
ctx
.
GlobalDuration
(
flags
.
MaxBatchSubmissionTimeFlag
.
Name
),
MaxBatchSubmissionTime
:
ctx
.
GlobalDuration
(
flags
.
MaxBatchSubmissionTimeFlag
.
Name
),
PollInterval
:
ctx
.
GlobalDuration
(
flags
.
PollIntervalFlag
.
Name
),
PollInterval
:
ctx
.
GlobalDuration
(
flags
.
PollIntervalFlag
.
Name
),
NumConfirmations
:
ctx
.
GlobalUint64
(
flags
.
NumConfirmationsFlag
.
Name
),
NumConfirmations
:
ctx
.
GlobalUint64
(
flags
.
NumConfirmationsFlag
.
Name
),
...
...
go/batch-submitter/drivers/proposer/driver.go
View file @
ad90e01f
...
@@ -32,7 +32,8 @@ type Config struct {
...
@@ -32,7 +32,8 @@ type Config struct {
L1Client
*
ethclient
.
Client
L1Client
*
ethclient
.
Client
L2Client
*
l2ethclient
.
Client
L2Client
*
l2ethclient
.
Client
BlockOffset
uint64
BlockOffset
uint64
MaxTxSize
uint64
MaxStateRootElements
uint64
MinStateRootElements
uint64
SCCAddr
common
.
Address
SCCAddr
common
.
Address
CTCAddr
common
.
Address
CTCAddr
common
.
Address
ChainID
*
big
.
Int
ChainID
*
big
.
Int
...
@@ -165,13 +166,10 @@ func (d *Driver) CraftBatchTx(
...
@@ -165,13 +166,10 @@ func (d *Driver) CraftBatchTx(
log
.
Info
(
name
+
" crafting batch tx"
,
"start"
,
start
,
"end"
,
end
,
log
.
Info
(
name
+
" crafting batch tx"
,
"start"
,
start
,
"end"
,
end
,
"nonce"
,
nonce
)
"nonce"
,
nonce
)
var
(
var
stateRoots
[][
stateRootSize
]
byte
stateRoots
[][
stateRootSize
]
byte
totalStateRootSize
uint64
)
for
i
:=
new
(
big
.
Int
)
.
Set
(
start
);
i
.
Cmp
(
end
)
<
0
;
i
.
Add
(
i
,
bigOne
)
{
for
i
:=
new
(
big
.
Int
)
.
Set
(
start
);
i
.
Cmp
(
end
)
<
0
;
i
.
Add
(
i
,
bigOne
)
{
// Consume state roots until reach our maximum tx size.
// Consume state roots until reach our maximum tx size.
if
totalStateRootSize
+
stateRootSize
>
d
.
cfg
.
MaxTxSize
{
if
uint64
(
len
(
stateRoots
))
>
d
.
cfg
.
MaxStateRootElements
{
break
break
}
}
...
@@ -180,10 +178,18 @@ func (d *Driver) CraftBatchTx(
...
@@ -180,10 +178,18 @@ func (d *Driver) CraftBatchTx(
return
nil
,
err
return
nil
,
err
}
}
totalStateRootSize
+=
stateRootSize
stateRoots
=
append
(
stateRoots
,
block
.
Root
())
stateRoots
=
append
(
stateRoots
,
block
.
Root
())
}
}
// Abort if we don't have enough state roots to meet our minimum
// requirement.
if
uint64
(
len
(
stateRoots
))
<
d
.
cfg
.
MinStateRootElements
{
log
.
Info
(
name
+
" number of state roots below minimum"
,
"num_state_roots"
,
len
(
stateRoots
),
"min_state_roots"
,
d
.
cfg
.
MinStateRootElements
)
return
nil
,
nil
}
d
.
metrics
.
NumElementsPerBatch
()
.
Observe
(
float64
(
len
(
stateRoots
)))
d
.
metrics
.
NumElementsPerBatch
()
.
Observe
(
float64
(
len
(
stateRoots
)))
log
.
Info
(
name
+
" batch constructed"
,
"num_state_roots"
,
len
(
stateRoots
))
log
.
Info
(
name
+
" batch constructed"
,
"num_state_roots"
,
len
(
stateRoots
))
...
...
go/batch-submitter/flags/flags.go
View file @
ad90e01f
...
@@ -66,6 +66,20 @@ var (
...
@@ -66,6 +66,20 @@ var (
Required
:
true
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"MAX_L1_TX_SIZE"
),
EnvVar
:
prefixEnvVar
(
"MAX_L1_TX_SIZE"
),
}
}
MinStateRootElementsFlag
=
cli
.
Uint64Flag
{
Name
:
"min-state-root-elements"
,
Usage
:
"Minimum number of elements required to submit a state "
+
"root batch"
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"MIN_STATE_ROOT_ELEMENTS"
),
}
MaxStateRootElementsFlag
=
cli
.
Uint64Flag
{
Name
:
"max-state-root-elements"
,
Usage
:
"Maximum number of elements required to submit a state "
+
"root batch"
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"MAX_STATE_ROOT_ELEMENTS"
),
}
MaxBatchSubmissionTimeFlag
=
cli
.
DurationFlag
{
MaxBatchSubmissionTimeFlag
=
cli
.
DurationFlag
{
Name
:
"max-batch-submission-time"
,
Name
:
"max-batch-submission-time"
,
Usage
:
"Maximum amount of time that we will wait before "
+
Usage
:
"Maximum amount of time that we will wait before "
+
...
@@ -240,6 +254,8 @@ var requiredFlags = []cli.Flag{
...
@@ -240,6 +254,8 @@ var requiredFlags = []cli.Flag{
SCCAddressFlag
,
SCCAddressFlag
,
MinL1TxSizeFlag
,
MinL1TxSizeFlag
,
MaxL1TxSizeFlag
,
MaxL1TxSizeFlag
,
MinStateRootElementsFlag
,
MaxStateRootElementsFlag
,
MaxBatchSubmissionTimeFlag
,
MaxBatchSubmissionTimeFlag
,
PollIntervalFlag
,
PollIntervalFlag
,
NumConfirmationsFlag
,
NumConfirmationsFlag
,
...
...
ops/envs/batch-submitter.env
View file @
ad90e01f
...
@@ -6,6 +6,8 @@ BATCH_SUBMITTER_LOG_LEVEL=debug
...
@@ -6,6 +6,8 @@ BATCH_SUBMITTER_LOG_LEVEL=debug
BATCH_SUBMITTER_LOG_TERMINAL=true
BATCH_SUBMITTER_LOG_TERMINAL=true
BATCH_SUBMITTER_MIN_L1_TX_SIZE=32
BATCH_SUBMITTER_MIN_L1_TX_SIZE=32
BATCH_SUBMITTER_MAX_L1_TX_SIZE=90000
BATCH_SUBMITTER_MAX_L1_TX_SIZE=90000
BATCH_SUBMITTER_MIN_STATE_ROOT_ELEMENTS=1
BATCH_SUBMITTER_MAX_STATE_ROOT_ELEMENTS=3000
BATCH_SUBMITTER_MAX_BATCH_SUBMISSION_TIME=0
BATCH_SUBMITTER_MAX_BATCH_SUBMISSION_TIME=0
BATCH_SUBMITTER_POLL_INTERVAL=500ms
BATCH_SUBMITTER_POLL_INTERVAL=500ms
BATCH_SUBMITTER_NUM_CONFIRMATIONS=1
BATCH_SUBMITTER_NUM_CONFIRMATIONS=1
...
...
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