-
Notifications
You must be signed in to change notification settings - Fork 398
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
Ordered / unordered channels #132
Comments
Unordered channels will need an accumulator to track received packets. It can just store a hash though. |
We could still keep the maximum index before which all packets have been received. |
func receivePacketUnordered(packet Packet) {
allpacketmax := getMaximuimIndexAllPacketReceived()
if allpacketmax + 1 != packet.Index {
setPacketReceived(packet.Index)
return
}
allpacketmax += 1
for rpacket := range iteratePacketReceived() {
if rpacket.Index != allpacketmax + 1 {
break
}
allpacketmax += 1
deletePacketReceived(rpacket.Index)
}
setMaximumIndexAllPacketReceived(allpacketmax)
} The relayers can still relay ordered func relayOrdered() {
allpacketmax := chainDest.QueryMaximimIndexAllPacketReceived()
packet := chainSrc.QueryPacketSent(allpacketmax)
chainDest.TxRelayPacket(packet)
} or unordered func relayUnordered(index uint64) {
chainSrc.QueryPacketSent(index)
chainDest.TxRelayPacket(packet)
// unlike ordered channel, it does not fail even if
// the packet is not the successor of the latest packet sent
} in this way any packet sent unordered are marked as sent( |
Yes, that would be the idea. I am a bit concerned about the iteration on-chain however. Better to have the relayer provide start / end indices of packets to be cleaned up and the chain just verifies that they have all been received (and |
Split off from #126. Would be superseded by #131 if we implement that. Otherwise,
The text was updated successfully, but these errors were encountered: