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

[TRA-461] Remove x/vault/MsgWithdrawFromVault #1859

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Conversation

ttl33
Copy link
Contributor

@ttl33 ttl33 commented Jul 5, 2024

Changelist

  • Remove proto for x/vault/MsgWIthdrawFromVault (reasoning: waiting for Vault-of-Vaults spec)
  • Remove from msg & interface registration
  • Ran both make proto-gen and cd indexer/packages/v4-protos && npm run build:proto
  • Remove validation impl

Test Plan

n/a

Author/Reviewer Checklist

  • If this PR has changes that result in a different app state given the same prior state and transaction list, manually add the state-breaking label.
  • If the PR has breaking postgres changes to the indexer add the indexer-postgres-breaking label.
  • If this PR isn't state-breaking but has changes that modify behavior in PrepareProposal or ProcessProposal, manually add the label proposal-breaking.
  • If this PR is one of many that implement a specific feature, manually label them all feature:[feature-name].
  • If you wish to for mergify-bot to automatically create a PR to backport your change to a release branch, manually add the label backport/[branch-name].
  • Manually add any of the following labels: refactor, chore, bug.

Summary by CodeRabbit

  • Removed Features

    • Deprecated the functionality for withdrawing funds from vaults. Users can no longer perform withdrawal operations.
  • Bug Fixes

    • Improved error handling by removing outdated errors related to vault withdrawals.
  • Testing

    • Updated test cases to reflect the removal of withdrawal functionality.
  • Code Maintenance

    • Cleaned up codebase by removing redundant functions and message definitions related to vault withdrawals.

Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

The primary changes involve the removal of the withdrawFromVault function and all related message declarations, response types, encoding, decoding functions, and error handling from various files in a protocol for managing vaults. This results in a streamlined focus on deposit operations and parameter updates without affecting the rest of the functionality.

Changes

File Path Change Summary
indexer/.../dydxprotocol/vault/tx.rpc.msg.ts Removed withdrawFromVault function from Msg interface and its implementation in MsgClientImpl.
indexer/.../dydxprotocol/vault/tx.ts Removed MsgWithdrawFromVault and MsgWithdrawFromVaultResponse interfaces and their encoding/decoding functions.
proto/dydxprotocol/vault/tx.proto Removed WithdrawFromVault functionality and related message definitions.
protocol/.../interface_registry.go Removed MsgWithdrawFromVault call from the NewInterfaceRegistry function.
protocol/.../all_msgs.go Removed MsgWithdrawFromVault and MsgWithdrawFromVaultResponse messages declarations.
protocol/.../normal_msgs.go Removed MsgWithdrawFromVault and MsgWithdrawFromVaultResponse declarations.
protocol/.../normal_msgs_test.go Removed testing declarations for MsgWithdrawFromVault and MsgWithdrawFromVaultResponse.
protocol/testutil/constants/vault.go Removed VaultState struct and related instances.
protocol/testutil/encoding/utils.go Removed MsgWithdrawFromVault{} from GetTestEncodingCfg function.
protocol/x/vault/types/errors.go Removed ErrInvalidWithdrawalAmount, ErrVaultNotFound, and ErrOwnerShareNotFound declarations.

Poem

In a vault now purely for deposit treasure,
Withdrawals no longer provide us measure.
Code cleaned, messages lean,
Errors bid an unseen adieu scene.
A protocol's heart with less endeavors,
Streamlined, steady, now forever.

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

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.

Copy link

linear bot commented Jul 5, 2024

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.

Actionable comments posted: 2

Outside diff range and nitpick comments (3)
protocol/x/vault/types/errors.go (1)

Line range hint 3-3:
Remove unused import.

The import errorsmod is no longer used and can be removed.

- import errorsmod "cosmossdk.io/errors"
protocol/app/module/interface_registry.go (1)

Line range hint 48-48:
Remove unused entry.

The entry for MsgWithdrawFromVault is no longer used and can be removed.

- "dydxprotocol.vault.MsgWithdrawFromVault": getLegacyMsgSignerFn(
-   []string{"subaccount_id", "owner"},
- ),
indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts (1)

Line range hint 61-61:
Replace empty interface with type alias.

An empty interface is equivalent to {}. Use a type alias instead.

- export interface MsgUpdateParamsResponse {}
+ export type MsgUpdateParamsResponse = {};
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dc6e0a0 and 3b794d0.

Files ignored due to path filters (1)
  • protocol/x/vault/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (10)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts (3 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts (3 hunks)
  • proto/dydxprotocol/vault/tx.proto (2 hunks)
  • protocol/app/module/interface_registry.go (1 hunks)
  • protocol/app/msgs/all_msgs.go (1 hunks)
  • protocol/app/msgs/normal_msgs.go (1 hunks)
  • protocol/app/msgs/normal_msgs_test.go (1 hunks)
  • protocol/testutil/constants/vault.go (2 hunks)
  • protocol/testutil/encoding/utils.go (1 hunks)
  • protocol/x/vault/types/errors.go (1 hunks)
Files skipped from review due to trivial changes (5)
  • proto/dydxprotocol/vault/tx.proto
  • protocol/app/msgs/all_msgs.go
  • protocol/app/msgs/normal_msgs.go
  • protocol/testutil/constants/vault.go
  • protocol/testutil/encoding/utils.go
Additional context used
Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts

[error] 41-41: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (2)
protocol/app/msgs/normal_msgs_test.go (2)

Line range hint 1-107:
Ensure the removal of MsgWithdrawFromVault and MsgWithdrawFromVaultResponse from the expected messages list.

The expectedMsgs list should no longer include /dydxprotocol.vault.MsgWithdrawFromVault and /dydxprotocol.vault.MsgWithdrawFromVaultResponse.

Verification successful

Verification successful: The message types /dydxprotocol.vault.MsgWithdrawFromVault and /dydxprotocol.vault.MsgWithdrawFromVaultResponse have been successfully removed from the codebase, as indicated by the absence of these types in the repository.

  • No occurrences of /dydxprotocol.vault.MsgWithdrawFromVault found.
  • No occurrences of /dydxprotocol.vault.MsgWithdrawFromVaultResponse found.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the expected messages list does not include MsgWithdrawFromVault and MsgWithdrawFromVaultResponse.

# Test: Ensure that the messages are not present in the expected messages list. Expect: No occurrences of the removed messages.
rg --type go '/dydxprotocol.vault.MsgWithdrawFromVault|/dydxprotocol.vault.MsgWithdrawFromVaultResponse' protocol/app/msgs/normal_msgs_test.go

Length of output: 144


Script:

#!/bin/bash
# Description: Verify that the entire repository does not include MsgWithdrawFromVault and MsgWithdrawFromVaultResponse.

# Test: Ensure that the messages are not present in the repository. Expect: No occurrences of the removed messages.
rg '/dydxprotocol.vault.MsgWithdrawFromVault|/dydxprotocol.vault.MsgWithdrawFromVaultResponse'

Length of output: 96


Script:

#!/bin/bash
# Description: Verify that the entire repository does not include MsgWithdrawFromVault and MsgWithdrawFromVaultResponse.

# Test: Ensure that the messages are not present in the repository. Expect: No occurrences of the removed messages.
rg --type go 'MsgWithdrawFromVault|MsgWithdrawFromVaultResponse'

Length of output: 66


Line range hint 109-111:
Verify the handling of the removed message types in validateMsgValue.

Ensure that the validateMsgValue function correctly handles the absence of MsgWithdrawFromVault and MsgWithdrawFromVaultResponse.

@@ -1,14 +1,11 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { MsgDepositToVault, MsgDepositToVaultResponse, MsgWithdrawFromVault, MsgWithdrawFromVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unused import.

The import MsgWithdrawFromVault and MsgWithdrawFromVaultResponse is no longer used and can be removed.

- import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgWithdrawFromVault, MsgWithdrawFromVaultResponse } from "./tx";
+ import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";

@@ -39,88 +39,6 @@ export interface MsgDepositToVaultResponse {}
/** MsgDepositToVaultResponse is the Msg/DepositToVault response type. */

export interface MsgDepositToVaultResponseSDKType {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace empty interface with type alias.

An empty interface is equivalent to {}. Use a type alias instead.

- export interface MsgDepositToVaultResponse {}
+ export type MsgDepositToVaultResponse = {};
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export interface MsgDepositToVaultResponseSDKType {}
export type MsgDepositToVaultResponseSDKType = {};
Tools
Biome

[error] 41-41: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

@ttl33 ttl33 merged commit c25143f into main Jul 9, 2024
32 of 34 checks passed
@ttl33 ttl33 deleted the tl/vault-withdrawal-undo branch July 9, 2024 16:03
tqin7 pushed a commit that referenced this pull request Jul 11, 2024
tqin7 pushed a commit that referenced this pull request Jul 11, 2024
tqin7 pushed a commit that referenced this pull request Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants