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

Ordered / unordered channels #132

Closed
cwgoes opened this issue Jun 25, 2019 · 4 comments · Fixed by #144
Closed

Ordered / unordered channels #132

cwgoes opened this issue Jun 25, 2019 · 4 comments · Fixed by #144
Assignees
Labels
tao Transport, authentication, & ordering layer.
Milestone

Comments

@cwgoes
Copy link
Contributor

cwgoes commented Jun 25, 2019

Split off from #126. Would be superseded by #131 if we implement that. Otherwise,

  • Add unordered channels, with timeout semantics as they currently are
  • Alter ordered channels so that timeouts (of any packet) immediately close ordered channels
@cwgoes cwgoes added the tao Transport, authentication, & ordering layer. label Jun 25, 2019
@cwgoes cwgoes self-assigned this Jun 25, 2019
@cwgoes cwgoes added this to the Specification Clarification milestone Jun 25, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Jun 29, 2019

Unordered channels will need an accumulator to track received packets. It can just store a hash though.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jul 2, 2019

We could still keep the maximum index before which all packets have been received.

@mossid
Copy link

mossid commented Jul 2, 2019

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(setPacketReceived) individually onchain and pruned once the maximum index catches it

@cwgoes
Copy link
Contributor Author

cwgoes commented Jul 4, 2019

in this way any packet sent unordered are marked as sent(setPacketReceived) individually onchain and pruned once the maximum index catches it

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 cleanupReceived should be separate from recvPacket).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tao Transport, authentication, & ordering layer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants