Skip to content

Commit

Permalink
fix ante test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kitty committed Aug 24, 2021
1 parent 63072c1 commit dc0f978
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion testutil/testdata/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewTestFeeAmount() sdk.Coins {

// NewTestGasLimit is a test fee gas limit.
func NewTestGasLimit() uint64 {
return 100000
return 120000
}

// NewTestMsg creates a message for testing with the given signers.
Expand Down
6 changes: 3 additions & 3 deletions x/auth/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,9 +1112,9 @@ func (suite *AnteTestSuite) TestAnteHandlerReCheck() {
name string
params types.Params
}{
{"memo size check", types.NewParams(1, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1)},
{"txsize check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, 10000000, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1)},
{"sig verify cost check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, 100000000)},
{"memo size check", types.NewParams(1, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultSigVerifyCostBls12381)},
{"txsize check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, 10000000, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultSigVerifyCostBls12381)},
{"sig verify cost check secp256k1", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, 100000000, types.DefaultSigVerifyCostBls12381)},
}
for _, tc := range testCases {
// set testcase parameters
Expand Down
12 changes: 7 additions & 5 deletions x/auth/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ func TestParams_Validate(t *testing.T) {
}{
{"default params", types.DefaultParams(), nil},
{"invalid tx signature limit", types.NewParams(types.DefaultMaxMemoCharacters, 0, types.DefaultTxSizeCostPerByte,
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid tx signature limit: 0")},
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultSigVerifyCostBls12381), fmt.Errorf("invalid tx signature limit: 0")},
{"invalid ED25519 signature verification cost", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte,
0, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid ED25519 signature verification cost: 0")},
0, types.DefaultSigVerifyCostSecp256k1, types.DefaultSigVerifyCostBls12381), fmt.Errorf("invalid ED25519 signature verification cost: 0")},
{"invalid SECK256k1 signature verification cost", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte,
types.DefaultSigVerifyCostED25519, 0), fmt.Errorf("invalid SECK256k1 signature verification cost: 0")},
types.DefaultSigVerifyCostED25519, 0, types.DefaultSigVerifyCostBls12381), fmt.Errorf("invalid SECK256k1 signature verification cost: 0")},
{"invalid BLS12381 signature verification cost", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte,
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, 0), fmt.Errorf("invalid BLS12381 signature verification cost: 0")},
{"invalid max memo characters", types.NewParams(0, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte,
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid max memo characters: 0")},
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultSigVerifyCostBls12381), fmt.Errorf("invalid max memo characters: 0")},
{"invalid tx size cost per byte", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, 0,
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid tx size cost per byte: 0")},
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultSigVerifyCostBls12381), fmt.Errorf("invalid tx size cost per byte: 0")},
}
for _, tt := range tests {
tt := tt
Expand Down

0 comments on commit dc0f978

Please sign in to comment.