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
40d3f4ff
Unverified
Commit
40d3f4ff
authored
Jan 16, 2024
by
Roberto Bayardo
Committed by
GitHub
Jan 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
baseFee naming consistency (#8973)
parent
077254ed
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
144 additions
and
144 deletions
+144
-144
attributes.go
op-node/rollup/derive/attributes.go
+4
-4
l1_block_info.go
op-node/rollup/derive/l1_block_info.go
+2
-2
payload_util.go
op-node/rollup/derive/payload_util.go
+2
-2
system_config.go
op-node/rollup/derive/system_config.go
+2
-2
system_config_test.go
op-node/rollup/derive/system_config_test.go
+6
-6
types.go
op-service/eth/types.go
+4
-4
cli.go
op-service/txmgr/cli.go
+16
-16
noop.go
op-service/txmgr/metrics/noop.go
+1
-1
tx_metrics.go
op-service/txmgr/metrics/tx_metrics.go
+7
-7
price_bump_test.go
op-service/txmgr/price_bump_test.go
+44
-44
txmgr.go
op-service/txmgr/txmgr.go
+37
-37
txmgr_test.go
op-service/txmgr/txmgr_test.go
+19
-19
No files found.
op-node/rollup/derive/attributes.go
View file @
40d3f4ff
...
@@ -108,17 +108,17 @@ func (ba *FetchingAttributesBuilder) PreparePayloadAttributes(ctx context.Contex
...
@@ -108,17 +108,17 @@ func (ba *FetchingAttributesBuilder) PreparePayloadAttributes(ctx context.Contex
}
}
// If this is the Ecotone activation block we update the system config by copying over "Scalar"
// If this is the Ecotone activation block we update the system config by copying over "Scalar"
// to "Base
f
eeScalar". Note that after doing so, the L2 view of the system config differs from
// to "Base
F
eeScalar". Note that after doing so, the L2 view of the system config differs from
// that on the L1 up until we receive a "type 4" log event that explicitly updates the new
// that on the L1 up until we receive a "type 4" log event that explicitly updates the new
// scalars.
// scalars.
if
ba
.
rollupCfg
.
IsEcotoneActivationBlock
(
nextL2Time
)
{
if
ba
.
rollupCfg
.
IsEcotoneActivationBlock
(
nextL2Time
)
{
// check if the scalar is too big to convert to uint32, and if so just use the uint32 max value
// check if the scalar is too big to convert to uint32, and if so just use the uint32 max value
base
f
eeScalar
:=
uint32
(
math
.
MaxUint32
)
base
F
eeScalar
:=
uint32
(
math
.
MaxUint32
)
scalar
:=
new
(
big
.
Int
)
.
SetBytes
(
sysConfig
.
Scalar
[
:
])
scalar
:=
new
(
big
.
Int
)
.
SetBytes
(
sysConfig
.
Scalar
[
:
])
if
scalar
.
Cmp
(
big
.
NewInt
(
math
.
MaxUint32
))
<
0
{
if
scalar
.
Cmp
(
big
.
NewInt
(
math
.
MaxUint32
))
<
0
{
base
f
eeScalar
=
uint32
(
scalar
.
Int64
())
base
F
eeScalar
=
uint32
(
scalar
.
Int64
())
}
}
sysConfig
.
Base
feeScalar
=
basef
eeScalar
sysConfig
.
Base
FeeScalar
=
baseF
eeScalar
}
}
txs
:=
make
([]
hexutil
.
Bytes
,
0
,
1
+
len
(
depositTxs
))
txs
:=
make
([]
hexutil
.
Bytes
,
0
,
1
+
len
(
depositTxs
))
...
...
op-node/rollup/derive/l1_block_info.go
View file @
40d3f4ff
...
@@ -269,8 +269,8 @@ func L1InfoDeposit(rollupCfg *rollup.Config, sysCfg eth.SystemConfig, seqNumber
...
@@ -269,8 +269,8 @@ func L1InfoDeposit(rollupCfg *rollup.Config, sysCfg eth.SystemConfig, seqNumber
var
err
error
var
err
error
if
isEcotoneButNotFirstBlock
(
rollupCfg
,
l2BlockTime
)
{
if
isEcotoneButNotFirstBlock
(
rollupCfg
,
l2BlockTime
)
{
l1BlockInfo
.
BlobBaseFee
=
block
.
BlobBaseFee
()
l1BlockInfo
.
BlobBaseFee
=
block
.
BlobBaseFee
()
l1BlockInfo
.
BlobBaseFeeScalar
=
sysCfg
.
BlobBase
f
eeScalar
l1BlockInfo
.
BlobBaseFeeScalar
=
sysCfg
.
BlobBase
F
eeScalar
l1BlockInfo
.
BaseFeeScalar
=
sysCfg
.
Base
f
eeScalar
l1BlockInfo
.
BaseFeeScalar
=
sysCfg
.
Base
F
eeScalar
data
,
err
=
l1BlockInfo
.
marshalBinaryEcotone
()
data
,
err
=
l1BlockInfo
.
marshalBinaryEcotone
()
}
else
{
}
else
{
l1BlockInfo
.
L1FeeOverhead
=
sysCfg
.
Overhead
l1BlockInfo
.
L1FeeOverhead
=
sysCfg
.
Overhead
...
...
op-node/rollup/derive/payload_util.go
View file @
40d3f4ff
...
@@ -78,8 +78,8 @@ func PayloadToSystemConfig(rollupCfg *rollup.Config, payload *eth.ExecutionPaylo
...
@@ -78,8 +78,8 @@ func PayloadToSystemConfig(rollupCfg *rollup.Config, payload *eth.ExecutionPaylo
Overhead
:
info
.
L1FeeOverhead
,
Overhead
:
info
.
L1FeeOverhead
,
Scalar
:
info
.
L1FeeScalar
,
Scalar
:
info
.
L1FeeScalar
,
GasLimit
:
uint64
(
payload
.
GasLimit
),
GasLimit
:
uint64
(
payload
.
GasLimit
),
Base
f
eeScalar
:
info
.
BaseFeeScalar
,
Base
F
eeScalar
:
info
.
BaseFeeScalar
,
BlobBase
f
eeScalar
:
info
.
BlobBaseFeeScalar
,
BlobBase
F
eeScalar
:
info
.
BlobBaseFeeScalar
,
},
err
},
err
}
}
}
}
op-node/rollup/derive/system_config.go
View file @
40d3f4ff
...
@@ -164,8 +164,8 @@ func ProcessSystemConfigUpdateLogEvent(destSysCfg *eth.SystemConfig, ev *types.L
...
@@ -164,8 +164,8 @@ func ProcessSystemConfigUpdateLogEvent(destSysCfg *eth.SystemConfig, ev *types.L
if
!
solabi
.
EmptyReader
(
reader
)
{
if
!
solabi
.
EmptyReader
(
reader
)
{
return
NewCriticalError
(
errors
.
New
(
"too many bytes"
))
return
NewCriticalError
(
errors
.
New
(
"too many bytes"
))
}
}
destSysCfg
.
Base
f
eeScalar
=
binary
.
BigEndian
.
Uint32
(
packed
[
0
:
4
])
destSysCfg
.
Base
F
eeScalar
=
binary
.
BigEndian
.
Uint32
(
packed
[
0
:
4
])
destSysCfg
.
BlobBase
f
eeScalar
=
binary
.
BigEndian
.
Uint32
(
packed
[
4
:
8
])
destSysCfg
.
BlobBase
F
eeScalar
=
binary
.
BigEndian
.
Uint32
(
packed
[
4
:
8
])
return
nil
return
nil
default
:
default
:
return
fmt
.
Errorf
(
"unrecognized L1 sysCfg update type: %s"
,
updateType
)
return
fmt
.
Errorf
(
"unrecognized L1 sysCfg update type: %s"
,
updateType
)
...
...
op-node/rollup/derive/system_config_test.go
View file @
40d3f4ff
...
@@ -149,19 +149,19 @@ func TestProcessSystemConfigUpdateLogEvent(t *testing.T) {
...
@@ -149,19 +149,19 @@ func TestProcessSystemConfigUpdateLogEvent(t *testing.T) {
},
},
},
},
hook
:
func
(
t
*
testing
.
T
,
log
*
types
.
Log
)
*
types
.
Log
{
hook
:
func
(
t
*
testing
.
T
,
log
*
types
.
Log
)
*
types
.
Log
{
base
f
eeScalar
:=
big
.
NewInt
(
0xaa
)
base
F
eeScalar
:=
big
.
NewInt
(
0xaa
)
blobBase
f
eeScalar
:=
big
.
NewInt
(
0xbb
)
blobBase
F
eeScalar
:=
big
.
NewInt
(
0xbb
)
packed
:=
make
([]
byte
,
8
)
packed
:=
make
([]
byte
,
8
)
base
f
eeScalar
.
FillBytes
(
packed
[
0
:
4
])
base
F
eeScalar
.
FillBytes
(
packed
[
0
:
4
])
blobBase
f
eeScalar
.
FillBytes
(
packed
[
4
:
8
])
blobBase
F
eeScalar
.
FillBytes
(
packed
[
4
:
8
])
data
,
err
:=
bytesArgs
.
Pack
(
packed
)
data
,
err
:=
bytesArgs
.
Pack
(
packed
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
log
.
Data
=
data
log
.
Data
=
data
return
log
return
log
},
},
config
:
eth
.
SystemConfig
{
config
:
eth
.
SystemConfig
{
Base
f
eeScalar
:
0xaa
,
Base
F
eeScalar
:
0xaa
,
BlobBase
f
eeScalar
:
0xbb
,
BlobBase
F
eeScalar
:
0xbb
,
},
},
err
:
false
,
err
:
false
,
},
},
...
...
op-service/eth/types.go
View file @
40d3f4ff
...
@@ -316,10 +316,10 @@ type SystemConfig struct {
...
@@ -316,10 +316,10 @@ type SystemConfig struct {
Scalar
Bytes32
`json:"scalar"`
Scalar
Bytes32
`json:"scalar"`
// GasLimit identifies the L2 block gas limit
// GasLimit identifies the L2 block gas limit
GasLimit
uint64
`json:"gasLimit"`
GasLimit
uint64
`json:"gasLimit"`
// Base
f
eeScalar scales the L1 calldata fee after the Ecotone upgrade
// Base
F
eeScalar scales the L1 calldata fee after the Ecotone upgrade
Base
feeScalar
uint32
`json:"basef
eeScalar"`
Base
FeeScalar
uint32
`json:"baseF
eeScalar"`
// BlobBase
f
eeScalar scales the L1 blob fee after the Ecotone upgrade
// BlobBase
F
eeScalar scales the L1 blob fee after the Ecotone upgrade
BlobBase
feeScalar
uint32
`json:"blobBasef
eeScalar"`
BlobBase
FeeScalar
uint32
`json:"blobBaseF
eeScalar"`
// More fields can be added for future SystemConfig versions.
// More fields can be added for future SystemConfig versions.
}
}
...
...
op-service/txmgr/cli.go
View file @
40d3f4ff
...
@@ -29,7 +29,7 @@ const (
...
@@ -29,7 +29,7 @@ const (
SafeAbortNonceTooLowCountFlagName
=
"safe-abort-nonce-too-low-count"
SafeAbortNonceTooLowCountFlagName
=
"safe-abort-nonce-too-low-count"
FeeLimitMultiplierFlagName
=
"fee-limit-multiplier"
FeeLimitMultiplierFlagName
=
"fee-limit-multiplier"
FeeLimitThresholdFlagName
=
"txmgr.fee-limit-threshold"
FeeLimitThresholdFlagName
=
"txmgr.fee-limit-threshold"
MinBase
f
eeFlagName
=
"txmgr.min-basefee"
MinBase
F
eeFlagName
=
"txmgr.min-basefee"
MinTipCapFlagName
=
"txmgr.min-tip-cap"
MinTipCapFlagName
=
"txmgr.min-tip-cap"
ResubmissionTimeoutFlagName
=
"resubmission-timeout"
ResubmissionTimeoutFlagName
=
"resubmission-timeout"
NetworkTimeoutFlagName
=
"network-timeout"
NetworkTimeoutFlagName
=
"network-timeout"
...
@@ -139,8 +139,8 @@ func CLIFlagsWithDefaults(envPrefix string, defaults DefaultFlagValues) []cli.Fl
...
@@ -139,8 +139,8 @@ func CLIFlagsWithDefaults(envPrefix string, defaults DefaultFlagValues) []cli.Fl
EnvVars
:
prefixEnvVars
(
"TXMGR_FEE_LIMIT_THRESHOLD"
),
EnvVars
:
prefixEnvVars
(
"TXMGR_FEE_LIMIT_THRESHOLD"
),
},
},
&
cli
.
Float64Flag
{
&
cli
.
Float64Flag
{
Name
:
MinBase
f
eeFlagName
,
Name
:
MinBase
F
eeFlagName
,
Usage
:
"Enforces a minimum basefee (in GWei) to assume when determining tx fees. Off by default."
,
Usage
:
"Enforces a minimum base
fee (in GWei) to assume when determining tx fees. Off by default."
,
EnvVars
:
prefixEnvVars
(
"TXMGR_MIN_BASEFEE"
),
EnvVars
:
prefixEnvVars
(
"TXMGR_MIN_BASEFEE"
),
},
},
&
cli
.
Float64Flag
{
&
cli
.
Float64Flag
{
...
@@ -193,7 +193,7 @@ type CLIConfig struct {
...
@@ -193,7 +193,7 @@ type CLIConfig struct {
SafeAbortNonceTooLowCount
uint64
SafeAbortNonceTooLowCount
uint64
FeeLimitMultiplier
uint64
FeeLimitMultiplier
uint64
FeeLimitThresholdGwei
float64
FeeLimitThresholdGwei
float64
MinBase
f
eeGwei
float64
MinBase
F
eeGwei
float64
MinTipCapGwei
float64
MinTipCapGwei
float64
ResubmissionTimeout
time
.
Duration
ResubmissionTimeout
time
.
Duration
ReceiptQueryInterval
time
.
Duration
ReceiptQueryInterval
time
.
Duration
...
@@ -231,9 +231,9 @@ func (m CLIConfig) Check() error {
...
@@ -231,9 +231,9 @@ func (m CLIConfig) Check() error {
if
m
.
FeeLimitMultiplier
==
0
{
if
m
.
FeeLimitMultiplier
==
0
{
return
errors
.
New
(
"must provide FeeLimitMultiplier"
)
return
errors
.
New
(
"must provide FeeLimitMultiplier"
)
}
}
if
m
.
MinBase
f
eeGwei
<
m
.
MinTipCapGwei
{
if
m
.
MinBase
F
eeGwei
<
m
.
MinTipCapGwei
{
return
fmt
.
Errorf
(
"minBase
f
ee smaller than minTipCap, have %f < %f"
,
return
fmt
.
Errorf
(
"minBase
F
ee smaller than minTipCap, have %f < %f"
,
m
.
MinBase
f
eeGwei
,
m
.
MinTipCapGwei
)
m
.
MinBase
F
eeGwei
,
m
.
MinTipCapGwei
)
}
}
if
m
.
ResubmissionTimeout
==
0
{
if
m
.
ResubmissionTimeout
==
0
{
return
errors
.
New
(
"must provide ResubmissionTimeout"
)
return
errors
.
New
(
"must provide ResubmissionTimeout"
)
...
@@ -266,7 +266,7 @@ func ReadCLIConfig(ctx *cli.Context) CLIConfig {
...
@@ -266,7 +266,7 @@ func ReadCLIConfig(ctx *cli.Context) CLIConfig {
SafeAbortNonceTooLowCount
:
ctx
.
Uint64
(
SafeAbortNonceTooLowCountFlagName
),
SafeAbortNonceTooLowCount
:
ctx
.
Uint64
(
SafeAbortNonceTooLowCountFlagName
),
FeeLimitMultiplier
:
ctx
.
Uint64
(
FeeLimitMultiplierFlagName
),
FeeLimitMultiplier
:
ctx
.
Uint64
(
FeeLimitMultiplierFlagName
),
FeeLimitThresholdGwei
:
ctx
.
Float64
(
FeeLimitThresholdFlagName
),
FeeLimitThresholdGwei
:
ctx
.
Float64
(
FeeLimitThresholdFlagName
),
MinBase
feeGwei
:
ctx
.
Float64
(
MinBasef
eeFlagName
),
MinBase
FeeGwei
:
ctx
.
Float64
(
MinBaseF
eeFlagName
),
MinTipCapGwei
:
ctx
.
Float64
(
MinTipCapFlagName
),
MinTipCapGwei
:
ctx
.
Float64
(
MinTipCapFlagName
),
ResubmissionTimeout
:
ctx
.
Duration
(
ResubmissionTimeoutFlagName
),
ResubmissionTimeout
:
ctx
.
Duration
(
ResubmissionTimeoutFlagName
),
ReceiptQueryInterval
:
ctx
.
Duration
(
ReceiptQueryIntervalFlagName
),
ReceiptQueryInterval
:
ctx
.
Duration
(
ReceiptQueryIntervalFlagName
),
...
@@ -313,9 +313,9 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {
...
@@ -313,9 +313,9 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {
return
Config
{},
fmt
.
Errorf
(
"invalid fee limit threshold: %w"
,
err
)
return
Config
{},
fmt
.
Errorf
(
"invalid fee limit threshold: %w"
,
err
)
}
}
minBase
fee
,
err
:=
eth
.
GweiToWei
(
cfg
.
MinBasef
eeGwei
)
minBase
Fee
,
err
:=
eth
.
GweiToWei
(
cfg
.
MinBaseF
eeGwei
)
if
err
!=
nil
{
if
err
!=
nil
{
return
Config
{},
fmt
.
Errorf
(
"invalid min basefee: %w"
,
err
)
return
Config
{},
fmt
.
Errorf
(
"invalid min base
fee: %w"
,
err
)
}
}
minTipCap
,
err
:=
eth
.
GweiToWei
(
cfg
.
MinTipCapGwei
)
minTipCap
,
err
:=
eth
.
GweiToWei
(
cfg
.
MinTipCapGwei
)
...
@@ -328,7 +328,7 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {
...
@@ -328,7 +328,7 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {
ResubmissionTimeout
:
cfg
.
ResubmissionTimeout
,
ResubmissionTimeout
:
cfg
.
ResubmissionTimeout
,
FeeLimitMultiplier
:
cfg
.
FeeLimitMultiplier
,
FeeLimitMultiplier
:
cfg
.
FeeLimitMultiplier
,
FeeLimitThreshold
:
feeLimitThreshold
,
FeeLimitThreshold
:
feeLimitThreshold
,
MinBase
fee
:
minBasef
ee
,
MinBase
Fee
:
minBaseF
ee
,
MinTipCap
:
minTipCap
,
MinTipCap
:
minTipCap
,
ChainID
:
chainID
,
ChainID
:
chainID
,
TxSendTimeout
:
cfg
.
TxSendTimeout
,
TxSendTimeout
:
cfg
.
TxSendTimeout
,
...
@@ -359,8 +359,8 @@ type Config struct {
...
@@ -359,8 +359,8 @@ type Config struct {
// below this threshold.
// below this threshold.
FeeLimitThreshold
*
big
.
Int
FeeLimitThreshold
*
big
.
Int
// Minimum basefee (in Wei) to assume when determining tx fees.
// Minimum base
fee (in Wei) to assume when determining tx fees.
MinBase
f
ee
*
big
.
Int
MinBase
F
ee
*
big
.
Int
// Minimum tip cap (in Wei) to enforce when determining tx fees.
// Minimum tip cap (in Wei) to enforce when determining tx fees.
MinTipCap
*
big
.
Int
MinTipCap
*
big
.
Int
...
@@ -412,9 +412,9 @@ func (m Config) Check() error {
...
@@ -412,9 +412,9 @@ func (m Config) Check() error {
if
m
.
FeeLimitMultiplier
==
0
{
if
m
.
FeeLimitMultiplier
==
0
{
return
errors
.
New
(
"must provide FeeLimitMultiplier"
)
return
errors
.
New
(
"must provide FeeLimitMultiplier"
)
}
}
if
m
.
MinBase
fee
!=
nil
&&
m
.
MinTipCap
!=
nil
&&
m
.
MinBasef
ee
.
Cmp
(
m
.
MinTipCap
)
==
-
1
{
if
m
.
MinBase
Fee
!=
nil
&&
m
.
MinTipCap
!=
nil
&&
m
.
MinBaseF
ee
.
Cmp
(
m
.
MinTipCap
)
==
-
1
{
return
fmt
.
Errorf
(
"minBase
f
ee smaller than minTipCap, have %v < %v"
,
return
fmt
.
Errorf
(
"minBase
F
ee smaller than minTipCap, have %v < %v"
,
m
.
MinBase
f
ee
,
m
.
MinTipCap
)
m
.
MinBase
F
ee
,
m
.
MinTipCap
)
}
}
if
m
.
ResubmissionTimeout
==
0
{
if
m
.
ResubmissionTimeout
==
0
{
return
errors
.
New
(
"must provide ResubmissionTimeout"
)
return
errors
.
New
(
"must provide ResubmissionTimeout"
)
...
...
op-service/txmgr/metrics/noop.go
View file @
40d3f4ff
...
@@ -14,6 +14,6 @@ func (*NoopTxMetrics) RecordGasBumpCount(int) {}
...
@@ -14,6 +14,6 @@ func (*NoopTxMetrics) RecordGasBumpCount(int) {}
func
(
*
NoopTxMetrics
)
RecordTxConfirmationLatency
(
int64
)
{}
func
(
*
NoopTxMetrics
)
RecordTxConfirmationLatency
(
int64
)
{}
func
(
*
NoopTxMetrics
)
TxConfirmed
(
*
types
.
Receipt
)
{}
func
(
*
NoopTxMetrics
)
TxConfirmed
(
*
types
.
Receipt
)
{}
func
(
*
NoopTxMetrics
)
TxPublished
(
string
)
{}
func
(
*
NoopTxMetrics
)
TxPublished
(
string
)
{}
func
(
*
NoopTxMetrics
)
RecordBase
f
ee
(
*
big
.
Int
)
{}
func
(
*
NoopTxMetrics
)
RecordBase
F
ee
(
*
big
.
Int
)
{}
func
(
*
NoopTxMetrics
)
RecordTipCap
(
*
big
.
Int
)
{}
func
(
*
NoopTxMetrics
)
RecordTipCap
(
*
big
.
Int
)
{}
func
(
*
NoopTxMetrics
)
RPCError
()
{}
func
(
*
NoopTxMetrics
)
RPCError
()
{}
op-service/txmgr/metrics/tx_metrics.go
View file @
40d3f4ff
...
@@ -17,7 +17,7 @@ type TxMetricer interface {
...
@@ -17,7 +17,7 @@ type TxMetricer interface {
RecordPendingTx
(
pending
int64
)
RecordPendingTx
(
pending
int64
)
TxConfirmed
(
*
types
.
Receipt
)
TxConfirmed
(
*
types
.
Receipt
)
TxPublished
(
string
)
TxPublished
(
string
)
RecordBase
f
ee
(
*
big
.
Int
)
RecordBase
F
ee
(
*
big
.
Int
)
RecordTipCap
(
*
big
.
Int
)
RecordTipCap
(
*
big
.
Int
)
RPCError
()
RPCError
()
}
}
...
@@ -33,7 +33,7 @@ type TxMetrics struct {
...
@@ -33,7 +33,7 @@ type TxMetrics struct {
txPublishError
*
prometheus
.
CounterVec
txPublishError
*
prometheus
.
CounterVec
publishEvent
*
metrics
.
Event
publishEvent
*
metrics
.
Event
confirmEvent
metrics
.
EventVec
confirmEvent
metrics
.
EventVec
base
f
ee
prometheus
.
Gauge
base
F
ee
prometheus
.
Gauge
tipCap
prometheus
.
Gauge
tipCap
prometheus
.
Gauge
rpcError
prometheus
.
Counter
rpcError
prometheus
.
Counter
}
}
...
@@ -104,10 +104,10 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics {
...
@@ -104,10 +104,10 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics {
},
[]
string
{
"error"
}),
},
[]
string
{
"error"
}),
confirmEvent
:
metrics
.
NewEventVec
(
factory
,
ns
,
"txmgr"
,
"confirm"
,
"tx confirm"
,
[]
string
{
"status"
}),
confirmEvent
:
metrics
.
NewEventVec
(
factory
,
ns
,
"txmgr"
,
"confirm"
,
"tx confirm"
,
[]
string
{
"status"
}),
publishEvent
:
metrics
.
NewEvent
(
factory
,
ns
,
"txmgr"
,
"publish"
,
"tx publish"
),
publishEvent
:
metrics
.
NewEvent
(
factory
,
ns
,
"txmgr"
,
"publish"
,
"tx publish"
),
base
f
ee
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
base
F
ee
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Namespace
:
ns
,
Name
:
"basefee_wei"
,
Name
:
"basefee_wei"
,
Help
:
"Latest L1 base
f
ee (in Wei)"
,
Help
:
"Latest L1 base
F
ee (in Wei)"
,
Subsystem
:
"txmgr"
,
Subsystem
:
"txmgr"
,
}),
}),
tipCap
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
tipCap
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
...
@@ -158,9 +158,9 @@ func (t *TxMetrics) TxPublished(errString string) {
...
@@ -158,9 +158,9 @@ func (t *TxMetrics) TxPublished(errString string) {
}
}
}
}
func
(
t
*
TxMetrics
)
RecordBase
fee
(
basef
ee
*
big
.
Int
)
{
func
(
t
*
TxMetrics
)
RecordBase
Fee
(
baseF
ee
*
big
.
Int
)
{
bff
,
_
:=
base
f
ee
.
Float64
()
bff
,
_
:=
base
F
ee
.
Float64
()
t
.
base
f
ee
.
Set
(
bff
)
t
.
base
F
ee
.
Set
(
bff
)
}
}
func
(
t
*
TxMetrics
)
RecordTipCap
(
tipcap
*
big
.
Int
)
{
func
(
t
*
TxMetrics
)
RecordTipCap
(
tipcap
*
big
.
Int
)
{
...
...
op-service/txmgr/price_bump_test.go
View file @
40d3f4ff
...
@@ -14,19 +14,19 @@ import (
...
@@ -14,19 +14,19 @@ import (
type
priceBumpTest
struct
{
type
priceBumpTest
struct
{
prevGasTip
int64
prevGasTip
int64
prevBase
f
ee
int64
prevBase
F
ee
int64
newGasTip
int64
newGasTip
int64
newBase
f
ee
int64
newBase
F
ee
int64
expectedTip
int64
expectedTip
int64
expectedFC
int64
expectedFC
int64
isBlobTx
bool
isBlobTx
bool
}
}
func
(
tc
*
priceBumpTest
)
run
(
t
*
testing
.
T
)
{
func
(
tc
*
priceBumpTest
)
run
(
t
*
testing
.
T
)
{
prevFC
:=
calcGasFeeCap
(
big
.
NewInt
(
tc
.
prevBase
f
ee
),
big
.
NewInt
(
tc
.
prevGasTip
))
prevFC
:=
calcGasFeeCap
(
big
.
NewInt
(
tc
.
prevBase
F
ee
),
big
.
NewInt
(
tc
.
prevGasTip
))
lgr
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
lgr
:=
testlog
.
Logger
(
t
,
log
.
LvlCrit
)
tip
,
fc
:=
updateFees
(
big
.
NewInt
(
tc
.
prevGasTip
),
prevFC
,
big
.
NewInt
(
tc
.
newGasTip
),
big
.
NewInt
(
tc
.
newBase
f
ee
),
tc
.
isBlobTx
,
lgr
)
tip
,
fc
:=
updateFees
(
big
.
NewInt
(
tc
.
prevGasTip
),
prevFC
,
big
.
NewInt
(
tc
.
newGasTip
),
big
.
NewInt
(
tc
.
newBase
F
ee
),
tc
.
isBlobTx
,
lgr
)
require
.
Equal
(
t
,
tc
.
expectedTip
,
tip
.
Int64
(),
"tip must be as expected"
)
require
.
Equal
(
t
,
tc
.
expectedTip
,
tip
.
Int64
(),
"tip must be as expected"
)
require
.
Equal
(
t
,
tc
.
expectedFC
,
fc
.
Int64
(),
"fee cap must be as expected"
)
require
.
Equal
(
t
,
tc
.
expectedFC
,
fc
.
Int64
(),
"fee cap must be as expected"
)
...
@@ -36,112 +36,112 @@ func TestUpdateFees(t *testing.T) {
...
@@ -36,112 +36,112 @@ func TestUpdateFees(t *testing.T) {
require
.
Equal
(
t
,
int64
(
10
),
priceBump
,
"test must be updated if priceBump is adjusted"
)
require
.
Equal
(
t
,
int64
(
10
),
priceBump
,
"test must be updated if priceBump is adjusted"
)
tests
:=
[]
priceBumpTest
{
tests
:=
[]
priceBumpTest
{
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
90
,
newBase
f
ee
:
900
,
newGasTip
:
90
,
newBase
F
ee
:
900
,
expectedTip
:
110
,
expectedFC
:
2310
,
expectedTip
:
110
,
expectedFC
:
2310
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
90
,
newBase
f
ee
:
900
,
newGasTip
:
90
,
newBase
F
ee
:
900
,
expectedTip
:
200
,
expectedFC
:
4200
,
expectedTip
:
200
,
expectedFC
:
4200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
101
,
newBase
f
ee
:
1000
,
newGasTip
:
101
,
newBase
F
ee
:
1000
,
expectedTip
:
110
,
expectedFC
:
2310
,
expectedTip
:
110
,
expectedFC
:
2310
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
101
,
newBase
f
ee
:
1000
,
newGasTip
:
101
,
newBase
F
ee
:
1000
,
expectedTip
:
200
,
expectedFC
:
4200
,
expectedTip
:
200
,
expectedFC
:
4200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
100
,
newBase
f
ee
:
1001
,
newGasTip
:
100
,
newBase
F
ee
:
1001
,
expectedTip
:
110
,
expectedFC
:
2310
,
expectedTip
:
110
,
expectedFC
:
2310
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
100
,
newBase
f
ee
:
1001
,
newGasTip
:
100
,
newBase
F
ee
:
1001
,
expectedTip
:
200
,
expectedFC
:
4200
,
expectedTip
:
200
,
expectedFC
:
4200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
101
,
newBase
f
ee
:
900
,
newGasTip
:
101
,
newBase
F
ee
:
900
,
expectedTip
:
110
,
expectedFC
:
2310
,
expectedTip
:
110
,
expectedFC
:
2310
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
101
,
newBase
f
ee
:
900
,
newGasTip
:
101
,
newBase
F
ee
:
900
,
expectedTip
:
200
,
expectedFC
:
4200
,
expectedTip
:
200
,
expectedFC
:
4200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
90
,
newBase
f
ee
:
1010
,
newGasTip
:
90
,
newBase
F
ee
:
1010
,
expectedTip
:
110
,
expectedFC
:
2310
,
expectedTip
:
110
,
expectedFC
:
2310
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
90
,
newBase
f
ee
:
1010
,
newGasTip
:
90
,
newBase
F
ee
:
1010
,
expectedTip
:
200
,
expectedFC
:
4200
,
expectedTip
:
200
,
expectedFC
:
4200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
101
,
newBase
f
ee
:
2000
,
newGasTip
:
101
,
newBase
F
ee
:
2000
,
expectedTip
:
110
,
expectedFC
:
4110
,
expectedTip
:
110
,
expectedFC
:
4110
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
101
,
newBase
f
ee
:
3000
,
newGasTip
:
101
,
newBase
F
ee
:
3000
,
expectedTip
:
200
,
expectedFC
:
6200
,
expectedTip
:
200
,
expectedFC
:
6200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
120
,
newBase
f
ee
:
900
,
newGasTip
:
120
,
newBase
F
ee
:
900
,
expectedTip
:
120
,
expectedFC
:
2310
,
expectedTip
:
120
,
expectedFC
:
2310
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
220
,
newBase
f
ee
:
900
,
newGasTip
:
220
,
newBase
F
ee
:
900
,
expectedTip
:
220
,
expectedFC
:
4200
,
expectedTip
:
220
,
expectedFC
:
4200
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
120
,
newBase
f
ee
:
1100
,
newGasTip
:
120
,
newBase
F
ee
:
1100
,
expectedTip
:
120
,
expectedFC
:
2320
,
expectedTip
:
120
,
expectedFC
:
2320
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
220
,
newBase
f
ee
:
2000
,
newGasTip
:
220
,
newBase
F
ee
:
2000
,
expectedTip
:
220
,
expectedFC
:
4220
,
expectedTip
:
220
,
expectedFC
:
4220
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
120
,
newBase
f
ee
:
1140
,
newGasTip
:
120
,
newBase
F
ee
:
1140
,
expectedTip
:
120
,
expectedFC
:
2400
,
expectedTip
:
120
,
expectedFC
:
2400
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
220
,
newBase
f
ee
:
2040
,
newGasTip
:
220
,
newBase
F
ee
:
2040
,
expectedTip
:
220
,
expectedFC
:
4300
,
expectedTip
:
220
,
expectedFC
:
4300
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
120
,
newBase
f
ee
:
1200
,
newGasTip
:
120
,
newBase
F
ee
:
1200
,
expectedTip
:
120
,
expectedFC
:
2520
,
expectedTip
:
120
,
expectedFC
:
2520
,
},
},
{
{
prevGasTip
:
100
,
prevBase
f
ee
:
1000
,
prevGasTip
:
100
,
prevBase
F
ee
:
1000
,
newGasTip
:
220
,
newBase
f
ee
:
2100
,
newGasTip
:
220
,
newBase
F
ee
:
2100
,
expectedTip
:
220
,
expectedFC
:
4420
,
expectedTip
:
220
,
expectedFC
:
4420
,
isBlobTx
:
true
,
isBlobTx
:
true
,
},
},
...
...
op-service/txmgr/txmgr.go
View file @
40d3f4ff
...
@@ -89,7 +89,7 @@ type ETHBackend interface {
...
@@ -89,7 +89,7 @@ type ETHBackend interface {
// SendTransaction submits a signed transaction to L1.
// SendTransaction submits a signed transaction to L1.
SendTransaction
(
ctx
context
.
Context
,
tx
*
types
.
Transaction
)
error
SendTransaction
(
ctx
context
.
Context
,
tx
*
types
.
Transaction
)
error
// These functions are used to estimate what the basefee & priority fee should be set to.
// These functions are used to estimate what the base
fee & priority fee should be set to.
// TODO(CLI-3318): Maybe need a generic interface to support different RPC providers
// TODO(CLI-3318): Maybe need a generic interface to support different RPC providers
HeaderByNumber
(
ctx
context
.
Context
,
number
*
big
.
Int
)
(
*
types
.
Header
,
error
)
HeaderByNumber
(
ctx
context
.
Context
,
number
*
big
.
Int
)
(
*
types
.
Header
,
error
)
SuggestGasTipCap
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
SuggestGasTipCap
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
...
@@ -245,12 +245,12 @@ func (m *SimpleTxManager) send(ctx context.Context, candidate TxCandidate) (*typ
...
@@ -245,12 +245,12 @@ func (m *SimpleTxManager) send(ctx context.Context, candidate TxCandidate) (*typ
// NOTE: If the [TxCandidate.GasLimit] is non-zero, it will be used as the transaction's gas.
// NOTE: If the [TxCandidate.GasLimit] is non-zero, it will be used as the transaction's gas.
// NOTE: Otherwise, the [SimpleTxManager] will query the specified backend for an estimate.
// NOTE: Otherwise, the [SimpleTxManager] will query the specified backend for an estimate.
func
(
m
*
SimpleTxManager
)
craftTx
(
ctx
context
.
Context
,
candidate
TxCandidate
)
(
*
types
.
Transaction
,
error
)
{
func
(
m
*
SimpleTxManager
)
craftTx
(
ctx
context
.
Context
,
candidate
TxCandidate
)
(
*
types
.
Transaction
,
error
)
{
gasTipCap
,
base
fee
,
blobBasef
ee
,
err
:=
m
.
suggestGasPriceCaps
(
ctx
)
gasTipCap
,
base
Fee
,
blobBaseF
ee
,
err
:=
m
.
suggestGasPriceCaps
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
m
.
metr
.
RPCError
()
m
.
metr
.
RPCError
()
return
nil
,
fmt
.
Errorf
(
"failed to get gas price info: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to get gas price info: %w"
,
err
)
}
}
gasFeeCap
:=
calcGasFeeCap
(
base
f
ee
,
gasTipCap
)
gasFeeCap
:=
calcGasFeeCap
(
base
F
ee
,
gasTipCap
)
gasLimit
:=
candidate
.
GasLimit
gasLimit
:=
candidate
.
GasLimit
...
@@ -284,10 +284,10 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
...
@@ -284,10 +284,10 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
var
txMessage
types
.
TxData
var
txMessage
types
.
TxData
if
sidecar
!=
nil
{
if
sidecar
!=
nil
{
if
blobBase
f
ee
==
nil
{
if
blobBase
F
ee
==
nil
{
return
nil
,
fmt
.
Errorf
(
"expected non-nil blobBase
f
ee"
)
return
nil
,
fmt
.
Errorf
(
"expected non-nil blobBase
F
ee"
)
}
}
blobFeeCap
:=
calcBlobFeeCap
(
blobBase
f
ee
)
blobFeeCap
:=
calcBlobFeeCap
(
blobBase
F
ee
)
message
:=
&
types
.
BlobTx
{
message
:=
&
types
.
BlobTx
{
To
:
*
candidate
.
To
,
To
:
*
candidate
.
To
,
Data
:
candidate
.
TxData
,
Data
:
candidate
.
TxData
,
...
@@ -588,7 +588,7 @@ func (m *SimpleTxManager) queryReceipt(ctx context.Context, txHash common.Hash,
...
@@ -588,7 +588,7 @@ func (m *SimpleTxManager) queryReceipt(ctx context.Context, txHash common.Hash,
return
nil
return
nil
}
}
m
.
metr
.
RecordBase
f
ee
(
tip
.
BaseFee
)
m
.
metr
.
RecordBase
F
ee
(
tip
.
BaseFee
)
m
.
l
.
Debug
(
"Transaction mined, checking confirmations"
,
"tx"
,
txHash
,
m
.
l
.
Debug
(
"Transaction mined, checking confirmations"
,
"tx"
,
txHash
,
"block"
,
eth
.
ReceiptBlockID
(
receipt
),
"tip"
,
eth
.
HeaderBlockID
(
tip
),
"block"
,
eth
.
ReceiptBlockID
(
receipt
),
"tip"
,
eth
.
HeaderBlockID
(
tip
),
"numConfirmations"
,
m
.
cfg
.
NumConfirmations
)
"numConfirmations"
,
m
.
cfg
.
NumConfirmations
)
...
@@ -620,14 +620,14 @@ func (m *SimpleTxManager) queryReceipt(ctx context.Context, txHash common.Hash,
...
@@ -620,14 +620,14 @@ func (m *SimpleTxManager) queryReceipt(ctx context.Context, txHash common.Hash,
// multiple of the suggested values.
// multiple of the suggested values.
func
(
m
*
SimpleTxManager
)
increaseGasPrice
(
ctx
context
.
Context
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
func
(
m
*
SimpleTxManager
)
increaseGasPrice
(
ctx
context
.
Context
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
m
.
txLogger
(
tx
,
true
)
.
Info
(
"bumping gas price for transaction"
)
m
.
txLogger
(
tx
,
true
)
.
Info
(
"bumping gas price for transaction"
)
tip
,
base
fee
,
blobBasef
ee
,
err
:=
m
.
suggestGasPriceCaps
(
ctx
)
tip
,
base
Fee
,
blobBaseF
ee
,
err
:=
m
.
suggestGasPriceCaps
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
m
.
txLogger
(
tx
,
false
)
.
Warn
(
"failed to get suggested gas tip and basefee"
,
"err"
,
err
)
m
.
txLogger
(
tx
,
false
)
.
Warn
(
"failed to get suggested gas tip and base
fee"
,
"err"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
bumpedTip
,
bumpedFee
:=
updateFees
(
tx
.
GasTipCap
(),
tx
.
GasFeeCap
(),
tip
,
base
f
ee
,
tx
.
Type
()
==
types
.
BlobTxType
,
m
.
l
)
bumpedTip
,
bumpedFee
:=
updateFees
(
tx
.
GasTipCap
(),
tx
.
GasFeeCap
(),
tip
,
base
F
ee
,
tx
.
Type
()
==
types
.
BlobTxType
,
m
.
l
)
if
err
:=
m
.
checkLimits
(
tip
,
base
f
ee
,
bumpedTip
,
bumpedFee
);
err
!=
nil
{
if
err
:=
m
.
checkLimits
(
tip
,
base
F
ee
,
bumpedTip
,
bumpedFee
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -659,10 +659,10 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
...
@@ -659,10 +659,10 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
// Blob transactions have an additional blob gas price we must specify, so we must make sure it is
// Blob transactions have an additional blob gas price we must specify, so we must make sure it is
// getting bumped appropriately.
// getting bumped appropriately.
bumpedBlobFee
:=
calcThresholdValue
(
tx
.
BlobGasFeeCap
(),
true
)
bumpedBlobFee
:=
calcThresholdValue
(
tx
.
BlobGasFeeCap
(),
true
)
if
bumpedBlobFee
.
Cmp
(
blobBase
f
ee
)
<
0
{
if
bumpedBlobFee
.
Cmp
(
blobBase
F
ee
)
<
0
{
bumpedBlobFee
=
blobBase
f
ee
bumpedBlobFee
=
blobBase
F
ee
}
}
if
err
:=
m
.
checkBlobFeeLimits
(
blobBase
f
ee
,
bumpedBlobFee
);
err
!=
nil
{
if
err
:=
m
.
checkBlobFeeLimits
(
blobBase
F
ee
,
bumpedBlobFee
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
message
:=
&
types
.
BlobTx
{
message
:=
&
types
.
BlobTx
{
...
@@ -700,8 +700,8 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
...
@@ -700,8 +700,8 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
return
signedTx
,
nil
return
signedTx
,
nil
}
}
// suggestGasPriceCaps suggests what the new tip, base
fee, and blobfee should be based on the
// suggestGasPriceCaps suggests what the new tip, base
fee, and blob base fee should be based on
// current L1 conditions. blobfee will be nil if 4844 is not yet active.
//
the
current L1 conditions. blobfee will be nil if 4844 is not yet active.
func
(
m
*
SimpleTxManager
)
suggestGasPriceCaps
(
ctx
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
func
(
m
*
SimpleTxManager
)
suggestGasPriceCaps
(
ctx
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
m
.
cfg
.
NetworkTimeout
)
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
m
.
cfg
.
NetworkTimeout
)
defer
cancel
()
defer
cancel
()
...
@@ -717,33 +717,33 @@ func (m *SimpleTxManager) suggestGasPriceCaps(ctx context.Context) (*big.Int, *b
...
@@ -717,33 +717,33 @@ func (m *SimpleTxManager) suggestGasPriceCaps(ctx context.Context) (*big.Int, *b
head
,
err
:=
m
.
backend
.
HeaderByNumber
(
cCtx
,
nil
)
head
,
err
:=
m
.
backend
.
HeaderByNumber
(
cCtx
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
m
.
metr
.
RPCError
()
m
.
metr
.
RPCError
()
return
nil
,
nil
,
nil
,
fmt
.
Errorf
(
"failed to fetch the suggested basefee: %w"
,
err
)
return
nil
,
nil
,
nil
,
fmt
.
Errorf
(
"failed to fetch the suggested base
fee: %w"
,
err
)
}
else
if
head
.
BaseFee
==
nil
{
}
else
if
head
.
BaseFee
==
nil
{
return
nil
,
nil
,
nil
,
errors
.
New
(
"txmgr does not support pre-london blocks that do not have a basefee"
)
return
nil
,
nil
,
nil
,
errors
.
New
(
"txmgr does not support pre-london blocks that do not have a base
fee"
)
}
}
base
f
ee
:=
head
.
BaseFee
base
F
ee
:=
head
.
BaseFee
m
.
metr
.
RecordBase
fee
(
basef
ee
)
m
.
metr
.
RecordBase
Fee
(
baseF
ee
)
m
.
metr
.
RecordTipCap
(
tip
)
m
.
metr
.
RecordTipCap
(
tip
)
// Enforce minimum basefee and tip cap
// Enforce minimum base
fee and tip cap
if
minTipCap
:=
m
.
cfg
.
MinTipCap
;
minTipCap
!=
nil
&&
tip
.
Cmp
(
minTipCap
)
==
-
1
{
if
minTipCap
:=
m
.
cfg
.
MinTipCap
;
minTipCap
!=
nil
&&
tip
.
Cmp
(
minTipCap
)
==
-
1
{
m
.
l
.
Debug
(
"Enforcing min tip cap"
,
"minTipCap"
,
m
.
cfg
.
MinTipCap
,
"origTipCap"
,
tip
)
m
.
l
.
Debug
(
"Enforcing min tip cap"
,
"minTipCap"
,
m
.
cfg
.
MinTipCap
,
"origTipCap"
,
tip
)
tip
=
new
(
big
.
Int
)
.
Set
(
m
.
cfg
.
MinTipCap
)
tip
=
new
(
big
.
Int
)
.
Set
(
m
.
cfg
.
MinTipCap
)
}
}
if
minBase
fee
:=
m
.
cfg
.
MinBasefee
;
minBasefee
!=
nil
&&
basefee
.
Cmp
(
minBasef
ee
)
==
-
1
{
if
minBase
Fee
:=
m
.
cfg
.
MinBaseFee
;
minBaseFee
!=
nil
&&
baseFee
.
Cmp
(
minBaseF
ee
)
==
-
1
{
m
.
l
.
Debug
(
"Enforcing min base
fee"
,
"minBasefee"
,
m
.
cfg
.
MinBasefee
,
"origBasefee"
,
basef
ee
)
m
.
l
.
Debug
(
"Enforcing min base
fee"
,
"minBaseFee"
,
m
.
cfg
.
MinBaseFee
,
"origBaseFee"
,
baseF
ee
)
base
fee
=
new
(
big
.
Int
)
.
Set
(
m
.
cfg
.
MinBasef
ee
)
base
Fee
=
new
(
big
.
Int
)
.
Set
(
m
.
cfg
.
MinBaseF
ee
)
}
}
var
blobFee
*
big
.
Int
var
blobFee
*
big
.
Int
if
head
.
ExcessBlobGas
!=
nil
{
if
head
.
ExcessBlobGas
!=
nil
{
blobFee
=
eip4844
.
CalcBlobFee
(
*
head
.
ExcessBlobGas
)
blobFee
=
eip4844
.
CalcBlobFee
(
*
head
.
ExcessBlobGas
)
}
}
return
tip
,
base
f
ee
,
blobFee
,
nil
return
tip
,
base
F
ee
,
blobFee
,
nil
}
}
func
(
m
*
SimpleTxManager
)
checkLimits
(
tip
,
base
f
ee
,
bumpedTip
,
bumpedFee
*
big
.
Int
)
error
{
func
(
m
*
SimpleTxManager
)
checkLimits
(
tip
,
base
F
ee
,
bumpedTip
,
bumpedFee
*
big
.
Int
)
error
{
// If below threshold, don't apply multiplier limit
// If below threshold, don't apply multiplier limit
if
thr
:=
m
.
cfg
.
FeeLimitThreshold
;
thr
!=
nil
&&
thr
.
Cmp
(
bumpedFee
)
==
1
{
if
thr
:=
m
.
cfg
.
FeeLimitThreshold
;
thr
!=
nil
&&
thr
.
Cmp
(
bumpedFee
)
==
1
{
return
nil
return
nil
...
@@ -755,20 +755,20 @@ func (m *SimpleTxManager) checkLimits(tip, basefee, bumpedTip, bumpedFee *big.In
...
@@ -755,20 +755,20 @@ func (m *SimpleTxManager) checkLimits(tip, basefee, bumpedTip, bumpedFee *big.In
if
bumpedTip
.
Cmp
(
maxTip
)
>
0
{
if
bumpedTip
.
Cmp
(
maxTip
)
>
0
{
return
fmt
.
Errorf
(
"bumped tip cap %v is over %dx multiple of the suggested value"
,
bumpedTip
,
m
.
cfg
.
FeeLimitMultiplier
)
return
fmt
.
Errorf
(
"bumped tip cap %v is over %dx multiple of the suggested value"
,
bumpedTip
,
m
.
cfg
.
FeeLimitMultiplier
)
}
}
maxFee
:=
calcGasFeeCap
(
new
(
big
.
Int
)
.
Mul
(
base
f
ee
,
feeLimitMult
),
maxTip
)
maxFee
:=
calcGasFeeCap
(
new
(
big
.
Int
)
.
Mul
(
base
F
ee
,
feeLimitMult
),
maxTip
)
if
bumpedFee
.
Cmp
(
maxFee
)
>
0
{
if
bumpedFee
.
Cmp
(
maxFee
)
>
0
{
return
fmt
.
Errorf
(
"bumped fee cap %v is over %dx multiple of the suggested value"
,
bumpedFee
,
m
.
cfg
.
FeeLimitMultiplier
)
return
fmt
.
Errorf
(
"bumped fee cap %v is over %dx multiple of the suggested value"
,
bumpedFee
,
m
.
cfg
.
FeeLimitMultiplier
)
}
}
return
nil
return
nil
}
}
func
(
m
*
SimpleTxManager
)
checkBlobFeeLimits
(
blobBase
f
ee
,
bumpedBlobFee
*
big
.
Int
)
error
{
func
(
m
*
SimpleTxManager
)
checkBlobFeeLimits
(
blobBase
F
ee
,
bumpedBlobFee
*
big
.
Int
)
error
{
// If below threshold, don't apply multiplier limit. Note we use same threshold parameter here
// If below threshold, don't apply multiplier limit. Note we use same threshold parameter here
// used for non-blob fee limiting.
// used for non-blob fee limiting.
if
thr
:=
m
.
cfg
.
FeeLimitThreshold
;
thr
!=
nil
&&
thr
.
Cmp
(
bumpedBlobFee
)
==
1
{
if
thr
:=
m
.
cfg
.
FeeLimitThreshold
;
thr
!=
nil
&&
thr
.
Cmp
(
bumpedBlobFee
)
==
1
{
return
nil
return
nil
}
}
maxBlobFee
:=
new
(
big
.
Int
)
.
Mul
(
calcBlobFeeCap
(
blobBase
f
ee
),
big
.
NewInt
(
int64
(
m
.
cfg
.
FeeLimitMultiplier
)))
maxBlobFee
:=
new
(
big
.
Int
)
.
Mul
(
calcBlobFeeCap
(
blobBase
F
ee
),
big
.
NewInt
(
int64
(
m
.
cfg
.
FeeLimitMultiplier
)))
if
bumpedBlobFee
.
Cmp
(
maxBlobFee
)
>
0
{
if
bumpedBlobFee
.
Cmp
(
maxBlobFee
)
>
0
{
return
fmt
.
Errorf
(
return
fmt
.
Errorf
(
"bumped blob fee %v is over %dx multiple of the suggested value: %w"
,
"bumped blob fee %v is over %dx multiple of the suggested value: %w"
,
...
@@ -790,7 +790,7 @@ func calcThresholdValue(x *big.Int, isBlobTx bool) *big.Int {
...
@@ -790,7 +790,7 @@ func calcThresholdValue(x *big.Int, isBlobTx bool) *big.Int {
return
threshold
.
Mul
(
threshold
,
x
)
.
Add
(
threshold
,
ninetyNine
)
.
Div
(
threshold
,
oneHundred
)
return
threshold
.
Mul
(
threshold
,
x
)
.
Add
(
threshold
,
ninetyNine
)
.
Div
(
threshold
,
oneHundred
)
}
}
// updateFees takes an old transaction's tip & fee cap plus a new tip & basefee, and returns
// updateFees takes an old transaction's tip & fee cap plus a new tip & base
fee, and returns
// a suggested tip and fee cap such that:
// a suggested tip and fee cap such that:
//
//
// (a) each satisfies geth's required tx-replacement fee bumps, and
// (a) each satisfies geth's required tx-replacement fee bumps, and
...
@@ -799,20 +799,20 @@ func calcThresholdValue(x *big.Int, isBlobTx bool) *big.Int {
...
@@ -799,20 +799,20 @@ func calcThresholdValue(x *big.Int, isBlobTx bool) *big.Int {
func
updateFees
(
oldTip
,
oldFeeCap
,
newTip
,
newBaseFee
*
big
.
Int
,
isBlobTx
bool
,
lgr
log
.
Logger
)
(
*
big
.
Int
,
*
big
.
Int
)
{
func
updateFees
(
oldTip
,
oldFeeCap
,
newTip
,
newBaseFee
*
big
.
Int
,
isBlobTx
bool
,
lgr
log
.
Logger
)
(
*
big
.
Int
,
*
big
.
Int
)
{
newFeeCap
:=
calcGasFeeCap
(
newBaseFee
,
newTip
)
newFeeCap
:=
calcGasFeeCap
(
newBaseFee
,
newTip
)
lgr
=
lgr
.
New
(
"old_gasTipCap"
,
oldTip
,
"old_gasFeeCap"
,
oldFeeCap
,
lgr
=
lgr
.
New
(
"old_gasTipCap"
,
oldTip
,
"old_gasFeeCap"
,
oldFeeCap
,
"new_gasTipCap"
,
newTip
,
"new_gasFeeCap"
,
newFeeCap
,
"new_base
f
ee"
,
newBaseFee
)
"new_gasTipCap"
,
newTip
,
"new_gasFeeCap"
,
newFeeCap
,
"new_base
F
ee"
,
newBaseFee
)
thresholdTip
:=
calcThresholdValue
(
oldTip
,
isBlobTx
)
thresholdTip
:=
calcThresholdValue
(
oldTip
,
isBlobTx
)
thresholdFeeCap
:=
calcThresholdValue
(
oldFeeCap
,
isBlobTx
)
thresholdFeeCap
:=
calcThresholdValue
(
oldFeeCap
,
isBlobTx
)
if
newTip
.
Cmp
(
thresholdTip
)
>=
0
&&
newFeeCap
.
Cmp
(
thresholdFeeCap
)
>=
0
{
if
newTip
.
Cmp
(
thresholdTip
)
>=
0
&&
newFeeCap
.
Cmp
(
thresholdFeeCap
)
>=
0
{
lgr
.
Debug
(
"Using new tip and feecap"
)
lgr
.
Debug
(
"Using new tip and feecap"
)
return
newTip
,
newFeeCap
return
newTip
,
newFeeCap
}
else
if
newTip
.
Cmp
(
thresholdTip
)
>=
0
&&
newFeeCap
.
Cmp
(
thresholdFeeCap
)
<
0
{
}
else
if
newTip
.
Cmp
(
thresholdTip
)
>=
0
&&
newFeeCap
.
Cmp
(
thresholdFeeCap
)
<
0
{
// Tip has gone up, but basefee is flat or down.
// Tip has gone up, but base
fee is flat or down.
// TODO(CLI-3714): Do we need to recalculate the FC here?
// TODO(CLI-3714): Do we need to recalculate the FC here?
lgr
.
Debug
(
"Using new tip and threshold feecap"
)
lgr
.
Debug
(
"Using new tip and threshold feecap"
)
return
newTip
,
thresholdFeeCap
return
newTip
,
thresholdFeeCap
}
else
if
newTip
.
Cmp
(
thresholdTip
)
<
0
&&
newFeeCap
.
Cmp
(
thresholdFeeCap
)
>=
0
{
}
else
if
newTip
.
Cmp
(
thresholdTip
)
<
0
&&
newFeeCap
.
Cmp
(
thresholdFeeCap
)
>=
0
{
// Basefee has gone up, but the tip hasn't. Recalculate the feecap because if the tip went up a lot
// Base
fee has gone up, but the tip hasn't. Recalculate the feecap because if the tip went up a lot
// not enough of the feecap may be dedicated to paying the basefee.
// not enough of the feecap may be dedicated to paying the base
fee.
lgr
.
Debug
(
"Using threshold tip and recalculated feecap"
)
lgr
.
Debug
(
"Using threshold tip and recalculated feecap"
)
return
thresholdTip
,
calcGasFeeCap
(
newBaseFee
,
thresholdTip
)
return
thresholdTip
,
calcGasFeeCap
(
newBaseFee
,
thresholdTip
)
...
@@ -834,10 +834,10 @@ func calcGasFeeCap(baseFee, gasTipCap *big.Int) *big.Int {
...
@@ -834,10 +834,10 @@ func calcGasFeeCap(baseFee, gasTipCap *big.Int) *big.Int {
)
)
}
}
// calcBlobFeeCap computes a suggested blob fee cap that is twice the current header's blob basefee
// calcBlobFeeCap computes a suggested blob fee cap that is twice the current header's blob base
fee
// value, with a minimum value of minBlobTxFee.
// value, with a minimum value of minBlobTxFee.
func
calcBlobFeeCap
(
blobBase
f
ee
*
big
.
Int
)
*
big
.
Int
{
func
calcBlobFeeCap
(
blobBase
F
ee
*
big
.
Int
)
*
big
.
Int
{
cap
:=
new
(
big
.
Int
)
.
Mul
(
blobBase
f
ee
,
two
)
cap
:=
new
(
big
.
Int
)
.
Mul
(
blobBase
F
ee
,
two
)
if
cap
.
Cmp
(
minBlobTxFee
)
<
0
{
if
cap
.
Cmp
(
minBlobTxFee
)
<
0
{
cap
.
Set
(
minBlobTxFee
)
cap
.
Set
(
minBlobTxFee
)
}
}
...
...
op-service/txmgr/txmgr_test.go
View file @
40d3f4ff
...
@@ -166,7 +166,7 @@ func (g *gasPricer) feesForEpoch(epoch int64) (*big.Int, *big.Int, uint64) {
...
@@ -166,7 +166,7 @@ func (g *gasPricer) feesForEpoch(epoch int64) (*big.Int, *big.Int, uint64) {
return
epochGasTipCap
,
epochGasFeeCap
,
epochExcessBlobGas
return
epochGasTipCap
,
epochGasFeeCap
,
epochExcessBlobGas
}
}
func
(
g
*
gasPricer
)
base
f
ee
()
*
big
.
Int
{
func
(
g
*
gasPricer
)
base
F
ee
()
*
big
.
Int
{
g
.
mu
.
Lock
()
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
defer
g
.
mu
.
Unlock
()
return
new
(
big
.
Int
)
.
Mul
(
g
.
baseBaseFee
,
big
.
NewInt
(
g
.
epoch
))
return
new
(
big
.
Int
)
.
Mul
(
g
.
baseBaseFee
,
big
.
NewInt
(
g
.
epoch
))
...
@@ -263,7 +263,7 @@ func (b *mockBackend) HeaderByNumber(ctx context.Context, number *big.Int) (*typ
...
@@ -263,7 +263,7 @@ func (b *mockBackend) HeaderByNumber(ctx context.Context, number *big.Int) (*typ
bg
:=
b
.
g
.
excessblobgas
()
bg
:=
b
.
g
.
excessblobgas
()
return
&
types
.
Header
{
return
&
types
.
Header
{
Number
:
num
,
Number
:
num
,
BaseFee
:
b
.
g
.
base
f
ee
(),
BaseFee
:
b
.
g
.
base
F
ee
(),
ExcessBlobGas
:
&
bg
,
ExcessBlobGas
:
&
bg
,
},
nil
},
nil
}
}
...
@@ -275,7 +275,7 @@ func (b *mockBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (ui
...
@@ -275,7 +275,7 @@ func (b *mockBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (ui
if
msg
.
GasFeeCap
.
Cmp
(
msg
.
GasTipCap
)
<
0
{
if
msg
.
GasFeeCap
.
Cmp
(
msg
.
GasTipCap
)
<
0
{
return
0
,
core
.
ErrTipAboveFeeCap
return
0
,
core
.
ErrTipAboveFeeCap
}
}
return
b
.
g
.
base
f
ee
()
.
Uint64
(),
nil
return
b
.
g
.
base
F
ee
()
.
Uint64
(),
nil
}
}
func
(
b
*
mockBackend
)
SuggestGasTipCap
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
{
func
(
b
*
mockBackend
)
SuggestGasTipCap
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
{
...
@@ -1022,7 +1022,7 @@ func TestIncreaseGasPrice(t *testing.T) {
...
@@ -1022,7 +1022,7 @@ func TestIncreaseGasPrice(t *testing.T) {
},
},
},
},
{
{
name
:
"enforces min bump on only basefee increase"
,
name
:
"enforces min bump on only base
fee increase"
,
run
:
func
(
t
*
testing
.
T
)
{
run
:
func
(
t
*
testing
.
T
)
{
tx
,
newTx
:=
doGasPriceIncrease
(
t
,
100
,
1000
,
99
,
460
)
tx
,
newTx
:=
doGasPriceIncrease
(
t
,
100
,
1000
,
99
,
460
)
require
.
True
(
t
,
newTx
.
GasFeeCap
()
.
Cmp
(
tx
.
GasFeeCap
())
>
0
,
"new tx fee cap must be larger"
)
require
.
True
(
t
,
newTx
.
GasFeeCap
()
.
Cmp
(
tx
.
GasFeeCap
())
>
0
,
"new tx fee cap must be larger"
)
...
@@ -1061,7 +1061,7 @@ func TestIncreaseGasPrice(t *testing.T) {
...
@@ -1061,7 +1061,7 @@ func TestIncreaseGasPrice(t *testing.T) {
}
}
}
}
// TestIncreaseGasPriceLimits asserts that if the L1 basefee & tip remain the
// TestIncreaseGasPriceLimits asserts that if the L1 base
fee & tip remain the
// same, repeated calls to IncreaseGasPrice eventually hit a limit.
// same, repeated calls to IncreaseGasPrice eventually hit a limit.
func
TestIncreaseGasPriceLimits
(
t
*
testing
.
T
)
{
func
TestIncreaseGasPriceLimits
(
t
*
testing
.
T
)
{
t
.
Run
(
"no-threshold"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"no-threshold"
,
func
(
t
*
testing
.
T
)
{
...
@@ -1094,7 +1094,7 @@ func testIncreaseGasPriceLimit(t *testing.T, lt gasPriceLimitTest) {
...
@@ -1094,7 +1094,7 @@ func testIncreaseGasPriceLimit(t *testing.T, lt gasPriceLimitTest) {
borkedTip
:=
int64
(
10
)
borkedTip
:=
int64
(
10
)
borkedFee
:=
int64
(
45
)
borkedFee
:=
int64
(
45
)
// simulate 100 excess blobs which yields a 50 wei blob basefee
// simulate 100 excess blobs which yields a 50 wei blob base
fee
borkedExcessBlobGas
:=
uint64
(
100
*
params
.
BlobTxBlobGasPerBlob
)
borkedExcessBlobGas
:=
uint64
(
100
*
params
.
BlobTxBlobGasPerBlob
)
borkedBackend
:=
failingBackend
{
borkedBackend
:=
failingBackend
{
gasTip
:
big
.
NewInt
(
borkedTip
),
gasTip
:
big
.
NewInt
(
borkedTip
),
...
@@ -1227,9 +1227,9 @@ func TestNonceReset(t *testing.T) {
...
@@ -1227,9 +1227,9 @@ func TestNonceReset(t *testing.T) {
func
TestMinFees
(
t
*
testing
.
T
)
{
func
TestMinFees
(
t
*
testing
.
T
)
{
for
_
,
tt
:=
range
[]
struct
{
for
_
,
tt
:=
range
[]
struct
{
desc
string
desc
string
minBase
f
ee
*
big
.
Int
minBase
F
ee
*
big
.
Int
minTipCap
*
big
.
Int
minTipCap
*
big
.
Int
expectMinBase
f
ee
bool
expectMinBase
F
ee
bool
expectMinTipCap
bool
expectMinTipCap
bool
}{
}{
{
{
...
@@ -1237,8 +1237,8 @@ func TestMinFees(t *testing.T) {
...
@@ -1237,8 +1237,8 @@ func TestMinFees(t *testing.T) {
},
},
{
{
desc
:
"high-min-basefee"
,
desc
:
"high-min-basefee"
,
minBase
f
ee
:
big
.
NewInt
(
10
_000_000
),
minBase
F
ee
:
big
.
NewInt
(
10
_000_000
),
expectMinBase
f
ee
:
true
,
expectMinBase
F
ee
:
true
,
},
},
{
{
desc
:
"high-min-tipcap"
,
desc
:
"high-min-tipcap"
,
...
@@ -1247,14 +1247,14 @@ func TestMinFees(t *testing.T) {
...
@@ -1247,14 +1247,14 @@ func TestMinFees(t *testing.T) {
},
},
{
{
desc
:
"high-mins"
,
desc
:
"high-mins"
,
minBase
f
ee
:
big
.
NewInt
(
10
_000_000
),
minBase
F
ee
:
big
.
NewInt
(
10
_000_000
),
minTipCap
:
big
.
NewInt
(
1
_000_000
),
minTipCap
:
big
.
NewInt
(
1
_000_000
),
expectMinBase
f
ee
:
true
,
expectMinBase
F
ee
:
true
,
expectMinTipCap
:
true
,
expectMinTipCap
:
true
,
},
},
{
{
desc
:
"low-min-basefee"
,
desc
:
"low-min-basefee"
,
minBase
f
ee
:
big
.
NewInt
(
1
),
minBase
F
ee
:
big
.
NewInt
(
1
),
},
},
{
{
desc
:
"low-min-tipcap"
,
desc
:
"low-min-tipcap"
,
...
@@ -1262,24 +1262,24 @@ func TestMinFees(t *testing.T) {
...
@@ -1262,24 +1262,24 @@ func TestMinFees(t *testing.T) {
},
},
{
{
desc
:
"low-mins"
,
desc
:
"low-mins"
,
minBase
f
ee
:
big
.
NewInt
(
1
),
minBase
F
ee
:
big
.
NewInt
(
1
),
minTipCap
:
big
.
NewInt
(
1
),
minTipCap
:
big
.
NewInt
(
1
),
},
},
}
{
}
{
t
.
Run
(
tt
.
desc
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
desc
,
func
(
t
*
testing
.
T
)
{
require
:=
require
.
New
(
t
)
require
:=
require
.
New
(
t
)
conf
:=
configWithNumConfs
(
1
)
conf
:=
configWithNumConfs
(
1
)
conf
.
MinBase
fee
=
tt
.
minBasef
ee
conf
.
MinBase
Fee
=
tt
.
minBaseF
ee
conf
.
MinTipCap
=
tt
.
minTipCap
conf
.
MinTipCap
=
tt
.
minTipCap
h
:=
newTestHarnessWithConfig
(
t
,
conf
)
h
:=
newTestHarnessWithConfig
(
t
,
conf
)
tip
,
base
f
ee
,
_
,
err
:=
h
.
mgr
.
suggestGasPriceCaps
(
context
.
TODO
())
tip
,
base
F
ee
,
_
,
err
:=
h
.
mgr
.
suggestGasPriceCaps
(
context
.
TODO
())
require
.
NoError
(
err
)
require
.
NoError
(
err
)
if
tt
.
expectMinBase
f
ee
{
if
tt
.
expectMinBase
F
ee
{
require
.
Equal
(
tt
.
minBase
fee
,
basefee
,
"expect suggested basefee to equal MinBasef
ee"
)
require
.
Equal
(
tt
.
minBase
Fee
,
baseFee
,
"expect suggested base fee to equal MinBaseF
ee"
)
}
else
{
}
else
{
require
.
Equal
(
h
.
gasPricer
.
baseBaseFee
,
base
fee
,
"expect suggested basefee to equal mock base
fee"
)
require
.
Equal
(
h
.
gasPricer
.
baseBaseFee
,
base
Fee
,
"expect suggested base fee to equal mock base
fee"
)
}
}
if
tt
.
expectMinTipCap
{
if
tt
.
expectMinTipCap
{
...
...
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