Skip to content

feat: add x/assetctl [WIP DNM]#25

Draft
facundomedica wants to merge 24 commits intomainfrom
feature/assetctl
Draft

feat: add x/assetctl [WIP DNM]#25
facundomedica wants to merge 24 commits intomainfrom
feature/assetctl

Conversation

@facundomedica
Copy link
Contributor

No description provided.

@@ -0,0 +1,154 @@
# `x/assetctl` - Asset Registry Module
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to review this readme, as there were some stuff that didn't comply with this

// GetSupportAssetsCmd returns the command to support assets
func GetSupportAssetsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "manage-supported-assets [assets-to-add] [assets-to-remove]",

Choose a reason for hiding this comment

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

I think, it's a bit error-prone to keep both assets to add and assets to remove in the same command. It might be better to have one command to add assets and another one to remove (same as I suggested for proto rpcs).

service Msg {
option (cosmos.msg.v1.service) = true;

rpc ManageRegisteredAssets(MsgManageRegisteredAssets) returns (MsgManageRegisteredAssetsResponse);

Choose a reason for hiding this comment

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

Please tell me if I am wrong: supported assets are assets available on the Hub and registered assets are assets available on some specific chainlet, am I correct?

}


message MsgManageRegisteredAssets {

Choose a reason for hiding this comment

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

I would probably split both Manage... rpc calls into two, one to register/add and another to unregister/remove.



// DenomUnit represents a unit of a asset
message DenomUnit {

Choose a reason for hiding this comment

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

}

message MsgManageSupportedAssetsResponse {
repeated cosmos.bank.v1beta1.Metadata added_assets = 1 [(gogoproto.nullable) = false];

Choose a reason for hiding this comment

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

Why do we return added assets here but do not return anything in MsgManageRegisteredAssetsResponse?


// checkMsgs is recursive in case there are nested authz messages, with a hard limit of 3 levels.
func (ah AssetControlAnteHandler) checkMsgs(ctx sdk.Context, msgs []sdk.Msg, level int) error {
if level >= 3 {

Choose a reason for hiding this comment

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

Is it something special in number 3 here?

for _, msg := range msgs {
msgType := sdk.MsgTypeURL(msg)

if msgType == ibcTransferMsgType {

Choose a reason for hiding this comment

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

I guess, type switch is possible here.

}

// OnRecvPacket implements types.IBCModule.
func (m *IBCMiddleware) OnRecvPacket(ctx types.Context, packet channeltypes.Packet, relayer types.AccAddress) exported.Acknowledgement {

Choose a reason for hiding this comment

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

I really suggest to add some unit tests for this function since it's basically the core logic of the whole assetctl module.

}
}

return &types.MsgManageSupportedAssetsResponse{}, nil

Choose a reason for hiding this comment

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

Is it supposed be empty every time?

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.

2 participants