Skip to content

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

@joshuakarp

Description

@joshuakarp

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions