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

PSS: Error when opting in with your already-assigned key #1731

Closed
p-offtermatt opened this issue Mar 26, 2024 · 0 comments · Fixed by #1732
Closed

PSS: Error when opting in with your already-assigned key #1731

p-offtermatt opened this issue Mar 26, 2024 · 0 comments · Fixed by #1732
Assignees
Labels
source: devnet To indicate an issue surfaced in a devnet. type: bug Issues that need priority attention -- something isn't working

Comments

@p-offtermatt
Copy link
Contributor

p-offtermatt commented Mar 26, 2024

Problem

Thanks to @dasanchez for surfacing!

If validator V first assigns a consumer key for a chain C (but is not opted in),
and then V opts into C, there are two natural ways:

  1. opt in specifying the already assigned key again
  2. opt in without specifying a consumer key (and using the already assigned key implicitly)

Right now, 2) works, but 1) throws an error:

Error: rpc error: code = Unknown desc = rpc error: code = Unknown desc = failed to execute message; message index: 0: a validator has assigned the consumer key already: consumer key is already in use by a validator [/home/runner/work/cosmos-builds/cosmos-builds/interchain-security/x/ccv/provider/keeper/key_assignment.go:377] With gas wanted: '18446744073709551615' and gas used: '38919' : unknown request

I think 1) should not throw an error, and just behave like 2).

Closing criteria

We either take care to document that 1) is not intended, or we make 1) behave like 2).

Problem details

The problem is here:

Optin in assigns a consumer key

err = k.AssignConsumerKey(ctx, chainID, validator, consumerTMPublicKey)

Assignment checks whether the consumer key is in use by any validator:

if _, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found {
// consumer key is already in use
// prevent multiple validators from assigning the same key
return errorsmod.Wrapf(
types.ErrConsumerKeyInUse, "a validator has assigned the consumer key already",
)
}

My preferred solution would be to adjust

if _, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found {
// consumer key is already in use
// prevent multiple validators from assigning the same key
return errorsmod.Wrapf(
types.ErrConsumerKeyInUse, "a validator has assigned the consumer key already",
)
}

to only throw an error if the validator that has already assigned the consumer key is not the same as the one now trying to assign the key, and have it act as a noop otherwise. I think it is slightly weird to have the pure key assignment tx sometimes be a noop without failing, but I think it shouldn't be an issue with gas or anything

@p-offtermatt p-offtermatt added the type: bug Issues that need priority attention -- something isn't working label Mar 26, 2024
@github-project-automation github-project-automation bot moved this to 🩹 F1: Triage in Cosmos Hub Mar 26, 2024
@p-offtermatt p-offtermatt self-assigned this Mar 26, 2024
@p-offtermatt p-offtermatt moved this from 🩹 F1: Triage to 🏗 F3: InProgress in Cosmos Hub Mar 26, 2024
@p-offtermatt p-offtermatt added the source: devnet To indicate an issue surfaced in a devnet. label Mar 27, 2024
@p-offtermatt p-offtermatt moved this from 🏗 F3: InProgress to 👀 F3: InReview in Cosmos Hub Mar 28, 2024
@p-offtermatt p-offtermatt moved this from 👀 F3: InReview to 👍 F4: Assessment in Cosmos Hub Apr 3, 2024
@mpoke mpoke closed this as completed Apr 4, 2024
@mpoke mpoke moved this from 👍 F4: Assessment to ✅ Done in Cosmos Hub Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source: devnet To indicate an issue surfaced in a devnet. type: bug Issues that need priority attention -- something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants