Skip to content

Conversation

@lumtis
Copy link
Contributor

@lumtis lumtis commented Feb 5, 2021

starport module create <module-name> --ibc creates a module with standard placeholders to implement an IBC module

Optional flag --ibc-ordering [none|ordered|unordered selects the ordering of the channels

starport ibc packet <module-name> <packet-name> field1 field2... creates for the module a packet that can be send over IBC with custom data

This packet generates a new tx:
appd tx <module-name> send-<packet-name> [src-port] [src-channel] field1 ... that allows to send the packet to a channel

(This tx generation will be optional in the future since sometimes packet emission can sometimes be triggered by on-chain logic)

Everything is generated for the developer, this only thing left for them to customize:

  • eventual channel handshake additional logics
  • action when a packet is received
  • action when a packet is acknowledged
  • action when a packet timed out

To fix:

  • Can't send message from client 2 (eventually a problem from relayer or when using twice the same chain locally)
  • Acknowledgment hooks not triggered
  • Packet timeouted sometimes before the default threshold of 10 minutes
  • Error when setting timeout to 0 (while it should disable the timeout)

@ignite ignite deleted a comment from Ogungodspower5 Feb 5, 2021
@lumtis
Copy link
Contributor Author

lumtis commented Feb 8, 2021

I was thinking first of having a first PR with only one generated packet and, afterward, implement packet creation with Starport with a command but actually, it would involve having placeholders that would be then replaced.

It's better to atomically push the packet creation command with the whole IBC module creation feature. It would be a command that takes the data that compose the packet and generate everything for sending the packet in a method SendFooPacket in the keeper. This method can then be called in a handler to perform the IBC transmission.
It would also generate the type dispatcher when a packet is receiving.

Ideas for the format of the command? Since a packet is a type, I am thinking we could transform the type command into a whole namespace and have everything related to type generation in this namespace.

Therefore we could have:

starport type crud post text --module blog
starport type packet post text --module ibcblog

Any opinion on this @fadeev @ilgooz @clockworkgr ?

@fadeev
Copy link
Contributor

fadeev commented Feb 9, 2021

I propose starport packet post text --module ibcblog. We don't want to modify the type command just yet and packet is substantially different from type (it doesn't add crud, right?).

The general idea is that we add features trying not to modify the existing command set of Starport. Once we get closer to 1.0 and we understand exactly the functionality that Starport will provide, we'll reorganize commands into a better system in a single release.

@lumtis
Copy link
Contributor Author

lumtis commented Feb 9, 2021

I agree we should avoid changing the design of the command whenever possible.
The idea for the namespace is if we plan in the future to continue to enrich the scaffolding feature, we are likely to consider other type generation possibilities and then all of those types of command should be inside the same namespace.

One another simple example is about scaffolding a type without CRUD operations, where you simply have the keeper methods to set the type, delete, etc. but not the generated transactions. For me it is not intuitive that type directly means having CRUD operations.

If we consider IBC packets should not be linked to this namespace I'm ok with this. Although I would consider directly allocating a new namespace for every IBC related commands in the future starport ibc packet ... --module foo

@fadeev
Copy link
Contributor

fadeev commented Feb 16, 2021

Right now we're adding packets to the same types/packet.go file with a string replacement. Wouldn't it be better if we had like packet_post.go and packet_user.go to make it less fragile?

I would also add underscore in cli/txpost.go for readability.

@lumtis
Copy link
Contributor Author

lumtis commented Feb 16, 2021

I got inspired by the structure of ibc-transfer but it's actually better to have the least placeholder as possible for better mainabitlity

@lumtis lumtis marked this pull request as ready for review February 17, 2021 09:21
@lumtis lumtis requested review from fadeev and ilgooz as code owners February 17, 2021 09:21
@lumtis lumtis added this to the v0.15 milestone Feb 17, 2021
Copy link
Member

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

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

Great work Lucas!

@fadeev fadeev requested a review from toschdev February 19, 2021 11:42
lumtis and others added 3 commits February 19, 2021 13:41
Co-authored-by: İlker G. Öztürk <ilkergoktugozturk@gmail.com>
@lumtis lumtis requested a review from ilgooz February 19, 2021 15:28
Copy link
Contributor

@fadeev fadeev left a comment

Choose a reason for hiding this comment

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

This is seriously cool! Can't wait to have "hello world" for IBC 🛰

@lumtis lumtis merged commit 019c44f into develop Feb 19, 2021
@lumtis lumtis deleted the feat/ibc-module branch February 19, 2021 19:28
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
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.

feat: scaffold an IBC module

4 participants