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: rename MsgBridgeCall OutgoingBridgeCall receiver to refund #525

Merged
merged 1 commit into from
May 29, 2024

Conversation

zakir-code
Copy link
Contributor

@zakir-code zakir-code commented May 29, 2024

Summary by CodeRabbit

  • Changes
    • Renamed the receiver field to refund across various components and functions to improve clarity and consistency in handling refund addresses.
    • Updated command usage and argument handling for CmdBridgeCall to reflect the new structure.
    • Adjusted validation logic and tests to accommodate the renaming of fields.

Copy link

coderabbitai bot commented May 29, 2024

Walkthrough

The changes focus on renaming the receiver field to refund across various components of the crosschain module. This includes updates to protocol buffer definitions, CLI commands, keeper functions, tests, and types. The primary goal is to ensure consistency and clarity in naming conventions throughout the codebase, reflecting the purpose of the field more accurately.

Changes

File Path Change Summary
proto/fx/crosschain/v1/tx.proto Renamed receiver field to refund in MsgBridgeCall message.
proto/fx/crosschain/v1/types.proto Renamed receiver field to refund in OutgoingBridgeCall message.
x/crosschain/client/cli/flags.go Removed FlagTo constant.
x/crosschain/client/cli/tx.go Updated CmdBridgeCall function to include [refund] argument and adjusted handling.
x/crosschain/keeper/bridge_call_out.go Renamed receiver parameter to refundAddr in BridgeCallCoinsToERC20Token function.
x/crosschain/keeper/bridge_call_out_test.go Changed Receiver field to Refund in TestKeeper_BridgeCallResultHandler function.
x/crosschain/keeper/bridge_call_refund.go Updated HandleOutgoingBridgeCallRefund function to use refund address.
x/crosschain/keeper/bridge_call_refund_test.go Changed Receiver field to Refund in TestKeeper_HandleOutgoingBridgeCallRefund function.
x/crosschain/keeper/msg_server.go Replaced msg.Receiver with msg.Refund in BridgeCall function.
x/crosschain/tests/bridge_call_out_test.go Added bridgeCallRefundAddrByte variable and updated MsgBridgeCall struct initialization.
x/crosschain/tests/msg_server_test.go Replaced Receiver field with Refund in TestMsgBridgeCall function.
x/crosschain/types/msgs.go Adjusted validation logic for addresses in MsgBridgeCall struct's validateBasic method.
x/crosschain/types/msgs_test.go Renamed Receiver field to Refund in MsgBridgeCall struct.
x/crosschain/types/types.go Updated GetCheckpoint function to use m.Refund in OutgoingBridgeCall struct.
x/crosschain/types/types_test.go Changed Receiver field to Refund in TestOutgoingBridgeCall_Checkpoint function.
x/tron/types/checkpoint.go Updated GetCheckpointBridgeCall function to use bridgeCall.Refund.

Poem

In code, a change so bright and clear,
From receiver to refund, we steer.
Fields renamed with thoughtful care,
Across the modules, everywhere.
Consistency now in every line,
Our crosschain code, a work divine.
🌟✨🐇


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

@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: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 43a7e8a and 91a1f29.
Files ignored due to path filters (2)
  • x/crosschain/types/tx.pb.go is excluded by !**/*.pb.go
  • x/crosschain/types/types.pb.go is excluded by !**/*.pb.go
Files selected for processing (16)
  • proto/fx/crosschain/v1/tx.proto (1 hunks)
  • proto/fx/crosschain/v1/types.proto (1 hunks)
  • x/crosschain/client/cli/flags.go (1 hunks)
  • x/crosschain/client/cli/tx.go (2 hunks)
  • x/crosschain/keeper/bridge_call_out.go (2 hunks)
  • x/crosschain/keeper/bridge_call_out_test.go (1 hunks)
  • x/crosschain/keeper/bridge_call_refund.go (2 hunks)
  • x/crosschain/keeper/bridge_call_refund_test.go (1 hunks)
  • x/crosschain/keeper/msg_server.go (1 hunks)
  • x/crosschain/tests/bridge_call_out_test.go (2 hunks)
  • x/crosschain/tests/msg_server_test.go (1 hunks)
  • x/crosschain/types/msgs.go (2 hunks)
  • x/crosschain/types/msgs_test.go (4 hunks)
  • x/crosschain/types/types.go (1 hunks)
  • x/crosschain/types/types_test.go (1 hunks)
  • x/tron/types/checkpoint.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/crosschain/keeper/bridge_call_out.go
Additional comments not posted (37)
x/crosschain/client/cli/flags.go (1)

1-5: Removal of FlagTo constant aligns with the renaming strategy in the PR. Ensure all references to this flag are updated or removed in the codebase.

x/crosschain/keeper/bridge_call_refund_test.go (1)

22-23: The test correctly initializes and uses the new Refund field, aligning with the changes in the keeper functions.

x/crosschain/keeper/bridge_call_refund.go (1)

15-16: The function HandleOutgoingBridgeCallRefund correctly uses the refund address, and the logic remains consistent with the intended functionality. Ensure comprehensive testing to verify the behavior with the new field.

Also applies to: 24-24, 42-42, 46-46

x/tron/types/checkpoint.go (1)

114-114: The inclusion of the refund address in GetCheckpointBridgeCall is consistent with the renaming strategy. Verify the correctness of the generated checkpoint to ensure it meets the expected format and values.

x/crosschain/tests/bridge_call_out_test.go (1)

48-54: The test correctly initializes and uses the new Refund field, aligning with the changes in the message handling functions.

x/crosschain/keeper/bridge_call_out_test.go (1)

48-48: The test correctly initializes and uses the new Refund field, aligning with the changes in the keeper functions.

proto/fx/crosschain/v1/types.proto (1)

260-260: Renaming receiver to refund in OutgoingBridgeCall aligns with the PR objectives.

x/crosschain/types/types_test.go (1)

67-68: The test case TestOutgoingBridgeCall_Checkpoint correctly reflects the renaming of receiver to refund.

proto/fx/crosschain/v1/tx.proto (1)

378-378: The MsgBridgeCall message correctly updates the receiver field to refund.

x/crosschain/client/cli/tx.go (1)

195-197: Updated CmdBridgeCall to include refund parameter.

Ensure that the refund parameter is correctly documented and tested in associated unit tests.

Also applies to: 205-217, 225-226

x/crosschain/types/types.go (1)

479-479: Updated GetCheckpoint to include refund parameter in the ABI encoding process.

Ensure that the refund parameter is correctly documented and tested in associated unit tests.

x/crosschain/keeper/msg_server.go (1)

601-601: The renaming of receiver to refund in the BridgeCall function aligns with the PR objectives and is correctly implemented.

x/crosschain/types/msgs.go (2)

718-718: Renaming receiver to refund in MsgBridgeCallClaim.validateBasic aligns with the PR objectives and maintains the validation logic.


1184-1185: Conditionally validating the refund address in MsgBridgeCall.validateBasic based on the presence of Coins is a logical change and aligns with the PR objectives.

x/crosschain/tests/msg_server_test.go (13)

1334-1334: Ensure the Refund field is correctly used in the MsgBridgeCall test case.


Line range hint 10-133: The test cases in TestMsgBondedOracle are well-structured and cover a variety of scenarios.


Line range hint 135-235: The test cases in TestMsgAddDelegate effectively validate the conditions under which delegation can occur, including proper error handling.


Line range hint 237-287: Comprehensive tests for MsgEditBridger ensure that the function behaves as expected under various conditions.


Line range hint 289-389: The TestMsgSetOracleSetConfirm function thoroughly tests the oracle set confirmation process, including signature verification and error handling.


Line range hint 391-431: The TestClaimWithOracleOnline function correctly tests the claim process under the condition that the oracle is online, ensuring proper functionality.


Line range hint 433-533: The TestClaimMsgGasConsumed function provides valuable insights into the gas consumption of various claim messages, ensuring efficiency.


Line range hint 535-585: The TestClaimTest function effectively tests the claim functionality, including comprehensive error handling and successful processing.


Line range hint 587-687: The TestRequestBatchBaseFee function provides important insights into how different base fee values affect the profitability and processing of request batches.


Line range hint 689-709: The TestMsgUpdateChainOracles function effectively tests the addition and removal of oracles, ensuring correct processing and state consistency.


Line range hint 711-761: The TestBridgeCallClaim function effectively tests the bridge call claim functionality, including comprehensive error handling and successful processing.


Line range hint 763-813: The TestMsgBridgeCall function effectively tests the processing of bridge calls, ensuring correct handling and state consistency.


Line range hint 815-865: The TestAddPendingPoolRewards function effectively tests the addition of rewards to the pending pool, including comprehensive error handling and successful addition.

x/crosschain/types/msgs_test.go (10)

1949-1949: Ensure the Refund field is correctly used in the MsgBridgeCall struct.


1966-1966: The Refund field is correctly initialized in the test case setup.


1986-1986: The Refund field is correctly initialized in the test case setup for the error scenario.


1988-1988: The To field is correctly initialized in the test case setup for the error scenario.


2000-2000: The Refund field is correctly initialized in the test case setup for the error scenario.


2002-2002: The To field is correctly initialized in the test case setup for the error scenario.


2007-2007: The error scenario for an empty Refund address is correctly handled.


2014-2014: The Refund field is correctly initialized in the test case setup for the error scenario.


2016-2016: The To field is correctly initialized in the test case setup for the error scenario.


2029-2029: The Refund field is correctly used in the MsgBridgeCall struct.

@nulnut
Copy link
Member

nulnut commented May 29, 2024

mg

@zakir-code zakir-code merged commit c4d8846 into main May 29, 2024
10 checks passed
@zakir-code zakir-code deleted the fx0x55/rename branch May 29, 2024 06:18
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.

3 participants