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

chore: adding basic Msg service and SubmitTx rpc boilerplate #2086

Merged
merged 28 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d20f2d2
add protos/rpcs, boilerplate
charleenfei Aug 23, 2022
48e44b6
typo
charleenfei Aug 23, 2022
3cacc48
typo
charleenfei Aug 23, 2022
ab10570
Merge branch 'main' into charly/2052_sendtx_rpc_msgs
charleenfei Aug 24, 2022
5eb8eb2
update re comments
charleenfei Aug 24, 2022
1748c3a
update msg
charleenfei Aug 24, 2022
c0a5259
Merge branch 'main' into charly/2052_sendtx_rpc_msgs
charleenfei Aug 24, 2022
aa6ce16
merge main
charleenfei Aug 24, 2022
a4a7708
initial commit, adding all types
damiannolan Aug 26, 2022
81d74fd
finish up correcting compile errors
charleenfei Aug 26, 2022
bd25b55
goformat
charleenfei Aug 26, 2022
6e6fe62
Merge branch 'refactor_genesis_types' into charly/2052_sendtx_rpc_msgs
charleenfei Aug 26, 2022
fee8080
update to new proto
charleenfei Aug 26, 2022
a605ba6
update proto
charleenfei Aug 29, 2022
a0a21ff
register interfaces update
charleenfei Aug 29, 2022
6c508cb
Merge branch 'main' into ics27/refactor-genesis-types
charleenfei Aug 29, 2022
a9e44a1
format
charleenfei Aug 29, 2022
a8bb9ca
Merge branch 'main' into charly/2052_sendtx_rpc_msgs
charleenfei Aug 29, 2022
c897d0b
update changelog
charleenfei Aug 29, 2022
ab6a796
Merge branch 'ics27/refactor-genesis-types' of github.com:cosmos/ibc-…
charleenfei Aug 29, 2022
656ca38
update changelog
charleenfei Aug 29, 2022
7f4274e
Merge branch 'ics27/refactor-genesis-types' into charly/2052_sendtx_r…
charleenfei Aug 29, 2022
4eec1dc
update msgSubmitTxResp
charleenfei Aug 29, 2022
e26f181
Merge branch 'main' into charly/2052_sendtx_rpc_msgs
charleenfei Aug 30, 2022
864cbfb
merge
charleenfei Aug 30, 2022
1f0828a
update proto
charleenfei Aug 30, 2022
679d47c
update proto
charleenfei Aug 30, 2022
26b6d6f
update ordering
charleenfei Aug 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 104 additions & 67 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@

- [Query](#ibc.applications.interchain_accounts.controller.v1.Query)

- [ibc/applications/interchain_accounts/v1/packet.proto](#ibc/applications/interchain_accounts/v1/packet.proto)
- [CosmosTx](#ibc.applications.interchain_accounts.v1.CosmosTx)
- [InterchainAccountPacketData](#ibc.applications.interchain_accounts.v1.InterchainAccountPacketData)

- [Type](#ibc.applications.interchain_accounts.v1.Type)

- [ibc/applications/interchain_accounts/controller/v1/tx.proto](#ibc/applications/interchain_accounts/controller/v1/tx.proto)
- [MsgRegisterAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount)
- [MsgRegisterAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse)
- [MsgSubmitTx](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTx)
- [MsgSubmitTxResponse](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTxResponse)

- [Msg](#ibc.applications.interchain_accounts.controller.v1.Msg)

Expand All @@ -117,12 +125,6 @@
- [ibc/applications/interchain_accounts/v1/metadata.proto](#ibc/applications/interchain_accounts/v1/metadata.proto)
- [Metadata](#ibc.applications.interchain_accounts.v1.Metadata)

- [ibc/applications/interchain_accounts/v1/packet.proto](#ibc/applications/interchain_accounts/v1/packet.proto)
- [CosmosTx](#ibc.applications.interchain_accounts.v1.CosmosTx)
- [InterchainAccountPacketData](#ibc.applications.interchain_accounts.v1.InterchainAccountPacketData)

- [Type](#ibc.applications.interchain_accounts.v1.Type)

- [ibc/applications/transfer/v1/transfer.proto](#ibc/applications/transfer/v1/transfer.proto)
- [DenomTrace](#ibc.applications.transfer.v1.DenomTrace)
- [Params](#ibc.applications.transfer.v1.Params)
Expand Down Expand Up @@ -1517,6 +1519,67 @@ Query provides defines the gRPC querier service.



<a name="ibc/applications/interchain_accounts/v1/packet.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/applications/interchain_accounts/v1/packet.proto



<a name="ibc.applications.interchain_accounts.v1.CosmosTx"></a>

### CosmosTx
CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | |






<a name="ibc.applications.interchain_accounts.v1.InterchainAccountPacketData"></a>

### InterchainAccountPacketData
InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `type` | [Type](#ibc.applications.interchain_accounts.v1.Type) | | |
| `data` | [bytes](#bytes) | | |
| `memo` | [string](#string) | | |





<!-- end messages -->


<a name="ibc.applications.interchain_accounts.v1.Type"></a>

### Type
Type defines a classification of message issued from a controller chain to its associated interchain accounts
host

| Name | Number | Description |
| ---- | ------ | ----------- |
| TYPE_UNSPECIFIED | 0 | Default zero value enumeration |
| TYPE_EXECUTE_TX | 1 | Execute a transaction on an interchain accounts host chain |


<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="ibc/applications/interchain_accounts/controller/v1/tx.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down Expand Up @@ -1555,6 +1618,40 @@ MsgRegisterAccountResponse defines the response for Msg/RegisterAccount




<a name="ibc.applications.interchain_accounts.controller.v1.MsgSubmitTx"></a>

### MsgSubmitTx
MsgSubmitTx defines the payload for MsgSubmitTx


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `owner` | [string](#string) | | |
| `connection_id` | [string](#string) | | |
| `timeout_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Timeout height relative to the current block height. The timeout is disabled when set to 0. |
| `timeout_timestamp` | [uint64](#uint64) | | Timeout timestamp in absolute nanoseconds since unix epoch. The timeout is disabled when set to 0. |
| `packet_data` | [ibc.applications.interchain_accounts.v1.InterchainAccountPacketData](#ibc.applications.interchain_accounts.v1.InterchainAccountPacketData) | | |






<a name="ibc.applications.interchain_accounts.controller.v1.MsgSubmitTxResponse"></a>

### MsgSubmitTxResponse
MsgSubmitTxResponse defines the response for MsgSubmitTx


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sequence` | [uint64](#uint64) | | |





<!-- end messages -->

<!-- end enums -->
Expand All @@ -1570,6 +1667,7 @@ Msg defines the 27-interchain-accounts/controller Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `RegisterAccount` | [MsgRegisterAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount) | [MsgRegisterAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse) | RegisterAccount defines a rpc handler for MsgRegisterAccount. | |
| `SubmitTx` | [MsgSubmitTx](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTx) | [MsgSubmitTxResponse](#ibc.applications.interchain_accounts.controller.v1.MsgSubmitTxResponse) | SubmitTx defines a rpc handler for MsgSubmitTx. | |

<!-- end services -->

Expand Down Expand Up @@ -1830,67 +1928,6 @@ See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-



<a name="ibc/applications/interchain_accounts/v1/packet.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/applications/interchain_accounts/v1/packet.proto



<a name="ibc.applications.interchain_accounts.v1.CosmosTx"></a>

### CosmosTx
CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | |






<a name="ibc.applications.interchain_accounts.v1.InterchainAccountPacketData"></a>

### InterchainAccountPacketData
InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `type` | [Type](#ibc.applications.interchain_accounts.v1.Type) | | |
| `data` | [bytes](#bytes) | | |
| `memo` | [string](#string) | | |





<!-- end messages -->


<a name="ibc.applications.interchain_accounts.v1.Type"></a>

### Type
Type defines a classification of message issued from a controller chain to its associated interchain accounts
host

| Name | Number | Description |
| ---- | ------ | ----------- |
| TYPE_UNSPECIFIED | 0 | Default zero value enumeration |
| TYPE_EXECUTE_TX | 1 | Execute a transaction on an interchain accounts host chain |


<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="ibc/applications/transfer/v1/transfer.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ func (k Keeper) RegisterAccount(goCtx context.Context, msg *types.MsgRegisterAcc
ChannelId: channelID,
}, nil
}

// SubmitTx defines a rpc handler for MsgSubmitTx
func (k Keeper) SubmitTx(goCtx context.Context, msg *types.MsgSubmitTx) (*types.MsgSubmitTxResponse, error) {
return &types.MsgSubmitTxResponse{}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ import (

// RegisterInterfaces registers the interchain accounts controller message types using the provided InterfaceRegistry
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRegisterAccount{})
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgRegisterAccount{},
&MsgSubmitTx{},
)
}
23 changes: 23 additions & 0 deletions modules/apps/27-interchain-accounts/controller/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types"
clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
host "github.com/cosmos/ibc-go/v5/modules/core/24-host"
)

Expand Down Expand Up @@ -46,3 +48,24 @@ func (msg MsgRegisterAccount) GetSigners() []sdk.AccAddress {

return []sdk.AccAddress{accAddr}
}

// NewMsgSubmitTx creates a new instance of MsgSubmitTx
func NewMsgSubmitTx(owner, connectionID string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, packetData icatypes.InterchainAccountPacketData) *MsgSubmitTx {
return &MsgSubmitTx{
ConnectionId: connectionID,
Owner: owner,
Copy link
Member

Choose a reason for hiding this comment

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

This should be an AccAddress I believe because it is on the controller chain, we know it should be a valid address

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it better to cast it in the proto or check if its a valid addr in ValidateBasic?

TimeoutHeight: timeoutHeight,
TimeoutTimestamp: timeoutTimestamp,
PacketData: packetData,
}
}

// ValidateBasic implements sdk.Msg
func (msg MsgSubmitTx) ValidateBasic() error {
return nil
}

// GetSigners implements sdk.Msg
func (msg MsgSubmitTx) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return []sdk.AccAddress{}
return []sdk.AccAddress{owner}

This needs to be authenticated by owner signature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea i would fill out this function in the next PR along with validate basic :)

}
Loading