Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mt-batcher]: Querying gasPrice without timeout judgment can cause the program to wait continuously #1306

Open
agnarsong opened this issue Jul 19, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@agnarsong
Copy link
Contributor

Describe the bug
Querying gasPrice without timeout judgment can cause the program to wait continuously

To Reproduce
Steps to reproduce the behavior:

  1. Modify a testcase in mantle/mt-batcher/txmgr/txmgr_test.go
  2. 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
	}
.
.
.
  1. 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
@agnarsong agnarsong added the bug Something isn't working label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants