cosmos / interchain-security

Interchain Security is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another.
https://cosmos.github.io/interchain-security/
Other
154 stars 115 forks source link

chore!: Add last PSS changes #1941

Closed sainoe closed 3 months ago

sainoe commented 4 months ago

Please go to the Preview tab and select the appropriate sub-template:

Summary by CodeRabbit

coderabbitai[bot] commented 4 months ago
Walkthrough ## Walkthrough The recent changes encompass a variety of updates including bug fixes, dependency upgrades, and new feature implementations. Key highlights include addressing audit suggestions, updating Docker and buf-setup-action versions, introducing a new ADR for inactive validators, and enhancing error handling and token allocation logic in the provider module. Additionally, new governance proposal messages and methods were added to facilitate consumer chain modifications. ## Changes | File(s) | Change Summary | |---------|----------------| | `.changelog/unreleased/bug-fixes/provider/1925-apply-audit-suggestions.md`, `.changelog/unreleased/state-breaking/provider/1925-apply-audit-suggestions.md` | Introduced changes to apply audit suggestions, focusing on a bug fix related to computing the maximum capped power. | | `.changelog/unreleased/dependencies/1924-bump-ibc.md` | Updated dependency by bumping `ibc-go` to version `v7.5.1`. | | `.github/workflows/docker-publish.yml` | Updated Docker login action version from `v3.1.0` to `v3.2.0`. | | `.github/workflows/proto-registry.yml`, `.github/workflows/proto.yml` | Updated `buf-setup-action` version from `v1.32.0` to `v1.32.2`. | | `docs/docs/adrs/adr-017-allowing-inactive-validators.md`, `docs/docs/adrs/intro.md` | Introduced ADR 017, proposing changes to allow inactive validators to validate on consumer chains. | | `docs/docs/features/power-shaping.md` | Introduced a mechanism to cap the size of the validator set on a consumer chain. | | `docs/figures/inactivevals_after.excalidraw`, `docs/figures/inactivevals_before.excalidraw` | Added Excalidraw diagrams depicting validator states before and after changes. | | `proto/interchain_security/ccv/provider/v1/provider.proto` | Added `ConsumerModificationProposal` message for governance proposals on the provider chain. | | `proto/interchain_security/ccv/provider/v1/tx.proto` | Introduced new RPC method `ConsumerModification` and message type `MsgConsumerModification`. | | `tests/e2e/steps_partial_set_security.go` | Adjusted validator powers for different chains to adhere to power caps. | | `x/ccv/provider/keeper/proposal_handler.go` | Added a case for `ConsumerModificationProposal` in `NewProviderProposalHandler` function. | | `x/ccv/provider/types/codec.go` | Registered `ConsumerModificationProposal` in `RegisterInterfaces` function. | | `x/ccv/provider/types/errors.go` | Added new error declarations and renumbered subsequent errors. | | `x/ccv/provider/keeper/legacy_proposal_test.go` | Added test scenarios for handling consumer modification proposals. | | `x/ccv/provider/keeper/consumer_equivocation.go` | Updated error handling in `JailAndTombstoneValidator` function. | | `x/ccv/provider/keeper/distribution.go` | Enhanced token allocation logic and error handling in `AllocateTokensToConsumerValidators`. | | `x/ccv/provider/keeper/relay.go` | Updated logic for opting in validators in a Top-N chain and improved error handling in `QueueVSCPackets` method. | ## Sequence Diagram(s) (Beta) ```mermaid sequenceDiagram participant Provider participant Consumer participant Governance Governance->>Provider: Submit ConsumerModificationProposal Provider->>Provider: Validate Proposal Provider-->>Governance: Proposal Accepted Governance->>Consumer: Notify Consumer Chain Consumer-->>Provider: Acknowledge Changes Provider->>Provider: Update Validator Set Provider-->>Consumer: Apply Validator Set Changes Consumer-->>Governance: Confirm Changes Applied ```

Recent review details **Configuration used: .coderabbit.yml** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 5231874e448cd22a1a0ccb4605e672a427195191 and db6b9e1f42c9c46332979ee88e8d55eb58e4ec74.
Files selected for processing (3) * x/ccv/provider/keeper/consumer_equivocation.go (1 hunks) * x/ccv/provider/keeper/distribution.go (7 hunks) * x/ccv/provider/keeper/relay.go (2 hunks)
Files skipped from review as they are similar to previous changes (1) * x/ccv/provider/keeper/relay.go
Additional context used
Path-based instructions (2)
x/ccv/provider/keeper/distribution.go (1) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
x/ccv/provider/keeper/consumer_equivocation.go (1) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (5)
x/ccv/provider/keeper/distribution.go (4)
`101-108`: Improve error handling by continuing after logging errors instead of returning immediately. This change enhances the robustness of the token allocation process by ensuring that one failure does not halt the distribution for all chains. Also applies to: 137-145 --- `190-199`: Enhance error resilience by continuing after logging errors in token allocation to validators. This change improves the error handling by ensuring that failures in token allocation to one validator do not stop the process for others. --- `222-229`: Properly handle remaining decimal rewards after truncation. This update ensures that the consumer rewards allocation is accurately updated with the remaining decimal coins after sending the integer part to the distribution module. --- Line range hint `370-390`: Enhance error handling and robustness in the jailing and tombstoning process. The updates to this function improve its reliability by handling various error conditions more effectively and ensuring that validators are properly managed.
x/ccv/provider/keeper/consumer_equivocation.go (1)
`370-390`: Strengthen error handling and process clarity in the jailing and tombstoning of validators. This update improves the security and reliability of the system by ensuring that validators are properly managed and that errors are handled more effectively.
--- 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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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 as 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. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
mergify[bot] commented 4 months ago

⚠️ The sha of the head commit of this PR conflicts with #1928. Mergify cannot evaluate rules on this PR. ⚠️

sainoe commented 4 months ago

Gosec fails due to some low severity issues. All are unhandled errors and most of them are located in the genesis export. I think it's OK to neglect them atm.