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
1bdd8e63
Commit
1bdd8e63
authored
Feb 08, 2022
by
Conner Fromknecht
Committed by
Matthew Slipper
Feb 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add SAFE_ABORT_NONCE_TOO_LOW_COUNT flag
parent
bcbde5f3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
26 deletions
+50
-26
batch_submitter.go
go/batch-submitter/batch_submitter.go
+4
-3
config.go
go/batch-submitter/config.go
+22
-16
flags.go
go/batch-submitter/flags/flags.go
+9
-0
clear_pending_tx_test.go
go/bss-core/drivers/clear_pending_tx_test.go
+4
-3
txmgr.go
go/bss-core/txmgr/txmgr.go
+6
-1
txmgr_test.go
go/bss-core/txmgr/txmgr_test.go
+4
-3
batch-submitter.env
ops/envs/batch-submitter.env
+1
-0
No files found.
go/batch-submitter/batch_submitter.go
View file @
1bdd8e63
...
...
@@ -108,9 +108,10 @@ func Main(gitVersion string) func(ctx *cli.Context) error {
}
txManagerConfig
:=
txmgr
.
Config
{
ResubmissionTimeout
:
cfg
.
ResubmissionTimeout
,
ReceiptQueryInterval
:
time
.
Second
,
NumConfirmations
:
cfg
.
NumConfirmations
,
ResubmissionTimeout
:
cfg
.
ResubmissionTimeout
,
ReceiptQueryInterval
:
time
.
Second
,
NumConfirmations
:
cfg
.
NumConfirmations
,
SafeAbortNonceTooLowCount
:
cfg
.
SafeAbortNonceTooLowCount
,
}
var
services
[]
*
bsscore
.
Service
...
...
go/batch-submitter/config.go
View file @
1bdd8e63
...
...
@@ -89,6 +89,11 @@ type Config struct {
// appending new batches.
NumConfirmations
uint64
// SafeAbortNonceTooLowCount is the number of ErrNonceTooLowObservations
// required to give up on a tx at a particular nonce without receiving
// confirmation.
SafeAbortNonceTooLowCount
uint64
// ResubmissionTimeout is time we will wait before resubmitting a
// transaction.
ResubmissionTimeout
time
.
Duration
...
...
@@ -178,22 +183,23 @@ type Config struct {
func
NewConfig
(
ctx
*
cli
.
Context
)
(
Config
,
error
)
{
cfg
:=
Config
{
/* Required Flags */
BuildEnv
:
ctx
.
GlobalString
(
flags
.
BuildEnvFlag
.
Name
),
EthNetworkName
:
ctx
.
GlobalString
(
flags
.
EthNetworkNameFlag
.
Name
),
L1EthRpc
:
ctx
.
GlobalString
(
flags
.
L1EthRpcFlag
.
Name
),
L2EthRpc
:
ctx
.
GlobalString
(
flags
.
L2EthRpcFlag
.
Name
),
CTCAddress
:
ctx
.
GlobalString
(
flags
.
CTCAddressFlag
.
Name
),
SCCAddress
:
ctx
.
GlobalString
(
flags
.
SCCAddressFlag
.
Name
),
MaxL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MaxL1TxSizeFlag
.
Name
),
MaxBatchSubmissionTime
:
ctx
.
GlobalDuration
(
flags
.
MaxBatchSubmissionTimeFlag
.
Name
),
PollInterval
:
ctx
.
GlobalDuration
(
flags
.
PollIntervalFlag
.
Name
),
NumConfirmations
:
ctx
.
GlobalUint64
(
flags
.
NumConfirmationsFlag
.
Name
),
ResubmissionTimeout
:
ctx
.
GlobalDuration
(
flags
.
ResubmissionTimeoutFlag
.
Name
),
FinalityConfirmations
:
ctx
.
GlobalUint64
(
flags
.
FinalityConfirmationsFlag
.
Name
),
RunTxBatchSubmitter
:
ctx
.
GlobalBool
(
flags
.
RunTxBatchSubmitterFlag
.
Name
),
RunStateBatchSubmitter
:
ctx
.
GlobalBool
(
flags
.
RunStateBatchSubmitterFlag
.
Name
),
SafeMinimumEtherBalance
:
ctx
.
GlobalUint64
(
flags
.
SafeMinimumEtherBalanceFlag
.
Name
),
ClearPendingTxs
:
ctx
.
GlobalBool
(
flags
.
ClearPendingTxsFlag
.
Name
),
BuildEnv
:
ctx
.
GlobalString
(
flags
.
BuildEnvFlag
.
Name
),
EthNetworkName
:
ctx
.
GlobalString
(
flags
.
EthNetworkNameFlag
.
Name
),
L1EthRpc
:
ctx
.
GlobalString
(
flags
.
L1EthRpcFlag
.
Name
),
L2EthRpc
:
ctx
.
GlobalString
(
flags
.
L2EthRpcFlag
.
Name
),
CTCAddress
:
ctx
.
GlobalString
(
flags
.
CTCAddressFlag
.
Name
),
SCCAddress
:
ctx
.
GlobalString
(
flags
.
SCCAddressFlag
.
Name
),
MaxL1TxSize
:
ctx
.
GlobalUint64
(
flags
.
MaxL1TxSizeFlag
.
Name
),
MaxBatchSubmissionTime
:
ctx
.
GlobalDuration
(
flags
.
MaxBatchSubmissionTimeFlag
.
Name
),
PollInterval
:
ctx
.
GlobalDuration
(
flags
.
PollIntervalFlag
.
Name
),
NumConfirmations
:
ctx
.
GlobalUint64
(
flags
.
NumConfirmationsFlag
.
Name
),
SafeAbortNonceTooLowCount
:
ctx
.
GlobalUint64
(
flags
.
SafeAbortNonceTooLowCountFlag
.
Name
),
ResubmissionTimeout
:
ctx
.
GlobalDuration
(
flags
.
ResubmissionTimeoutFlag
.
Name
),
FinalityConfirmations
:
ctx
.
GlobalUint64
(
flags
.
FinalityConfirmationsFlag
.
Name
),
RunTxBatchSubmitter
:
ctx
.
GlobalBool
(
flags
.
RunTxBatchSubmitterFlag
.
Name
),
RunStateBatchSubmitter
:
ctx
.
GlobalBool
(
flags
.
RunStateBatchSubmitterFlag
.
Name
),
SafeMinimumEtherBalance
:
ctx
.
GlobalUint64
(
flags
.
SafeMinimumEtherBalanceFlag
.
Name
),
ClearPendingTxs
:
ctx
.
GlobalBool
(
flags
.
ClearPendingTxsFlag
.
Name
),
/* Optional Flags */
LogLevel
:
ctx
.
GlobalString
(
flags
.
LogLevelFlag
.
Name
),
LogTerminal
:
ctx
.
GlobalBool
(
flags
.
LogTerminalFlag
.
Name
),
...
...
go/batch-submitter/flags/flags.go
View file @
1bdd8e63
...
...
@@ -80,6 +80,14 @@ var (
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"NUM_CONFIRMATIONS"
),
}
SafeAbortNonceTooLowCountFlag
=
cli
.
Uint64Flag
{
Name
:
"safe-abort-nonce-too-low-count"
,
Usage
:
"Number of ErrNonceTooLow observations required to "
+
"give up on a tx at a particular nonce without receiving "
+
"confirmation"
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"SAFE_ABORT_NONCE_TOO_LOW_COUNT"
),
}
ResubmissionTimeoutFlag
=
cli
.
DurationFlag
{
Name
:
"resubmission-timeout"
,
Usage
:
"Duration we will wait before resubmitting a "
+
...
...
@@ -221,6 +229,7 @@ var requiredFlags = []cli.Flag{
MaxBatchSubmissionTimeFlag
,
PollIntervalFlag
,
NumConfirmationsFlag
,
SafeAbortNonceTooLowCountFlag
,
ResubmissionTimeoutFlag
,
FinalityConfirmationsFlag
,
RunTxBatchSubmitterFlag
,
...
...
go/bss-core/drivers/clear_pending_tx_test.go
View file @
1bdd8e63
...
...
@@ -204,9 +204,10 @@ func newClearPendingTxHarnessWithNumConfs(
l1Client
:=
mock
.
NewL1Client
(
l1ClientConfig
)
txMgr
:=
txmgr
.
NewSimpleTxManager
(
"test"
,
txmgr
.
Config
{
ResubmissionTimeout
:
time
.
Second
,
ReceiptQueryInterval
:
50
*
time
.
Millisecond
,
NumConfirmations
:
numConfirmations
,
ResubmissionTimeout
:
time
.
Second
,
ReceiptQueryInterval
:
50
*
time
.
Millisecond
,
NumConfirmations
:
numConfirmations
,
SafeAbortNonceTooLowCount
:
3
,
},
l1Client
)
return
&
clearPendingTxHarness
{
...
...
go/bss-core/txmgr/txmgr.go
View file @
1bdd8e63
...
...
@@ -38,6 +38,11 @@ type Config struct {
// NumConfirmations specifies how many blocks are need to consider a
// transaction confirmed.
NumConfirmations
uint64
// SafeAbortNonceTooLowCount specifies how many ErrNonceTooLow observations
// are required to give up on a tx at a particular nonce without receiving
// confirmation.
SafeAbortNonceTooLowCount
uint64
}
// TxManager is an interface that allows callers to reliably publish txs,
...
...
@@ -120,7 +125,7 @@ func (m *SimpleTxManager) Send(
ctxc
,
cancel
:=
context
.
WithCancel
(
ctx
)
defer
cancel
()
sendState
:=
NewSendState
(
3
)
sendState
:=
NewSendState
(
m
.
cfg
.
SafeAbortNonceTooLowCount
)
// Create a closure that will block on passed sendTx function in the
// background, returning the first successfully mined receipt back to
...
...
go/bss-core/txmgr/txmgr_test.go
View file @
1bdd8e63
...
...
@@ -45,9 +45,10 @@ func newTestHarness() *testHarness {
func
configWithNumConfs
(
numConfirmations
uint64
)
txmgr
.
Config
{
return
txmgr
.
Config
{
ResubmissionTimeout
:
time
.
Second
,
ReceiptQueryInterval
:
50
*
time
.
Millisecond
,
NumConfirmations
:
numConfirmations
,
ResubmissionTimeout
:
time
.
Second
,
ReceiptQueryInterval
:
50
*
time
.
Millisecond
,
NumConfirmations
:
numConfirmations
,
SafeAbortNonceTooLowCount
:
3
,
}
}
...
...
ops/envs/batch-submitter.env
View file @
1bdd8e63
...
...
@@ -8,6 +8,7 @@ BATCH_SUBMITTER_MAX_L1_TX_SIZE=90000
BATCH_SUBMITTER_MAX_BATCH_SUBMISSION_TIME=0
BATCH_SUBMITTER_POLL_INTERVAL=500ms
BATCH_SUBMITTER_NUM_CONFIRMATIONS=1
BATCH_SUBMITTER_SAFE_ABORT_NONCE_TOO_LOW_COUNT=3
BATCH_SUBMITTER_RESUBMISSION_TIMEOUT=1s
BATCH_SUBMITTER_FINALITY_CONFIRMATIONS=0
BATCH_SUBMITTER_RUN_TX_BATCH_SUBMITTER=true
...
...
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