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

feat!: compute partial sets #1702

Merged
merged 15 commits into from
Mar 25, 2024
Prev Previous commit
Next Next commit
took into Simon's comments
  • Loading branch information
insumity committed Mar 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 0ab0b32b795f1ba340175e597cd102ebf0ba7a83
8 changes: 4 additions & 4 deletions testutil/ibc_testing/generic_setup.go
Original file line number Diff line number Diff line change
@@ -141,10 +141,6 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp](
prop.ChainId = chainID
prop.Top_N = consumerTopNParams[index] // isn't used in CreateConsumerClient

// set the consumer TopN here since the test suite setup only used the consumer addition prop
// to create the consumer genesis, see BeginBlockInit in /x/ccv/provider/keeper/proposal.go.
providerKeeper.SetTopN(providerChain.GetContext(), chainID, prop.Top_N)

// NOTE: the initial height passed to CreateConsumerClient
// must be the height on the consumer when InitGenesis is called
prop.InitialHeight = clienttypes.Height{RevisionNumber: 0, RevisionHeight: 3}
@@ -154,6 +150,10 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp](
)
s.Require().NoError(err)

// set the consumer TopN here since the test suite setup only used the consumer addition prop
// to create the consumer genesis, see BeginBlockInit in /x/ccv/provider/keeper/proposal.go.
providerKeeper.SetTopN(providerChain.GetContext(), chainID, prop.Top_N)

// commit the state on the provider chain
coordinator.CommitBlock(providerChain)

4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/proposal.go
Original file line number Diff line number Diff line change
@@ -299,9 +299,9 @@ func (k Keeper) MakeConsumerGenesis(
return k.IsOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr))
}

if topN, found := k.GetTopN(ctx, chainID); found {
if prop.Top_N > 0 {
// in a Top-N chain, we automatically opt in all validators that belong to the top N
minPower := k.ComputeMinPowerToOptIn(ctx, bondedValidators, topN)
minPower := k.ComputeMinPowerToOptIn(ctx, bondedValidators, prop.Top_N)
k.OptInTopNValidators(ctx, chainID, bondedValidators, minPower)
}