Glow end point projection (EPP)

Reference - Glow White Paper

End-Point Projection is used to extract:

  1. Client code for each participant, in a client language.
  2. Contract code for each blockchain, in a contract language.
  3. Verified logical model for DApp, in a logical language.

These are called End-Point languages.

Simple implementation - Direct Style

  1. Divide into interaction steps. Each step is the largest consecutive block of elementary actions (arithmetic, copying data etc…), which satisfy specific constraints.

  2. Simple functions that can be completed within a single interaction step, can be inlined or translated into function calls in contract language.

  3. For more complex control structures without such guarantee:

  4. They have to be first reduced to data structure, using CPS.

  5. Divide code into atomic blocks with only simple functions, and no change in participant.

  6. Control structure replaced with explicit pushing / popping of frames to and from an explicit control stack.

  7. For each action EPP generates:

  • Client code for participant to perform the action
  • Code in all other participants’ clients to check that the action is performed correctly. Or else take correction action.
  • Code in the on-chain contract to verify whether action was performed correctly, and enact appropriate consequences.
  • Logical specification of DApp behavior, when participant performs the action.
  • Logical specification of DApp behavior, when participant fails to perform action.
  1. For each consensual action EPP generates:
  • Code in all participants’ clients to perform action and monitor contract as it performs the action.
  • Code in the on-chain contract to perform the action
  • Logical specification of the DApp behavior as the contract performs the action.
  1. Each interaction step is then translated in the step’s active participant performing:
  • in sequence all the actions in the step,
  • finally sending a single message to the contract containing all the data published, together with all the assets transferred. We may merklize DApp state at this point.
  • The contract will then verify that message is valid. That each action applies to the current state of the contract, and satisfies all requirements.
  • Each participant watch the blockchain to see when the message is posted, and interaction step completed. They don’t have to do consensual checks, since contract enforces these.
  • Each interaction step comes with a deadline, typically based on a time limit since previous interaction step.
  • If participant fails to complete interaction step, other participants can send msg to contract to declare him default.

Why group into interaction steps?

consequences are the same regardless of which action in the group a participant stops cooperating at. It minimizes amount of messages exchanged between participants.

Constraints:

  • Actions must be consecutive, by the participant or consensus.
  • Boundary is when another participant takes an action / interaction protocol ends.