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) { ...@@ -21,12 +21,12 @@ func (a *SimpleTxmgrAPI) SetMinBaseFee(_ context.Context, val *big.Int) {
a.mgr.SetMinBaseFee(val) a.mgr.SetMinBaseFee(val)
} }
func (a *SimpleTxmgrAPI) GetPriorityFee(_ context.Context) *big.Int { func (a *SimpleTxmgrAPI) GetMinPriorityFee(_ context.Context) *big.Int {
return a.mgr.GetPriorityFee() return a.mgr.GetMinPriorityFee()
} }
func (a *SimpleTxmgrAPI) SetPriorityFee(_ context.Context, val *big.Int) { func (a *SimpleTxmgrAPI) SetMinPriorityFee(_ context.Context, val *big.Int) {
a.mgr.SetPriorityFee(val) a.mgr.SetMinPriorityFee(val)
} }
func (a *SimpleTxmgrAPI) GetMinBlobFee(_ context.Context) *big.Int { func (a *SimpleTxmgrAPI) GetMinBlobFee(_ context.Context) *big.Int {
......
...@@ -11,16 +11,18 @@ import ( ...@@ -11,16 +11,18 @@ import (
) )
func TestTxmgrRPC(t *testing.T) { func TestTxmgrRPC(t *testing.T) {
minBaseFee := big.NewInt(1000) minBaseFeeInit := big.NewInt(1000)
priorityFee := big.NewInt(2000) minPriorityFeeInit := big.NewInt(2000)
minBlobFee := big.NewInt(3000) minBlobFeeInit := big.NewInt(3000)
feeThreshold := big.NewInt(4000) feeThresholdInit := big.NewInt(4000)
bumpFeeRetryTimeInit := int64(100)
cfg := Config{} cfg := Config{}
cfg.MinBaseFee.Store(minBaseFee) cfg.MinBaseFee.Store(minBaseFeeInit)
cfg.MinTipCap.Store(priorityFee) cfg.MinTipCap.Store(minPriorityFeeInit)
cfg.MinBlobTxFee.Store(minBlobFee) cfg.MinBlobTxFee.Store(minBlobFeeInit)
cfg.FeeLimitThreshold.Store(feeThreshold) cfg.FeeLimitThreshold.Store(feeThresholdInit)
cfg.ResubmissionTimeout.Store(bumpFeeRetryTimeInit)
h := newTestHarnessWithConfig(t, &cfg) h := newTestHarnessWithConfig(t, &cfg)
...@@ -43,22 +45,30 @@ func TestTxmgrRPC(t *testing.T) { ...@@ -43,22 +45,30 @@ func TestTxmgrRPC(t *testing.T) {
type tcase struct { type tcase struct {
rpcMethod string rpcMethod string
value *big.Int initValue *big.Int
} }
cases := []tcase{ cases := []tcase{
{"MinBaseFee", big.NewInt(1001)}, {"MinBaseFee", minBaseFeeInit},
{"PriorityFee", big.NewInt(2001)}, {"MinPriorityFee", minPriorityFeeInit},
{"MinBlobFee", big.NewInt(3001)}, {"MinBlobFee", minBlobFeeInit},
{"FeeThreshold", big.NewInt(4001)}, {"FeeThreshold", feeThresholdInit},
{"BumpFeeRetryTime", big.NewInt(bumpFeeRetryTimeInit)},
} }
for _, tc := range cases { 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 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.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) { ...@@ -340,13 +340,13 @@ func (m *SimpleTxManager) SetMinBaseFee(val *big.Int) {
m.l.Info("txmgr config val changed: SetMinBaseFee", "newVal", val) 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() 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.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 { 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