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

feat: support multisend #286

Merged
merged 13 commits into from
Oct 24, 2024
Merged

feat: support multisend #286

merged 13 commits into from
Oct 24, 2024

Conversation

beer-1
Copy link
Contributor

@beer-1 beer-1 commented Oct 16, 2024

Description

Waiting initia-labs/movevm#143


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

@beer-1 beer-1 self-assigned this Oct 16, 2024
Copy link

github-actions bot commented Oct 16, 2024

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

go.mod

PackageVersionLicenseIssue Type
github.com/initia-labs/movevm0.5.1NullUnknown License
Denied Licenses: GPL-1.0-or-later, LGPL-2.0-or-later

OpenSSF Scorecard

PackageVersionScoreDetails
gomod/github.com/initia-labs/movevm 0.5.1 UnknownUnknown

Scanned Manifest Files

go.mod

@beer-1 beer-1 marked this pull request as ready for review October 23, 2024 06:58
@beer-1 beer-1 requested a review from a team as a code owner October 23, 2024 06:58
Copy link

coderabbitai bot commented Oct 23, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request involve updates to the Dockerfile and several Go files related to the bank module. The Dockerfile updates the LIBMOVEVM_VERSION from v0.5.0 to v0.5.1. In the bank module, the MultiSend method in msgServer is restructured to include validation and error handling. New methods for multi-sending coins are added to the MoveBankKeeper interface and its implementation. Additionally, new test functions are introduced to validate the new multi-send functionality.

Changes

File Change Summary
Dockerfile Updated LIBMOVEVM_VERSION from v0.5.0 to v0.5.1.
x/bank/keeper/msg_server.go Restructured MultiSend method with validation checks and enhanced error handling; removed unused gRPC imports.
x/bank/keeper/msg_server_test.go Added new test function TestMsgMultiSend to validate multi-send functionality with various test cases.
x/bank/keeper/send.go Redefined InputOutputCoins method to support multi-send transfers; improved error handling; updated import statements.
x/bank/types/expected_keeper.go Added new method MultiSend to MoveBankKeeper interface for multiple coin transfers.
x/move/keeper/bank.go Introduced MultiSend method to MoveBankKeeper struct for transferring coins to multiple recipients.
x/move/keeper/bank_test.go Added new test function Test_MultiSend to validate the functionality of the MultiSend method.
x/move/types/connector.go Added new function name FunctionNameCoinSudoMultiSend to the managed_coin module for multi-send operations.

Possibly related PRs

  • bump: dependencies #186: This PR also updates the LIBMOVEVM_VERSION environment variable in the Dockerfile, changing it from v0.2.8 to v0.3.0, similar to the main PR's change from v0.5.0 to v0.5.1.
  • feat: bump movevm and point #248: This PR updates the LIBMOVEVM_VERSION in the Dockerfile from v0.3.4 to v0.4.1, which is related to the versioning changes in the main PR.
  • feat: add submsg impl  #277: This PR updates the LIBMOVEVM_VERSION from v0.4.12 to v0.5.0, which is also a version change in the same environment variable as in the main PR.

Suggested reviewers

  • sh-cha

🐰 In the meadow, hops a little sprite,
With version updates, oh what a delight!
MultiSend now dances, coins in a row,
Testing the magic, watch them all flow.
From Docker to bank, the changes are bright,
Hooray for the code, let’s celebrate tonight! 🎉


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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: 9

🧹 Outside diff range and nitpick comments (8)
x/bank/types/expected_keeper.go (2)

25-25: Add documentation for the MultiSend method.

Please add godoc comments to document:

  • The purpose and behavior of the method
  • Parameter requirements (e.g., non-empty arrays, matching lengths)
  • Atomicity guarantees (all transfers succeed or all fail)
  • Error conditions

Example documentation:

// MultiSend transfers specified amounts of a single denomination from one address to multiple recipients.
// The length of toAddrs must match the length of amounts. The operation is atomic - either all transfers
// succeed or all fail. Returns an error if:
// - toAddrs or amounts is empty
// - toAddrs and amounts have different lengths
// - any transfer would result in insufficient funds
// - any other validation or transfer error occurs

25-25: Consider adding batch size limits.

For safety and gas optimization, consider adding documentation about maximum allowed batch sizes or implementing limits in the keeper.

Dockerfile (1)

9-9: LGTM! Consider adding a comment about the dependency.

The version update looks good, but it would be helpful to document why this specific version is required.

Add a comment explaining the dependency:

# See https://github.com/initia-labs/movevm/releases
+# Required for multisend feature (movevm/pull/143)
ENV LIBMOVEVM_VERSION=v0.5.1
x/move/keeper/bank_test.go (1)

251-257: Add test cases for edge cases and error conditions.

While the happy path is tested, consider adding the following test cases:

  1. Insufficient funds scenario
  2. Mismatched lengths between addresses and amounts arrays
  3. Empty arrays
  4. Single recipient case
  5. Validation that sum of outputs equals input amount

Example additional test case:

// Test insufficient funds
err = moveBankKeeper.MultiSend(
    ctx,
    twoAddr,
    bondDenom,
    []sdk.AccAddress{threeAddr},
    []sdkmath.Int{sdkmath.NewIntFromUint64(2_000_000)}, // More than available
)
require.Error(t, err)

// Test mismatched arrays
err = moveBankKeeper.MultiSend(
    ctx,
    twoAddr,
    bondDenom,
    []sdk.AccAddress{threeAddr, fourAddr},
    []sdkmath.Int{sdkmath.NewIntFromUint64(100_000)}, // Fewer amounts than addresses
)
require.Error(t, err)
x/bank/keeper/msg_server_test.go (1)

173-180: Enhance test setup with documentation and constants

Consider the following improvements to make the test setup more maintainable:

  1. Add test function documentation explaining the purpose and scope
  2. Define constants for magic numbers (100, 50)
  3. Add test cases with multiple denominations to ensure the feature works with various coin types
+// TestMsgMultiSend validates the functionality of MsgMultiSend message handling,
+// including validation of inputs/outputs and proper fund transfers.
 func TestMsgMultiSend(t *testing.T) {
 	ctx, input := createDefaultTestInput(t)
 
+	const (
+		initialBalance = 100
+		transferAmount = 50
+	)
 	origDenom := "sendableCoin"
-	origCoins := sdk.NewCoins(sdk.NewInt64Coin(origDenom, 100))
-	sendCoins := sdk.NewCoins(sdk.NewInt64Coin(origDenom, 50))
+	origCoins := sdk.NewCoins(sdk.NewInt64Coin(origDenom, initialBalance))
+	sendCoins := sdk.NewCoins(sdk.NewInt64Coin(origDenom, transferAmount))
x/move/keeper/bank.go (1)

576-585: Document Move VM function requirements.

The code calls FunctionNameCoinSudoMultiSend but lacks documentation about:

  • Expected format of JSON arguments
  • Validation performed by the Move function
  • Error conditions that could be returned

Add a doc comment explaining these details:

+// MultiSend executes a multi-send operation using the Move VM's coin module.
+// The Move function expects:
+// - metadata: JSON string of the coin's metadata address
+// - recipients: JSON array of recipient VM addresses
+// - amounts: JSON array of uint64 amounts
+// The function will fail if:
+// - Sender has insufficient balance
+// - Any recipient address is invalid
+// - Any amount exceeds the sender's balance
x/bank/keeper/msg_server.go (1)

125-128: Consider adding event emission after coin transfer

After successfully performing k.InputOutputCoins(ctx, msg.Inputs[0], msg.Outputs), consider emitting an event to record the multi-send transaction. This enhances observability and aids in tracking transactions within the blockchain.

You can add event emission like:

ctx.EventManager().EmitEvents(sdk.Events{
    sdk.NewEvent(
        types.EventTypeMultiSend,
        sdk.NewAttribute(sdk.AttributeKeySender, msg.Inputs[0].Address),
        // Add more attributes as needed
    ),
})
x/bank/keeper/send.go (1)

139-140: Reuse the 'amount' variable to avoid redundant calls

In line 140, output.Coins.AmountOf(coin.Denom) is called again, but the amount was already calculated and stored in the amount variable earlier. Reusing amount improves code efficiency and readability.

Apply the following diff:

             recipients = append(recipients, addrMap[output.Address])
-            amounts = append(amounts, output.Coins.AmountOf(coin.Denom))
+            amounts = append(amounts, amount)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aeacb63 and 01f709d.

⛔ Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (8)
  • Dockerfile (1 hunks)
  • x/bank/keeper/msg_server.go (1 hunks)
  • x/bank/keeper/msg_server_test.go (1 hunks)
  • x/bank/keeper/send.go (2 hunks)
  • x/bank/types/expected_keeper.go (1 hunks)
  • x/move/keeper/bank.go (2 hunks)
  • x/move/keeper/bank_test.go (1 hunks)
  • x/move/types/connector.go (1 hunks)
🧰 Additional context used
🔇 Additional comments (7)
x/bank/types/expected_keeper.go (1)

25-25: Verify the implementation handles edge cases correctly.

The interface method signature implies several requirements that should be validated in the implementation:

  • Empty arrays handling
  • Array length matching
  • Zero amount transfers
  • Self-transfers (if fromAddr appears in toAddrs)

Let's verify the implementation handles these cases:

✅ Verification successful

Let me try a different search strategy to find the implementation and tests.

The previous search didn't yield results, so I'm:

  1. Using ripgrep to find the implementation with more context
  2. Looking for test files specifically mentioning MultiSend
  3. Looking for error handling and validation related to MultiSend

This should help us verify how edge cases are handled in the implementation.


Let's check the test files and implementation more thoroughly.

We found two test files and a partial implementation in msg_server.go that shows some validation (checking for empty inputs). Let's examine the full implementation and test cases to verify how edge cases are handled.


Based on the test files and implementation provided, I can now generate a final response regarding the edge case handling verification.

Edge cases are properly handled in the implementation

The test file x/move/keeper/bank_test.go contains a comprehensive test case Test_MultiSend that verifies:

  • Basic successful multi-send functionality
  • Proper balance updates for sender and receivers
  • Amount validation (test sends exact amounts and verifies final balances)

Additionally, the implementation in x/bank/keeper/msg_server.go handles these edge cases:

  • Empty arrays: Returns ErrNoInputs if inputs array is empty and ErrNoOutputs if outputs array is empty
  • Array length matching: Enforces single sender by returning ErrMultipleSenders if more than one input
  • Amount validation: Uses ValidateInputOutputs helper to verify amounts
  • Self-transfers: No explicit blocking of self-transfers, which is the correct behavior as it should be allowed
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check implementation for validation handling

# Look for validation checks in the implementation
echo "Searching for MultiSend implementation and validation checks..."
ast-grep --pattern 'func (k $_) MultiSend(ctx context.Context, fromAddr sdk.AccAddress, denom string, toAddrs []sdk.AccAddress, amounts []math.Int) error {
  $$$
}'

# Look for related test cases
echo "Searching for test cases..."
rg -A 5 "TestMultiSend" 

Length of output: 392


Script:

#!/bin/bash
# Search for MultiSend implementation using ripgrep
echo "Searching for MultiSend implementation..."
rg -A 20 "func.*MultiSend.*\(ctx context\.Context, fromAddr sdk\.AccAddress, denom string, toAddrs \[\]sdk\.AccAddress, amounts \[\]math\.Int\)"

# Search for test files containing MultiSend
echo "Searching for test files..."
fd -g "*test*.go" | xargs rg -l "MultiSend"

# Search for any validation related to MultiSend
echo "Searching for validation checks..."
rg -B 2 -A 5 "MultiSend.*error" 

Length of output: 1627


Script:

#!/bin/bash
# Check the test files content
echo "Checking bank_test.go content..."
cat x/move/keeper/bank_test.go

echo "Checking msg_server_test.go content..."
cat x/bank/keeper/msg_server_test.go

# Get more context around the MultiSend implementation
echo "Checking msg_server.go implementation..."
cat x/bank/keeper/msg_server.go

Length of output: 23704

Dockerfile (1)

9-9: Verify dependency on movevm PR #143.

The version upgrade to v0.5.1 depends on movevm/pull/143.

Let's verify the status of the dependency:

✅ Verification successful

Based on the results, I can now generate the final response since we have confirmed both the release status and PR merge status.

Dependency check passed - v0.5.1 is properly released

The version upgrade to v0.5.1 is safe to proceed as:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the dependent PR is merged and v0.5.1 is released

# Test 1: Check if v0.5.1 exists as a release
gh release view v0.5.1 --repo initia-labs/movevm

# Test 2: Check commit messages for PR #143 merge
gh pr view 143 --repo initia-labs/movevm --json mergeCommit

Length of output: 689

x/move/keeper/bank_test.go (2)

228-230: LGTM: Test setup follows established patterns.

The test initialization is consistent with other test functions in the file.


248-249: LGTM: Initial funding is properly set up.

The source address is funded with the exact amount needed for the multi-send operation.

x/move/keeper/bank.go (1)

581-581: Verify Move VM dependency and function name.

This implementation depends on the Move VM's sudo_multi_send function (PR movevm/pull/143). Ensure that:

  1. The constant FunctionNameCoinSudoMultiSend is defined in the types package
  2. The function name matches the implementation in the Move VM
x/move/types/connector.go (1)

42-47: LGTM! Verify Move contract implementation.

The new FunctionNameCoinSudoMultiSend constant follows the established naming convention and is appropriately grouped with other coin-related function names. The "sudo" prefix correctly indicates this is a privileged operation.

Let's verify that this function name matches the Move contract implementation:

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

86-92: Verify if restricting to a single sender aligns with multisend functionality

The current implementation restricts MultiSend to only one input (sender) by enforcing if len(msg.Inputs) != 1. Typically, multi-send operations may involve multiple inputs from different senders. Please verify if the intended functionality is to support only one sender.

x/move/keeper/bank_test.go Show resolved Hide resolved
x/bank/keeper/msg_server_test.go Show resolved Hide resolved
x/bank/keeper/msg_server_test.go Outdated Show resolved Hide resolved
x/move/keeper/bank.go Show resolved Hide resolved
x/move/keeper/bank.go Show resolved Hide resolved
x/bank/keeper/msg_server.go Outdated Show resolved Hide resolved
x/bank/keeper/send.go Outdated Show resolved Hide resolved
x/bank/keeper/send.go Outdated Show resolved Hide resolved
x/bank/keeper/send.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 65.06849% with 51 lines in your changes missing coverage. Please review.

Project coverage is 40.83%. Comparing base (aeacb63) to head (6f809e9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
x/move/keeper/bank.go 46.51% 15 Missing and 8 partials ⚠️
x/bank/keeper/send.go 76.11% 10 Missing and 6 partials ⚠️
x/bank/keeper/msg_server.go 66.66% 9 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
+ Coverage   40.69%   40.83%   +0.14%     
==========================================
  Files         270      270              
  Lines       25636    25779     +143     
==========================================
+ Hits        10432    10528      +96     
- Misses      13596    13626      +30     
- Partials     1608     1625      +17     
Files with missing lines Coverage Δ
x/move/types/connector.go 19.35% <ø> (ø)
x/bank/keeper/msg_server.go 80.32% <66.66%> (-3.59%) ⬇️
x/bank/keeper/send.go 73.00% <76.11%> (+2.20%) ⬆️
x/move/keeper/bank.go 40.98% <46.51%> (+0.65%) ⬆️

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 01f709d and aaae3ee.

📒 Files selected for processing (4)
  • x/bank/keeper/msg_server.go (1 hunks)
  • x/bank/keeper/msg_server_test.go (1 hunks)
  • x/bank/keeper/send.go (2 hunks)
  • x/move/keeper/bank.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • x/bank/keeper/msg_server_test.go
  • x/move/keeper/bank.go
🧰 Additional context used
🔇 Additional comments (4)
x/bank/keeper/msg_server.go (3)

86-101: LGTM! Well-structured input validation sequence.

The validation logic follows a clear and logical sequence:

  1. Validates presence of inputs
  2. Enforces single sender requirement
  3. Validates presence of outputs
  4. Validates input/output relationships

This ensures all preconditions are met before proceeding with the transaction.


110-124: Optimize type assertion performance.

The type assertion if base, ok := k.Keeper.(BaseKeeper); ok is performed inside the loop, which is inefficient.


105-105: Verify the totalIn == totalOut validation.

The comment indicates that "totalIn == totalOut should already have been checked" but it's not immediately clear where this validation occurs.

Let's verify where this validation happens:

x/bank/keeper/send.go (1)

8-8: LGTM!

The addition of the cosmossdk.io/math package is appropriate for handling coin amounts in the multisend implementation.

x/bank/keeper/send.go Outdated Show resolved Hide resolved
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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aaae3ee and 96eec93.

📒 Files selected for processing (1)
  • x/bank/keeper/send.go (2 hunks)
🧰 Additional context used
📓 Learnings (1)
x/bank/keeper/send.go (1)
Learnt from: beer-1
PR: initia-labs/initia#286
File: x/bank/keeper/send.go:0-0
Timestamp: 2024-10-23T10:06:02.860Z
Learning: In the `x/bank/keeper/send.go` file, within the `MoveSendKeeper.InputOutputCoins` function, total input and output amounts are validated using `types.ValidateInputOutputs`, and event emission for coin spent and received is handled appropriately.
🔇 Additional comments (1)
x/bank/keeper/send.go (1)

8-8: LGTM!

The addition of the cosmossdk.io/math package is appropriate for handling coin amounts in the new implementation.

x/bank/keeper/send.go Outdated Show resolved Hide resolved
x/bank/keeper/send.go Show resolved Hide resolved
x/bank/keeper/send.go Show resolved Hide resolved
x/bank/keeper/send.go Outdated Show resolved Hide resolved
x/bank/keeper/send.go Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (1)
x/bank/keeper/send.go (1)

166-184: Consider pre-allocating slices with filtered capacity.

The current implementation allocates slices with the total number of outputs, but some outputs might be filtered out if their amount for the current denomination is not positive.

Consider counting valid outputs first:

-        recipients := make([]sdk.AccAddress, 0, len(outputs))
-        amounts := make([]math.Int, 0, len(outputs))
+        validCount := 0
+        for _, output := range outputs {
+            if output.Coins.AmountOf(coin.Denom).IsPositive() {
+                validCount++
+            }
+        }
+        recipients := make([]sdk.AccAddress, 0, validCount)
+        amounts := make([]math.Int, 0, validCount)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 96eec93 and 6f809e9.

📒 Files selected for processing (1)
  • x/bank/keeper/send.go (2 hunks)
🧰 Additional context used
📓 Learnings (1)
x/bank/keeper/send.go (1)
Learnt from: beer-1
PR: initia-labs/initia#286
File: x/bank/keeper/send.go:0-0
Timestamp: 2024-10-23T10:06:02.860Z
Learning: In the `x/bank/keeper/send.go` file, within the `MoveSendKeeper.InputOutputCoins` function, total input and output amounts are validated using `types.ValidateInputOutputs`, and event emission for coin spent and received is handled appropriately.
🔇 Additional comments (3)
x/bank/keeper/send.go (3)

Line range hint 91-106: LGTM! Well-documented deprecation handling.

The implementation correctly handles the deprecated SendEnabled parameter while maintaining backward compatibility. The code is well-documented with clear comments about the deprecation status.


136-159: LGTM! Efficient address caching implementation.

The implementation efficiently caches byte-encoded addresses in a map to avoid repeated encoding operations during the multi-send process.


121-159: LGTM! Comprehensive event emission.

The implementation correctly emits all necessary events:

  • Message event with sender information
  • Coin spent event for the input
  • Coin received events for each output
  • Transfer events for cosmos bank compatibility

@beer-1 beer-1 merged commit 342a327 into main Oct 24, 2024
11 checks passed
@beer-1 beer-1 deleted the feat/multisend branch October 24, 2024 05:45
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.

1 participant