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

Handle non staking tokens #1132

Merged
merged 35 commits into from
Feb 13, 2024
Merged

Handle non staking tokens #1132

merged 35 commits into from
Feb 13, 2024

Conversation

joe-bowman
Copy link
Contributor

@joe-bowman joe-bowman commented Feb 10, 2024

1. Summary

Fixes #1118 - Allows deposits of non-staking tokens in deposit/delegate accounts to be collected and handled as rewards

2.Type of change

  • New feature (non-breaking change which adds functionality)

3. Implementation details

  • Update ValidateCoinForZone to determine whether the deposit can be staked.
  • Ensure Increment and Decrement of WithdrawalWaitgroup is done by helper methods to ensure no overflow.
  • If coins cannot be staked, they are moved to the withdrawal account, where normal withdrawal processing can take place
  • Fix race condition in non-staking denom rewards
  • Fix identified race in un/re/delegation response

Summary by CodeRabbit

  • New Features
    • Introduced IncrementWithdrawalWaitgroup and SetWithdrawalWaitgroup methods for better withdrawal management.
    • Added SendToWithdrawal method for transferring coins in keeper.go.
    • Implemented IsDepositAddress method to validate deposit addresses.
  • Enhancements
    • Improved logging and error handling across various modules.
    • Enhanced token validation logic in ValidateCoinsForZone.
    • Adjusted logging levels in intent.go and withdrawal_record.go for better clarity.
  • Bug Fixes
    • Fixed error handling in DepositLsmTxCallbackFailOnNonMatchingValidator to prevent queue blocking.
    • Updated HandleWithdrawRewards function to use SetWithdrawalWaitgroup for consistency.
  • Refactor
    • Refactored handling of WithdrawalWaitgroup using getter and setter methods across several files.
  • Documentation, Style, Tests, Chores
    • Updated Go version requirement to 1.22 in Makefile and various workflow files.
    • Adjusted Dockerfiles to use updated Go and Alpine versions for improved security and compatibility.
  • Revert
    • Not applicable in this release.

@joe-bowman joe-bowman requested a review from faddat as a code owner February 10, 2024 01:58
Copy link

vercel bot commented Feb 10, 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 Feb 13, 2024 7:20pm

Copy link
Contributor

coderabbitai bot commented Feb 10, 2024

Walkthrough

The changes revolve around enhancing the handling and validation of withdrawal processes, improving error handling, logging, and the management of withdrawal waitgroups across the interchain staking module. A notable addition is the mechanism to deal with unstakable tokens by sending them to the withdrawal account, aligning with the requirement to handle tokens that are not meant for staking, such as those received from third-party airdrops.

Changes

Files Change Summary
x/interchainstaking/keeper/callbacks.go, .../callbacks_test.go Introduced IncrementWithdrawalWaitgroup, improved error handling, logging, and waitgroup management.
x/interchainstaking/keeper/ibc_packet_handlers.go, ..._test.go Updated withdrawal handling with SetWithdrawalWaitgroup, improved error handling and logging.
x/interchainstaking/keeper/delegation.go, .../hooks.go Enhanced WithdrawalWaitgroup handling, logging, and added redemption rate calculation logic.
x/interchainstaking/keeper/keeper.go, .../withdrawal_record.go Added SendToWithdrawal method, adjusted logging levels.
x/interchainstaking/types/zones.go, .../zones_test.go Added methods for withdrawal waitgroup management, updated coin validation logic.
Makefile, .github/workflows/..., Dockerfile, Dockerfile.relayer, icq-relayer/Dockerfile, proto/Dockerfile Updated Go version and base images in build configurations.

Assessment against linked issues

Objective Addressed Explanation
Withdraw unstakable tokens (#1118)

Poem

In the realm where bytes and chains entwine,
A rabbit hopped, through code so fine.
With every leap, it fixed a flaw,
Ensuring no token would withdraw in awe.

🌟 'Cross the chains, where tokens flow,
Ensuring all can stake, or to withdrawal go.
In this digital burrow, where the code does sing,
Our rabbit's work, makes the blockchain ring.


<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->
<!--


x/interchainstaking/keeper/callbacks_test.go, x/interchainstaking/keeper/callbacks.go: ## Short summary

  • The IncrementWithdrawalWaitgroup method is introduced in place of directly incrementing WithdrawalWaitgroup in several test functions.
  • Error handling in DepositLsmTxCallbackFailOnNonMatchingValidator is modified to avoid blocking queues.
  • SetWithdrawalWaitgroup and GetWithdrawalWaitgroup methods are used instead of directly setting and getting WithdrawalWaitgroup in TestDelegationAccountBalancesCallback, TestDelegationAccountBalanceCallback, and TestDelegationAccountBalanceCallbackLSM.
  • Several changes were made to the RewardsCallback, DelegationAccountBalanceCallback, DelegationAccountBalancesCallback functions in callbacks.go. The modifications involve adjustments to logging messages, handling of waitgroups, and validation of staking tokens before processing. The functions now utilize additional parameters for logging and waitgroup management, along with enhanced error handling and token validation logic.

x/interchainstaking/keeper/ibc_packet_handlers_test.go: ## Short summary

In the ibc_packet_handlers_test.go file, the HandleWithdrawRewards function has been updated to use a new method SetWithdrawalWaitgroup instead of directly setting the WithdrawalWaitgroup field. This change is applied consistently throughout the test cases related to handling withdrawals and delegator rewards.


x/interchainstaking/keeper/delegation.go: ### Short Summary

  • Changed the way WithdrawalWaitgroup is handled in WithdrawDelegationRewardsForResponse.
  • Updated logging and added logic for redemption rate calculation in FlushOutstandingDelegations.

x/interchainstaking/keeper/hooks.go: ## Short summary

In the provided diff for x/interchainstaking/keeper/hooks.go, the functionality related to handling WithdrawalWaitgroup in the AfterEpochEnd method of the Keeper struct has been refactored. The changes involve replacing direct access to WithdrawalWaitgroup with getter and setter methods (GetWithdrawalWaitgroup and SetWithdrawalWaitgroup) and introducing a new method IncrementWithdrawalWaitgroup to manage the waitgroup incrementation. These modifications aim to improve code readability and maintainability by encapsulating the logic related to WithdrawalWaitgroup within dedicated methods.


x/interchainstaking/keeper/keeper.go: ### Short Summary
Added a new method SendToWithdrawal to the Keeper struct in keeper.go that sends a specified amount of coins from an ICAAccount to a withdrawal address within a zone.


x/interchainstaking/keeper/ibc_packet_handlers.go: ## Short summary

  • Removed a logging statement related to withdrawal and staking denom.
  • Refactored handling logic for various account interactions.
  • Improved error handling and logging in delegation and redemption processes.

x/interchainstaking/types/zones.go: ## Short summary

  • Added IsDepositAddress method to check if a given address is the deposit address.
  • Updated DecrementWithdrawalWaitgroup to handle underflow and log related information.
  • Added SetWithdrawalWaitgroup and IncrementWithdrawalWaitgroup methods to manage the withdrawal waitgroup with logging and error handling.
  • Enhanced ValidateCoinsForZone to handle different coin validations based on zone settings.

x/interchainstaking/types/zones_test.go: ## Short summary

  • Added import for log from github.com/tendermint/tendermint/libs/log.
  • Refactored DecrementWithdrawalWg to use IncrementWithdrawalWaitgroup and DecrementWithdrawalWaitgroup methods with logging.
  • Updated tests to reflect changes in DecrementWithdrawalWg and ValidateCoinsForZone.
  • Added validation scenarios for different coin types in ValidateCoinsForZone.

x/interchainstaking/keeper/receipt_test.go: ## Short summary

In the TestHandleReceiptTransactionBadDenom function of receipt_test.go, the change involves replacing an assertion that checks for an error message containing a specific string with an assertion that expects no error to occur.


x/interchainstaking/transfer_middleware.go: ### Short Summary
The functionality in the TransferMiddleware has been adjusted to handle inbound msgTransfer packets more effectively. The changes involve logging improvements and additional checks related to the sender, receiver, and processing of transfers.


x/interchainstaking/keeper/intent.go: ## Short summary

In the UpdateDelegatorIntent function of intent.go, a logging statement was modified to change the log level from Error to Info.


Makefile: ## Short summary

The Makefile now requires Go version 1.22 instead of 1.21 for building Quicksilver. The error message now includes the detected Go version.


.github/workflows/buildtest.yaml: ## Short summary

The diff updates the Go version from "1.21" to "1.22" in the setup steps for the GitHub Actions workflow file. It also modifies the target operating systems in the matrix strategy, removing "darwin" as a target OS and adding "arm64" as an architecture for the "darwin" target OS.


.github/workflows/codeql.yml: ## Short summary

In the .github/workflows/codeql.yml file, the go-version parameter in the actions/setup-go step was updated from 1.21.5 to 1.21.7.


.github/workflows/golangci.yml: ## Short summary

The change in the .github/workflows/golangci.yml file updates the Go version to '1.21.x' and the golangci-lint version to 'v1.56.1' with a timeout of 15 minutes.


.github/workflows/interchaintest.yaml: ## Short summary

The diff involves updating the Go version from "1.21" to "1.22" in the workflow setup steps for setting up Go in multiple job configurations.


Dockerfile: ## Short summary

The Dockerfile has been updated to change the base image from golang:1.21.5-alpine3.18 to golang:1.21.7-alpine3.19, reflecting a version upgrade.


Dockerfile.relayer: ## Short summary

The Dockerfile for relayer has been updated to use golang:1.21.7-alpine3.19 as the base image instead of golang:1.21.5-alpine3.18.


icq-relayer/Dockerfile: ## Short summary

The Dockerfile has been updated to change the base image from golang:1.21.5-alpine3.19 to golang:1.21.7-alpine3.19.


proto/Dockerfile: ## Short summary

The Dockerfile now uses golang:1.21.7-alpine3.18 instead of golang:1.21.5-alpine3.18.


-->
<!-- end of auto-generated comment: raw summary by coderabbit.ai --><!-- This is an auto-generated comment: short summary by coderabbit.ai -->
<!--


### PR Objectives (User Provided Facts)

This pull request, numbered 1132, addresses issue #1118, focusing on handling non-staking tokens in deposit/delegate accounts as rewards. The objective is to enable the collection and processing of non-staking tokens, expanding system functionality. The PR introduces a new feature to accommodate these tokens, enhancing system capabilities. Key implementation details include updating validation logic, secure management of `WithdrawalWaitgroup`, and handling non-staking coins in the withdrawal account. The linked issue (#1118) discusses scenarios involving unstakable tokens sent to delegate accounts, proposing solutions involving token transfers and distribution logic.

### Comments Summary

The comments highlight testing challenges on the amd64 darwin platform, leading to discussions on test failures and potential solutions. Upgrading to Go version 1.22.0 did not resolve the issue, prompting considerations to adjust testing strategies or refactor specific failing tests like `TestHandleReceiptTransactionBadDenom`. The platform-specific test failure raised questions about environmental factors or subtle bugs affecting test outcomes, suggesting the need for detailed logging to diagnose the problem effectively.

### AI-Generated Summary of Generated Summaries

The PR introduces enhancements for handling non-staking tokens, including validation updates, secure `WithdrawalWaitgroup` management, and processing non-staking coins for withdrawal. Refactoring across files emphasizes encapsulation and error handling improvements, particularly in managing shared resources like `WithdrawalWaitgroup`. The PR also updates the Go version in configuration files and Dockerfiles, aligning with broader environment upgrades to support system enhancements effectively. These changes aim to boost system flexibility, code maintainability, and development environment compatibility for improved token handling and system robustness.

-->
<!-- end of auto-generated comment: short summary by coderabbit.ai --><!-- commit_ids_reviewed_start -->

<!-- 7705109186baa19f83770d0ad4bbb1282cc0d773 -->
<!-- b6bdf51d54301f1844cfb84897cdb0fa7c6e3e57 -->
<!-- 37b7d2adc546737ca6f4620734de385a8aa50c7e -->
<!-- 474026417da5a7e650c401b082f9a67685d73777 -->
<!-- 09681cbffef43035ff15ee8e78fda49226bdf0ae -->
<!-- 872c2fa0c11aa46bfa94be50d88d532c95de881a -->
<!-- 0ae72e90d4a5d550c5e26a11b7bff80d9bfba69d -->
<!-- dd80f7d4f8754509753938b05568e9bd24048953 -->
<!-- 157d99dd27f2bb43aea965d64829c9773827f74b -->
<!-- 5aef227726bf293050a275ca28f5bb7891120d9d -->
<!-- 3a7076476da07cc6f2ef6d75fb7edd36f145a7a8 -->
<!-- ed8165687b1c07afcb5f1c3b8e30036d1e80b7b8 -->
<!-- 3f9e3f37afcac2daf8e67888f49d2717bcdbfff6 -->
<!-- ec4085df21cefcd17d40a4c83360487cbb462d7f -->
<!-- dba928fac1685a66ba1ddb4d8450889771323563 -->
<!-- c94d2a73cfd61a02e0760c1b7a44aa6b3dcc6b12 -->
<!-- 9572b8f529efd380ad972e707287109636a7f3f5 -->

<!-- commit_ids_reviewed_end --><!-- tips_start -->

---

<details>
<summary>Tips</summary>

### 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.`
- 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 from git 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](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json).
- 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](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.

</details>

<!-- tips_end -->

x/interchainstaking/keeper/receipt.go Dismissed Show dismissed Hide dismissed
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: 20

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 356e188 and 7705109.
Files ignored due to path filters (2)
  • docker-compose.yml is excluded by: !**/*.yml
  • scripts/config/hermes.toml is excluded by: !**/*.toml
Files selected for processing (16)
  • scripts/setup.sh (2 hunks)
  • scripts/simple-test.sh (1 hunks)
  • scripts/vars.sh (2 hunks)
  • x/interchainstaking/keeper/callbacks.go (5 hunks)
  • x/interchainstaking/keeper/callbacks_test.go (10 hunks)
  • x/interchainstaking/keeper/delegation.go (3 hunks)
  • x/interchainstaking/keeper/delegation_test.go (9 hunks)
  • x/interchainstaking/keeper/hooks.go (3 hunks)
  • x/interchainstaking/keeper/ibc_packet_handlers.go (9 hunks)
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go (16 hunks)
  • x/interchainstaking/keeper/keeper.go (1 hunks)
  • x/interchainstaking/keeper/receipt.go (4 hunks)
  • x/interchainstaking/keeper/validators.go (1 hunks)
  • x/interchainstaking/transfer_middleware.go (1 hunks)
  • x/interchainstaking/types/zones.go (3 hunks)
  • x/interchainstaking/types/zones_test.go (3 hunks)
Additional comments: 43
x/interchainstaking/keeper/validators.go (1)
  • 31-39: LGTM!
x/interchainstaking/transfer_middleware.go (1)
  • 96-107: Verify the error handling in HandleMsgTransfer to ensure it's robust and correctly manages all potential failure scenarios.
x/interchainstaking/keeper/hooks.go (1)
  • 173-179: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [133-196]

Ensure consistent usage of GetWithdrawalWaitgroup, SetWithdrawalWaitgroup, and IncrementWithdrawalWaitgroup methods throughout the codebase for managing WithdrawalWaitgroup.

scripts/vars.sh (2)
  • 50-50: LGTM!
  • 68-69: Verify that the renamed commands (icq-relayer) are consistently updated throughout the project to avoid breaking changes.
scripts/simple-test.sh (1)
  • 111-136: Ensure that the logic for handling withdrawal, delegation, and deposit accounts before performing bank transactions is correctly implemented and robustly handles errors.
x/interchainstaking/types/zones.go (5)
  • 26-28: LGTM!
  • 45-48: Ensure that SetWithdrawalWaitgroup correctly logs the action and sets the waitgroup value as intended.
  • 50-58: Verify that DecrementWithdrawalWaitgroup correctly handles underflow and logs relevant information.
  • 60-66: Ensure that IncrementWithdrawalWaitgroup correctly handles overflow and logs relevant information.
  • 70-98: Verify that ValidateCoinsForZone correctly handles different coin validations based on zone settings.
x/interchainstaking/keeper/delegation.go (1)
  • 330-334: The condition if zone.GetWithdrawalWaitgroup() == 0 followed by triggering redemption rate calculation seems unrelated to the primary purpose of FlushOutstandingDelegations. Ensure this logic is intentional and correctly placed.
x/interchainstaking/keeper/receipt.go (1)
  • 328-331: The introduction of NewCompletedReceipt is a good practice for creating receipts. Ensure that the completion time is correctly set and used throughout the system to mark transactions as completed.
x/interchainstaking/types/zones_test.go (4)
  • 7-7: The import of log from github.com/tendermint/tendermint/libs/log is added. Ensure this new dependency is justified and used appropriately within the test cases.
  • 43-52: Refactoring in TestDecrementWithdrawalWg introduces logging and uses IncrementWithdrawalWaitgroup and DecrementWithdrawalWaitgroup methods. Ensure that the logging functionality is correctly implemented and that the test accurately reflects the intended behavior of these methods.
  • 64-89: In TestValidateCoinsForZone, new validation scenarios for different coin types have been added. Verify that these scenarios cover all relevant cases and that the assertions correctly reflect the expected behavior of ValidateCoinsForZone.
  • 43-52: TestParseMemoFields introduces tests for parsing memo fields from bytes. Ensure that the test cases adequately cover both valid and invalid scenarios and that the assertions accurately reflect the expected parsing outcomes.
scripts/setup.sh (2)
  • 269-269: Adding 100000000uother to ${VAL_ADDRESS_2}'s genesis account introduces a new token type. Ensure this aligns with the intended token management strategy and that the token denomination uother is correctly defined elsewhere in the system.
  • 478-478: The epoch duration changes to 360s for epoch and 120s for day modify the timing of system operations. Confirm these new durations are intended and correctly implemented to meet the system's requirements.
x/interchainstaking/keeper/ibc_packet_handlers.go (6)
  • 355-371: The logic for handling different cases of MsgSend based on the sender and receiver addresses is clear. However, ensure that the logic within each case, especially for delegating rewards and handling withdrawals, is thoroughly tested to prevent any unintended side effects.
  • 767-779: The handling of failed MsgSend operations based on the sender and receiver addresses is appropriate. However, ensure that the specific actions taken in each case, such as logging and potentially requeuing or adjusting logic, are aligned with the intended system behavior for failed transactions.
  • 956-961: In the HandleFailedRedeemTokens method, the decrement of the WithdrawalWaitgroup is correctly handled. However, ensure that the logic for triggering the redemption rate calculation after a failed batch token redemption is correctly implemented and that it does not inadvertently trigger under incorrect conditions.
  • 1001-1005: In the HandleDelegate method, the decrement of the WithdrawalWaitgroup and the conditional logic for triggering the redemption rate calculation are correctly implemented. Ensure that the conditions under which the redemption rate calculation is triggered are thoroughly tested to prevent any unintended triggers.
  • 1045-1049: In the HandleFailedDelegate method, the handling of failed delegation messages is appropriate. Ensure that the decrement of the WithdrawalWaitgroup and the conditional logic for triggering the redemption rate calculation after a failed delegation are correctly implemented and tested.
  • 1239-1248: In the HandleWithdrawRewards method, the decrement of the WithdrawalWaitgroup and the conditional logic for triggering the redemption rate calculation after rewards withdrawal are correctly implemented. Ensure that the conditions under which the redemption rate calculation is triggered are thoroughly tested to prevent any unintended triggers.
x/interchainstaking/keeper/callbacks_test.go (10)
  • 724-724: The method IncrementWithdrawalWaitgroup is introduced to encapsulate the logic of incrementing the WithdrawalWaitgroup. Ensure that the method correctly handles edge cases and concurrency issues to prevent race conditions or incorrect increments.
  • 760-761: Similar to the previous comment, verify that IncrementWithdrawalWaitgroup is properly implemented to handle concurrency and edge cases.
  • 790-791: As with the previous hunks, ensure that the implementation of IncrementWithdrawalWaitgroup is robust against concurrency issues and edge cases.
  • 2450-2451: The change in error handling strategy to avoid blocking queues is noted. It's crucial to ensure that this approach does not lead to unhandled errors or silent failures that could affect the system's stability or data integrity.
  • 2533-2533: The introduction of SetWithdrawalWaitgroup encapsulates the logic for setting the withdrawal waitgroup. Verify that this method properly validates its inputs and handles any potential errors or edge cases.
  • 2552-2552: Using GetWithdrawalWaitgroup to retrieve the waitgroup value is a good practice for encapsulation. Ensure that this method is consistent in its return values, especially in concurrent environments.
  • 2587-2587: The use of SetWithdrawalWaitgroup here for initialization purposes should be checked for correctness in terms of input validation and error handling.
  • 2604-2604: This assertion checks the expected state of WithdrawalWaitgroup after a series of operations. Ensure that the logic leading to this state is correctly implemented and accounts for concurrency.
  • 2622-2622: Again, verify that SetWithdrawalWaitgroup is correctly implemented, especially in terms of handling edge cases and ensuring data integrity.
  • 2639-2639: This final assertion checks the state of WithdrawalWaitgroup and balances. Confirm that the underlying logic accurately reflects the intended operations and that concurrency is properly managed.
x/interchainstaking/keeper/delegation_test.go (8)
  • 375-375: Ensure denom is defined and its value is consistent with the test's context to avoid potential confusion or errors.
  • 405-405: The use of underscores in large numbers improves readability. Good practice.
  • 420-420: Consistent use of underscores in large numbers for readability is maintained. Approved.
  • 429-429: Formatting large integer values with underscores enhances readability. Continue this practice.
  • 483-483: The use of underscores in large integer values is consistent and improves readability. Approved.
  • 537-537: Ensure the denom variable is appropriately defined and used within the test's context.
  • 589-589: Maintain consistency in the use of the denom variable and formatting of large integer values.
  • 622-637: Verify that mockAck is correctly implemented and used to simulate different test scenarios. Ensure error handling is consistent and comprehensive.

x/interchainstaking/keeper/keeper.go Outdated Show resolved Hide resolved
x/interchainstaking/keeper/callbacks.go Show resolved Hide resolved
x/interchainstaking/keeper/callbacks.go Show resolved Hide resolved
x/interchainstaking/keeper/callbacks.go Show resolved Hide resolved
x/interchainstaking/keeper/callbacks.go Show resolved Hide resolved
x/interchainstaking/keeper/receipt.go Show resolved Hide resolved
x/interchainstaking/keeper/receipt.go Show resolved Hide resolved
x/interchainstaking/keeper/receipt.go Show resolved Hide resolved
x/interchainstaking/keeper/ibc_packet_handlers.go Outdated Show resolved Hide resolved
x/interchainstaking/transfer_middleware.go Outdated Show resolved Hide resolved
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 7705109 and b6bdf51.
Files selected for processing (7)
  • x/interchainstaking/keeper/callbacks.go (5 hunks)
  • x/interchainstaking/keeper/callbacks_test.go (10 hunks)
  • x/interchainstaking/keeper/delegation.go (3 hunks)
  • x/interchainstaking/keeper/hooks.go (3 hunks)
  • x/interchainstaking/keeper/keeper.go (1 hunks)
  • x/interchainstaking/types/zones.go (3 hunks)
  • x/interchainstaking/types/zones_test.go (3 hunks)
Files skipped from review as they are similar to previous changes (6)
  • x/interchainstaking/keeper/callbacks.go
  • x/interchainstaking/keeper/callbacks_test.go
  • x/interchainstaking/keeper/delegation.go
  • x/interchainstaking/keeper/hooks.go
  • x/interchainstaking/keeper/keeper.go
  • x/interchainstaking/types/zones.go
Additional comments: 4
x/interchainstaking/types/zones_test.go (4)
  • 7-7: The import of log from github.com/tendermint/tendermint/libs/log is added. Ensure this new dependency is justified and used appropriately across the test cases.
  • 43-52: The test TestDecrementWithdrawalWg correctly tests the increment and decrement of the withdrawal waitgroup, including the scenario where decrementing would lead to an error. Ensure the logging via testlog is effectively capturing the necessary information for debugging.
  • 64-89: The test TestValidateCoinsForZone effectively covers various scenarios for coin validation, including valid and invalid formats, and matching against validator addresses. This thorough testing ensures robust validation logic.
  • 4-10: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [242-308]

The test TestParseMemoFields thoroughly covers the parsing of memo fields from bytes, including handling of invalid data and validation of parsed fields. This ensures the robustness of memo field parsing functionality.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 b6bdf51 and 37b7d2a.
Files selected for processing (1)
  • x/interchainstaking/keeper/ibc_packet_handlers.go (9 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/interchainstaking/keeper/ibc_packet_handlers.go

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 37b7d2a and 4740264.
Files selected for processing (1)
  • x/interchainstaking/transfer_middleware.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/interchainstaking/transfer_middleware.go

@faddat
Copy link
Contributor

faddat commented Feb 10, 2024

Need to check if this is still failing tests, when I first checked, it was.

@faddat
Copy link
Contributor

faddat commented Feb 10, 2024

tests fail only on amd64 darwin. Will upgrade repo to go v1.22.0 and see if that changes this. Seems like a compatibility issue.

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 5aef227 and 3a70764.
Files selected for processing (2)
  • Dockerfile (2 hunks)
  • Makefile (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • Dockerfile
  • Makefile

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 42 lines in your changes are missing coverage. Please review.

Comparison is base (9850a44) 62.65% compared to head (9572b8f) 62.86%.
Report is 1 commits behind head on main.

❗ Current head 9572b8f differs from pull request most recent head 608447d. Consider uploading reports for the commit 608447d to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1132      +/-   ##
==========================================
+ Coverage   62.65%   62.86%   +0.20%     
==========================================
  Files         172      172              
  Lines       11331    11394      +63     
==========================================
+ Hits         7100     7163      +63     
+ Misses       3479     3478       -1     
- Partials      752      753       +1     
Flag Coverage Δ
unittests 62.86% <71.62%> (+0.20%) ⬆️

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

Files Coverage Δ
x/interchainstaking/keeper/hooks.go 77.69% <100.00%> (-1.89%) ⬇️
x/interchainstaking/keeper/keeper.go 71.51% <100.00%> (+0.48%) ⬆️
x/interchainstaking/keeper/validators.go 94.36% <100.00%> (+0.61%) ⬆️
x/interchainstaking/keeper/withdrawal_record.go 89.03% <100.00%> (ø)
x/interchainstaking/keeper/intent.go 76.76% <0.00%> (ø)
x/interchainstaking/keeper/receipt.go 77.08% <86.66%> (+0.79%) ⬆️
x/interchainstaking/keeper/callbacks.go 64.52% <75.00%> (+5.13%) ⬆️
x/interchainstaking/keeper/delegation.go 88.71% <27.27%> (-3.84%) ⬇️
x/interchainstaking/types/zones.go 71.15% <70.37%> (+0.65%) ⬆️
x/interchainstaking/keeper/ibc_packet_handlers.go 68.35% <66.66%> (-0.33%) ⬇️

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 3a70764 and ed81656.
Files selected for processing (3)
  • x/interchainstaking/keeper/callbacks_test.go (12 hunks)
  • x/interchainstaking/keeper/ibc_packet_handlers.go (10 hunks)
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go (16 hunks)
Files skipped from review as they are similar to previous changes (3)
  • x/interchainstaking/keeper/callbacks_test.go
  • x/interchainstaking/keeper/ibc_packet_handlers.go
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go

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 ed81656 and 3f9e3f3.
Files selected for processing (5)
  • x/interchainstaking/keeper/callbacks.go (7 hunks)
  • x/interchainstaking/keeper/delegation.go (3 hunks)
  • x/interchainstaking/keeper/ibc_packet_handlers.go (15 hunks)
  • x/interchainstaking/keeper/intent.go (1 hunks)
  • x/interchainstaking/keeper/withdrawal_record.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • x/interchainstaking/keeper/callbacks.go
  • x/interchainstaking/keeper/delegation.go
  • x/interchainstaking/keeper/ibc_packet_handlers.go
Additional comments: 2
x/interchainstaking/keeper/intent.go (1)
  • 206-206: Change in logging level from Error to Info is appropriate for non-error conditions.
x/interchainstaking/keeper/withdrawal_record.go (1)
  • 34-34: Logging level change from Error to Info in AddWithdrawalRecord aligns with refining log verbosity.

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 3f9e3f3 and ec4085d.
Files selected for processing (1)
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go (17 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go

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 ec4085d and dba928f.
Files selected for processing (2)
  • x/interchainstaking/keeper/callbacks_test.go (14 hunks)
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go (18 hunks)
Files skipped from review as they are similar to previous changes (2)
  • x/interchainstaking/keeper/callbacks_test.go
  • x/interchainstaking/keeper/ibc_packet_handlers_test.go

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 dba928f and c94d2a7.
Files selected for processing (1)
  • x/interchainstaking/keeper/callbacks.go (11 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/interchainstaking/keeper/callbacks.go

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 c94d2a7 and 9572b8f.
Files selected for processing (3)
  • .github/workflows/golangci.yml (1 hunks)
  • x/interchainstaking/keeper/keeper.go (1 hunks)
  • x/interchainstaking/keeper/withdrawal_record.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/golangci.yml
  • x/interchainstaking/keeper/keeper.go
  • x/interchainstaking/keeper/withdrawal_record.go

@faddat
Copy link
Contributor

faddat commented Feb 13, 2024

so, that was a very rigorous way to handle this... :)

@faddat faddat merged commit 73f875b into main Feb 13, 2024
23 checks passed
@joe-bowman joe-bowman deleted the feature-1118-handle-non-staking-tokens branch February 13, 2024 20:15
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.

Withdraw unstakable tokens
2 participants