From f2482b651a2af24174bc5d27cf1c9f07e45ad1f7 Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 2 May 2024 14:22:32 +0200 Subject: [PATCH] reverts name to ComputeNextValidators because the semantics of ComputeNextEpochConsumerValSet were different in v4.1 --- x/ccv/provider/keeper/keeper.go | 2 +- x/ccv/provider/keeper/partial_set_security.go | 4 ++-- x/ccv/provider/keeper/proposal.go | 2 +- x/ccv/provider/keeper/relay.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 179348dd3d..bc3664bfd7 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -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.ComputeNextEpochConsumerValSet(ctx, chainID, k.stakingKeeper.GetLastValidators(ctx)) + nextValidators := k.ComputeNextValidators(ctx, chainID, k.stakingKeeper.GetLastValidators(ctx)) for _, v := range nextValidators { consAddr := sdk.ConsAddress(v.ProviderConsAddr) if provAddr.ToSdkConsAddr().Equals(consAddr) { diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go index 2e963f53ab..0d5177089a 100644 --- a/x/ccv/provider/keeper/partial_set_security.go +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -283,8 +283,8 @@ func (k Keeper) FilterOptedInAndAllowAndDenylistedPredicate(ctx sdk.Context, cha !k.IsDenylisted(ctx, chainID, providerAddr)) } -// 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 { +// 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 { nextValidators := k.FilterValidators(ctx, chainID, bondedValidators, func(providerAddr types.ProviderConsAddress) bool { return k.FilterOptedInAndAllowAndDenylistedPredicate(ctx, chainID, providerAddr) diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 0177ed24ab..1d2bf19a4f 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -292,7 +292,7 @@ func (k Keeper) MakeConsumerGenesis( } } - nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chainID, bondedValidators) + nextValidators := k.ComputeNextValidators(ctx, chainID, bondedValidators) k.SetConsumerValSet(ctx, chainID, nextValidators) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index ccaf3a25e8..230ed0a96a 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -231,7 +231,7 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { } } - nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chain.ChainId, bondedValidators) + nextValidators := k.ComputeNextValidators(ctx, chain.ChainId, bondedValidators) valUpdates := DiffValidators(currentValidators, nextValidators) k.SetConsumerValSet(ctx, chain.ChainId, nextValidators)