cosmos / ibc-go

Inter-Blockchain Communication Protocol (IBC) implementation in Golang.
https://ibc.cosmos.network/
MIT License
554 stars 593 forks source link

Ibcmodulev2 transfer application spike #7524

Closed bznein closed 6 days ago

bznein commented 3 weeks ago

Description

This Spike was done by Cian & Nikolas to help inform the IBCModuleV2 interface definition and to get a PoC of what a transfer v2 module looks like and ensures that funigibility between v1 and v2 can be retained.

A few notes about what we did here before anything goes into the feature branch.

This test ensures that fungibility remains and tokens can be sent back and forth using either the v1 or v2 router.

Questions

  1. What does forwarding look like in transfer v2? In v1 we stored the forwarded packets in state, we no longer provide the entire packet to the application callbacks.
  2. Are we happy with the general idea of re-using the transfer keeper and extending/overriding with new logic where appropriate.
  3. If we are going to include the sequence, should we also include the timeout timestamp? Previously we included the full packet in the application callbacks, but now we are providing a subset of that information. Are there use cases where this extra info should be needed? I guess there is nothing stopping an application from including the timestamp in the packet data if required. I think it's probably fine to omit.

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why.

gjermundgaraba commented 3 weeks ago

Are we happy with the general idea of re-using the transfer keeper and extending/overriding with new logic where appropriate.

To me, this depends a lot on how long we expect v1 to live in our codebase. Short-term, this might be OK, I don't love the idea of a v2 depending on v1 and having these convoluted paths that might end up with weird bugs later. For one release, I might be OK :)

I guess there is nothing stopping an application from including the timestamp in the packet data if required. I think it's probably fine to omit.

But the application would not know if the timestamp is the same as in the packet, unless only the application is allowed to construct new packets on all implementations?

chatton commented 3 weeks ago

Are we happy with the general idea of re-using the transfer keeper and extending/overriding with new logic where appropriate.

To me, this depends a lot on how long we expect v1 to live in our codebase. Short-term, this might be OK, I don't love the idea of a v2 depending on v1 and having these convoluted paths that might end up with weird bugs later. For one release, I might be OK :)

Thinking a bit more about this, I was thinking it might be possible to create some type that is a subset of of the transfer keeper that has all the functionality that is shared (e.g. code regarding denoms/ native vs ibc etc. )

Extracting some interfaces/ functions into a the transfer v1 module, then having (potentially a new go mod for) transfer v2 import from v1 the required components/functions and implement all the new logic in a new keeper while re-using a subset from v1.

Kind of similar to what is happening in this PR, but this is a bit messier just shoving it all in a sub directory.

gjermundgaraba commented 1 week ago

For some context: this PR is being split up in such a way that forwarding support will happen in a separate PR.

sonarcloud[bot] commented 6 days ago

Quality Gate Passed Quality Gate passed for 'ibc-go'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud