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

ICS 4: Channel & Packet Semantics #1

Closed
cwgoes opened this issue Feb 11, 2019 · 13 comments · Fixed by #34
Closed

ICS 4: Channel & Packet Semantics #1

cwgoes opened this issue Feb 11, 2019 · 13 comments · Fixed by #34
Assignees
Labels
tao Transport, authentication, & ordering layer.

Comments

@cwgoes
Copy link
Contributor

cwgoes commented Feb 11, 2019

Primarily a port of the original IBC spec.

Will cover:

  • Channel semantics
  • Required data structures
  • Standard encoding formats
  • Pseudocode algorithms for packet handling
@cwgoes cwgoes added tao Transport, authentication, & ordering layer. stage-strawman labels Feb 11, 2019
This was referenced Feb 26, 2019
@cwgoes cwgoes self-assigned this Mar 5, 2019
@cwgoes cwgoes changed the title ICS ?: IBC connection, channel, packet semantics ICS ?: IBC channel semantics Mar 5, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 5, 2019

Connection specification split into #3. Packet specification split into #24.

@cwgoes cwgoes changed the title ICS ?: IBC channel semantics ICS ?: IBC channel semantics & lifecycle Mar 5, 2019
@cwgoes cwgoes changed the title ICS ?: IBC channel semantics & lifecycle ICS 4: IBC channel semantics & lifecycle Mar 5, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 12, 2019

To-do in spec:

  • Define channel data structure which must be kept in state (probably needs to be provable)
  • Define channel negotiation handshake
  • Define possibilities for bidirectional-relay (four channels), unidirectional relay (two channels)
  • Define difference between enabling/disabling receipts
  • Enumerate security guarantees
  • Reference connection primitives as defined in ICS 3

@cwgoes
Copy link
Contributor Author

cwgoes commented Mar 18, 2019

Datagram formats that need to be defined here (that I can think of so far):

Opening handshake:

  • CHANOPENTRY - try to open a channel
  • CHANOPENACK - acknowledge & finalize a channel

Closing handshake:

  • CHANCLOSETRY - try to close a channel
  • CHANCLOSEACK - acknowledge & finalize a channel close

@cwgoes cwgoes added this to the Minimum Viable Insecure IBC milestone Mar 19, 2019
@mossid
Copy link

mossid commented Mar 20, 2019

  • Channel data structure also needed to be generic, there are some merkle tree implementation, for example merkle patricia tree, that the user cannot specify the position of the packet to be stored
  • I suggest to define a channel only from one side (like a pair of (PacketQueue, ReceiptQueue)) instead of all queues on both chains (like (PacketQueueA, PacketQueueB, ReceiptQueueA, ReceiptQueueB)). The channels are symmetric on both side so we can just define a channel as a pair of one-side channel...
  • The channel on both side should have same configuration; such as receipt enabled, type of packets allowed, expiration time, logic goverening the channel, etc. We should contain that information in the handshake message.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 3, 2019

Handshake:

  • Originating module init
  • Destination module try (open), (timeout => reset)
  • Originating module ack (open), (timeout => reset)

@cwgoes
Copy link
Contributor Author

cwgoes commented May 9, 2019

Actually I think a three-way handshake is better so some data can be conveyed / agreed-upon easily.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 9, 2019

Kinds of ordering:

  • SEQUENTIAL (exactly-once, ordered queue, track with index)
  • PARALLEL (exactly-once, unordered, track with accumulator)

@cwgoes
Copy link
Contributor Author

cwgoes commented May 9, 2019

Kinds of channel:

  • BIDIRECTIONAL - shared reference string, one queue per chain, tx/rx on both chains
  • UNIDIRECTIONAL - shared reference, one queue on sending chain, tx on A, rx on B

Bidirectional queues can only be created on bidirectional connections. Unidirectional queues can be created on (the right direction of) unidirectional connections or on bidirectional connections.

Queues are always owned by single modules.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 9, 2019

I think we will avoid receipts in the core IBC spec for now, I do not think they are fundamental.

@cwgoes
Copy link
Contributor Author

cwgoes commented May 9, 2019

I think storing full packets or just commitments can be an option on the channel level.

@cwgoes cwgoes changed the title ICS 4: IBC channel semantics & lifecycle ICS 4: Channel & Packet Semantics May 10, 2019
@cwgoes
Copy link
Contributor Author

cwgoes commented May 14, 2019

Goals of channel handshake:

  • Originating module
  • Destination module
  • Modules can negotiate some arbitrary data ("version") as part of handshake
  • Safe to send packets once complete, will be processed (how to deal with possible timeout?)
    Maybe wait for first packet sent by originating module before allowing dest. module to send.
  • 1-1 channel established once complete, no other modules can use
  • Usual asynchrony assumptions

@cwgoes
Copy link
Contributor Author

cwgoes commented May 16, 2019

Questions

  • increment sequence on packet timeout (require ordering there) too?
  • worth doing unordered channels
  • reverse mappings for client => connection, connection => channel (for safe closure)?
  • is txrx / tx / rx worthwhile? could also do at module layer presumably
  • clarify the module calling pattern

@cwgoes
Copy link
Contributor Author

cwgoes commented May 16, 2019

Ah, unordered channels are much better if you use an extra accumulator.

I think we can punt unidirectional channels until we have unidirectional or broadcast connections.

hulatown pushed a commit to hulatown/ibc that referenced this issue Apr 25, 2023
AdityaSripal added a commit that referenced this issue Sep 14, 2023
* feat: add spec for multi-hop channels

* chore: naming

* chore: add notes on chain registry

* Polymer/multihop (#1)

* ICS20: Replace Metadata with Memo (#877)

* memo string replacement

* formatting

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* ICS9: remove localhost client (#878)

* remove localhost client

* Update CHANGELOG.md

* Update README.md

* fix: update comment about channel state check in `sendPacket` (#865)

* update comment

* typo

* remove comment

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>

* ICS5: fix releasePort signature (#885)

Signed-off-by: Jun Kimura <junkxdev@gmail.com>

Signed-off-by: Jun Kimura <junkxdev@gmail.com>

* ICS721: Add tokenData to PacketData (#876)

* add tokenData to PacketData; improve TypeScript formatting

* revert else style

* extend 03-connection with a proof object for chains that can't introspect their own consensus state. (#839)

* extend 03-connection with HostConsensusStateProof

* make hostConsensusStateProof optional

* ICS28: Reflect deferred unbonding completion in spec (#826)

* call UnbondingCanComplete in EndBlock

* update README

* update ics23 link (#891)

* update eli5 blog post link (#892)

* ICS28: Sovereign to consumer chain transition (#840)

* update CreateConsumerClient for sovereign chains

* update InitGenesis for sovereign chains

* establish CCV on ACK and handle preCCV completion

* update Channel Uniqueness Correctness Reasoning

* add pre-CCV module interface with staking

* add clarifications

* add overview TODO

* fix pendingChanges bug

* refactor proposal names (#855)

* Update spec/app/ics-028-cross-chain-validation/system_model_and_properties.md

Co-authored-by: Daniel T <30197399+danwt@users.noreply.github.com>

* enable optimistic opening handshakes

* remove ConsumerAdditionProposal.initialHeight

* handle proposals in BeginBlock

* pass consumer unbonding period via gov proposal

* update channel init overview - wip

* update overview

* update modified date

* add note re. the existing staking module

Co-authored-by: Daniel T <30197399+danwt@users.noreply.github.com>

* ICS28: VSCPackets should have timeout on provider (#858)

* update CreateConsumerClient for sovereign chains

* update InitGenesis for sovereign chains

* establish CCV on ACK and handle preCCV completion

* update Channel Uniqueness Correctness Reasoning

* add pre-CCV module interface with staking

* add clarifications

* add overview TODO

* fix pendingChanges bug

* refactor proposal names

* add VSC timeout

* refactor proposal names (#855)

* Update spec/app/ics-028-cross-chain-validation/system_model_and_properties.md

Co-authored-by: Daniel T <30197399+danwt@users.noreply.github.com>

* enable optimistic opening handshakes

* remove ConsumerAdditionProposal.initialHeight

* handle proposals in BeginBlock

* pass consumer unbonding period via gov proposal

* update channel init overview - wip

* update overview

* update modified date

* ICS28: Channel initialization should have a timeout (#860)

* add init timeout

* fix typo

* add note on timed out channel init

* update vsc timeout as per implementation

Co-authored-by: Daniel T <30197399+danwt@users.noreply.github.com>

* add angbrav as code owner (#895)

Co-authored-by: Carlos Rodriguez <carlos@interchain.com>

* save progress

* start adding proof generation logic and update graphical_proof.jpg

* rm spec/.DS_Store

Signed-off-by: Jun Kimura <junkxdev@gmail.com>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Jun Kimura <junkxdev@gmail.com>
Co-authored-by: Haifeng Xi <haifeng@bianjie.ai>
Co-authored-by: Web3 Philosopher <seunlanlege@gmail.com>
Co-authored-by: Marius Poke <marius.poke@posteo.de>
Co-authored-by: Daniel T <30197399+danwt@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.com>

* update to ics-033

* start updating channel spec for multihop; add diagram for relayer proof querying

* chore: update spec history

* chore: spacing

* remove TODO comment; per PR feedback, connection proof not require for channel INIT

* add comment to MultihopProof struct making the proof ordering more clear; update proof generation logic to not include the key which should be generated during verification

* add verification proof pseudo code

* add/update multihop proof verification logic

* Update spec/core/ics-004-channel-and-packet-semantics/README.md

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update spec/core/ics-033-multi-hop/README.md

Co-authored-by: Aditya <adityasripal@gmail.com>

* remove consState var to simplify consensusState update assignment

* rename VerifyMultihopConsensusStateProof --> VerifyMultihopConsensusAndConnectionStateProofs to better reflect the function logic; further simplify the function logic and update comments

* simplify multihop proof logic steps further

* Ds/multihop (#4)

update multi-hop diagrams and remove old diagrams

* start updating multihop spec to include client state information in the proof

* check consensus/connection proof lengths immediately

* update spec with latest multihop solution

* remove client state from multihop proofs

* update spec with chanCloseFrozen; fix/update other parts of multihop spec

* revise and update multihop spec details

* add check to match client id in ConnectionEnd with client id in subsequent consensus state key

* fix indentation

* Update spec/core/ics-033-multi-hop/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update spec/core/ics-033-multi-hop/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update spec/core/ics-033-multi-hop/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update spec/core/ics-004-channel-and-packet-semantics/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update spec/core/ics-004-channel-and-packet-semantics/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* Update spec/core/ics-004-channel-and-packet-semantics/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* fix typo prevChain --> previousChain

* add comments for connection and multihopConnectionEnd

* Update spec/core/ics-003-connection-semantics/README.md

Co-authored-by: Aditya <adityasripal@gmail.com>

* add frozen channel proof generation logic

* refactor getMaxDelayPeriod to return the time and block delay

* use Identifier type instead of string for connectionHops array

* cleanup proof gen pseudo code

* check proof heights for consensus and connection states during multihop proof generation; use "proofHeight" instead of "keyHeight" for consistency

* Update spec/core/ics-033-multi-hop/README.md

Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>

* cleanup multihop proof gen pseudo code

* remove trailing whitespace; refactor multihop proof generation and add proof gen helper function descriptions

* add extra info about connectionHops ordering; update proof ordering to match connectionHops (receiver --> sender)

* clarify multi-hop proof verification now that proof ordering matches the connectionHops ordering (receiver --> sender)

* address latest PR feedback

* more pr feedback

* address more multihop PR feedback

* update multi-hop proof query/verification specs and add frozen channel proof logic

* update multi-hop proof diagrams

* wip address latest PR feedback

* add more clarifying comments/explanations and incorporate more PR feedback

---------

Signed-off-by: Jun Kimura <junkxdev@gmail.com>
Co-authored-by: Derek <derek@polymerlabs.org>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Jun Kimura <junkxdev@gmail.com>
Co-authored-by: Haifeng Xi <haifeng@bianjie.ai>
Co-authored-by: Web3 Philosopher <seunlanlege@gmail.com>
Co-authored-by: Marius Poke <marius.poke@posteo.de>
Co-authored-by: Daniel T <30197399+danwt@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.com>
Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>
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