skywire-testnet
skywire-testnet copied to clipboard
Improve transport-settlement handshake.
Depends on PR:#252
Description
We should depend on transport-discovery to settle transports, otherwise it may lead to some ambiguity. The following changes depend on deterministic Transport IDs (implemented within PR:#252).
The transport-settlement handshake SHOULD look as follows:
Legend
TpDisc
- Transport Discovery.Init-er
- Transport Initiating Node.Resp-er
- Transport Responder Node.E
- Transport Entry.S
- Signature.TpID
- Transport ID.Wait(<v>)
- Repetitively query until the resource is obtained.
The current implementation of the transport-settlement handshake works very similarly to the aforementioned. The only differences include:
- The
Resp-er
replies withE+2S
(Entry with two signatures) instead ofTpID
(Transport-ID). - The
Resp-er
does not wait for theTpDisc
to have the entry submitted.
Further Notes
For the implementation, ensure that:
- Only NEWLY-CREATED transports should go through the settlement-handshake. Always check the Transport Discovery whether the transport already has an entry. Both edges of the settlement-handshake should check this.
- The Initiator should check with the Transport Discovery whether a settlement-handshake is needed.
- The Responder should check the Transport Discovery whenever they
Factory.Accept()
a transport, if a settlement-handshake is required.
Tasks
- [ ] Make the aforementioned changes.
- [ ] Update tests.
- [ ] Update Skywire Specifications.
@evanlinjin this should simplify the transport establishment. However, if the tpID is deterministic, then why would Resp-er
even respond with the tpID? Would that not just increase the number of messages?
@jdknives
- We need a way for
Responder
to informInitiator
that it accepts the request. - Given the assumption that
Responder
will always agree to establish the transport, the alternate solution would be to haveInitiator
repetitively polltpDisc
as it awaits the confirmation of theEntry
being submitted. Or haveInitiator
requesttpDisc
with a timeout, and thetpDisc
keeps the connection withInitiator
open until theEntry
is submitted byResponder
. I am not a fan of either of these solutions as it adds more logic and complexity than what I have suggested.