celestiaorg / celestia-app

Celestia consensus node
https://celestiaorg.github.io/celestia-app/
Apache License 2.0
341 stars 279 forks source link

feat!: add a delay between quorum and upgrade height #3560

Closed rootulp closed 3 months ago

rootulp commented 3 months ago

Closes https://github.com/celestiaorg/celestia-app/issues/3552

Testing

Manually tested the new CLI commands by staring single node script and then:

$ celestia-appd query signal upgrade
no upgrade is pending.

$ celestia-appd tx signal signal 3 --from $VALIDATOR --fees $DEFAULT_FEES --broadcast-mode $BROADCAST_MODE --yes

$ celestia-appd tx signal try-upgrade  --from $VALIDATOR --fees $DEFAULT_FEES --broadcast-mode $BROADCAST_MODE --yes

$ celestia-appd query signal upgrade
upgrade is pending to app version 3 at height 151345.
coderabbitai[bot] commented 3 months ago
Walkthrough ## Walkthrough The recent changes introduce a delay mechanism for network upgrades and enhancements to the signal module. Key improvements include adding context-based conditional checks for version upgrading, integrating new query methods, and providing better error handling and unit test coverage to ensure robust upgrade processing. ## Changes | File | Change Summary | |---------------------------------------------|-------------------------------------------------------------------------------------------------| | app/app.go | Modified `EndBlocker` to include a context parameter `ctx` in the `ShouldUpgrade` call. | | app/module/configurator_test.go | Updated `TestConfigurator` to pass `config.Codec` to `signal.NewKeeper`. | | proto/celestia/signal/v1/query.proto | Added import for `upgrade.proto`, new RPC method `GetUpgrade`, and related message types. | | proto/celestia/signal/v1/upgrade.proto | Defined `Upgrade` message with `app_version` and `upgrade_height` fields. | | x/signal/cli/cli_test.go | Added `TestCmdGetUpgrade` to test the new `CmdGetUpgrade` function. | | x/signal/cli/query.go | Introduced `CmdGetUpgrade` command in `GetQueryCmd` function. | | x/signal/integration_test.go | Enhanced `TestUpgradeIntegration` with additional upgrade checks and validation logic. | | x/signal/keeper.go | Added `DefaultUpgradeHeightDelay`, new methods for managing upgrades, and updated `TryUpgrade`. | | x/signal/keeper_test.go | Enhanced tests for upgrade scenarios, added imports, and updated function calls in test cases. | | x/signal/types/errors.go | Introduced `ErrUpgradePending` and `ErrInvalidUpgradeVersion` errors. | | x/signal/types/keys.go | Added `UpgradeKey` and `FirstSignalKey` for managing upgrade information in the signal store. | ## Sequence Diagram ```mermaid sequenceDiagram participant User participant SignalModule participant UpgradeScheduler User->>SignalModule: MsgTryUpgrade SignalModule->>UpgradeScheduler: Validate Upgrade UpgradeScheduler-->>SignalModule: Schedule Upgrade (with delay) SignalModule-->>User: Acknowledge Upgrade ``` ## Assessment against linked issues | Objective | Addressed | Explanation | |----------------------------------------------------------------------------------------|-----------|-------------------| | Add a delay between `MsgTryUpgrade` and upgrade height (#3552) | ✅ | | | Ensure signals and future cranks are no-ops during upgrade delay period (#3552) | ✅ | | | Ensure proper error handling for invalid upgrade variations (#3552) | ✅ | |

Recent review details **Configuration used: .coderabbit.yaml** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 9184493bef077757c99dfe366f4ae718bafe35e9 and 8e9c37d86a8c5efd3522f4298d3802c124e3c4a2.
Files selected for processing (2) * x/signal/keeper_test.go (11 hunks) * x/signal/types/keys.go (1 hunks)
Files skipped from review as they are similar to previous changes (2) * x/signal/keeper_test.go * x/signal/types/keys.go
--- 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): > :bangbang: **IMPORTANT** > Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged. - 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.