-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
WIP: Initial IBC Spec #608
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #608 +/- ##
========================================
Coverage 66.09% 66.09%
========================================
Files 38 38
Lines 2094 2094
========================================
Hits 1384 1384
Misses 603 603
Partials 107 107 |
closes #602 |
docs/spec/ibc/ibc.md
Outdated
} | ||
|
||
type IBCTransfer struct { | ||
Destination sdk.Address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont we need a destination ChainID ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, eventually we will need to add a couple of more fields to IBCTransfer
. The goal for the first iteration is to keep everything as simple as possible so that we can get to an end-to-end process the fastest. Once we have an end-to-end process we'll extend everything and build up everything around it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what good is an MVP of IBC if we can't send to another chain? Maybe I'm not understanding something ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will assume that only two zones(hubs) are connected to each other directly, so the destination chain id is determined implicitly. We will add most of security functionalities(destchain checking, lightclient..) on the mvp2.
docs/spec/ibc/ibc.md
Outdated
|
||
**Packets** | ||
* Connect to 2 Tendermint RPC endpoints | ||
* Query for IBC outgoing `IBCOutMsg` queue (can poll on a certain time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If messages have sequence numbers, it can queue for a particular key determined based on next sequence number.
Token transfer between 2 chains using simple IBC API chain A:
note: ibc_transfer_timeout is always generated after timeout has passed chain B:
note: we assume chains never totally fail, i.e., they will eventually send the |
Here's the first box transliterated to Golang with minor changes // app init somewhere
ibcKeeper := ibc.NewKeeper(chain_A, config)
ibcChan := ibcKeeper.NewChannel(chain_B, ...)
ibcTable := ibcKeeper.IBCTable()
ibcTable.RegisterPacketHandler(ibc.PacketTypeAck, func(ctx sdk.Context, pkt ibc.Packet) {
if pkt.Timeout < block_header then {
burn winks from bonded_account
ibcChan.Send(ibc.NewAckPacket(nil, ??))
}
else
{
move(50 winks, bonded_account, Alice)
ibcChan.Send(ibc.NewAckPacket(err, nil))
}
})
ibcTable.RegisterPacketHandler(ibc.PacketTypeTimeout, func(ctx sdk.Context, pkt ibc.Packet) {
move (50 winks, bonded_account, Alice)
ibcChan.Send(ibc.NewAckPacket(err, nil))
})
// in DeliverTx somewhere
move(50 winks, Alice, deposit_account)
packet := NewIBCPacket(dst_id, 50, "winks", Alice, Bob, 1005)
ibcChan.Send(packet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schone!
Who sends the Presumably possible for timeout to pass, then ack packet to come later, so I think there needs to be a check for asset de-escrow to ensure Alice can't get her tokens back twice, e.g.
|
@adrianbrink, @mossid and I planned out just enough of the IBC spec to start moving forward with implementation, with room to expand to something closer to the design made by @ethanfrey (https://github.com/cosmos/ibc/blob/master/CosmosIBCSpecification.pdf).
closes #602