Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jul 3, 2024
1 parent ed93ba0 commit 5ff56e8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions tests/e2e/steps_inactive_vals.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
// high-level, this test does:
// - start the provider chain
// - start a consumer chain
// - check that non-consensus validators do not get slashed for downtime; and that they don't get rewards
// - check that active validators *do* get slashed for downtime, and don't get rewards while they are down
// - check that non-consensus validators do not get slashed for downtime on the provider; and that they don't get rewards
// - check that active validators *do* get slashed for downtime on the provider, and don't get rewards while they are down
// - check that non-consensus validators *do* get jailed for downtime on consumer chains
// - check that non-consensus validators *become* consensus validators when they have enough power
func stepsInactiveProviderValidators() []Step {
Expand Down Expand Up @@ -144,7 +144,6 @@ func stepsInactiveProviderValidators() []Step {
},
State: State{
ChainID("provi"): ChainState{
// check that now every validator got rewarded since the first block
Rewards: &Rewards{
IsNativeDenom: true, // check for rewards in the provider denom
IsIncrementalReward: true, // check rewards for currently produced blocks only
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/no_valupdates_genutil/doc.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
Package staking defines a "wrapper" module around the Cosmos SDK's native
x/staking module. In other words, it provides the exact same functionality as
x/genutil module. In other words, it provides the exact same functionality as
the native module in that it simply embeds the native module. However, it
overrides `EndBlock` which will return no validator set updates. Instead,
overrides `InitGenesis` which will return no validator set updates. Instead,
it is assumed that some other module will provide the validator set updates.
*/
package genutil
1 change: 0 additions & 1 deletion x/ccv/provider/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ func TestInitAndExportGenesis(t *testing.T) {
)

mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return(
// return an empty set of validators, since they are not tested against here
[]stakingtypes.Validator{
provVal,
}, nil).AnyTimes()
Expand Down
6 changes: 3 additions & 3 deletions x/ccv/provider/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) ([]abci.ValidatorUpdate, error) {
// The function returns the difference between the current validator set and the next validator set as a list of `abci.ValidatorUpdate` objects.
func (k Keeper) ProviderValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate {
// get the bonded validators from the staking module
bondedValidators, error := k.stakingKeeper.GetBondedValidatorsByPower(ctx)
if error != nil {
panic(fmt.Errorf("failed to get bonded validators: %w", error))
bondedValidators, err := k.stakingKeeper.GetBondedValidatorsByPower(ctx)
if err != nil {
panic(fmt.Errorf("failed to get bonded validators: %w", err))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
}

// get the last validator set sent to consensus
Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ func TestEndBlockVSU(t *testing.T) {
testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 5, lastValidators, powers, -1)

sort.Slice(lastValidators, func(i, j int) bool {
return lastValidators[i].ConsensusPower(sdk.DefaultPowerReduction) >
return lastValidators[i].GetConsensusPower(sdk.DefaultPowerReduction) >
lastValidators[j].GetConsensusPower(sdk.DefaultPowerReduction)
})
mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return(lastValidators, nil).AnyTimes()
Expand Down

0 comments on commit 5ff56e8

Please sign in to comment.