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

refactor(x/signal): reset all versions via ResetTally #3277

Merged
merged 12 commits into from
Apr 16, 2024

Conversation

rootulp
Copy link
Collaborator

@rootulp rootulp commented Apr 8, 2024

Closes #3276

@rootulp
Copy link
Collaborator Author

rootulp commented Apr 11, 2024

Keeping in draft for now. I plan on rebasing after #3290 merges.

@cmwaters
Copy link
Contributor

cmwaters commented Apr 11, 2024

I discovered one more follow-up while working on this. It doesn't look like ResetTally is actually invoked anywhere when I think it should be invoked here.

This makes sense to me. I probably intended it to be there but forgot so good find

@rootulp rootulp changed the title refactor(x/upgrade): reset all versions via ResetTally refactor(x/signal): reset all versions via ResetTally Apr 11, 2024
@rootulp rootulp marked this pull request as ready for review April 11, 2024 17:37
@rootulp rootulp requested a review from a team as a code owner April 11, 2024 17:37
@rootulp rootulp requested review from ramin and rach-id and removed request for a team April 11, 2024 17:37
Copy link
Contributor

coderabbitai bot commented Apr 11, 2024

Walkthrough

The recent changes involve updating the ResetTally function within the signal module to delete all versions in the store, rather than just those less than a current version, and adjusting its usage in the Upgrade method of the App struct. Additionally, the associated unit tests have been updated to align with this new logic, including the addition of a new test to explicitly verify the reset functionality.

Changes

File Changes
app/app.go, x/signal/keeper.go Added a call to ResetTally in the Upgrade method; modified ResetTally to delete all versions from the store and updated its signature.
x/signal/keeper_test.go Removed the version parameter from ResetTally in tests; added a new test TestResetTally to verify the reset of voting power to zero.
specs/src/README.md, specs/src/specs/state_machine_modules.md Replaced references to the upgrade module with the signal module.
.github/workflows/lint.yml Added a new configuration skip-pkg-cache: true to the linting job in the GitHub Actions workflow.

Assessment against linked issues

Objective Addressed Explanation
Move some unit tests from tally_test.go to keeper_test.go [#3276] It is unclear if tests were moved from tally_test.go to keeper_test.go as the summary does not mention moving existing tests, only modifying and adding tests in keeper_test.go.
Update ResetTally to delete all versions in the map instead of only those less than the current version [#3276]

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:

Note: Auto-reply has been disabled for this repository by the repository owner. 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.

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 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.
  • 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.

@rootulp rootulp requested review from cmwaters and ninabarbakadze and removed request for ramin and rach-id April 12, 2024 01:10
@rootulp rootulp requested a review from liamsi as a code owner April 12, 2024 01:12
@celestia-bot celestia-bot requested a review from a team April 12, 2024 01:12
cmwaters
cmwaters previously approved these changes Apr 12, 2024
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

LGTM

The only edge case against doing this is imagine we release v2 and shortly after v3 (before the network has upgraded to v2). Some nodes upgrade to v2 and signal v2. Some upgrade to v3 and signal v3. v2 eventually receives quorum and the upgrade happens. Now the nodes who signalled v3 have had their "votes" wiped and so they must revote if they want to move to v3

Comment on lines 20 to 26
// The purpose of this wrapper is to enable the passing of an additional paramKeeper parameter in
// ante.NewDeductFeeDecorator whilst still satisfying the ante.TxFeeChecker type.
func ValidateTxFeeWrapper(paramKeeper params.Keeper) ante.TxFeeChecker {
return func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
return ValidateTxFee(ctx, tx, paramKeeper)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@rootulp
Copy link
Collaborator Author

rootulp commented Apr 12, 2024

I thought about that edge case and I don't think it's possible because these lines. In other words, when the app version is 1, the nodes that try to signal for 3 will hit an ErrInvalidVersion because they are signaling for a version too far in advance.

Update: I actually confirmed this in a unit test while working on this PR.

evan-forbes
evan-forbes previously approved these changes Apr 12, 2024
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

LGTM

@cmwaters
Copy link
Contributor

I thought about that edge case and I don't think it's possible because these lines. In other words, when the app version is 1, the nodes that try to signal for 3 will hit an ErrInvalidVersion because they are signaling for a version too far in advance.

Makes sense. I always wasn't sure whether we should allow skip versions or not

@rootulp
Copy link
Collaborator Author

rootulp commented Apr 12, 2024

I'm not sure why golangci-lint is failing on prepare environment. Error looks unrelated to this PR.

@rootulp
Copy link
Collaborator Author

rootulp commented Apr 12, 2024

I think we can try skipping the pkg cache

@rootulp rootulp dismissed stale reviews from evan-forbes and cmwaters via b7a5491 April 12, 2024 18:45
@celestia-bot celestia-bot requested a review from a team April 12, 2024 18:45
@celestia-bot celestia-bot requested a review from a team April 12, 2024 18:49
evan-forbes
evan-forbes previously approved these changes Apr 15, 2024
@celestia-bot celestia-bot requested a review from a team April 15, 2024 14:59
@celestia-bot celestia-bot requested review from rach-id and removed request for a team April 15, 2024 14:59
@rootulp rootulp removed the request for review from rach-id April 15, 2024 14:59
@rootulp rootulp requested review from ninabarbakadze and removed request for evan-forbes April 15, 2024 19:54
Copy link
Member

@ninabarbakadze ninabarbakadze left a comment

Choose a reason for hiding this comment

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

sorry for the delay. lgtm

@rootulp rootulp merged commit 541ddf1 into celestiaorg:main Apr 16, 2024
34 checks passed
@rootulp rootulp deleted the rp/upgrade-flups branch April 16, 2024 15:19
ninabarbakadze pushed a commit to ninabarbakadze/celestia-app that referenced this pull request Apr 17, 2024
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.

x/signal: follow-ups from docs
4 participants