Skip to main content
The approval module contains data structures for managing the approval workflow in TAPLE. Events that require approval must go through this process before being applied to a subject’s state.

ApprovalRequest

Represents a request for approval of an event.
event_request
Signed<EventRequest>
required
The signed event request.
sn
u64
required
The sequence number of the event.
gov_version
u64
required
The version of the governance contract.
patch
ValueWrapper
required
The patch to apply to the state.
state_hash
DigestIdentifier
required
The hash of the state after applying the patch.
hash_prev_event
DigestIdentifier
required
The hash of the previous event.
gov_id
DigestIdentifier
required
The identifier of the governance contract.

ApprovalResponse

Represents a response to an approval request.
appr_req_hash
DigestIdentifier
required
The hash of the approval request being responded to.
approved
bool
required
Whether the approval request was approved or not.

ApprovalEntity

Represents a complete approval entity, tracking the request, response, and state.
id
DigestIdentifier
required
The identifier of the approval entity.
request
Signed<ApprovalRequest>
required
The signed approval request.
response
Option<Signed<ApprovalResponse>>
The signed approval response, if one has been received.
state
ApprovalState
required
The state of the approval entity.
sender
KeyIdentifier
required
The identifier of the entity that sent the approval request.

ApprovalState

An enum representing the possible states of an approval entity.
Pending
The approval entity is pending a response.
RespondedAccepted
Request for approval which is in responded status and accepted.
RespondedRejected
Request for approval which is in responded status and rejected.
Obsolete
The approval entity is obsolete.

Approval Workflow

  1. Request - An ApprovalRequest is created and sent to approvers
  2. Review - Approvers review the request and create an ApprovalResponse
  3. Collection - Responses are collected until quorum is reached
  4. Application - If approved, the event is applied to the subject

Example

// Create an approval response
let approval_response = Signed::<ApprovalResponse>::new(
    event_proposal_hash,
    true, // approved
    signature,
);

// Verify the response
approval_response.verify()?;
  • Event - Events that may require approval
  • Signed<T> - Wrapper for cryptographically signed data
  • DigestIdentifier - Cryptographic identifier
  • Signature - Cryptographic signature

Build docs developers (and LLMs) love