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

chore: amend validator to validators #17809

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
770 changes: 385 additions & 385 deletions api/cosmos/staking/v1beta1/staking.pulsar.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ message HistoricalInfo {
// recent HistoricalInfo
// (`n` is set by the staking module's `historical_entries` parameter).
message HistoricalRecord {
bytes apphash = 1;
google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true];
bytes validator_hash = 3;
bytes apphash = 1;
google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true];
bytes validators_hash = 3;
}

// CommissionRates defines the initial commission rates to be used for creating
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/staking/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func createValidatorAccs(t *testing.T, f *fixture) ([]sdk.AccAddress, []types.Va
// have its order changed
sortedVals := make([]types.Validator, len(validators))
copy(sortedVals, validators)
hi := types.HistoricalRecord{Time: &header.Time, Apphash: header.AppHash, ValidatorHash: header.NextValidatorsHash}
hi := types.HistoricalRecord{Time: &header.Time, Apphash: header.AppHash, ValidatorsHash: header.NextValidatorsHash}
assert.NilError(t, f.stakingKeeper.HistoricalInfo.Set(f.sdkCtx, uint64(5), hi))

return addrs, validators
Expand Down
6 changes: 3 additions & 3 deletions x/staking/keeper/historical_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func (k Keeper) TrackHistoricalInfo(ctx context.Context) error {
time := sdkCtx.HeaderInfo().Time

historicalEntry := types.HistoricalRecord{
Time: &time,
ValidatorHash: sdkCtx.CometInfo().ValidatorsHash,
Apphash: sdkCtx.HeaderInfo().AppHash,
Time: &time,
ValidatorsHash: sdkCtx.CometInfo().ValidatorsHash,
Apphash: sdkCtx.HeaderInfo().AppHash,
}

// Set latest HistoricalInfo at current height
Expand Down
42 changes: 21 additions & 21 deletions x/staking/keeper/historical_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func (s *KeeperTestSuite) TestHistoricalInfo() {

time := ctx.BlockTime()
hi := stakingtypes.HistoricalRecord{
Time: &time,
ValidatorHash: ctx.CometInfo().ValidatorsHash,
Apphash: ctx.HeaderInfo().AppHash,
Time: &time,
ValidatorsHash: ctx.CometInfo().ValidatorsHash,
Apphash: ctx.HeaderInfo().AppHash,
}
require.NoError(keeper.HistoricalInfo.Set(ctx, uint64(2), hi))

Expand Down Expand Up @@ -68,15 +68,15 @@ func (s *KeeperTestSuite) TestTrackHistoricalInfo() {
// and check that it has been stored
t := time.Now().Round(0).UTC()
hi4 := stakingtypes.HistoricalRecord{
Time: &t,
ValidatorHash: []byte("validatorHash"),
Apphash: []byte("AppHash"),
Time: &t,
ValidatorsHash: []byte("validatorHash"),
Apphash: []byte("AppHash"),
}

hi5 := stakingtypes.HistoricalRecord{
Time: &t,
ValidatorHash: []byte("validatorHash"),
Apphash: []byte("AppHash"),
Time: &t,
ValidatorsHash: []byte("validatorHash"),
Apphash: []byte("AppHash"),
}

require.NoError(keeper.HistoricalInfo.Set(ctx, uint64(4), hi4))
Expand Down Expand Up @@ -118,9 +118,9 @@ func (s *KeeperTestSuite) TestTrackHistoricalInfo() {

// Check HistoricalInfo at height 10 is persisted
expected := stakingtypes.HistoricalRecord{
Time: &t,
ValidatorHash: ctx.CometInfo().ValidatorsHash,
Apphash: ctx.HeaderInfo().AppHash,
Time: &t,
ValidatorsHash: ctx.CometInfo().ValidatorsHash,
Apphash: ctx.HeaderInfo().AppHash,
}
recv, err = keeper.HistoricalInfo.Get(ctx, uint64(10))
require.NoError(err, "GetHistoricalInfo failed after BeginBlock")
Expand All @@ -142,19 +142,19 @@ func (s *KeeperTestSuite) TestGetAllHistoricalInfo() {
t := time.Now().Round(0).UTC()

hist1 := stakingtypes.HistoricalRecord{
Time: &t,
ValidatorHash: nil,
Apphash: nil,
Time: &t,
ValidatorsHash: nil,
Apphash: nil,
}
hist2 := stakingtypes.HistoricalRecord{
Time: &t,
ValidatorHash: nil,
Apphash: nil,
Time: &t,
ValidatorsHash: nil,
Apphash: nil,
}
hist3 := stakingtypes.HistoricalRecord{
Time: &t,
ValidatorHash: nil,
Apphash: nil,
Time: &t,
ValidatorsHash: nil,
Apphash: nil,
}

expHistInfos := []stakingtypes.HistoricalRecord{hist1, hist2, hist3}
Expand Down
6 changes: 3 additions & 3 deletions x/staking/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ func HistoricalInfoCodec(cdc codec.BinaryCodec) collcodec.ValueCodec[types.Histo
}

return types.HistoricalRecord{
Apphash: historicalinfo.Header.AppHash,
Time: &historicalinfo.Header.Time,
ValidatorHash: historicalinfo.Header.NextValidatorsHash,
Apphash: historicalinfo.Header.AppHash,
Time: &historicalinfo.Header.Time,
ValidatorsHash: historicalinfo.Header.NextValidatorsHash,
}, nil
})
}
Expand Down
Loading