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
created OrderedSet Commitment contains commitments of resources created in this action
consumed OrderedSet Nullifier contains nullifiers of resources consumed in this action
resourceLogicProofs Map Tag (LogicRef, PS.Proof) contains a map of resource logic proofs associated with this action. The key is the self resource for which the proof is computed, the first parameter of the value opens to the required verifying key, the second one is the corresponding proof
complianceUnits Set ComplianceUnit The set of transaction's compliance units
applicationData Map Tag OrderedSet (BitString, DeletionCriterion) maps tags to relevant application data needed to verify resource logic proofs. The deletion criterion field is described here. The openings are expected to be ordered.

Note

For function privacy in the shielded contenxt, instead of a logic proof we verify a proof of a logic proof validity - a recursive proof. LogicRefHash type corresponds to the RL VK commitment while verifying key in resourceLogicProofs refers to the key to be used for verification (i.e., verifier circuit verifying key as opposed to a resource logic verifying key). RL VK commitment should be included somewhere else, e.g., applicationData[tag], and the compliance instance must reference it in refInstance as it is also a compliance proof instance.

Actions partition the state change induced by a transaction and limit the resource logics evaluation context: 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 commitment or nullifier is present in the action's created or consumed correspondingly. A resource is associated with exactly one action. A resource is said to be consumed in the action for a valid action if its nullifier is present in the action's consumed list. A resource is said to be created in the action for a valid action if its commitment is in the action's created list.

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(Set (NullifierKey, Resource), Set Resource, ApplicationData) -> Action - creates an action
  2. delta(Action) -> DeltaHash
  3. verify(Action) -> Bool

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

Given a set of input resource objects consumedResources: Set (NullifierKey, Resource, CMtreePath), a set of output resource plaintexts createdResources: Set Resource, and applicationData, including a set of application inputs required by resource logics, an action is computed the following way:

  1. Partition action into compliance units and compute a compliance proof for each unit. Put the information about the units in action.complianceUnits
  2. For each resource, compute a resource logic proof. Associate each proof with the tag of the resource and the logic hash reference. Put the resulting map in action.resourceLogicProofs
  3. action.consumed = r.nullifier(nullifierKey) for r in consumedResources
  4. action.created = r.commitment() for r in createdResources
  5. action.applicationData = applicationData

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. action input resources have valid resource logic proofs associated with them: verify(RLVerifyingKey, RLInstance, RLproof) = True
  2. action output resources have valid resource logic proofs associated with them: verify(RLVerifyingKey, RLInstance, RLproof) = True
  3. all compliance proofs are valid: complianceUnit.verify() = True
  4. transaction's \(rts\) field contains correct CMtree roots (that were actual CMtree roots at some epochs) used to prove the existence of consumed resources in the compliance proofs.

delta

action.delta() -> DeltaHash is a computable component used to compute transactionDelta. It 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).