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!: remove stopTime from MsgRemoveConsumer #2208

Merged
merged 14 commits into from
Sep 4, 2024

Conversation

insumity
Copy link
Contributor

@insumity insumity commented Sep 3, 2024

Description

Problem
Before, a consumer chain could issue a MsgRemoveConsumer and immediately (depending on the set stopTime) delete some of its state. The deletion of the state includes the removal of consensus keys used on the consumer chain, etc. As a result, if a consumer was to call MsgRemoveChain, we might not be able to slash validators for misbehaviors on a just-removed consumer chain.

Solution
We remove stopTime from MsgRemoveConsumer and internally set the chain's state to be removed after unbonding period. Additionally, we introduce the DELETED phase that can only occur on a STOPPED chain. When a chain calls MsgRemoveConsumer it is stopped (i.e., no VSCPackets are not queued for this chain, etc.) but the state of the chain still resides on the Hub. After an unbonding period elapses, we delete the state of the chain and the chain moves to the DELETED phase.

Note: Previous version of ICS could delete the state of a consumer chain but not close the underlying CCV channel. In this PR, we always close the channel when we delete the state of the chain.

Testing
No additional testing performed, besides fixing the already existing one. From E2E tests, we executed the happy-path and slash-throttle.


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
  • Added ! to the type prefix if the change is state-machine breaking
  • Confirmed this PR does not introduce changes requiring state migrations, OR migration code has been added to consumer and/or provider modules
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Followed the guidelines for building SDK modules
  • Included the necessary unit and integration tests
  • Added a changelog entry to CHANGELOG.md
  • Included comments for documenting Go code
  • Updated the relevant documentation or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed
  • If this PR is library API breaking, bump the go.mod version string of the repo, and follow through on a new major release

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 ! the type prefix if the change is state-machine breaking
  • confirmed this PR does not introduce changes requiring state migrations, OR confirmed migration code has been added to consumer and/or provider modules
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage

Summary by CodeRabbit

  • New Features

    • Introduced a new ConsumerPhase field to enhance the consumer chain state representation.
    • Added a new enumeration value for deleted consumer phases, improving state management clarity.
    • Expanded the querying capabilities to include the deleted state for consumer chains.
  • Bug Fixes

    • Simplified consumer removal logic by eliminating unnecessary stop time parameters, streamlining user interactions.
  • Documentation

    • Updated command documentation to reflect new filtering options for consumer chain states.
  • Refactor

    • Renamed methods and variables to reflect the transition from stopping to removing consumer chains, enhancing code clarity.
  • Tests

    • Adjusted test cases to align with the new consumer removal logic and updated naming conventions for better clarity.

@github-actions github-actions bot added C:Testing Assigned automatically by the PR labeler C:x/provider Assigned automatically by the PR labeler labels Sep 3, 2024
@@ -266,15 +271,6 @@ func TestProviderStateIsCleanedAfterConsumerChainIsStopped(t *testing.T, ctx sdk
acks := providerKeeper.GetSlashAcks(ctx, consumerId)
require.Empty(t, acks)

// in case the chain was successfully stopped, it should not contain a Top N associated to it
ps, err := providerKeeper.GetConsumerPowerShapingParameters(ctx, 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.

We do not delete the power-shaping or initialization parameters during a chain deletion anymore.

@insumity insumity marked this pull request as ready for review September 3, 2024 15:12
@insumity insumity requested a review from a team as a code owner September 3, 2024 15:12
Copy link
Contributor

coderabbitai bot commented Sep 3, 2024

Walkthrough

Walkthrough

The changes introduce significant modifications to the consumer lifecycle management within the interchain security protocol. Key alterations include the addition of a ConsumerPhase field, the introduction of a CONSUMER_PHASE_DELETED state, and the removal of stop_time parameters across various messages and functions. The focus has shifted from stopping consumer chains to deleting them, affecting how consumer states are managed, queried, and processed throughout the system.

Changes

Files Change Summary
proto/interchain_security/ccv/provider/v1/genesis.proto Added ConsumerPhase phase to ConsumerState.
proto/interchain_security/ccv/provider/v1/provider.proto Added CONSUMER_PHASE_DELETED to ConsumerPhase enum.
proto/interchain_security/ccv/provider/v1/query.proto Updated QueryConsumerChainsRequest comment to include Deleted=5 for phase.
proto/interchain_security/ccv/provider/v1/tx.proto Removed stop_time from MsgRemoveConsumer and repositioned signer.
tests/e2e/action_rapid_test.go Removed StopTimeOffset from SubmitConsumerRemovalProposalAction.
tests/e2e/actions.go Removed StopTimeOffset from SubmitConsumerRemovalProposalAction and adjusted related logic.
tests/e2e/state.go Removed stopTime calculation from GetProposal method and eliminated StopTime from ConsumerRemovalProposal.
tests/e2e/state_rapid_test.go Removed StopTime from ConsumerRemovalProposal generation logic.
tests/e2e/steps_stop_chain.go Removed StopTimeOffset from struct initialization; StopTime remains set to 0.
tests/e2e/testlib/types.go Removed StopTime from ConsumerRemovalProposal struct.
tests/e2e/trace_handlers_test.go Removed StopTime from ConsumerRemovalProposal instances.
tests/e2e/v4/state.go Removed stop_time extraction from GetProposal method.
tests/integration/stop_consumer.go Replaced StopConsumerChain with SetConsumerPhase and DeleteConsumerChain methods.
testutil/keeper/expectations.go Renamed GetMocksForStopConsumerChainWithCloseChannel to GetMocksForDeleteConsumerChain.
testutil/keeper/unit_test_helpers.go Renamed SetupForStoppingConsumerChain to SetupForDeleteConsumerChain and updated related logic.
x/ccv/provider/client/cli/query.go Updated command documentation to include Deleted state for filtering consumer chains.
x/ccv/provider/client/cli/tx.go Simplified NewRemoveConsumerCmd by removing stop time parameters.
x/ccv/provider/keeper/consumer_lifecycle.go Renamed methods to reflect removal instead of stopping, including BeginBlockStopConsumers to BeginBlockRemoveConsumers.
x/ccv/provider/keeper/consumer_lifecycle_test.go Updated tests to reflect changes from stopping to removing consumers.
x/ccv/provider/keeper/distribution.go Renamed GetAllRegisteredConsumerIds to GetAllLaunchedConsumerIds.
x/ccv/provider/keeper/genesis.go Updated InitGenesis and ExportGenesis to set and export consumer phase correctly.
x/ccv/provider/keeper/grpc_query.go Replaced GetAllRegisteredConsumerIds with GetAllLaunchedConsumerIds in query functions.
x/ccv/provider/keeper/keeper.go Renamed GetAllRegisteredConsumerIds to GetAllLaunchedConsumerIds with updated logic to filter by phase.
x/ccv/provider/keeper/keeper_test.go Renamed TestGetAllRegisteredConsumerChainIDs to TestGetAllLaunchedConsumerIds and updated test logic accordingly.
x/ccv/provider/keeper/msg_server.go Updated UpdateConsumer and RemoveConsumer methods to reflect new lifecycle management logic.
x/ccv/provider/types/consumer.go Added phase parameter to NewConsumerStates function.
x/ccv/provider/types/errors.go Renamed ErrInvalidStopTime to ErrInvalidRemovalTime.
x/ccv/provider/types/keys.go Renamed keys related to stop times to reflect removal times.
x/ccv/provider/types/legacy_proposal.go Removed StopTime from NewConsumerRemovalProposal function.
x/ccv/provider/types/msg.go Removed stopTime parameter from NewMsgRemoveConsumer.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Keeper
    participant State

    User->>CLI: Request to remove consumer
    CLI->>Keeper: NewRemoveConsumerCmd(consumerId)
    Keeper->>State: SetConsumerPhase(consumerId, CONSUMER_PHASE_DELETED)
    Keeper->>State: DeleteConsumerChain(consumerId)
    State-->>Keeper: Confirm deletion
    Keeper-->>CLI: Success response
    CLI-->>User: Consumer removed successfully
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

x/ccv/provider/module.go Dismissed Show dismissed Hide dismissed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (7)
x/ccv/provider/types/consumer.go (1)

15-15: Approved with recommendations

The code changes look good and are consistent with the PR summary. The new phase parameter allows setting the Phase field in the ConsumerState struct, enabling representation of different phases within the consumer lifecycle.

However, please note the following recommendations:

  1. The function signature change is backwards incompatible. Ensure that all callers of this function are updated to provide the new phase argument.

  2. Consider adding tests to cover the function changes, specifically for the new phase parameter and the corresponding Phase field in the ConsumerState struct. Although the PR summary mentions that the existing tests were fixed and the end-to-end tests passed, it's still a good practice to have unit tests covering this function directly.

Also applies to: 25-25

x/ccv/provider/migrations/v5/migrations.go (1)

Line range hint 18-20: Question the hardcoded value of 95 for topN.

The function is setting the topN value to a hardcoded value of 95 for all launched consumer IDs.

Consider the following:

  • Is there a specific reason for choosing the value 95?
  • Should this value be configurable instead of hardcoded?
  • Add a comment to explain the significance of this value.
tests/e2e/trace_handlers_test.go (1)

Line range hint 1-216: Consider adding e2e tests for the specific changes introduced in this PR.

The existing e2e tests cover a wide range of scenarios and proposal types. However, there are no specific tests for the changes introduced in this PR, such as:

  • The removal of stopTime from MsgRemoveConsumer
  • The introduction of the DELETED phase for consumer chains

To ensure sufficient code coverage, consider adding e2e tests that specifically exercise these changes.

Do you want me to suggest some test cases that cover these changes? I can help draft the test code if needed.

x/ccv/provider/keeper/consumer_lifecycle_test.go (4)

651-653: Update references from "stop" to "remove" for consistency.

The function name and some comments refer to stopping consumers, but the code is actually testing the removal of consumers. Consider renaming the function to TestBeginBlockRemoveConsumers and updating comments to reflect the removal functionality.

Also applies to: 655-657, 659-661


706-707: Update comment to reflect the new removal functionality.

- // the chain is considered to be stopped and ready for deletion (i.e., `StopAndPrepareForConsumerRemoval` is called)
+ // the chain is considered to be stopped and ready for removal

733-733: Rename the function to TestGetConsumersReadyToRemove.

The function name suggests it's testing the retrieval of consumers ready to be stopped, but the code is actually testing the retrieval of consumers ready to be removed. Rename the function to TestGetConsumersReadyToRemove for consistency with the new removal functionality.

Also applies to: 735-735, 737-737, 740-740, 744-744, 748-748, 752-752


757-757: Rename the function to TestDeleteConsumerChain.

The function name suggests it's testing the stopping of consumer chains, but the code is actually testing the deletion of consumer chains. Rename the function to TestDeleteConsumerChain for consistency with the new deletion functionality.

Comment on lines +110 to +111
providerKeeper.SetConsumerPhase(s.providerCtx(), s.getFirstBundle().ConsumerId, types.ConsumerPhase_CONSUMER_PHASE_STOPPED)
err := providerKeeper.DeleteConsumerChain(s.providerCtx(), s.getFirstBundle().ConsumerId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Complete the test function.

The changes made to stop the consumer chain using the new methods SetConsumerPhase and DeleteConsumerChain are in line with the PR objectives. However, the test function is incomplete and has commented out code that needs to be implemented.

Please complete the test function by implementing the following:

  1. Simulate the relayer behavior by calling OnChanCloseConfirm on the provider chain's channel end.
  2. Check for the panic in the consumer chain's BeginBlock.
  3. Check if the provider's channel is removed.

Do you want me to open a GitHub issue to track this task?

Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

See my comments below.

x/ccv/provider/types/legacy_proposal.go Outdated Show resolved Hide resolved
x/ccv/provider/migrations/v5/migrations.go Show resolved Hide resolved
x/ccv/provider/keeper/relay.go Show resolved Hide resolved
x/ccv/provider/keeper/consumer_lifecycle.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/msg_server.go Show resolved Hide resolved
x/ccv/provider/keeper/consumer_lifecycle.go Show resolved Hide resolved
x/ccv/provider/keeper/consumer_lifecycle.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/keeper.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/relay.go Show resolved Hide resolved
@insumity insumity merged commit 3cc9ba2 into feat/permissionless Sep 4, 2024
13 of 16 checks passed
@insumity insumity deleted the insumity/fix-stop-time branch September 4, 2024 13:27
github-merge-queue bot pushed a commit that referenced this pull request Sep 6, 2024
* feat: first iteration on Permissionless ICS (#2117)

* (partially) renamed chain ids to consumer ids

* renamed proposal messages

* removed global slash entry

* fixed unit tests

* added new messages

* introduced new state

* added functionality for the register and initialize messages

* renamed (partially) chainIds to consumerIds

* set consumerId to chainId association during registration

* added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize

* added initial work on traversing initialized chains that are to-be-launched

* fixed rebase issues after bringing the VSCMaturedPackets work in

* made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass)

* renamed more chainIDs to consumerIds

* removed ClientIdToChainId state because chainId already resides on the registration record

* nit fixes in go docs

* removed MsgConsumerAddition

* added CLI commands for new messages

* removed consumer modification proposal

* removed (partially) consumer removal proposal

* rebased to pick up the inactive-validators work (PR #2079)

* introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId)

* added safeguard so that a validator cannot opt-in to two different chains with the same chain id

* renamed some chainIDs to consumerIds

* updated based on comments

Co-authored-by: bernd-m <[email protected]>

* fixed integration tests

* rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize

* changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible

* cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes

* fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional

* fixed hooks and the code around proposalId to consumerId

* feat: extend consumer validator query to return commission rate (backport #2162) (#2165)

* adapt #2162 changes for permissionless ICS

* nits

---------

Co-authored-by: kirdatatjana <[email protected]>

* renamed some chainIds to consumerIds

* took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.)

* Update x/ccv/provider/types/msg.go

Co-authored-by: bernd-m <[email protected]>

* removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer

* added PopulateMinimumPowerInTopN tested

* took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals)

* feat: add fields to consumer validators query (#2167)

* extend consumer validators query

* nit

* nits

* fix msg order

* deprecate power for consumer_power

* modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds

* fixed some rebase issues and changed a proto to be backward-compatible

---------

Co-authored-by: bernd-m <[email protected]>
Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* fixed bug on removing previous spawn time & added tests

* added some additional tests

* added tests on the hooks

* removed check that spawn time is in the future

* feat: refactor consumer validator set computation (#2175)

* add UT

* nits

* address comments

* Update x/ccv/provider/keeper/partial_set_security.go

Co-authored-by: insumity <[email protected]>

* fix tests

---------

Co-authored-by: insumity <[email protected]>

* fix!: ConsumerModificationProposal is needed in Gaia upgrade handler (#2176)

ConsumerModificationProposal is needed in Gaia upgrade handler

* fix: allow the owner of a chain to remove the chain (#2178)

fixed access in RemoveConsumer

* refactor: add proto enum for ConsumerPhase (#2182)

* feat: extend `consumer_validators` query to return consumer valset before launch (#2164)

* (partially) renamed chain ids to consumer ids

* renamed proposal messages

* removed global slash entry

* fixed unit tests

* added new messages

* introduced new state

* added functionality for the register and initialize messages

* renamed (partially) chainIds to consumerIds

* set consumerId to chainId association during registration

* added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize

* added initial work on traversing initialized chains that are to-be-launched

* fixed rebase issues after bringing the VSCMaturedPackets work in

* made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass)

* renamed more chainIDs to consumerIds

* removed ClientIdToChainId state because chainId already resides on the registration record

* nit fixes in go docs

* removed MsgConsumerAddition

* added CLI commands for new messages

* removed consumer modification proposal

* removed (partially) consumer removal proposal

* rebased to pick up the inactive-validators work (PR #2079)

* introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId)

* added safeguard so that a validator cannot opt-in to two different chains with the same chain id

* renamed some chainIDs to consumerIds

* updated based on comments

Co-authored-by: bernd-m <[email protected]>

* fixed integration tests

* rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize

* changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible

* cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes

* fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional

* fixed hooks and the code around proposalId to consumerId

* pre-spawn query

* rebase

* nits

* feat: extend consumer validator query to return commission rate (backport #2162) (#2165)

* adapt #2162 changes for permissionless ICS

* nits

---------

Co-authored-by: kirdatatjana <[email protected]>

* remove panics

* renamed some chainIds to consumerIds

* took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.)

* Update x/ccv/provider/types/msg.go

Co-authored-by: bernd-m <[email protected]>

* removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer

* added PopulateMinimumPowerInTopN tested

* took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals)

* update logic

* took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals)

* feat: add fields to consumer validators query (#2167)

* extend consumer validators query

* nit

* nits

* fix msg order

* deprecate power for consumer_power

* nits

* feat: first iteration on Permissionless ICS (#2117)

* (partially) renamed chain ids to consumer ids

* renamed proposal messages

* removed global slash entry

* fixed unit tests

* added new messages

* introduced new state

* added functionality for the register and initialize messages

* renamed (partially) chainIds to consumerIds

* set consumerId to chainId association during registration

* added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize

* added initial work on traversing initialized chains that are to-be-launched

* fixed rebase issues after bringing the VSCMaturedPackets work in

* made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass)

* renamed more chainIDs to consumerIds

* removed ClientIdToChainId state because chainId already resides on the registration record

* nit fixes in go docs

* removed MsgConsumerAddition

* added CLI commands for new messages

* removed consumer modification proposal

* removed (partially) consumer removal proposal

* rebased to pick up the inactive-validators work (PR #2079)

* introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId)

* added safeguard so that a validator cannot opt-in to two different chains with the same chain id

* renamed some chainIDs to consumerIds

* updated based on comments

Co-authored-by: bernd-m <[email protected]>

* fixed integration tests

* rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize

* changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible

* cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes

* fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional

* fixed hooks and the code around proposalId to consumerId

* feat: extend consumer validator query to return commission rate (backport #2162) (#2165)

* adapt #2162 changes for permissionless ICS

* nits

---------

Co-authored-by: kirdatatjana <[email protected]>

* renamed some chainIds to consumerIds

* took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.)

* Update x/ccv/provider/types/msg.go

Co-authored-by: bernd-m <[email protected]>

* removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer

* added PopulateMinimumPowerInTopN tested

* took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals)

* feat: add fields to consumer validators query (#2167)

* extend consumer validators query

* nit

* nits

* fix msg order

* deprecate power for consumer_power

* modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds

* fixed some rebase issues and changed a proto to be backward-compatible

---------

Co-authored-by: bernd-m <[email protected]>
Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* cover stopped phase case

* fixed bug on removing previous spawn time & added tests

* added some additional tests

* added tests on the hooks

* removed check that spawn time is in the future

* feat: refactor consumer validator set computation (#2175)

* add UT

* nits

* address comments

* Update x/ccv/provider/keeper/partial_set_security.go

Co-authored-by: insumity <[email protected]>

* fix tests

---------

Co-authored-by: insumity <[email protected]>

* nit

* nits

* nit

---------

Co-authored-by: insumity <[email protected]>
Co-authored-by: bernd-m <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* fix build

* tests: fix integration test setup (#2183)

* fix integration test setup

* fix integration tests

* feat: add consumer chain query (#2179)

* feat: first iteration on Permissionless ICS (#2117)

* (partially) renamed chain ids to consumer ids

* renamed proposal messages

* removed global slash entry

* fixed unit tests

* added new messages

* introduced new state

* added functionality for the register and initialize messages

* renamed (partially) chainIds to consumerIds

* set consumerId to chainId association during registration

* added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize

* added initial work on traversing initialized chains that are to-be-launched

* fixed rebase issues after bringing the VSCMaturedPackets work in

* made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass)

* renamed more chainIDs to consumerIds

* removed ClientIdToChainId state because chainId already resides on the registration record

* nit fixes in go docs

* removed MsgConsumerAddition

* added CLI commands for new messages

* removed consumer modification proposal

* removed (partially) consumer removal proposal

* rebased to pick up the inactive-validators work (PR #2079)

* introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId)

* added safeguard so that a validator cannot opt-in to two different chains with the same chain id

* renamed some chainIDs to consumerIds

* updated based on comments

Co-authored-by: bernd-m <[email protected]>

* fixed integration tests

* rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize

* changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible

* cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes

* fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional

* fixed hooks and the code around proposalId to consumerId

* feat: extend consumer validator query to return commission rate (backport #2162) (#2165)

* adapt #2162 changes for permissionless ICS

* nits

---------

Co-authored-by: kirdatatjana <[email protected]>

* renamed some chainIds to consumerIds

* took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.)

* Update x/ccv/provider/types/msg.go

Co-authored-by: bernd-m <[email protected]>

* removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer

* added PopulateMinimumPowerInTopN tested

* took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals)

* feat: add fields to consumer validators query (#2167)

* extend consumer validators query

* nit

* nits

* fix msg order

* deprecate power for consumer_power

* modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds

* fixed some rebase issues and changed a proto to be backward-compatible

---------

Co-authored-by: bernd-m <[email protected]>
Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* fixed bug on removing previous spawn time & added tests

* added some additional tests

* added tests on the hooks

* removed check that spawn time is in the future

* feat: refactor consumer validator set computation (#2175)

* add UT

* nits

* address comments

* Update x/ccv/provider/keeper/partial_set_security.go

Co-authored-by: insumity <[email protected]>

* fix tests

---------

Co-authored-by: insumity <[email protected]>

* add UT

* nits

* nits

* revert legacy prop funcs

* fix UT

---------

Co-authored-by: insumity <[email protected]>
Co-authored-by: bernd-m <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* feat: extend consumer chains query (#2172)

* feat: first iteration on Permissionless ICS (#2117)

* (partially) renamed chain ids to consumer ids

* renamed proposal messages

* removed global slash entry

* fixed unit tests

* added new messages

* introduced new state

* added functionality for the register and initialize messages

* renamed (partially) chainIds to consumerIds

* set consumerId to chainId association during registration

* added extra check in the initialization so unknokwn, launched, or stopped chains cannot re-initialize

* added initial work on traversing initialized chains that are to-be-launched

* fixed rebase issues after bringing the VSCMaturedPackets work in

* made it so we traverse initialization records instead of addition proposals (+ additional changes so the unit tests pass)

* renamed more chainIDs to consumerIds

* removed ClientIdToChainId state because chainId already resides on the registration record

* nit fixes in go docs

* removed MsgConsumerAddition

* added CLI commands for new messages

* removed consumer modification proposal

* removed (partially) consumer removal proposal

* rebased to pick up the inactive-validators work (PR #2079)

* introduced consumerId in the equivocation messages (and a useful query for Hermes to get the consumerId)

* added safeguard so that a validator cannot opt-in to two different chains with the same chain id

* renamed some chainIDs to consumerIds

* updated based on comments

Co-authored-by: bernd-m <[email protected]>

* fixed integration tests

* rebased to pick up the removal of legacy proposals (#2130) and re-introduced old messages so that existing proposals can deserialize

* changes messages to only have MsgCreateConsumer and MsgUpdateConsumer and modified protos so that we are backward-compatible

* cleaned up slightly a few things (mostly committing & pushing) so people can pick up the latest changes

* fixed the CreateConsumer and UpdateConsumer logic and made most of the fields optional

* fixed hooks and the code around proposalId to consumerId

* feat: extend consumer validator query to return commission rate (backport #2162) (#2165)

* adapt #2162 changes for permissionless ICS

* nits

---------

Co-authored-by: kirdatatjana <[email protected]>

* renamed some chainIds to consumerIds

* took into account comments and also added safeguard to reject new proposals that still use deprecated messages (e.g., MsgConsumerAddition, etc.)

* Update x/ccv/provider/types/msg.go

Co-authored-by: bernd-m <[email protected]>

* removed double-gas charge on MsgCreateConsumer and imroved the logic of MsgUpdateConsumer

* added PopulateMinimumPowerInTopN tested

* took into account comments (using protos for marshalling string slice, fixed issues in the UpdateConsumer logic, added extra check to abort spurious proposals)

* feat: add fields to consumer validators query (#2167)

* extend consumer validators query

* nit

* nits

* fix msg order

* deprecate power for consumer_power

* modified the way we verify the new owner address, as well as nit refactoring on the ConsumerIds

* fixed some rebase issues and changed a proto to be backward-compatible

---------

Co-authored-by: bernd-m <[email protected]>
Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* add phase + metadata

* first logic draft

* add filter

* reformat test

* nits

* nit

* address comments

* update tests

* nits

* update logic

* update CLI

* revert unwanted changes

* remove filter field

* nit

* fix bad int conversion

* update cli

---------

Co-authored-by: insumity <[email protected]>
Co-authored-by: bernd-m <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>

* feat!: migrations for permissionless  (#2174)

* migrations for permissionless -- wip

* feat!: migrations for permissionless (#2177)

* initial commit

* took into account comments

* removed deprecated queries

* fix error due to rebase

* remove fields from provider genesis

* remove commented code

---------

Co-authored-by: insumity <[email protected]>

* feat: update `consumer_chains` REST endpoint (#2188)

update consumer chains REST endpoint

* fix: permissionless added event + cli changes (#2185)

* add consumer registration event

* fix some queries, CLI and permissionless logic

* cli changes

* addressed review comments

* fix!: several permissionless changes (#2189)

* minor fixes in tests

* replace IsConsumerProposedOrRegistered with IsConsumerActive

* remove param from createStakingValidator

* handle error in GetTopN

* remove aux methods for getting PowerShapingParameters

* remove default PowerShapingParameters

* fix tests

* handle error messages

* fix: fix consumer chain query CLI (#2190)

* fix consumer chains query cli

* add consumer-chain cli command

* fix consumer chains cli bug

* fix!: fix store.set nil values (#2193)

fix store.set nil values

* fix!: msgs validation (#2195)

* add testing for ValidateStringField

* ValidateInitializationParameters

* ValidatePowerShapingParameters

* validate NewOwnerAddress

* apply review suggestions

* fix: fix queries' API REST endpoint path (#2196)

* clean uw files

* doc

* Revert "doc"

This reverts commit efc2718.

* Revert "clean uw files"

This reverts commit 5773cf3.

* remove deprecated REST endpoints

* update REST endpoint

* fix broken UT by previous PR (#2195)

* fix: permissionless query (#2191)

* fix implementation

* addressed comments

* cleanup

* keep metadata and powershaping data for stopped consumer chains

* addressed comments

* adapt unit-tests

* refactor: mostly refactors  (#2194)

* handle errors

* set the reverse index in SetConsumerClientId

* rename method

* create consumer_lifecycle.go with launch/stop logic

* move methods around

* move methods around

* handle ChangeRewardDenoms

* add TODOs

* remove proposal_test

* remove todos

* apply review suggestions

* apply review suggestions

* fix UTs

* fix!: provider msg validation (#2197)

* validate MsgAssignConsumerKey

* validate MsgSubmitConsumerMisbehaviour and MsgSubmitConsumerDoubleVoting

* move RemoveConsumer

* refactor: rearrange messages in msg.go

* validate MsgOptIn and MsgOptOut

* validate MsgSetConsumerCommissionRate

* remove ValidateBasic for deprecated msgs

* remove deprecated GetSigners

* remove deprecated GetSignBytes

* remove deprecated govv1beta1 validation

* remove Route and Type

* Update x/ccv/provider/keeper/msg_server.go

Co-authored-by: insumity <[email protected]>

* apply review suggestions

* apply review suggestions

---------

Co-authored-by: insumity <[email protected]>

* test: fix e2e tests + PSS e2e tests use permissionless (#2192)

Fix e2e tests + make PSS e2e tests use Permissionless ICS

* refactor: power shaping (#2207)

* update allowlist and denylist power shaping update

* fix tests

* refactor: move power shaping params to power_shaping.go

* rename record to parameters

* fix merge conflicts

* feat: fix queries (#2209)

* remove chain ID from all-pairs-valconsensus-address

* add consumer_id to Chain

* add GetAllLaunchedConsumerIds

* fix UT

* apply review suggestions

* fix!: remove `stopTime` from `MsgRemoveConsumer` (#2208)

* init commit

* renamed stop time to removal time

* fix errors in tests

* add GetAllConsumerWithIBCClients

* use GetAllConsumerWithIBCClients for efficiency

* fix UTs

* remove GetAllLaunchedConsumerIds as not needed

* typo in GetAllConsumersWithIBCClients

* improve comment

* Apply suggestions from code review

Co-authored-by: Marius Poke <[email protected]>

* took into account comments

---------

Co-authored-by: mpoke <[email protected]>

* feat: remove provider migration for CV 3 to 6 (#2211)

* remove migrations to CV < 7

* add changelog entry

* fix version name

* fix!: fix migration issue (#2214)

* init commit

* took into account comments

* fix!: register `ConsumerModificationProposal` and others (#2215)

init commit

* fix: fix misbehaviour and equivocation evidence CLI commands (#2213)

* silent errors in MBT driver

* fix misbehaviour and double-signing CLI cmds + few nits

* revert changes

* nit: remove type prefix from consumer phase enum (#2220)

remove type prefix in consumer phase enum

* refactor: stop using signer field in messages (#2219)

* remove error check

* stop using signer field in messages

* expand TODO comment

* replace signer with submitter

* fix UTs

* chore: update TX CLI help (#2222)

* update CLI help

* apply review suggestions

* feat!: add events for provider messages (#2221)

* add events for CreateConsumer

* add events for UpdateConsumer

* add events for RemoveConsumer

* add events for the rest of the messages

* apply review suggestions

* Id instead of ID

* fix events

* fix UT

* remove duplicate AttributeSubmitterAddress

* fix: fix queries' API endpoints (#2226)

* endpoint fixes

* Update proto/interchain_security/ccv/provider/v1/query.proto

Co-authored-by: MSalopek <[email protected]>

* Update proto/interchain_security/ccv/provider/v1/query.proto

Co-authored-by: MSalopek <[email protected]>

* generate proto

---------

Co-authored-by: MSalopek <[email protected]>

* fix!: replace CanLaunch with InitializeConsumer (#2224)

replace CanLaunch with InitializeConsumer

* fix: improve commands' description (#2227)

init commit

---------

Co-authored-by: insumity <[email protected]>
Co-authored-by: bernd-m <[email protected]>
Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: kirdatatjana <[email protected]>
Co-authored-by: MSalopek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants