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

fix: sdk.Coins.Add #14715

Merged
merged 11 commits into from
Jan 26, 2023
Prev Previous commit
Next Next commit
fix feegrant tests
  • Loading branch information
robert-zaremba committed Jan 23, 2023
commit 09d4b7a2d9242660c717cae1f7bc42b15e9a73a8
29 changes: 16 additions & 13 deletions x/feegrant/periodic_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestPeriodicFeeValidAllow(t *testing.T) {
leftAtom := sdk.NewCoins(sdk.NewInt64Coin("atom", 512))
oneAtom := sdk.NewCoins(sdk.NewInt64Coin("atom", 1))
eth := sdk.NewCoins(sdk.NewInt64Coin("eth", 1))
emptyCoins := sdk.Coins{}

now := ctx.BlockTime()
oneHour := now.Add(1 * time.Hour)
Expand Down Expand Up @@ -61,11 +62,12 @@ func TestPeriodicFeeValidAllow(t *testing.T) {
PeriodSpendLimit: smallAtom,
PeriodReset: now.Add(30 * time.Minute),
},
blockTime: now,
valid: true,
accept: true,
remove: false,
periodReset: now.Add(30 * time.Minute),
blockTime: now,
valid: true,
accept: true,
remove: false,
remainsPeriod: emptyCoins,
periodReset: now.Add(30 * time.Minute),
},
"mismatched currencies": {
allow: feegrant.PeriodicAllowance{
Expand Down Expand Up @@ -94,7 +96,7 @@ func TestPeriodicFeeValidAllow(t *testing.T) {
blockTime: now,
accept: true,
remove: false,
remainsPeriod: nil,
remainsPeriod: emptyCoins,
remains: leftAtom,
periodReset: now.Add(1 * time.Hour),
},
Expand All @@ -113,7 +115,7 @@ func TestPeriodicFeeValidAllow(t *testing.T) {
blockTime: now.Add(1 * time.Hour),
accept: true,
remove: false,
remainsPeriod: nil,
remainsPeriod: emptyCoins,
remains: smallAtom,
periodReset: oneHour.Add(tenMinutes), // one step from last reset, not now
},
Expand Down Expand Up @@ -142,12 +144,13 @@ func TestPeriodicFeeValidAllow(t *testing.T) {
PeriodReset: now,
PeriodSpendLimit: atom,
},
valid: true,
fee: atom,
blockTime: oneHour,
accept: true,
remove: false,
periodReset: oneHour.Add(tenMinutes), // one step from last reset, not now
valid: true,
fee: atom,
blockTime: oneHour,
accept: true,
remove: false,
remainsPeriod: emptyCoins,
periodReset: oneHour.Add(tenMinutes), // one step from last reset, not now
},
"expired": {
allow: feegrant.PeriodicAllowance{
Expand Down