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

refactor!: deprecate blocktime on context #17738

Merged
merged 17 commits into from
Sep 18, 2023
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* `WithChainID` / `WithBlockHeight` / `WithBlockHeader` must be used to set values on the context
* (x/bank) [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) `BurnCoins` takes an address instead of a module name
* (x/distribution) [#17670](https://github.com/cosmos/cosmos-sdk/pull/17670) `AllocateTokens` takes `comet.VoteInfos` instead of `[]abci.VoteInfo`
* (types) [#17738](https://github.com/cosmos/cosmos-sdk/pull/17738) `WithBlockTime()` was removed & `BlockTime()` were deprecated in favor of `WithHeaderInfo()` & `HeaderInfo()`. `BlockTime` now gets data from `HeaderInfo()` instead of `BlockHeader()`.
* (client) [#17746](https://github.com/cosmos/cosmos-sdk/pull/17746) `txEncodeAmino` & `txDecodeAmino` txs via grpc and rest were removed
* `RegisterLegacyAmino` was removed from `AppModuleBasic`

### CLI Breaking Changes

Expand Down
4 changes: 1 addition & 3 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ func (app *BaseApp) PrepareProposal(req *abci.RequestPrepareProposal) (resp *abc
app.prepareProposalState.ctx = app.getContextForProposal(app.prepareProposalState.ctx, req.Height).
WithVoteInfos(toVoteInfo(req.LocalLastCommit.Votes)). // this is a set of votes that are not finalized yet, wait for commit
WithBlockHeight(req.Height).
WithBlockTime(req.Time).
WithProposer(req.ProposerAddress).
WithExecMode(sdk.ExecModePrepareProposal).
WithCometInfo(corecomet.Info{
Expand Down Expand Up @@ -517,7 +516,6 @@ func (app *BaseApp) ProcessProposal(req *abci.RequestProcessProposal) (resp *abc
app.processProposalState.ctx = app.getContextForProposal(app.processProposalState.ctx, req.Height).
WithVoteInfos(req.ProposedLastCommit.Votes). // this is a set of votes that are not finalized yet, wait for commit
WithBlockHeight(req.Height).
WithBlockTime(req.Time).
WithHeaderHash(req.Hash).
WithProposer(req.ProposerAddress).
WithCometInfo(corecomet.Info{
Expand Down Expand Up @@ -1149,7 +1147,7 @@ func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, e
if ok {
cInfo, err := rms.GetCommitInfo(height)
if cInfo != nil && err == nil {
ctx = ctx.WithBlockTime(cInfo.Timestamp)
ctx = ctx.WithHeaderInfo(coreheader.Info{Time: cInfo.Timestamp})
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/grpc/node/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s queryServer) Config(ctx context.Context, _ *ConfigRequest) (*ConfigRespo
func (s queryServer) Status(ctx context.Context, _ *StatusRequest) (*StatusResponse, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

blockTime := sdkCtx.BlockTime()
blockTime := sdkCtx.HeaderInfo().Time

return &StatusResponse{
// TODO: Get earliest version from store.
Expand Down
65 changes: 33 additions & 32 deletions tests/integration/auth/migrations/v2/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"testing"
"time"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"

"cosmossdk.io/core/header"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
sdkmath "cosmossdk.io/math"
Expand Down Expand Up @@ -73,7 +73,8 @@ func TestMigrateVestingAccounts(t *testing.T) {
legacySubspace := newMockSubspace(authtypes.DefaultParams())
require.NoError(t, v4.Migrate(ctx, storeService, legacySubspace, cdc))

ctx = app.BaseApp.NewContextLegacy(false, cmtproto.Header{Time: time.Now()})
ctx = app.BaseApp.NewContext(false)
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Now()})
err = stakingKeeper.SetParams(ctx, stakingtypes.DefaultParams())
require.NoError(t, err)
lastAccNum := uint64(1000)
Expand All @@ -99,10 +100,10 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(200)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.Unix())
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

err = accountKeeper.Params.Set(ctx, authtypes.DefaultParams())
require.NoError(t, err)
Expand All @@ -129,10 +130,10 @@ func TestMigrateVestingAccounts(t *testing.T) {
require.NoError(t, err)
baseAccount := createBaseAccount(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(200)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.Unix())
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -152,10 +153,10 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(200)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.Unix())
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -179,7 +180,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(200)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(1, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(1, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand All @@ -200,7 +201,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(200)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(1, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(1, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand All @@ -225,7 +226,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(1, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(1, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand All @@ -250,7 +251,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(1, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(1, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand All @@ -271,10 +272,10 @@ func TestMigrateVestingAccounts(t *testing.T) {
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.Unix())
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -290,16 +291,16 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"continuous vesting, start time after blocktime",
func(ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
startTime := ctx.BlockTime().AddDate(1, 0, 0).Unix()
endTime := ctx.BlockTime().AddDate(2, 0, 0).Unix()
startTime := ctx.HeaderInfo().Time.AddDate(1, 0, 0).Unix()
endTime := ctx.HeaderInfo().Time.AddDate(2, 0, 0).Unix()
baseAccount := createBaseAccount(delegatorAddr)
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))
delayedAccount, err := types.NewContinuousVestingAccount(baseAccount, vestedCoins, startTime, endTime)
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -315,16 +316,16 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"continuous vesting, start time passed but not ended",
func(ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
startTime := ctx.BlockTime().AddDate(-1, 0, 0).Unix()
endTime := ctx.BlockTime().AddDate(2, 0, 0).Unix()
startTime := ctx.HeaderInfo().Time.AddDate(-1, 0, 0).Unix()
endTime := ctx.HeaderInfo().Time.AddDate(2, 0, 0).Unix()
baseAccount := createBaseAccount(delegatorAddr)
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))
delayedAccount, err := types.NewContinuousVestingAccount(baseAccount, vestedCoins, startTime, endTime)
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -340,16 +341,16 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"continuous vesting, start time and endtime passed",
func(ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
startTime := ctx.BlockTime().AddDate(-2, 0, 0).Unix()
endTime := ctx.BlockTime().AddDate(-1, 0, 0).Unix()
startTime := ctx.HeaderInfo().Time.AddDate(-2, 0, 0).Unix()
endTime := ctx.HeaderInfo().Time.AddDate(-1, 0, 0).Unix()
baseAccount := createBaseAccount(delegatorAddr)
bondDenom, err := stakingKeeper.BondDenom(ctx)
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))
delayedAccount, err := types.NewContinuousVestingAccount(baseAccount, vestedCoins, startTime, endTime)
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -370,7 +371,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(100)))

start := ctx.BlockTime().Unix() + int64(time.Hour/time.Second)
start := ctx.HeaderInfo().Time.Unix() + int64(time.Hour/time.Second)

periods := []types.Period{
{
Expand Down Expand Up @@ -475,7 +476,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
delayedAccount, err := types.NewPeriodicVestingAccount(baseAccount, vestedCoins, startTime, periods)
require.NoError(t, err)

ctx = ctx.WithBlockTime(time.Unix(1601042400+31536000+15897600+15897600+1, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Unix(1601042400+31536000+15897600+15897600+1, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand Down Expand Up @@ -524,7 +525,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
delayedAccount, err := types.NewPeriodicVestingAccount(baseAccount, vestedCoins, startTime, periods)
require.NoError(t, err)

ctx = ctx.WithBlockTime(time.Unix(1601042400+31536000+1, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Unix(1601042400+31536000+1, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand Down Expand Up @@ -573,7 +574,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
delayedAccount, err := types.NewPeriodicVestingAccount(baseAccount, vestedCoins, startTime, periods)
require.NoError(t, err)

ctx = ctx.WithBlockTime(time.Unix(1601042400+31536000+15638400+1, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Unix(1601042400+31536000+15638400+1, 0)})

accountKeeper.SetAccount(ctx, delayedAccount)

Expand All @@ -595,7 +596,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))

delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(10, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(10, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand All @@ -604,7 +605,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
_, err = stakingKeeper.Delegate(ctx, delegatorAddr, sdkmath.NewInt(300), stakingtypes.Unbonded, validator, true)
require.NoError(t, err)

ctx = ctx.WithBlockTime(ctx.BlockTime().AddDate(1, 0, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.AddDate(1, 0, 0)})

valAddr, err := sdk.ValAddressFromBech32(validator.OperatorAddress)
require.NoError(t, err)
Expand All @@ -627,7 +628,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))

delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(10, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(10, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand All @@ -646,7 +647,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
require.NoError(t, err)
vestedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, sdkmath.NewInt(300)))

delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(10, 0, 0).Unix())
delayedAccount, err := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.HeaderInfo().Time.AddDate(10, 0, 0).Unix())
require.NoError(t, err)

accountKeeper.SetAccount(ctx, delayedAccount)
Expand Down Expand Up @@ -675,7 +676,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
tc.prepareFunc(ctx, validator, delegatorAddr)

if tc.blockTime != 0 {
ctx = ctx.WithBlockTime(time.Unix(tc.blockTime, 0))
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Unix(tc.blockTime, 0)})
}

// We introduce the bug
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/evidence/keeper/infraction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"cosmossdk.io/collections"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/comet"
"cosmossdk.io/core/header"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/evidence"
Expand Down Expand Up @@ -236,7 +237,7 @@ func TestHandleDoubleSign(t *testing.T) {
assert.Assert(t, val.GetTokens().Equal(newTokens))

// jump to past the unbonding period
ctx = ctx.WithBlockTime(time.Unix(1, 0).Add(stakingParams.UnbondingTime))
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Unix(1, 0).Add(stakingParams.UnbondingTime)})

// require we cannot unjail
assert.Error(t, f.slashingKeeper.Unjail(ctx, operatorAddr), slashingtypes.ErrValidatorJailed.Error())
Expand All @@ -262,7 +263,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
t.Parallel()
f := initFixture(t)

ctx := f.sdkCtx.WithIsCheckTx(false).WithBlockHeight(1).WithBlockTime(time.Now())
ctx := f.sdkCtx.WithIsCheckTx(false).WithBlockHeight(1).WithHeaderInfo(header.Info{Time: time.Now()})
populateValidators(t, f)

power := int64(100)
Expand All @@ -288,7 +289,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
nci := comet.Info{Evidence: []comet.Evidence{{
Validator: comet.Validator{Address: valpubkey.Address(), Power: power},
Type: comet.MisbehaviorType(abci.MisbehaviorType_DUPLICATE_VOTE),
Time: ctx.BlockTime(),
Time: ctx.HeaderInfo().Time,
Height: 0,
}}}

Expand All @@ -297,7 +298,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {

ctx = ctx.WithCometInfo(nci)
ctx = ctx.WithConsensusParams(cp)
ctx = ctx.WithBlockTime(ctx.BlockTime().Add(cp.Evidence.MaxAgeDuration + 1))
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(cp.Evidence.MaxAgeDuration + 1)})
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + cp.Evidence.MaxAgeNumBlocks + 1)

assert.NilError(t, f.evidenceKeeper.BeginBlocker(ctx))
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
dbm "github.com/cosmos/cosmos-db"
"gotest.tools/v3/assert"

"cosmossdk.io/core/header"
"cosmossdk.io/depinject"
"cosmossdk.io/log"

Expand Down Expand Up @@ -163,7 +164,7 @@ func TestImportExportQueues(t *testing.T) {
params, err = s2.GovKeeper.Params.Get(ctx2)
assert.NilError(t, err)
// Jump the time forward past the DepositPeriod and VotingPeriod
ctx2 = ctx2.WithBlockTime(ctx2.BlockHeader().Time.Add(*params.MaxDepositPeriod).Add(*params.VotingPeriod))
ctx2 = ctx2.WithHeaderInfo(header.Info{Time: ctx2.BlockHeader().Time.Add(*params.MaxDepositPeriod).Add(*params.VotingPeriod)})

// Make sure that they are still in the DepositPeriod and VotingPeriod respectively
proposal1, err = s2.GovKeeper.Proposals.Get(ctx2, proposalID1)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/staking/keeper/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"gotest.tools/v3/assert"

"cosmossdk.io/core/header"
"cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -93,7 +94,7 @@ func TestUnbondingDelegationsMaxEntries(t *testing.T) {
assert.Assert(math.IntEq(t, newNotBonded, oldNotBonded))

// mature unbonding delegations
ctx = ctx.WithBlockTime(completionTime)
ctx = ctx.WithHeaderInfo(header.Info{Time: completionTime})
_, err = f.stakingKeeper.CompleteUnbonding(ctx, addrDel, addrVal)
assert.NilError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/staking/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestCancelUnbondingDelegation(t *testing.T) {
unbondingAmount := sdk.NewInt64Coin(bondDenom, 5)
ubd := types.NewUnbondingDelegation(
delegatorAddr, validatorAddr, 10,
ctx.BlockTime().Add(time.Minute*10),
ctx.HeaderInfo().Time.Add(time.Minute*10),
unbondingAmount.Amount,
0,
address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"),
Expand Down
Loading