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!: Fix opt-in assignment #1732

Merged
merged 10 commits into from
Apr 2, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Assigning a key that is already assigned by the same validator will now be a no-op instead of throwing an error.
([\#1732](https://github.com/cosmos/interchain-security/pull/1732))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Assigning a key that is already assigned by the same validator will now be a no-op instead of throwing an error.
p-offtermatt marked this conversation as resolved.
Show resolved Hide resolved
([\#1732](https://github.com/cosmos/interchain-security/pull/1732))
4 changes: 2 additions & 2 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ TEST RESULTS
}
}
if len(passedTests) > 0 {
report += fmt.Sprintln("\n\nPASSED TESTS:\n")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these trailing newlines gave me a warning on the CLI when I tried to regenerate the traces, so I removed them

report += fmt.Sprintln("\n\nPASSED TESTS:")
for _, t := range passedTests {
report += t.Report()
}
}
if len(remainingTests) > 0 {
report += fmt.Sprintln("\n\nREMAINING TESTS:\n")
report += fmt.Sprintln("\n\nREMAINING TESTS:")
for _, t := range remainingTests {
report += t.Report()
}
Expand Down
12 changes: 0 additions & 12 deletions tests/e2e/steps_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex
},
},
},
{
// op should fail - key already assigned by the same validator
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed because expected behaviour is now inconsistent across versions.

@bermuell should I do something else? The change is that on main, this will not expect an error anymore, while it will still expect one in old releases. Might be easier to just not test this particular thing here, it's tested separately in steps_start_chains anyways

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
16 changes: 12 additions & 4 deletions tests/e2e/steps_start_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,24 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint
},
},
{
// op should fail - key already assigned by the same validator
// op should be a noop - key already assigned, but 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",
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,
},
},
},
State: State{},
},
{
// op should fail - key already assigned by another validator
Expand Down
26 changes: 23 additions & 3 deletions tests/e2e/tracehandler_testdata/consumer-double-sign.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
26 changes: 23 additions & 3 deletions tests/e2e/tracehandler_testdata/democracy.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"democ": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
26 changes: 23 additions & 3 deletions tests/e2e/tracehandler_testdata/democracyRewardsSteps.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"democ": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
26 changes: 23 additions & 3 deletions tests/e2e/tracehandler_testdata/happyPath.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
52 changes: 46 additions & 6 deletions tests/e2e/tracehandler_testdata/multipleConsumers.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down Expand Up @@ -399,10 +419,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"densu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
26 changes: 23 additions & 3 deletions tests/e2e/tracehandler_testdata/shorthappy.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
26 changes: 23 additions & 3 deletions tests/e2e/tracehandler_testdata/slashThrottle.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,30 @@
"Validator": "carol",
"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"
"ExpectError": false,
"ExpectedError": ""
},
"State": {}
"State": {
"consu": {
"ValBalances": null,
"ProposedConsumerChains": null,
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": {
"carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"
},
"ProviderKeys": {
"carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"
},
"ConsumerPendingPacketQueueSize": null,
"RegisteredConsumerRewardDenoms": null,
"ClientsFrozenHeights": null,
"Proposals": null
}
}
},
{
"ActionType": "main.AssignConsumerPubKeyAction",
Expand Down
Loading
Loading