This repository was archived by the owner on Oct 31, 2024. It is now read-only.
Replies: 1 comment 2 replies
-
|
Nice write-up 👌 I just see one non-critical question: on whether we want to refuse the handshake in case that one element in I guess we'll prefer at first to accept the stream even in case that some positions are incorrect for some source subnet (e.g, mismatch between given cert id and position, or the position is way too far in the future, etc) So that we avoid stalling the entire testing system in case of issue with the history of one subnet |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal is here to define a starting point on how to handle the different kind of input that can be sent to the TCE gRPC server from any client.
We will try to define a unique API for any clients using this gRPC entrypoint. The goal is to allow anyone to define a context to drive what certificates are pushing to the stream.
For simplicity, I’ll only talk about
target stream, meaning that only certificate which targets a particular subnet are going to be pushed.Opening the stream
After negotiating and handshake between the client and the server, the stream needs to know what certificates send. To do so, the client needs to use the
OpenStreammessage in order to define a context that can be used by the server.The
OpenStreammessage is defining aTargetCheckpointthat contains various information:target_subnet_ids: A list of targeted subnet ids that the client is interested in receiving the certificates. This field can't be empty and need at least one subnet_id.positions: A list ofTargetSubnetPositionthat define the local state of the client.In the next sections, I’m going to use a state representing the state of a TCE node internally, such as:
The
subnet_Ais having 7 certificates targeting it, it produced 2 certificates.The
subnet_Bis having 2 certificates targeting it, it produced 3 certificates.The
subnet_Cis having 1 certificate targeting it.The
subnet_Dis having 0 certificate targeting it, it produced 3 certificates.The certificate
0x07is targeting bothsubnet_Aandsubnet_C.In this example, the
certificate_idrepresent some kind of "ordering" across certificates. Meaning that0x03is coming before0x04and after0x02.OpenStream without position
OpenStream { target_checkpoint: TargetCheckpoint { target_subnet_ids: [subnet_A], positions: [] } }When a client sends this
OpenStreamthe server will translate it that way:subnet_AThe server needs to respond with a
StreamOpenedand will start pushing certificates.The response for the current query will be:
OpenStream with position
OpenStream { target_checkpoint: TargetCheckpoint { target_subnet_ids: [subnet_A], positions: [ TargetStreamPosition { target_subnet_id: subnet_A, source_subnet_id: subnet_B, position: 1, certificate_id: 0x03, }, TargetStreamPosition { target_subnet_id: subnet_A, source_subnet_id: subnet_D, position: 1, certificate_id: 0x05, } ] } }When a client sends this
OpenStreamthe TCE will translate it that way:subnet_Asubnet_Bsubnet_DThe server needs to respond with a
StreamOpenedand will start pushing certificates.The response for the current query will be:
OpenStream with multiple subnet_id
OpenStream { target_checkpoint: TargetCheckpoint { target_subnet_ids: [subnet_A, subnet_C], positions: [] } }Requesting an
OpenStreamwith multipletarget_subnet_idswill return certificates targeting every subnet defined. Duplication will be removed. In our example, the certificate0x07is both targetingsubnet_Aandsubnet_Cbut the TCE is going to push the certificate only one time.CertificatePushed
The pushed certificate message is containing only the certificate. In order to allow the client to track the progress, we have two options:
CertificatePushedmessage, containing a list ofTargetStreamPositionCertificatePushedit needs to infer the positionI would prefer the first option.
Beta Was this translation helpful? Give feedback.
All reactions