refactor!: deprecate blocktime on context (#17738)

This commit is contained in:
Marko
2023-09-18 13:55:21 +00:00
committed by GitHub
parent 8df065b611
commit 6615ff4f76
89 changed files with 379 additions and 369 deletions
+5 -4
View File
@@ -7,6 +7,7 @@ import (
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"cosmossdk.io/core/header"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
@@ -49,7 +50,7 @@ func TestExpiredGrantsQueue(t *testing.T) {
grantee2 := addrs[2]
grantee3 := addrs[3]
grantee4 := addrs[4]
expiration := ctx.BlockTime().AddDate(0, 1, 0)
expiration := ctx.HeaderInfo().Time.AddDate(0, 1, 0)
expiration2 := expiration.AddDate(1, 0, 0)
smallCoins := sdk.NewCoins(sdk.NewInt64Coin("stake", 10))
sendAuthz := banktypes.NewSendAuthorization(smallCoins, nil)
@@ -94,12 +95,12 @@ func TestExpiredGrantsQueue(t *testing.T) {
checkGrants(ctx, 4)
// expiration is exclusive!
ctx = ctx.WithBlockTime(expiration)
ctx = ctx.WithHeaderInfo(header.Info{Time: expiration})
checkGrants(ctx, 4)
ctx = ctx.WithBlockTime(expiration.AddDate(0, 0, 1))
ctx = ctx.WithHeaderInfo(header.Info{Time: expiration.AddDate(0, 0, 1)})
checkGrants(ctx, 2)
ctx = ctx.WithBlockTime(expiration2.AddDate(0, 0, 1))
ctx = ctx.WithHeaderInfo(header.Info{Time: expiration2.AddDate(0, 0, 1)})
checkGrants(ctx, 1)
}