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: Add support for priority validators #2101

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

p-offtermatt
Copy link
Contributor

Description

Closes: #2030


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Included the correct type prefix in the PR title
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • Confirmed the correct type prefix in the PR title
  • Confirmed all author checklist items have been addressed
  • Confirmed that this PR does not change production code

@github-actions github-actions bot added the C:x/provider Assigned automatically by the PR labeler label Jul 26, 2024
@github-actions github-actions bot added the C:Testing Assigned automatically by the PR labeler label Oct 15, 2024
@github-actions github-actions bot added C:Docs Assigned automatically by the PR labeler C:ADR Assigned automatically by the PR labeler labels Oct 16, 2024
Copy link
Contributor Author

@p-offtermatt p-offtermatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great so far. I left a few comments

proto/interchain_security/ccv/provider/v1/provider.proto Outdated Show resolved Hide resolved
tests/e2e/steps_permissionless_ics.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/grpc_query.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/power_shaping.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/power_shaping_test.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/power_shaping_test.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/power_shaping_test.go Show resolved Hide resolved
@@ -218,6 +218,12 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk
return err
}

// chainId -> Prioritylist
err = rekeyChainIdAndConsAddrKey(store, providertypes.PrioritylistKeyPrefix(), chainId, consumerId)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add this here I think, since this is for a migration that will happen before we have the priority vals feature
@mpoke could you double-check that that's true? I'm not very on top of the ICS release schedule atm

@kirdatatjana kirdatatjana marked this pull request as ready for review October 17, 2024 13:48
@kirdatatjana kirdatatjana requested a review from a team as a code owner October 17, 2024 13:48
@@ -0,0 +1,2 @@
- Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the file (here and below) so they do not have xxx. Probably add a verb there as well to make it clear from the name what this does (e.g., introduce-priority...).

@@ -1840,6 +1840,190 @@ func stepsValidatorsDenylistedChain() []Step {
return s
}

// stepsValidatorsAllowlistedChain starts a provider chain and an Opt-In chain with an prioritylist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment name does not match function name.

ChainID("consu"): ChainState{
ValPowers: &map[ValidatorID]uint{
ValidatorID("alice"): 100,
ValidatorID("bob"): 200,
Copy link
Contributor

@insumity insumity Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above it's written:

// Bob is not in the validator set due to ValidatorSetCap and priority list

so why is "bob" validating here?

"denylist": [],
"min_stake": "0",
"allow_inactive_vals": false,
"prioritylist": []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation here and below.

@@ -89,7 +89,7 @@ func (k Keeper) UpdateMinimumPowerInTopN(ctx sdk.Context, consumerId string, old

// CapValidatorSet caps the provided `validators` if chain with `consumerId` is an Opt In chain with a validator-set cap.
// If cap is `k`, `CapValidatorSet` returns the first `k` validators from `validators` with the highest power.
func (k Keeper) CapValidatorSet(
func (k Keeper) CapValidatorSet2(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a better name to express what this does. Also, the function name does not match comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:ADR Assigned automatically by the PR labeler C:Docs Assigned automatically by the PR labeler C:Testing Assigned automatically by the PR labeler C:x/provider Assigned automatically by the PR labeler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add priority validators list to the power shaping params
3 participants