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

fix!: change UX in key assignment #1998

Merged
merged 9 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Change the UX in key assignment by returning an error if a validator tries to
reuse the same consumer key.
([\#1998](https://github.com/cosmos/interchain-security/pull/1998))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Change the UX in key assignment by returning an error if a validator tries to
reuse the same consumer key.
([\#1998](https://github.com/cosmos/interchain-security/pull/1998))
12 changes: 12 additions & 0 deletions tests/e2e/steps_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex
},
},
},
{
// op should fail - key already assigned by the same validator
Action: AssignConsumerPubKeyAction{
Chain: ChainID(consumerName),
Validator: ValidatorID("carol"),
ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey,
ReconfigureNode: false,
ExpectError: true,
ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator",
},
State: State{},
},
{
// op should fail - key already assigned by another validator
Action: AssignConsumerPubKeyAction{
Expand Down
18 changes: 5 additions & 13 deletions tests/e2e/steps_start_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,16 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint
},
},
{
// op should be a noop - key already assigned, but by the same validator
// op should fail - key already assigned by the same validator
Action: AssignConsumerPubKeyAction{
Chain: ChainID(consumerName),
Validator: ValidatorID("carol"),
ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey,
ReconfigureNode: false,
ExpectError: false,
},
State: State{
ChainID(consumerName): ChainState{
AssignedKeys: &map[ValidatorID]string{
ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ConsumerValconsAddressOnProvider,
},
ProviderKeys: &map[ValidatorID]string{
ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ValconsAddress,
},
},
ExpectError: true,
ExpectedError: "a validator has or had assigned this consumer key already",
},
State: State{},
},
{
// op should fail - key already assigned by another validator
Expand All @@ -114,7 +106,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint
ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey,
ReconfigureNode: false,
ExpectError: true,
ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator",
ExpectedError: "a validator has or had assigned this consumer key already",
},
State: State{
ChainID(consumerName): ChainState{
Expand Down
30 changes: 4 additions & 26 deletions tests/e2e/tracehandler_testdata/consumer-double-sign.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -180,7 +158,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
Expand Down
30 changes: 4 additions & 26 deletions tests/e2e/tracehandler_testdata/democracy.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"democ": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -180,7 +158,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"democ": {
Expand Down
30 changes: 4 additions & 26 deletions tests/e2e/tracehandler_testdata/democracyRewardsSteps.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"democ": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -180,7 +158,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"democ": {
Expand Down
30 changes: 4 additions & 26 deletions tests/e2e/tracehandler_testdata/happyPath.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -180,7 +158,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
Expand Down
60 changes: 8 additions & 52 deletions tests/e2e/tracehandler_testdata/multipleConsumers.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -180,7 +158,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
Expand Down Expand Up @@ -449,32 +427,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"densu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -484,7 +440,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"densu": {
Expand Down
30 changes: 4 additions & 26 deletions tests/e2e/tracehandler_testdata/shorthappy.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,10 @@
"Validator": "carol",
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": false,
"ExpectedError": ""
"ExpectError": true,
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"IBCTransferParams": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"HasToValidate": null,
"Proposals": null
}
}
"State": {}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand All @@ -180,7 +158,7 @@
"ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}",
"ReconfigureNode": false,
"ExpectError": true,
"ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator"
"ExpectedError": "a validator has or had assigned this consumer key already"
},
"State": {
"consu": {
Expand Down
Loading
Loading