Skip to content

Commit fcbbf76

Browse files
committed
migrate what is possible to collections
1 parent 8d2a749 commit fcbbf76

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

docs/build/building-apps/05-app-testnet.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ When creating a testnet the important part is migrate the validator set from man
7979
// Remove all valdiators from last validators store
8080
iterator = app.StakingKeeper.LastValidatorsIterator(ctx)
8181
for ; iterator.Valid(); iterator.Next() {
82-
stakingStore.Delete(iterator.Key())
82+
app.StakingKeeper.LastValidatorPower.Delete(iterator.Key())
8383
}
8484
iterator.Close()
8585

8686
// Add our validator to power and last validators store
8787
app.StakingKeeper.SetValidator(ctx, newVal)
8888
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal)
8989
if err != nil {
90-
tmos.Exit(err.Error())
90+
panic(err)
9191
}
9292
app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal)
9393
app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0)
@@ -103,10 +103,10 @@ Since the validator set has changed, we need to update the distribution records
103103

104104
```go
105105
// Initialize records for this validator across all distribution stores
106-
app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1))
107-
app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1))
108-
app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission())
109-
app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}})
106+
app.DistrKeeper.ValidatorHistoricalRewards.Set(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1))
107+
app.DistrKeeper.ValidatorCurrentRewards.Set(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1))
108+
app.DistrKeeper.ValidatorAccumulatedCommission.Set(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission())
109+
app.DistrKeeper.ValidatorOutstandingRewards.Set(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}})
110110
```
111111

112112
#### Slashing
@@ -124,7 +124,7 @@ We also need to set the validator signing info for the new validator.
124124
StartHeight: app.LastBlockHeight() - 1,
125125
Tombstoned: false,
126126
}
127-
app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo)
127+
app.SlashingKeeper.ValidatorSigningInfo.Set(ctx, newConsAddr, newValidatorSigningInfo)
128128
```
129129

130130
#### Bank

0 commit comments

Comments
 (0)