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: nit naming changes #1854

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ func (k Keeper) HasToValidate(
// if the validator is opted in and belongs to the validators of the next epoch, then if nothing changes
// the validator would have to validate in the next epoch
if k.IsOptedIn(ctx, chainID, provAddr) {
nextValidators := k.ComputeNextValidators(ctx, chainID, k.stakingKeeper.GetLastValidators(ctx))
nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chainID, k.stakingKeeper.GetLastValidators(ctx))
for _, v := range nextValidators {
consAddr := sdk.ConsAddress(v.ProviderConsAddr)
if provAddr.ToSdkConsAddr().Equals(consAddr) {
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/partial_set_security.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ func (k Keeper) FilterOptedInAndAllowAndDenylistedPredicate(ctx sdk.Context, cha
!k.IsDenylisted(ctx, chainID, providerAddr))
}

// ComputeNextValidators computes the validators for the upcoming epoch based on the currently `bondedValidators`.
func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator) []types.ConsumerValidator {
// ComputeNextEpochConsumerValSet computes the validators for the upcoming epoch based on the currently `bondedValidators`
func (k Keeper) ComputeNextEpochConsumerValSet(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator) []types.ConsumerValidator {
nextValidators := k.FilterValidators(ctx, chainID, bondedValidators,
func(providerAddr types.ProviderConsAddress) bool {
return k.FilterOptedInAndAllowAndDenylistedPredicate(ctx, chainID, providerAddr)
Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (k Keeper) MakeConsumerGenesis(
}
}

nextValidators := k.ComputeNextValidators(ctx, chainID, bondedValidators)
nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chainID, bondedValidators)

k.SetConsumerValSet(ctx, chainID, nextValidators)

Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) {
}
}

nextValidators := k.ComputeNextValidators(ctx, chain.ChainId, bondedValidators)
nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chain.ChainId, bondedValidators)

valUpdates := DiffValidators(currentValidators, nextValidators)
k.SetConsumerValSet(ctx, chain.ChainId, nextValidators)
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/validator_set_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func TestSetConsumerValSet(t *testing.T) {
require.Equal(t, nextValidators, nextCurrentValidators)
}

func TestComputeNextEpochConsumerValSetConsiderAll(t *testing.T) {
func TestFilterValidatorsConsiderAll(t *testing.T) {
providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t))
defer ctrl.Finish()

Expand Down Expand Up @@ -367,7 +367,7 @@ func TestComputeNextEpochConsumerValSetConsiderAll(t *testing.T) {
require.Equal(t, expectedValidators, actualValidators)
}

func TestComputeNextEpochConsumerValSetConsiderOnlyOptIn(t *testing.T) {
func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) {
providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t))
defer ctrl.Finish()

Expand Down
Loading