Commit 116b6e62 authored by Sam Stokes's avatar Sam Stokes Committed by GitHub

txmgr: rename Get|SetPriorityFee to Get|SetMinPriorityFee (#11526)

parent ddeb96b4
......@@ -21,12 +21,12 @@ func (a *SimpleTxmgrAPI) SetMinBaseFee(_ context.Context, val *big.Int) {
a.mgr.SetMinBaseFee(val)
}
func (a *SimpleTxmgrAPI) GetPriorityFee(_ context.Context) *big.Int {
return a.mgr.GetPriorityFee()
func (a *SimpleTxmgrAPI) GetMinPriorityFee(_ context.Context) *big.Int {
return a.mgr.GetMinPriorityFee()
}
func (a *SimpleTxmgrAPI) SetPriorityFee(_ context.Context, val *big.Int) {
a.mgr.SetPriorityFee(val)
func (a *SimpleTxmgrAPI) SetMinPriorityFee(_ context.Context, val *big.Int) {
a.mgr.SetMinPriorityFee(val)
}
func (a *SimpleTxmgrAPI) GetMinBlobFee(_ context.Context) *big.Int {
......
......@@ -11,16 +11,18 @@ import (
)
func TestTxmgrRPC(t *testing.T) {
minBaseFee := big.NewInt(1000)
priorityFee := big.NewInt(2000)
minBlobFee := big.NewInt(3000)
feeThreshold := big.NewInt(4000)
minBaseFeeInit := big.NewInt(1000)
minPriorityFeeInit := big.NewInt(2000)
minBlobFeeInit := big.NewInt(3000)
feeThresholdInit := big.NewInt(4000)
bumpFeeRetryTimeInit := int64(100)
cfg := Config{}
cfg.MinBaseFee.Store(minBaseFee)
cfg.MinTipCap.Store(priorityFee)
cfg.MinBlobTxFee.Store(minBlobFee)
cfg.FeeLimitThreshold.Store(feeThreshold)
cfg.MinBaseFee.Store(minBaseFeeInit)
cfg.MinTipCap.Store(minPriorityFeeInit)
cfg.MinBlobTxFee.Store(minBlobFeeInit)
cfg.FeeLimitThreshold.Store(feeThresholdInit)
cfg.ResubmissionTimeout.Store(bumpFeeRetryTimeInit)
h := newTestHarnessWithConfig(t, &cfg)
......@@ -43,22 +45,30 @@ func TestTxmgrRPC(t *testing.T) {
type tcase struct {
rpcMethod string
value *big.Int
initValue *big.Int
}
cases := []tcase{
{"MinBaseFee", big.NewInt(1001)},
{"PriorityFee", big.NewInt(2001)},
{"MinBlobFee", big.NewInt(3001)},
{"FeeThreshold", big.NewInt(4001)},
{"MinBaseFee", minBaseFeeInit},
{"MinPriorityFee", minPriorityFeeInit},
{"MinBlobFee", minBlobFeeInit},
{"FeeThreshold", feeThresholdInit},
{"BumpFeeRetryTime", big.NewInt(bumpFeeRetryTimeInit)},
}
for _, tc := range cases {
t.Run(tc.rpcMethod, func(t *testing.T) {
t.Run("Get|Set"+tc.rpcMethod, func(t *testing.T) {
var res *big.Int
require.NoError(t, rpcClient.Call(&res, "txmgr_set"+tc.rpcMethod, tc.value))
require.NoError(t, rpcClient.Call(&res, "txmgr_get"+tc.rpcMethod))
require.Equal(t, tc.initValue, res)
newVal := new(big.Int)
newVal.Add(tc.initValue, big.NewInt(1))
require.NoError(t, rpcClient.Call(&res, "txmgr_set"+tc.rpcMethod, newVal))
require.NoError(t, rpcClient.Call(&res, "txmgr_get"+tc.rpcMethod))
require.Equal(t, tc.value, res)
require.Equal(t, newVal, res)
})
}
}
......@@ -340,13 +340,13 @@ func (m *SimpleTxManager) SetMinBaseFee(val *big.Int) {
m.l.Info("txmgr config val changed: SetMinBaseFee", "newVal", val)
}
func (m *SimpleTxManager) GetPriorityFee() *big.Int {
func (m *SimpleTxManager) GetMinPriorityFee() *big.Int {
return m.cfg.MinTipCap.Load()
}
func (m *SimpleTxManager) SetPriorityFee(val *big.Int) {
func (m *SimpleTxManager) SetMinPriorityFee(val *big.Int) {
m.cfg.MinTipCap.Store(val)
m.l.Info("txmgr config val changed: SetPriorityFee", "newVal", val)
m.l.Info("txmgr config val changed: SetMinPriorityFee", "newVal", val)
}
func (m *SimpleTxManager) GetMinBlobFee() *big.Int {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment