[mt-batcher]: Querying gasPrice without timeout judgment can cause the program to wait continuously
agnarsong opened this issue · 0 comments
agnarsong commented
Describe the bug
Querying gasPrice without timeout judgment can cause the program to wait continuously
To Reproduce
Steps to reproduce the behavior:
- Modify a testcase in mantle/mt-batcher/txmgr/txmgr_test.go
- modified code:
func TestTxMgrConfirmAtMinGasPrice(t *testing.T) {
t.Parallel()
h := newTestHarness()
gasPricer := newGasPricer(1)
updateGasPrice := func(ctx context.Context) (*types.Transaction, error) {
gasTipCap, gasFeeCap := gasPricer.sample()
for i := 0; i <= 3; i++ {
fmt.Printf("sleep %v \n", i+1)
time.Sleep(60 * time.Second)
}
return types.NewTx(&types.DynamicFeeTx{
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
}), nil
}
.
.
.
- run this testcae
go test -run TestTxMgrConfirmAtMinGasPrice txmgr/txmgr_test.go -v
Expected behavior
go test -run TestTxMgrConfirmAtMinGasPrice txmgr/txmgr_test.go -v
Screenshots
(anaconda3)➜ mt-batcher git:(develop) ✗ go test -run TestTxMgrConfirmAtMinGasPrice txmgr/txmgr_test.go -v
=== RUN TestTxMgrConfirmAtMinGasPrice
=== PAUSE TestTxMgrConfirmAtMinGasPrice
=== CONT TestTxMgrConfirmAtMinGasPrice
sleep 1
sleep 2
sleep 3
sleep 4
--- PASS: TestTxMgrConfirmAtMinGasPrice (480.00s)
PASS
ok command-line-arguments 480.142s