Anoma.Node.Transaction.Backends (Anoma v0.34.0)

I am the Transaction Backend module.

I define a set of backends for the execution of the given transaction candidate. Currently, I support transparent resource machine (RM) execution as well as the following debug executions: read-only, key-value store, and blob store executions.

Public API

I have the following public functionality:

Summary

Functions

I execute the specified transaction candidate using the designated backend. If the transaction is provided as a jammed noun atom, I first attempt to apply cue/1 in order to unpack the transaction code.

Types

backend()

@type backend() ::
  :debug_term_storage
  | {:read_only, pid()}
  | :transparent_resource
  | :cairo_resource

transaction()

@type transaction() :: {backend(), Noun.t() | binary()}

Functions

execute(node_id, arg, id)

@spec execute(node_id, {back, Noun.t()}, id) :: :ok
when id: binary(), node_id: String.t(), back: backend()

I execute the specified transaction candidate using the designated backend. If the transaction is provided as a jammed noun atom, I first attempt to apply cue/1 in order to unpack the transaction code.

First, I execute the transaction code on the Anoma VM. Next, I apply processing logic to the resulting value, dependent on the selected backend.

  • For read-only backend, the value is sent directly to specified recepient.
  • For the key-value and blob store executions, the obtained value is stored and a Complete Event is issued.
  • For the transparent Resource Machine (RM) execution, I verify the transaction's validity and compute the corresponding set of nullifiers, which is transmitted as a Nullifier Event.

nullifier_existence_check(transaction, node_id, id)

@spec nullifier_existence_check(
  Anoma.CairoResource.Transaction.t(),
  String.t(),
  binary()
) ::
  true | {:error, String.t()}

root_existence_check(transaction, node_id, id)

@spec root_existence_check(Anoma.CairoResource.Transaction.t(), String.t(), binary()) ::
  true | {:error, String.t()}

store_value(node_id, id, result)

@spec store_value(String.t(), binary(), Noun.t()) :: {:ok, any()} | :error