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

Problem: don't support hardfork style upgrades #1258

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Dec 14, 2023

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features

    • Support for hard-fork style upgrades has been introduced.
    • New upgrade logic implemented to handle chain upgrades seamlessly.
  • Documentation

    • Updated CHANGELOG to reflect the new upgrade support feature.
  • Bug Fixes

    • Ensured that the app's begin block logic now includes fork upgrade checks and executions.

@yihuang yihuang requested a review from a team as a code owner December 14, 2023 08:17
@yihuang yihuang requested review from JayT106 and leejw51crypto and removed request for a team December 14, 2023 08:17
Copy link
Contributor

coderabbitai bot commented Dec 14, 2023

Warning

Rate Limit Exceeded

@yihuang has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 14 minutes and 58 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. 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 6bb630b and 54809f7.

Walkthrough

The software has been updated to include support for hard-fork style upgrades. A new variable for storing fork information and a function for initiating fork logic during the block beginning phase have been added. These allow the application to seamlessly transition through upgrades at specified blockchain heights.

Changes

File(s) Summary of Changes
CHANGELOG.md Added support for hard-fork style upgrades in the unreleased version.
app/app.go Introduced Forks variable and updated BeginBlocker function to call BeginBlockForks.
app/forks.go Created new file with Fork struct definition and BeginBlockForks function to handle chain upgrades.

🐇✨
In the realm of code, we hop and leap,
With forks in hand, the blockchain we sweep.
Upgrades await, on heights they perch,
A seamless jump, for our tech to surge. 🚀🌟

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 X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 29cdd9d and 1d9709e.
Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • app/app.go (2 hunks)
  • app/forks.go (1 hunks)
Additional comments: 7
CHANGELOG.md (1)
  • 3-5: The CHANGELOG.md correctly documents the addition of support for hard-fork style upgrades as an unreleased feature, which aligns with the PR objectives and the AI-generated summaries.
app/app.go (3)
  • 175-178: The addition of the Forks variable is consistent with the PR's objective to handle hardfork-style upgrades. Ensure that the Fork struct and its usage are properly documented for maintainability.

  • 987-989: The call to BeginBlockForks within the BeginBlocker function is a critical part of the upgrade mechanism. It's important to ensure that BeginBlockForks is robust, handles errors gracefully, and does not negatively impact the performance of block processing.

#!/bin/bash
# Verify that BeginBlockForks function exists and is properly defined in forks.go
ast-grep --lang go --pattern $'func BeginBlockForks($_, $_) $_ { $$$ }'
  • 175-182: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [175-991]

Overall, the changes to app.go align with the PR's objectives to handle hardfork-style upgrades. It is crucial to ensure that the new Fork struct and the BeginBlockForks function are thoroughly tested, especially since they are part of the blockchain's consensus-critical code.

app/forks.go (3)
  • 5-20: The Fork struct is well-documented and contains clear fields for upgrade management. The reference to the Osmosis project provides context for the adaptation, which is good for maintainability.

  • 22-30: The BeginBlockForks function assumes that there will only be one fork per block height. If the system is intended to support multiple forks at the same height, this could be a limitation. Please confirm if this is by design.

  • 22-30: The Forks variable is used within BeginBlockForks but its definition and initialization are not shown. Ensure that Forks is properly defined and initialized elsewhere in the codebase.

#!/bin/bash
# Search for the definition and initialization of the `Forks` variable.
rg 'var Forks \[\]Fork'

app/forks.go Outdated Show resolved Hide resolved
app/forks.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: yihuang <[email protected]>
@yihuang yihuang requested a review from mmsqe December 14, 2023 08:20
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1d9709e and 6bb630b.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Merging #1258 (54809f7) into main (29cdd9d) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1258      +/-   ##
==========================================
- Coverage   35.83%   35.81%   -0.03%     
==========================================
  Files         115      116       +1     
  Lines       10647    10653       +6     
==========================================
  Hits         3815     3815              
- Misses       6456     6462       +6     
  Partials      376      376              
Files Coverage Δ
app/forks.go 0.00% <0.00%> (ø)

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