Skip to content
module arch.system.state.resource_machine.data_structures.action.index;

Action

An action is a composite structure of type Action that contains the following components:

Component Type Description
logicVerifierInputs Map Tag LogicVerifierInputs For each resource tag, contains the associated logic proof and everything required to verify it. The structure of LogicVerifierInputs is further described below.
complianceUnits List ComplianceUnit The set of transaction's compliance units.

LogicVerifierInputs

Name Type Description
verifyingKey ResourceLogicProvingSystem.verifyingKey Contains the verifying key used to verify the logic proof.
applicationData (ResourcePayload, DiscoveryPayload, ExternalPayload, ApplicationPayload) Contains inputs required to verify the RL proof. Each payload type is List(BitString, DeletionCriterion). The tuple entries are further described below. The deletion criterion field is further described here.
proof ResourceLogicProvingSystem.Proof The proof of the resource logic.

applicationData

Application data contains the inputs required to verify the RL proof. It has four entries, all of which of type List (BitString, DeletionCriterion):

  1. ResourcePayload – contains resource-object-related data. For example, encrypted (or not) resource object.
  2. DiscoveryPayload – contains data related to discovery, for example, FMD ciphertext.
  3. ExternalPayload – contains data associated with external calls, for example, forwarderCallData from Ethereum.
  4. ApplicationPayload – contains other data expected by the resource logic, for example, a signature to be verified.

Definitions

Actions partition the state change induced by a transaction and limit the evaluation context of resource logics: proofs created in the context of an action have access only to the resources associated with the action. A resource is said to be associated with an action if its tag is a key of the logicVerifierInputs map. A resource is associated with at most two actions: resource creation is associated with exactly one action and resource consumption is associated with exactly one action. A resource is said to be consumed in the action for a valid action if its nullifier is a key of the logicVerifierInputs map. A resource is said to be created in the action for a valid action if its commitment is a key of the logicVerifierInputs map.

Note

Unlike transactions, actions don't need to be balanced, but if an action is valid and balanced, it is sufficient to create a balanced transaction.

Interface

  1. create(List (NullifierKey, Resource, deltaExtraInput, CMtreePath, CMTreeRoot, applicationData, PS.Witness), List (Resource, deltaExtraInput, applicationData, PS.Witness)) -> Action
  2. verify(Action) -> Bool
  3. delta(Action) -> DeltaHash
  4. to_instance(Action, Tag) -> Maybe ResourceLogicProvingSystem.Instance

Proofs

For each resource consumed or created in the action, it is required to provide a proof that the logic associated with that resource evaluates to True given the input parameters that describe the state transition induced by the action. The number of such proofs in an action equals to the amount of resources (both created and consumed) in that action, even if some resources have the same logics. Resource logic proofs are further described here.

create

  1. complianceUnits: Partition the resources into compliance units and compute a compliance proof for each unit
  2. logicVerifierInputs: For each resource, compute a resource logic proof and associate each proof with the tag of the resource and other components that are required to verify it.

verify

Validity of an action can only be determined for actions that are associated with a transaction. Assuming that an action is associated with a transaction, an action is considered valid if all of the following conditions hold:

  1. All resource logic proofs associated with the action are valid
  2. All compliance proofs associated with the action are valid: cu.verify() = True for cu in complianceUnits
  3. logicVerifierInputs keys = the list of tags associated with complianceUnits (ignoring the order)

delta

action.delta() computes the action delta. Action delta is computed from r.delta() of the resources that comprise the action and defined as action.delta() = sum(cu.delta() for cu in action.complianceUnits).

to_instance

This function assembles the instance required to verify a resource logic proof from the data in the action.

The main task is to assemble the tree root containing all created and consumed resource in the action. The exact depth and shape of the tree is instantiation-dependent.