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

Apply timedCancellable to Sigchain such as the deadline in nodes claim process #243

Open
joshuakarp opened this issue Sep 21, 2021 · 3 comments
Labels
development Standard development enhancement New feature or request r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy

Comments

@joshuakarp
Copy link
Contributor

Specification

From original node claims issue: #213 (comment)

Due to intermediate resources being created for this interaction between 2 agents to sign each node, we will need a deadline for each interaction step.

To simplify, you can have a single deadline for the entire interaction from step 2 onwards.

X -> sends notification to (to start cross signing request)( -> Y
STEP 2 BEGINS HERE:
X <- calls cross signing grpc request and sends its signed claim (intermediate) <- Y (use bidirectional stream and lock the sigchain on Y and X)
X -> responds with double signing the Y signed claim, and also bundles it with its own signed claim (intermediate) -> Y
X <- responds with double signing the X signed claim <- Y

Both X and Y would need a deadline starting from step 2.

To implement a deadline, there are 2 ways:

  1. Using the underlying GRPC deadline functionality - I've seen this parameter get used in unary calls, but I don't know how that applies to streams, it may not relevant to streams.
  2. Using racing promises. I've already implemented this pattern in the networking domain. See the usage of timerStart and timerStop inside ForwardProxy and the Promise.race call in ConnectionForward. The usage is quite complex in the networking domain, but in the case of this node claims process, the entire usage of the Timer type (in src/types.ts) should be executed entirely inside the GRPCClientAgent of Y and agentService of X. However it is possible to consider the construction and destruction of the timer object in the imperative shell, and then use it in an optional way inside the nodes domain.

If the deadline fails it's an exception in the interaction. Upon this exception you need to throw the relevant error to the other side of the interaction, and then finish up and clean up any intermediate resources. Remember to UNLOCK your domains!

This work should be extended into other relevant gRPC calls too.

Additional context

Tasks

  1. Look into the pre-existing timeout construct
  2. Add timeout to both client-side and server-side claims process
  3. Throw relevant exceptions on timeout (close stream, etc)
@CMCDragonkai
Copy link
Member

Using deadlines right now is tricky due to our async start ops in the client interceptor: #249 (comment).

May not affect agent service for now due to lack of any interceptor.

@CMCDragonkai
Copy link
Member

This should be integrated into the design in #297.

@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy label Jul 24, 2022
@tegefaulkes tegefaulkes changed the title Incorporate deadlines into nodes claims process Apply timedCancellable to Sigchain such as the deadline in nodes claim process Oct 5, 2022
@CMCDragonkai CMCDragonkai self-assigned this Nov 2, 2022
@CMCDragonkai
Copy link
Member

In our new RPC design, we are envisioning the ability for the server to call back the client while handling the client's call. This should replace the duplex stream being used currently to do this. Each call can have a deadline, so then naturally this issue will be resolved if each subcall has a deadline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development enhancement New feature or request r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy
Development

No branches or pull requests

4 participants