Skip to content

Commit

Permalink
refactor(bank, feegrant, authz): avoid creating baseaccount (#19188)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
  • Loading branch information
tac0turtle and alexanderbez authored Feb 13, 2024
1 parent 26d30f2 commit 869c96c
Show file tree
Hide file tree
Showing 43 changed files with 228 additions and 133 deletions.
6 changes: 3 additions & 3 deletions client/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type TestAccountRetriever struct {
func (t TestAccountRetriever) GetAccount(_ Context, addr sdk.AccAddress) (Account, error) {
acc, ok := t.Accounts[addr.String()]
if !ok {
return nil, fmt.Errorf("account %s not found", addr)
return nil, fmt.Errorf("account: account %s not found", addr)
}

return acc, nil
Expand All @@ -68,7 +68,7 @@ func (t TestAccountRetriever) GetAccountWithHeight(clientCtx Context, addr sdk.A
func (t TestAccountRetriever) EnsureExists(_ Context, addr sdk.AccAddress) error {
_, ok := t.Accounts[addr.String()]
if !ok {
return fmt.Errorf("account %s not found", addr)
return fmt.Errorf("ensureExists: account %s not found", addr)
}
return nil
}
Expand All @@ -77,7 +77,7 @@ func (t TestAccountRetriever) EnsureExists(_ Context, addr sdk.AccAddress) error
func (t TestAccountRetriever) GetAccountNumberSequence(_ Context, addr sdk.AccAddress) (accNum, accSeq uint64, err error) {
acc, ok := t.Accounts[addr.String()]
if !ok {
return 0, 0, fmt.Errorf("account %s not found", addr)
return 0, 0, fmt.Errorf("accountNumberSequence: account %s not found", addr)
}
return acc.Num, acc.Seq, nil
}
4 changes: 0 additions & 4 deletions client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,6 @@ func (f Factory) Prepare(clientCtx client.Context) (Factory, error) {
fc := f
from := clientCtx.FromAddress

if err := fc.accountRetriever.EnsureExists(clientCtx, from); err != nil {
return fc, err
}

initNum, initSeq := fc.accountNumber, fc.sequence
if initNum == 0 || initSeq == 0 {
num, seq, err := fc.accountRetriever.GetAccountNumberSequence(clientCtx, from)
Expand Down
1 change: 0 additions & 1 deletion client/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func GenerateOrBroadcastTxCLI(clientCtx client.Context, flagSet *pflag.FlagSet,
if err != nil {
return err
}

return GenerateOrBroadcastTxWithFactory(clientCtx, txf, msgs...)
}

Expand Down
3 changes: 3 additions & 0 deletions docs/architecture/adr-020-protobuf-transaction-encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* 2021 Feb 24: The Cosmos SDK does not use Tendermint's `PubKey` interface anymore, but its own `cryptotypes.PubKey`. Updates to reflect this.
* 2021 May 3: Rename `clientCtx.JSONMarshaler` to `clientCtx.JSONCodec`.
* 2021 June 10: Add `clientCtx.Codec: codec.Codec`.
* 2024 February 5: Account creation step

## Status

Expand Down Expand Up @@ -317,6 +318,8 @@ the client logic will now need to take a codec interface that knows not only how
to handle all the types, but also knows how to generate transactions, signatures,
and messages.

If the account is sending its first transaction, the account number must be set to 0. This is due to the account not being created yet.

```go
type AccountRetriever interface {
GetAccount(clientCtx Context, addr sdk.AccAddress) (client.Account, error)
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/baseapp/block_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ func TestBaseApp_BlockGas(t *testing.T) {
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount)
require.NoError(t, err)
require.Equal(t, feeCoin.Amount, bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount)
seq := accountKeeper.GetAccount(ctx, addr1).GetSequence()
require.Equal(t, uint64(0), seq)

// msg and signatures
msg := &baseapptestutil.MsgKeyValue{
Expand All @@ -152,8 +150,7 @@ func TestBaseApp_BlockGas(t *testing.T) {
txBuilder.SetFeeAmount(feeAmount)
txBuilder.SetGasLimit(uint64(simtestutil.DefaultConsensusParams.Block.MaxGas))

senderAccountNumber := accountKeeper.GetAccount(ctx, addr1).GetAccountNumber()
privs, accNums, accSeqs := []cryptotypes.PrivKey{priv1}, []uint64{senderAccountNumber}, []uint64{0}
privs, accNums, accSeqs := []cryptotypes.PrivKey{priv1}, []uint64{0}, []uint64{0}
_, txBytes, err := createTestTx(txConfig, txBuilder, privs, accNums, accSeqs, ctx.ChainID())
require.NoError(t, err)

Expand All @@ -176,7 +173,7 @@ func TestBaseApp_BlockGas(t *testing.T) {
require.Equal(t, []byte("ok"), okValue)
}
// check block gas is always consumed
baseGas := uint64(38798) // baseGas is the gas consumed before tx msg
baseGas := uint64(38012) // baseGas is the gas consumed before tx msg
expGasConsumed := addUint64Saturating(tc.gasToConsume, baseGas)
if expGasConsumed > uint64(simtestutil.DefaultConsensusParams.Block.MaxGas) {
// capped by gasLimit
Expand All @@ -186,7 +183,7 @@ func TestBaseApp_BlockGas(t *testing.T) {
// tx fee is always deducted
require.Equal(t, int64(0), bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount.Int64())
// sender's sequence is always increased
seq = accountKeeper.GetAccount(ctx, addr1).GetSequence()
seq := accountKeeper.GetAccount(ctx, addr1).GetSequence()
require.NoError(t, err)
require.Equal(t, uint64(1), seq)
})
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/bank/keeper/deterministic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func TestGRPCQuerySpendableBalances(t *testing.T) {
assert.NilError(t, err)

req := banktypes.NewQuerySpendableBalancesRequest(addr1, nil)
testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.SpendableBalances, 2032, false)
testdata.DeterministicIterations(t, f.ctx, req, f.queryClient.SpendableBalances, 1777, false)
}

func TestGRPCQueryTotalSupply(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/distribution/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestGRPCValidatorOutstandingRewards(t *testing.T) {
// send funds to val addr
funds := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, int64(1000))
assert.NilError(t, f.bankKeeper.SendCoinsFromModuleToAccount(f.sdkCtx, types.ModuleName, sdk.AccAddress(f.valAddr), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, funds))))

f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(f.valAddr)))
initialStake := int64(10)
tstaking := stakingtestutil.NewHelper(t, f.sdkCtx, f.stakingKeeper)
tstaking.Commission = stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0))
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestGRPCValidatorCommission(t *testing.T) {
// send funds to val addr
funds := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, int64(1000))
assert.NilError(t, f.bankKeeper.SendCoinsFromModuleToAccount(f.sdkCtx, types.ModuleName, sdk.AccAddress(f.valAddr), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, funds))))

f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(f.valAddr)))
initialStake := int64(10)
tstaking := stakingtestutil.NewHelper(t, f.sdkCtx, f.stakingKeeper)
tstaking.Commission = stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0))
Expand Down Expand Up @@ -498,7 +498,7 @@ func TestGRPCDelegationRewards(t *testing.T) {
// send funds to val addr
funds := f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, int64(1000))
assert.NilError(t, f.bankKeeper.SendCoinsFromModuleToAccount(f.sdkCtx, types.ModuleName, sdk.AccAddress(f.valAddr), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, funds))))

f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(f.valAddr)))
initialStake := int64(10)
tstaking := stakingtestutil.NewHelper(t, f.sdkCtx, f.stakingKeeper)
tstaking.Commission = stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0))
Expand Down
1 change: 1 addition & 0 deletions tests/integration/distribution/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ func TestMsgDepositValidatorRewardsPool(t *testing.T) {
require.NoError(t, err)
// send funds from module to addr to perform DepositValidatorRewardsPool
err = f.bankKeeper.SendCoinsFromModuleToAccount(f.sdkCtx, distrtypes.ModuleName, addr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, tokens)))
f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(valAddr1)))
require.NoError(t, err)
tstaking := stakingtestutil.NewHelper(t, f.sdkCtx, f.stakingKeeper)
tstaking.Commission = stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0))
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/evidence/keeper/infraction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type fixture struct {
sdkCtx sdk.Context
cdc codec.Codec

accountKeeper authkeeper.AccountKeeper
bankKeeper bankkeeper.Keeper
evidenceKeeper *keeper.Keeper
slashingKeeper slashingkeeper.Keeper
Expand Down Expand Up @@ -164,6 +165,7 @@ func initFixture(tb testing.TB) *fixture {
app: integrationApp,
sdkCtx: sdkCtx,
cdc: cdc,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
evidenceKeeper: evidenceKeeper,
slashingKeeper: slashingKeeper,
Expand All @@ -183,7 +185,7 @@ func TestHandleDoubleSign(t *testing.T) {
assert.NilError(t, err)
operatorAddr, valpubkey := valAddresses[0], pubkeys[0]
tstaking := stakingtestutil.NewHelper(t, ctx, f.stakingKeeper)

f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(operatorAddr)))
selfDelegation := tstaking.CreateValidatorWithValPower(operatorAddr, valpubkey, power, true)

// execute end-blocker and verify validator attributes
Expand Down Expand Up @@ -278,7 +280,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
operatorAddr, valpubkey := valAddresses[0], pubkeys[0]

tstaking := stakingtestutil.NewHelper(t, ctx, f.stakingKeeper)

f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(operatorAddr)))
amt := tstaking.CreateValidatorWithValPower(operatorAddr, valpubkey, power, true)

// execute end-blocker and verify validator attributes
Expand Down Expand Up @@ -328,7 +330,7 @@ func TestHandleDoubleSignAfterRotation(t *testing.T) {

operatorAddr, valpubkey := valAddresses[0], pubkeys[0]
tstaking := stakingtestutil.NewHelper(t, ctx, f.stakingKeeper)

f.accountKeeper.SetAccount(f.sdkCtx, f.accountKeeper.NewAccountWithAddress(f.sdkCtx, sdk.AccAddress(operatorAddr)))
selfDelegation := tstaking.CreateValidatorWithValPower(operatorAddr, valpubkey, power, true)

// execute end-blocker and verify validator attributes
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/gov/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ func TestProposalPassedEndblocker(t *testing.T) {
stakingMsgSvr := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper)
valAddr := sdk.ValAddress(addrs[0])
proposer := addrs[0]
acc := suite.AccountKeeper.NewAccountWithAddress(ctx, addrs[0])
suite.AccountKeeper.SetAccount(ctx, acc)

createValidators(t, stakingMsgSvr, ctx, []sdk.ValAddress{valAddr}, []int64{10})
_, err := suite.StakingKeeper.EndBlocker(ctx)
Expand Down Expand Up @@ -421,6 +423,9 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) {
toAddrStr, err := ac.BytesToString(addrs[0])
require.NoError(t, err)

acc := suite.AccountKeeper.NewAccountWithAddress(ctx, addrs[0])
suite.AccountKeeper.SetAccount(ctx, acc)

createValidators(t, stakingMsgSvr, ctx, []sdk.ValAddress{valAddr}, []int64{10})
_, err = suite.StakingKeeper.EndBlocker(ctx)
require.NoError(t, err)
Expand Down Expand Up @@ -499,6 +504,8 @@ func TestExpeditedProposal_PassAndConversionToRegular(t *testing.T) {
valAddr := sdk.ValAddress(addrs[0])
proposer := addrs[0]

acc := suite.AccountKeeper.NewAccountWithAddress(ctx, addrs[0])
suite.AccountKeeper.SetAccount(ctx, acc)
// Create a validator so that able to vote on proposal.
createValidators(t, stakingMsgSvr, ctx, []sdk.ValAddress{valAddr}, []int64{10})
_, err = suite.StakingKeeper.EndBlocker(ctx)
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/gov/keeper/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func createValidators(t *testing.T, f *fixture, powers []int64) ([]sdk.AccAddres
assert.NilError(t, f.stakingKeeper.SetNewValidatorByPowerIndex(f.ctx, val2))
assert.NilError(t, f.stakingKeeper.SetNewValidatorByPowerIndex(f.ctx, val3))

for _, addr := range addrs {
f.accountKeeper.SetAccount(f.ctx, f.accountKeeper.NewAccountWithAddress(f.ctx, addr))
}

_, _ = f.stakingKeeper.Delegate(f.ctx, addrs[0], f.stakingKeeper.TokensFromConsensusPower(f.ctx, powers[0]), stakingtypes.Unbonded, val1, true)
_, _ = f.stakingKeeper.Delegate(f.ctx, addrs[1], f.stakingKeeper.TokensFromConsensusPower(f.ctx, powers[1]), stakingtypes.Unbonded, val2, true)
_, _ = f.stakingKeeper.Delegate(f.ctx, addrs[2], f.stakingKeeper.TokensFromConsensusPower(f.ctx, powers[2]), stakingtypes.Unbonded, val3, true)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/gov/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type fixture struct {
queryClient v1.QueryClient
legacyQueryClient v1beta1.QueryClient

accountKeeper authkeeper.AccountKeeper
bankKeeper bankkeeper.Keeper
stakingKeeper *stakingkeeper.Keeper
govKeeper *keeper.Keeper
Expand Down Expand Up @@ -153,6 +154,7 @@ func initFixture(tb testing.TB) *fixture {
ctx: sdkCtx,
queryClient: queryClient,
legacyQueryClient: legacyQueryClient,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
stakingKeeper: stakingKeeper,
govKeeper: govKeeper,
Expand Down
1 change: 0 additions & 1 deletion tests/integration/gov/keeper/tally_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) {
assert.Assert(t, found)
val2, found := f.stakingKeeper.GetValidator(ctx, vals[1])
assert.Assert(t, found)

_, err := f.stakingKeeper.Delegate(ctx, addrs[3], delTokens, stakingtypes.Unbonded, val1, true)
assert.NilError(t, err)
_, err = f.stakingKeeper.Delegate(ctx, addrs[3], delTokens, stakingtypes.Unbonded, val2, true)
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/slashing/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"cosmossdk.io/core/comet"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
authkeeper "cosmossdk.io/x/auth/keeper"
bankkeeper "cosmossdk.io/x/bank/keeper"
"cosmossdk.io/x/slashing"
slashingkeeper "cosmossdk.io/x/slashing/keeper"
Expand All @@ -24,6 +25,7 @@ import (
func TestBeginBlocker(t *testing.T) {
var (
interfaceRegistry codectypes.InterfaceRegistry
accountKeeper authkeeper.AccountKeeper
bankKeeper bankkeeper.Keeper
stakingKeeper *stakingkeeper.Keeper
slashingKeeper slashingkeeper.Keeper
Expand All @@ -35,6 +37,7 @@ func TestBeginBlocker(t *testing.T) {
depinject.Supply(log.NewNopLogger()),
),
&interfaceRegistry,
&accountKeeper,
&bankKeeper,
&stakingKeeper,
&slashingKeeper,
Expand All @@ -50,6 +53,8 @@ func TestBeginBlocker(t *testing.T) {

// bond the validator
power := int64(100)
acc := accountKeeper.NewAccountWithAddress(ctx, sdk.AccAddress(addr))
accountKeeper.SetAccount(ctx, acc)
amt := tstaking.CreateValidatorWithValPower(addr, pk, power, true)
_, err = stakingKeeper.EndBlocker(ctx)
require.NoError(t, err)
Expand Down
15 changes: 15 additions & 0 deletions tests/integration/slashing/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type fixture struct {

ctx sdk.Context

accountKeeper authkeeper.AccountKeeper
bankKeeper bankkeeper.Keeper
slashingKeeper slashingkeeper.Keeper
stakingKeeper *stakingkeeper.Keeper
Expand Down Expand Up @@ -135,6 +136,7 @@ func initFixture(tb testing.TB) *fixture {
return &fixture{
app: integrationApp,
ctx: sdkCtx,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
slashingKeeper: slashingKeeper,
stakingKeeper: stakingKeeper,
Expand All @@ -157,6 +159,8 @@ func TestUnJailNotBonded(t *testing.T) {
// create max (5) validators all with the same power
for i := uint32(0); i < p.MaxValidators; i++ {
addr, val := f.valAddrs[i], pks[i]
acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(addr))
f.accountKeeper.SetAccount(f.ctx, acc)
tstaking.CreateValidatorWithValPower(addr, val, 100, true)
}

Expand All @@ -166,6 +170,8 @@ func TestUnJailNotBonded(t *testing.T) {

// create a 6th validator with less power than the cliff validator (won't be bonded)
addr, val := f.valAddrs[5], pks[5]
acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(addr))
f.accountKeeper.SetAccount(f.ctx, acc)
amt := f.stakingKeeper.TokensFromConsensusPower(f.ctx, 50)
msg := tstaking.CreateValidatorMsg(addr, val, amt)
msg.MinSelfDelegation = amt
Expand Down Expand Up @@ -246,6 +252,8 @@ func TestHandleNewValidator(t *testing.T) {
assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, sdk.ConsAddress(valpubkey.Address()), info))

// Validator created
acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(addr))
f.accountKeeper.SetAccount(f.ctx, acc)
amt := tstaking.CreateValidatorWithValPower(addr, valpubkey, 100, true)

_, err = f.stakingKeeper.EndBlocker(f.ctx)
Expand Down Expand Up @@ -303,6 +311,9 @@ func TestHandleAlreadyJailed(t *testing.T) {
info := slashingtypes.NewValidatorSigningInfo(consaddr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, sdk.ConsAddress(val.Address()), info))

acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(addr))
f.accountKeeper.SetAccount(f.ctx, acc)

amt := tstaking.CreateValidatorWithValPower(addr, val, power, true)

_, err = f.stakingKeeper.EndBlocker(f.ctx)
Expand Down Expand Up @@ -366,6 +377,10 @@ func TestValidatorDippingInAndOut(t *testing.T) {

pks := simtestutil.CreateTestPubKeys(3)
simtestutil.AddTestAddrsFromPubKeys(f.bankKeeper, f.stakingKeeper, f.ctx, pks, f.stakingKeeper.TokensFromConsensusPower(f.ctx, 200))
for _, pk := range pks {
acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(pk.Address()))
f.accountKeeper.SetAccount(f.ctx, acc)
}

addr, val := pks[0].Address(), pks[0]
consAddr := sdk.ConsAddress(addr)
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/staking/keeper/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func createValidators(t *testing.T, f *fixture, powers []int64) ([]sdk.AccAddres
assert.NilError(t, f.stakingKeeper.SetNewValidatorByPowerIndex(f.sdkCtx, val1))
assert.NilError(t, f.stakingKeeper.SetNewValidatorByPowerIndex(f.sdkCtx, val2))

for _, addr := range addrs {
acc := f.accountKeeper.NewAccountWithAddress(f.sdkCtx, addr)
f.accountKeeper.SetAccount(f.sdkCtx, acc)
}

_, err := f.stakingKeeper.Delegate(f.sdkCtx, addrs[0], f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, powers[0]), types.Unbonded, val1, true)
assert.NilError(t, err)
_, err = f.stakingKeeper.Delegate(f.sdkCtx, addrs[1], f.stakingKeeper.TokensFromConsensusPower(f.sdkCtx, powers[1]), types.Unbonded, val2, true)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/staking/keeper/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ func TestUnbondingDelegationsMaxEntries(t *testing.T) {

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

Expand Down
Loading

0 comments on commit 869c96c

Please sign in to comment.