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
d0b9758c
Unverified
Commit
d0b9758c
authored
Sep 28, 2023
by
OptimismBot
Committed by
GitHub
Sep 28, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7456 from ethereum-optimism/jg/configurable_txmgr_cli_default_values
txmgr: Allow CLI Default values to be configured
parents
20f9664c
71a657e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
26 deletions
+51
-26
config.go
op-challenger/config/config.go
+1
-1
flags.go
op-challenger/flags/flags.go
+1
-1
cli.go
op-service/txmgr/cli.go
+47
-22
cli_test.go
op-service/txmgr/cli_test.go
+2
-2
No files found.
op-challenger/config/config.go
View file @
d0b9758c
...
@@ -144,7 +144,7 @@ func NewConfig(
...
@@ -144,7 +144,7 @@ func NewConfig(
TraceType
:
traceType
,
TraceType
:
traceType
,
TxMgrConfig
:
txmgr
.
NewCLIConfig
(
l1EthRpc
),
TxMgrConfig
:
txmgr
.
NewCLIConfig
(
l1EthRpc
,
txmgr
.
DefaultChallengerFlagValues
),
MetricsConfig
:
opmetrics
.
DefaultCLIConfig
(),
MetricsConfig
:
opmetrics
.
DefaultCLIConfig
(),
PprofConfig
:
oppprof
.
DefaultCLIConfig
(),
PprofConfig
:
oppprof
.
DefaultCLIConfig
(),
...
...
op-challenger/flags/flags.go
View file @
d0b9758c
...
@@ -174,7 +174,7 @@ var optionalFlags = []cli.Flag{
...
@@ -174,7 +174,7 @@ var optionalFlags = []cli.Flag{
func
init
()
{
func
init
()
{
optionalFlags
=
append
(
optionalFlags
,
oplog
.
CLIFlags
(
envVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
oplog
.
CLIFlags
(
envVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
txmgr
.
CLIFlags
(
envVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
txmgr
.
CLIFlags
WithDefaults
(
envVarPrefix
,
txmgr
.
DefaultChallengerFlagValues
)
...
)
optionalFlags
=
append
(
optionalFlags
,
opmetrics
.
CLIFlags
(
envVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
opmetrics
.
CLIFlags
(
envVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
oppprof
.
CLIFlags
(
envVarPrefix
)
...
)
optionalFlags
=
append
(
optionalFlags
,
oppprof
.
CLIFlags
(
envVarPrefix
)
...
)
...
...
op-service/txmgr/cli.go
View file @
d0b9758c
...
@@ -48,17 +48,42 @@ var (
...
@@ -48,17 +48,42 @@ var (
}
}
)
)
type
DefaultFlagValues
struct
{
NumConfirmations
uint64
SafeAbortNonceTooLowCount
uint64
ResubmissionTimeout
time
.
Duration
NetworkTimeout
time
.
Duration
TxSendTimeout
time
.
Duration
TxNotInMempoolTimeout
time
.
Duration
ReceiptQueryInterval
time
.
Duration
}
var
(
var
(
defaultNumConfirmations
=
uint64
(
10
)
DefaultBatcherFlagValues
=
DefaultFlagValues
{
defaultSafeAbortNonceTooLowCount
=
uint64
(
3
)
NumConfirmations
:
uint64
(
10
),
defaultResubmissionTimeout
=
48
*
time
.
Second
SafeAbortNonceTooLowCount
:
uint64
(
3
),
defaultNetworkTimeout
=
10
*
time
.
Second
ResubmissionTimeout
:
48
*
time
.
Second
,
defaultTxSendTimeout
=
0
*
time
.
Second
NetworkTimeout
:
10
*
time
.
Second
,
defaultTxNotInMempoolTimeout
=
2
*
time
.
Minute
TxSendTimeout
:
0
*
time
.
Second
,
defaultReceiptQueryInterval
=
12
*
time
.
Second
TxNotInMempoolTimeout
:
2
*
time
.
Minute
,
ReceiptQueryInterval
:
12
*
time
.
Second
,
}
DefaultChallengerFlagValues
=
DefaultFlagValues
{
NumConfirmations
:
uint64
(
3
),
SafeAbortNonceTooLowCount
:
uint64
(
3
),
ResubmissionTimeout
:
24
*
time
.
Second
,
NetworkTimeout
:
10
*
time
.
Second
,
TxSendTimeout
:
2
*
time
.
Minute
,
TxNotInMempoolTimeout
:
1
*
time
.
Minute
,
ReceiptQueryInterval
:
12
*
time
.
Second
,
}
)
)
func
CLIFlags
(
envPrefix
string
)
[]
cli
.
Flag
{
func
CLIFlags
(
envPrefix
string
)
[]
cli
.
Flag
{
return
CLIFlagsWithDefaults
(
envPrefix
,
DefaultBatcherFlagValues
)
}
func
CLIFlagsWithDefaults
(
envPrefix
string
,
defaults
DefaultFlagValues
)
[]
cli
.
Flag
{
prefixEnvVars
:=
func
(
name
string
)
[]
string
{
prefixEnvVars
:=
func
(
name
string
)
[]
string
{
return
opservice
.
PrefixEnvVar
(
envPrefix
,
name
)
return
opservice
.
PrefixEnvVar
(
envPrefix
,
name
)
}
}
...
@@ -81,43 +106,43 @@ func CLIFlags(envPrefix string) []cli.Flag {
...
@@ -81,43 +106,43 @@ func CLIFlags(envPrefix string) []cli.Flag {
&
cli
.
Uint64Flag
{
&
cli
.
Uint64Flag
{
Name
:
NumConfirmationsFlagName
,
Name
:
NumConfirmationsFlagName
,
Usage
:
"Number of confirmations which we will wait after sending a transaction"
,
Usage
:
"Number of confirmations which we will wait after sending a transaction"
,
Value
:
defaultNumConfirmations
,
Value
:
default
s
.
NumConfirmations
,
EnvVars
:
prefixEnvVars
(
"NUM_CONFIRMATIONS"
),
EnvVars
:
prefixEnvVars
(
"NUM_CONFIRMATIONS"
),
},
},
&
cli
.
Uint64Flag
{
&
cli
.
Uint64Flag
{
Name
:
SafeAbortNonceTooLowCountFlagName
,
Name
:
SafeAbortNonceTooLowCountFlagName
,
Usage
:
"Number of ErrNonceTooLow observations required to give up on a tx at a particular nonce without receiving confirmation"
,
Usage
:
"Number of ErrNonceTooLow observations required to give up on a tx at a particular nonce without receiving confirmation"
,
Value
:
defaultSafeAbortNonceTooLowCount
,
Value
:
default
s
.
SafeAbortNonceTooLowCount
,
EnvVars
:
prefixEnvVars
(
"SAFE_ABORT_NONCE_TOO_LOW_COUNT"
),
EnvVars
:
prefixEnvVars
(
"SAFE_ABORT_NONCE_TOO_LOW_COUNT"
),
},
},
&
cli
.
DurationFlag
{
&
cli
.
DurationFlag
{
Name
:
ResubmissionTimeoutFlagName
,
Name
:
ResubmissionTimeoutFlagName
,
Usage
:
"Duration we will wait before resubmitting a transaction to L1"
,
Usage
:
"Duration we will wait before resubmitting a transaction to L1"
,
Value
:
defaultResubmissionTimeout
,
Value
:
default
s
.
ResubmissionTimeout
,
EnvVars
:
prefixEnvVars
(
"RESUBMISSION_TIMEOUT"
),
EnvVars
:
prefixEnvVars
(
"RESUBMISSION_TIMEOUT"
),
},
},
&
cli
.
DurationFlag
{
&
cli
.
DurationFlag
{
Name
:
NetworkTimeoutFlagName
,
Name
:
NetworkTimeoutFlagName
,
Usage
:
"Timeout for all network operations"
,
Usage
:
"Timeout for all network operations"
,
Value
:
defaultNetworkTimeout
,
Value
:
default
s
.
NetworkTimeout
,
EnvVars
:
prefixEnvVars
(
"NETWORK_TIMEOUT"
),
EnvVars
:
prefixEnvVars
(
"NETWORK_TIMEOUT"
),
},
},
&
cli
.
DurationFlag
{
&
cli
.
DurationFlag
{
Name
:
TxSendTimeoutFlagName
,
Name
:
TxSendTimeoutFlagName
,
Usage
:
"Timeout for sending transactions. If 0 it is disabled."
,
Usage
:
"Timeout for sending transactions. If 0 it is disabled."
,
Value
:
defaultTxSendTimeout
,
Value
:
default
s
.
TxSendTimeout
,
EnvVars
:
prefixEnvVars
(
"TXMGR_TX_SEND_TIMEOUT"
),
EnvVars
:
prefixEnvVars
(
"TXMGR_TX_SEND_TIMEOUT"
),
},
},
&
cli
.
DurationFlag
{
&
cli
.
DurationFlag
{
Name
:
TxNotInMempoolTimeoutFlagName
,
Name
:
TxNotInMempoolTimeoutFlagName
,
Usage
:
"Timeout for aborting a tx send if the tx does not make it to the mempool."
,
Usage
:
"Timeout for aborting a tx send if the tx does not make it to the mempool."
,
Value
:
defaultTxNotInMempoolTimeout
,
Value
:
default
s
.
TxNotInMempoolTimeout
,
EnvVars
:
prefixEnvVars
(
"TXMGR_TX_NOT_IN_MEMPOOL_TIMEOUT"
),
EnvVars
:
prefixEnvVars
(
"TXMGR_TX_NOT_IN_MEMPOOL_TIMEOUT"
),
},
},
&
cli
.
DurationFlag
{
&
cli
.
DurationFlag
{
Name
:
ReceiptQueryIntervalFlagName
,
Name
:
ReceiptQueryIntervalFlagName
,
Usage
:
"Frequency to poll for receipts"
,
Usage
:
"Frequency to poll for receipts"
,
Value
:
defaultReceiptQueryInterval
,
Value
:
default
s
.
ReceiptQueryInterval
,
EnvVars
:
prefixEnvVars
(
"TXMGR_RECEIPT_QUERY_INTERVAL"
),
EnvVars
:
prefixEnvVars
(
"TXMGR_RECEIPT_QUERY_INTERVAL"
),
},
},
},
client
.
CLIFlags
(
envPrefix
)
...
)
},
client
.
CLIFlags
(
envPrefix
)
...
)
...
@@ -140,16 +165,16 @@ type CLIConfig struct {
...
@@ -140,16 +165,16 @@ type CLIConfig struct {
TxNotInMempoolTimeout
time
.
Duration
TxNotInMempoolTimeout
time
.
Duration
}
}
func
NewCLIConfig
(
l1RPCURL
string
)
CLIConfig
{
func
NewCLIConfig
(
l1RPCURL
string
,
defaults
DefaultFlagValues
)
CLIConfig
{
return
CLIConfig
{
return
CLIConfig
{
L1RPCURL
:
l1RPCURL
,
L1RPCURL
:
l1RPCURL
,
NumConfirmations
:
defaultNumConfirmations
,
NumConfirmations
:
default
s
.
NumConfirmations
,
SafeAbortNonceTooLowCount
:
defaultSafeAbortNonceTooLowCount
,
SafeAbortNonceTooLowCount
:
default
s
.
SafeAbortNonceTooLowCount
,
ResubmissionTimeout
:
defaultResubmissionTimeout
,
ResubmissionTimeout
:
default
s
.
ResubmissionTimeout
,
NetworkTimeout
:
defaultNetworkTimeout
,
NetworkTimeout
:
default
s
.
NetworkTimeout
,
TxSendTimeout
:
defaultTxSendTimeout
,
TxSendTimeout
:
default
s
.
TxSendTimeout
,
TxNotInMempoolTimeout
:
defaultTxNotInMempoolTimeout
,
TxNotInMempoolTimeout
:
default
s
.
TxNotInMempoolTimeout
,
ReceiptQueryInterval
:
defaultReceiptQueryInterval
,
ReceiptQueryInterval
:
default
s
.
ReceiptQueryInterval
,
SignerCLIConfig
:
client
.
NewCLIConfig
(),
SignerCLIConfig
:
client
.
NewCLIConfig
(),
}
}
}
}
...
...
op-service/txmgr/cli_test.go
View file @
d0b9758c
...
@@ -13,12 +13,12 @@ var (
...
@@ -13,12 +13,12 @@ var (
func
TestDefaultCLIOptionsMatchDefaultConfig
(
t
*
testing
.
T
)
{
func
TestDefaultCLIOptionsMatchDefaultConfig
(
t
*
testing
.
T
)
{
cfg
:=
configForArgs
()
cfg
:=
configForArgs
()
defaultCfg
:=
NewCLIConfig
(
l1EthRpcValue
)
defaultCfg
:=
NewCLIConfig
(
l1EthRpcValue
,
DefaultBatcherFlagValues
)
require
.
Equal
(
t
,
defaultCfg
,
cfg
)
require
.
Equal
(
t
,
defaultCfg
,
cfg
)
}
}
func
TestDefaultConfigIsValid
(
t
*
testing
.
T
)
{
func
TestDefaultConfigIsValid
(
t
*
testing
.
T
)
{
cfg
:=
NewCLIConfig
(
l1EthRpcValue
)
cfg
:=
NewCLIConfig
(
l1EthRpcValue
,
DefaultBatcherFlagValues
)
require
.
NoError
(
t
,
cfg
.
Check
())
require
.
NoError
(
t
,
cfg
.
Check
())
}
}
...
...
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