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

Code structure for packet v2 and eureka #7216

Closed
4 tasks
colin-axner opened this issue Aug 28, 2024 · 2 comments
Closed
4 tasks

Code structure for packet v2 and eureka #7216

colin-axner opened this issue Aug 28, 2024 · 2 comments
Labels
feat: ibc-eureka feat: port-router needs discussion Issues that need discussion before they can be worked on
Milestone

Comments

@colin-axner
Copy link
Contributor

Summary

Separate core IBC handlers into 3 sections:

  • classic (03-connection, 04-channel)
  • client (02-client)
  • packet (eureka packet server)

Problem Definition

Given the redesign of core IBC, we should take a second to create an intuitive folder structure/code layout.

Proposal

core IBC should maintain it's public msg server which has:

  • handshake rpc's
  • packet rpc's

It should embed a classic server to handle packet v1 types and it should also embed the client server and packet server. We could choose to move the existing implementations to their respective submodules #19 (I would recommend). We would keep the core IBC msg server, but it would either embed or redirect to each implementation as appropriate. This would mean the client msgs would be implemented on the 02-client keeper. The classic 04-channel msgs would be implemented on the channel keeper and the new v2 handlers would be implemented on the packet keeper.

Given that packet v2 (multi-packet data) will be used by the packet server and will create a new ibc module callback interface, I would recommend simplifying the core IBC msg server such that it either redirects to the legacy msg server or the packet msg server. There are likely a mirage of tricks that can be used here, but generally I am hoping for something like:

func (k *Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacket) (*channeltypes.MsgRecvPacketResponse, error) {
    packet := msg.GetPacket()
    if packet.IsLegacy() {
        return k.classicServer.RecvPacket(goCtx, msg)
    }
    
    return k.packetServer.RecvPacket(goCtx, msg)
}

The code layout might look like:

modules/
    core/
        keeper/
            msg_server.go
        server/
            classic/
                03-connection/
                04-channel/
                    keeper/
                        msg_server.go
            client/
                keeper/
                    msg_server.go
                types/
            packet/ // contains eureka + packet v2
                keeper/
                    msg_server.go
                types/

Optionally client can be 02-client or client-router.

In addition, I would recommend that each sub msg server also handle the application callbacks (packet server would have a port router) rather than having all the callbacks occur at the top level. The top level should be for composition of the sub components


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
  • Estimate provided
@colin-axner colin-axner added needs discussion Issues that need discussion before they can be worked on feat: port-router feat: ibc-eureka labels Aug 28, 2024
@colin-axner colin-axner added this to the v10.0.0 milestone Aug 28, 2024
@colin-axner
Copy link
Contributor Author

Happy to close this issue as I think the discussed content was investigated by #7302 and #7301 and will be settled on by the team without needing to have a separate pr to address this issue specifically

cc @chatton

@chatton
Copy link
Contributor

chatton commented Oct 1, 2024

Yep I think we can close, thanks @colin-axner

@chatton chatton closed this as completed Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: ibc-eureka feat: port-router needs discussion Issues that need discussion before they can be worked on
Projects
Status: Done
Status: Done 🥳
Development

No branches or pull requests

2 participants