Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
chore: Revert "feat: remove bank multisend msg (#274)" (v12.x) (#325)
Browse files Browse the repository at this point in the history
* Revert "feat: remove bank multisend msg (#274)"

This reverts commit 9165099.

* fix simulator
  • Loading branch information
p0mvn authored Sep 13, 2022
1 parent be61cb5 commit 72af815
Show file tree
Hide file tree
Showing 23 changed files with 2,242 additions and 70 deletions.
2 changes: 1 addition & 1 deletion codec/types/interface_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type InterfaceRegistry interface {
// the interface iface.
//
// Ex:
// registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{})
// registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}, &MsgMultiSend{})
RegisterImplementations(iface interface{}, impls ...proto.Message)

// ListAllInterfaces list the type URLs of all registered interfaces.
Expand Down
63 changes: 63 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@

- [cosmos/bank/v1beta1/bank.proto](#cosmos/bank/v1beta1/bank.proto)
- [DenomUnit](#cosmos.bank.v1beta1.DenomUnit)
- [Input](#cosmos.bank.v1beta1.Input)
- [Metadata](#cosmos.bank.v1beta1.Metadata)
- [Output](#cosmos.bank.v1beta1.Output)
- [Params](#cosmos.bank.v1beta1.Params)
- [SendEnabled](#cosmos.bank.v1beta1.SendEnabled)
- [Supply](#cosmos.bank.v1beta1.Supply)
Expand Down Expand Up @@ -114,6 +116,8 @@
- [Query](#cosmos.bank.v1beta1.Query)

- [cosmos/bank/v1beta1/tx.proto](#cosmos/bank/v1beta1/tx.proto)
- [MsgMultiSend](#cosmos.bank.v1beta1.MsgMultiSend)
- [MsgMultiSendResponse](#cosmos.bank.v1beta1.MsgMultiSendResponse)
- [MsgSend](#cosmos.bank.v1beta1.MsgSend)
- [MsgSendResponse](#cosmos.bank.v1beta1.MsgSendResponse)

Expand Down Expand Up @@ -1584,6 +1588,22 @@ denomination unit of the basic token.



<a name="cosmos.bank.v1beta1.Input"></a>

### Input
Input models transaction input.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `address` | [string](#string) | | |
| `coins` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |






<a name="cosmos.bank.v1beta1.Metadata"></a>

### Metadata
Expand All @@ -1609,6 +1629,22 @@ Since: cosmos-sdk 0.43 |



<a name="cosmos.bank.v1beta1.Output"></a>

### Output
Output models transaction outputs.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `address` | [string](#string) | | |
| `coins` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |






<a name="cosmos.bank.v1beta1.Params"></a>

### Params
Expand Down Expand Up @@ -2095,6 +2131,32 @@ Query defines the gRPC querier service.



<a name="cosmos.bank.v1beta1.MsgMultiSend"></a>

### MsgMultiSend
MsgMultiSend represents an arbitrary multi-in, multi-out send message.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `inputs` | [Input](#cosmos.bank.v1beta1.Input) | repeated | |
| `outputs` | [Output](#cosmos.bank.v1beta1.Output) | repeated | |






<a name="cosmos.bank.v1beta1.MsgMultiSendResponse"></a>

### MsgMultiSendResponse
MsgMultiSendResponse defines the Msg/MultiSend response type.






<a name="cosmos.bank.v1beta1.MsgSend"></a>

### MsgSend
Expand Down Expand Up @@ -2136,6 +2198,7 @@ Msg defines the bank Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Send` | [MsgSend](#cosmos.bank.v1beta1.MsgSend) | [MsgSendResponse](#cosmos.bank.v1beta1.MsgSendResponse) | Send defines a method for sending coins from one account to another account. | |
| `MultiSend` | [MsgMultiSend](#cosmos.bank.v1beta1.MsgMultiSend) | [MsgMultiSendResponse](#cosmos.bank.v1beta1.MsgMultiSendResponse) | MultiSend defines a method for sending coins from some accounts to other accounts. | |

<!-- end services -->

Expand Down
20 changes: 20 additions & 0 deletions proto/cosmos/bank/v1beta1/bank.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ message SendEnabled {
bool enabled = 2;
}

// Input models transaction input.
message Input {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string address = 1;
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

// Output models transaction outputs.
message Output {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string address = 1;
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

// Supply represents a struct that passively keeps track of the total supply
// amounts in the network.
// This message is deprecated now that supply is indexed by denom.
Expand Down
14 changes: 14 additions & 0 deletions proto/cosmos/bank/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
service Msg {
// Send defines a method for sending coins from one account to another account.
rpc Send(MsgSend) returns (MsgSendResponse);

// MultiSend defines a method for sending coins from some accounts to other accounts.
rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse);
}

// MsgSend represents a message to send coins from one account to another.
Expand All @@ -26,3 +29,14 @@ message MsgSend {

// MsgSendResponse defines the Msg/Send response type.
message MsgSendResponse {}

// MsgMultiSend represents an arbitrary multi-in, multi-out send message.
message MsgMultiSend {
option (gogoproto.equal) = false;

repeated Input inputs = 1 [(gogoproto.nullable) = false];
repeated Output outputs = 2 [(gogoproto.nullable) = false];
}

// MsgMultiSendResponse defines the Msg/MultiSend response type.
message MsgMultiSendResponse {}
1 change: 1 addition & 0 deletions simapp/params/weights.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package params
// Default simulation operation weights for messages and gov proposals
const (
DefaultWeightMsgSend int = 100
DefaultWeightMsgMultiSend int = 10
DefaultWeightMsgSetWithdrawAddress int = 50
DefaultWeightMsgWithdrawDelegationReward int = 50
DefaultWeightMsgWithdrawValidatorCommission int = 50
Expand Down
3 changes: 1 addition & 2 deletions x/authz/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)

var bankSendAuthMsgType = banktypes.SendAuthorization{}.MsgTypeURL()
Expand Down Expand Up @@ -73,7 +72,7 @@ func (s *TestSuite) TestKeeper() {
s.Require().Equal(authorization.MsgTypeURL(), bankSendAuthMsgType)

s.T().Log("verify fetching authorization with wrong msg type fails")
authorization, _ = app.AuthzKeeper.GetCleanAuthorization(ctx, granteeAddr, granterAddr, sdk.MsgTypeURL(&govtypes.MsgDeposit{}))
authorization, _ = app.AuthzKeeper.GetCleanAuthorization(ctx, granteeAddr, granterAddr, sdk.MsgTypeURL(&banktypes.MsgMultiSend{}))
s.Require().Nil(authorization)

s.T().Log("verify fetching authorization with wrong grantee fails")
Expand Down
Loading

0 comments on commit 72af815

Please sign in to comment.