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

Base signalling intent off the most recent claims #1345

Merged
merged 4 commits into from
Mar 26, 2024
Merged

Conversation

joe-bowman
Copy link
Contributor

@joe-bowman joe-bowman commented Mar 26, 2024

1. Summary

Fixes #1344

Use k.ClaimsManagerKeeper.IterateUserClaims instead of k.ClaimsManagerKeeper.IterateLastEpochUserClaims for AggregateIntent function.

2.Type of change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • New Features
    • Improved the processing of user claims within specific zones by updating the method used to iterate over these claims.

Copy link

vercel bot commented Mar 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
quicksilver ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2024 6:55pm

Copy link
Contributor

coderabbitai bot commented Mar 26, 2024

Walkthrough

The changes focus on ensuring that the AggregateDelegatorIntents function within the Keeper utilizes the most recent user claims by switching from IterateLastEpochUserClaims to IterateUserClaims. Additionally, to support this functionality, a new method IterateUserClaims has been added to the ClaimsManagerKeeper interface. This adjustment aims to correct the timing issue where intents were being aggregated using claims from a previous epoch rather than the current, more relevant data.

Changes

File Path Change Summary
x/interchainstaking/keeper/intent.go Updated to use IterateUserClaims for processing current epoch user claims.
x/interchainstaking/types/expected_keepers.go Added IterateUserClaims method to the ClaimsManagerKeeper interface.

Assessment against linked issues

Objective Addressed Explanation
Signalling Intent should use most recent claims (#1344)

Poem

In the realm of code, where logic reigns,
A rabbit hopped, fixing chains.
🐇💻 With every leap, a bug's demise,
In epochs' shift, the truth now lies.

'Neath moon's soft glow, on silicon vast,
Intentions clear, shadows cast.
🌙✨ With code refined, the rabbit's dance,
Ensures the claims, a second chance.

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>.
    • Generate unit-tests 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 tests 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 tests.
    • @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.
  • 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

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 63.48%. Comparing base (5bcc461) to head (1a136ce).
Report is 1 commits behind head on main.

❗ Current head 1a136ce differs from pull request most recent head c6a9138. Consider uploading reports for the commit c6a9138 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1345   +/-   ##
=======================================
  Coverage   63.48%   63.48%           
=======================================
  Files         171      171           
  Lines       11536    11536           
=======================================
  Hits         7324     7324           
  Misses       3469     3469           
  Partials      743      743           
Flag Coverage Δ
unittests 63.48% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
x/interchainstaking/keeper/intent.go 76.76% <0.00%> (ø)

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 e7e4fed and 9a68b17.
Files selected for processing (2)
  • x/interchainstaking/keeper/intent.go (1 hunks)
  • x/interchainstaking/types/expected_keepers.go (1 hunks)
Additional comments: 2
x/interchainstaking/types/expected_keepers.go (1)
  • 50-50: The addition of IterateUserClaims to the ClaimsManagerKeeper interface aligns with the PR objectives to ensure the most recent claims are used in the signaling process. This change is crucial for addressing the issue of outdated data affecting the signaling intent process.
x/interchainstaking/keeper/intent.go (1)
  • 105-105: The change from IterateLastEpochUserClaims to IterateUserClaims in the AggregateDelegatorIntents function is a direct response to the issue described in the PR objectives. It ensures that the most recent claims are used in the signaling process, addressing the problem of outdated data.

Please verify the impact of this change on performance and correctness, especially in scenarios with a large number of claims.

@joe-bowman
Copy link
Contributor Author

This pull request has been deployed to Vercel.

Latest commit: c6a9138
✅ Preview: https://pr-1345.app-dev.quicksilver.zone
🔍 Inspect: https://vercel.com/quicksilver/quicksilver/46JxyMnEmVdCtS4Ey5ye4ZnccYAv

View Workflow Logs

Copy link
Contributor

@faddat faddat left a comment

Choose a reason for hiding this comment

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

makes perfect sense

@faddat faddat merged commit 80e186c into main Mar 26, 2024
23 checks passed
tuantran1702 added a commit that referenced this pull request Mar 28, 2024
@joe-bowman joe-bowman deleted the si-from-recent-claims branch March 28, 2024 22:55
joe-bowman pushed a commit that referenced this pull request Apr 8, 2024
* fix(intent-test): fix the claim to match the supply

* refactor: enable some tests and convert them to keeper tests

* fix int64 to sdkmath.Int

* rename alias to sdkmath to avoid confusion

* fix claim to match supply

* remove balance

* add unclaimedRatio

* add multi claim, less than 100% supply

* add tests, write comment for reasoning expected output

* fix tests failing due to #1345

* fix test

---------

Co-authored-by: Jacob Gadikian <[email protected]>
Co-authored-by: Joe Bowman <[email protected]>
faddat added a commit that referenced this pull request Apr 11, 2024
* fix undefined window error (#1396)

* chore(deps): bump github.com/cosmos/ibc-go/v5 from 5.3.2 to 5.4.0 (#1398)

Bumps [github.com/cosmos/ibc-go/v5](https://github.com/cosmos/ibc-go) from 5.3.2 to 5.4.0.
- [Release notes](https://github.com/cosmos/ibc-go/releases)
- [Changelog](https://github.com/cosmos/ibc-go/blob/v5.4.0/CHANGELOG.md)
- [Commits](cosmos/ibc-go@v5.3.2...v5.4.0)

---
updated-dependencies:
- dependency-name: github.com/cosmos/ibc-go/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump golang.org/x/tools from 0.19.0 to 0.20.0 (#1392)

Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.19.0 to 0.20.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](golang/tools@v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump google.golang.org/grpc from 1.62.1 to 1.63.0 (#1383)

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.62.1 to 1.63.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.62.1...v1.63.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joe Bowman <[email protected]>

* use correct supply when determining proportions (#1389)

* use correct supply when determining proportions

* fix HandleMsgTransfer tests

---------

Co-authored-by: Tuan Tran <[email protected]>

* Reinstate the TestAggregateIntentWithPRClaims (#1320)

* fix(intent-test): fix the claim to match the supply

* refactor: enable some tests and convert them to keeper tests

* fix int64 to sdkmath.Int

* rename alias to sdkmath to avoid confusion

* fix claim to match supply

* remove balance

* add unclaimedRatio

* add multi claim, less than 100% supply

* add tests, write comment for reasoning expected output

* fix tests failing due to #1345

* fix test

---------

Co-authored-by: Jacob Gadikian <[email protected]>
Co-authored-by: Joe Bowman <[email protected]>

* fix: Withdrawal records should not exist with 0 burnAmount (#1284)

* add guard to ```AddWithdrawalRecord```  and ```SetWithdrawalRecord```

* fix tests missing BurnAmount field

* return error instead of panic for ```SetwithdrawalRecord```  and ```AddWithdrawalRecord```

* fix linting

* return error

* refactor to check for error

* add missing BurnAmount field in TestGetRatio

* refactor test

* add old function for testing upgrade handler

* add upgrade handler and test

* add Upgrade handler to testnet upgrades

* Update x/interchainstaking/keeper/withdrawal_record.go comment

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* add test for set withdrawal records

* refactor: remove old code from keeper

* linting

* linting

* resolve conflict, fix upgrade name

* linting

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Jacob Gadikian <[email protected]>
Co-authored-by: Joe Bowman <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Joseph Chalabi <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joe Bowman <[email protected]>
Co-authored-by: Tuan Tran <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signalling Intent should use most recent claims
2 participants