forked from evmos/evmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rpc/types): catch invalid values in CheckTxFee
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
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} |