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

add rollback cmd #62

Merged
merged 5 commits into from
Sep 20, 2024
Merged

add rollback cmd #62

merged 5 commits into from
Sep 20, 2024

Conversation

sh-cha
Copy link
Contributor

@sh-cha sh-cha commented Sep 13, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a rollback command for reverting the state of the Cosmos SDK and CometBFT to a specified block height, enhancing error recovery.
    • Added functionality for multiple rollbacks in the command-line interface, improving user control and interaction.
  • Chores

    • Updated the LIBMOVEVM library version to v0.4.9 for potential enhancements and improvements.
    • Updated various dependencies in the project to incorporate bug fixes and new features.

@sh-cha sh-cha self-assigned this Sep 13, 2024
@sh-cha sh-cha requested a review from a team as a code owner September 13, 2024 05:31
Copy link

coderabbitai bot commented Sep 13, 2024

Warning

Rate limit exceeded

@beer-1 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 7 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 84cb76c and fadaa1f.

Walkthrough

The changes introduce a new command in the Cosmos SDK and CometBFT environment for rolling back the application state to a specified block height. This rollback feature is implemented in a new file and integrated into the command-line interface, enhancing user control over application states. Additionally, the go.mod file has been updated to redirect module dependencies to local paths for development purposes, and the Dockerfile has been modified to upgrade the LIBMOVEVM library version.

Changes

File(s) Change Summary
cmd/minitiad/rollback.go Added a new command mrollback for rolling back the application state to a specified block height.
cmd/minitiad/root.go Integrated the NewMultipleRollbackCmd into the root command for enhanced command-line functionality.
Dockerfile Updated LIBMOVEVM version from v0.4.5 to v0.4.9.
go.mod Updated replace directives to redirect module paths for cometbft and OPinit to local versions and updated several dependency versions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant App
    participant DB
    participant CometBFT

    User->>CLI: Execute mrollback <target_height>
    CLI->>App: Retrieve server context
    CLI->>DB: Connect to database
    CLI->>App: Create application instance
    CLI->>CometBFT: RollbackMultipleState
    CometBFT-->>CLI: Rollback successful
    CLI->>DB: RollbackToVersion <target_height>
    DB-->>CLI: Confirm new height and hash
    CLI-->>User: Output confirmation
Loading

🐇 "In the world of code so bright,
A rollback command takes flight.
With heights to choose, we leap and bound,
Stability in state, joy all around!
Hopping through errors, we find our way,
A happy coder's bright new day!" 🐇


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>, please review it.
    -- 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @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.

CodeRabbit Configuration 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 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 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.

Copy link

@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: 4

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between eafd1d6 and 6657481.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (3)
  • cmd/minitiad/rollback.go (1 hunks)
  • cmd/minitiad/root.go (1 hunks)
  • go.mod (1 hunks)
Additional comments not posted (5)
cmd/minitiad/rollback.go (1)

17-58: LGTM! The rollback command is well-implemented.

The NewMultipleRollbackCmd function is well-structured and follows a clear sequence of steps to perform the rollback operation. It handles errors appropriately and returns informative error messages.

cmd/minitiad/root.go (1)

183-185: LGTM!

The NewMultipleRollbackCmd command is correctly added to the root command, enhancing the functionality of the command-line interface. The command is created using the appropriate application creator function.

go.mod (3)

277-277: Using a local version of cometbft for development.

Redirecting the github.com/cometbft/cometbft dependency to a local path (../cometbft) indicates that the project is using a modified or custom version of cometbft for development or testing purposes. This change can facilitate easier modifications and testing of the cometbft module.


279-279: Using a local version of OPinit for development.

Redirecting the github.com/initia-labs/OPinit dependency to a local path (../opinit) suggests that the project is using a local version of the OPinit module for development or testing purposes. This change can facilitate easier modifications and testing of the OPinit module.


280-280: Using a local version of OPinit/api for development.

Redirecting the github.com/initia-labs/OPinit/api dependency to a local path (../opinit/api) suggests that the project is using a local version of the OPinit/api module for development or testing purposes. This change, along with the previous replace directive for OPinit, indicates that both the main module and its api submodule are being replaced with local versions. Using local versions can facilitate easier modifications and testing of the OPinit and OPinit/api modules.

cmd/minitiad/rollback.go Show resolved Hide resolved
cmd/minitiad/rollback.go Show resolved Hide resolved
cmd/minitiad/rollback.go Show resolved Hide resolved
@initia-labs initia-labs deleted a comment from coderabbitai bot Sep 20, 2024
Copy link
Member

@beer-1 beer-1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.80%. Comparing base (622b897) to head (fadaa1f).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #62      +/-   ##
==========================================
+ Coverage   74.35%   76.80%   +2.45%     
==========================================
  Files          15       14       -1     
  Lines        1470     1410      -60     
==========================================
- Hits         1093     1083      -10     
+ Misses        328      280      -48     
+ Partials       49       47       -2     

@beer-1 beer-1 merged commit 21e2ccf into main Sep 20, 2024
9 checks passed
@beer-1 beer-1 deleted the feat/rollback-cmd branch September 20, 2024 03:24
@coderabbitai coderabbitai bot mentioned this pull request Sep 25, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants