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 queries for PSS and consumer commission rate #1733

Merged
merged 42 commits into from
Mar 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b0d4cf9
init commit
insumity Mar 13, 2024
0162242
nit change
insumity Mar 13, 2024
7ad2993
cleaning up
insumity Mar 19, 2024
5cd5ba5
clean up
insumity Mar 19, 2024
5393f19
Merge branch 'feat/partial-set-security' into insumity/add-opt-in-set
insumity Mar 19, 2024
03af237
fix distribution test
insumity Mar 19, 2024
07429fa
Update x/ccv/provider/keeper/hooks.go
insumity Mar 20, 2024
0ab0b32
took into Simon's comments
insumity Mar 20, 2024
1a0fa9e
took into rest of the comments
insumity Mar 20, 2024
56ca38d
nit change
insumity Mar 20, 2024
c614fd2
return an error if validator cannot opt out from a Top N chain
insumity Mar 20, 2024
6503f9b
removed automatic opt-in for validators that vote Yes on proposals
insumity Mar 20, 2024
330c085
tiny fix for E2E tests
insumity Mar 20, 2024
629cfd1
nit change to remove unecessary else
insumity Mar 21, 2024
afd4652
update consumer chains query to return topN
sainoe Mar 25, 2024
2e95f89
update query consu chains proto
sainoe Mar 25, 2024
a9db491
Merge remote-tracking branch 'remotes/upstream/insumity/add-opt-in-se…
sainoe Mar 25, 2024
1e3a8e7
add consumer chains per validator query
sainoe Mar 26, 2024
149ba7a
Add PSS command to provider's cli
sainoe Mar 26, 2024
24be8b2
nits
sainoe Mar 26, 2024
b311f35
add consumer commission rate query
sainoe Mar 26, 2024
22ca561
Merge branch 'feat/partial-set-security' into sainoe/pss-query
sainoe Mar 26, 2024
5509108
nits
sainoe Mar 26, 2024
ad91b0e
big renaming
sainoe Mar 27, 2024
559b28f
fix doc
sainoe Mar 27, 2024
00e43a9
nits
sainoe Mar 27, 2024
4f9084f
nits
sainoe Mar 27, 2024
d4fc4cb
docs
sainoe Mar 27, 2024
938d930
Update proto/interchain_security/ccv/provider/v1/query.proto
sainoe Mar 27, 2024
9739ddd
nit
sainoe Mar 27, 2024
c01ab08
add OptedIn in QueryConsumerChainsValidatorHasToValidate
sainoe Mar 27, 2024
4661a99
remove OptIn field in consumer chains query response
sainoe Mar 27, 2024
219d310
Merge remote-tracking branch 'remotes/upstream/sainoe/pss-query' into…
sainoe Mar 27, 2024
10dbb53
include validators that opt-in during the next epochs
sainoe Mar 27, 2024
d642e8a
update has-to-validate condition
sainoe Mar 28, 2024
69d0b28
Merge branch 'feat/partial-set-security' into sainoe/pss-query
sainoe Mar 28, 2024
f9e63f0
fix tinny bug in the tests after merging feat/partial-security
sainoe Mar 28, 2024
3ae3031
update doc
sainoe Mar 28, 2024
ed402f8
update cli description
sainoe Mar 28, 2024
c75594f
Update x/ccv/provider/keeper/grpc_query.go
sainoe Mar 28, 2024
899f3ea
Merge branch 'sainoe/pss-query' of https://github.com/cosmos/intercha…
sainoe Mar 28, 2024
b1c1beb
changes
sainoe Mar 28, 2024
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
6 changes: 4 additions & 2 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,13 @@ func (k Keeper) QueryConsumerChainsValidatorHasToValidate(goCtx context.Context,

ctx := sdk.UnwrapSDKContext(goCtx)

// get all the consumer chains for which the validator is opted-in
// get all the consumer chains for which the validator is already or will be
// opted-in starting from the next epoch
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment doesn't match the code below, right?

Copy link
Contributor Author

@sainoe sainoe Mar 27, 2024

Choose a reason for hiding this comment

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

I think it does. When k.IsOptedIn returns true, it means that the validator is either already on the consumer valset or will be opt-in at the start of the next epoch, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I guess you are right. I'm just a bit confused what should happen when someone has opted out, but is still currently in power on the consumer chain

consumersToValidate := []string{}
for _, consumer := range k.GetAllConsumerChains(ctx) {
chainID := consumer.ChainId
if k.IsConsumerValidator(ctx, chainID, types.NewProviderConsAddress(consAddr)) || k.IsOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr)) {

if k.IsOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that top N validators are only opted in right when the epoch begins, so this doesn't tell you who will get opted into the chain because of being in the top N.

Of course we cannot know for sure, but I would change this to just compute the MinPowerToOptIn for the chain, and then compute the validators that would be opted in, if the epoch would end without further power changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Will add that. Thanks!

consumersToValidate = append(consumersToValidate, chainID)
}
}
Expand Down
Loading