Skip to content

Commit

Permalink
fix(rpc/types): catch invalid values in CheckTxFee
Browse files Browse the repository at this point in the history
This change catches invalid values in CheckTxFee
and returns an error for:
* nil gasPrice
* negative gasPrice

which improves the reliability of the system.

Fixes evmos#2413
Fixes evmos#2414
  • Loading branch information
odeke-em committed Mar 14, 2024
1 parent ad1e289 commit 83a87e3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions rpc/types/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package types

import (
"math/big"
"testing"
)

func TestCheckTxFeeInvalidArgs(t *testing.T) {
if err := CheckTxFee(nil, 10, 100); err == nil {
t.Fatal("expecting a non-nil error")
}

gp := big.NewInt(-1)
if err := CheckTxFee(gp, 10, 100); err == nil {
t.Fatal("expecting a non-nil error")
}
}

0 comments on commit 83a87e3

Please sign in to comment.