Public execution
Transactions have a public execution component. Once a transaction is picked up by a sequencer to be included in a block, the sequencer is responsible for executing all enqueued public function calls in the transaction. These are defined by the data.accumulatedData.publicCallStack
field of the transaction object, which are commitments to the preimages of the enqueuedPublicFunctionCalls
in the transaction. The sequencer pops function calls from the stack, and pushes new ones as needed, until the public call stack is empty.
Bytecode
Unlike private functions, which are native circuits, public functions in the Aztec Network are specified in AVM bytecode . This bytecode is executed and proven in the Aztec Virtual Machine. Each enqueued public function spawns a new instance of the AVM, and a public kernel circuit aggregates these calls and produces a final proof of the transaction, which also includes the private kernel circuit proof of the transaction generated during local execution.
State
Since public execution is run by the sequencer, it is run on the very-latest state of the chain as it is when the transaction is included in the block. Public functions operate on public state, an updateable key-value mapping, instead of notes.
Reverts
Note that, unlike local private execution, public execution can revert due to a failed assertion, running out of gas, trying to call a non-existing function, or other failures. If this happens, the sequencer halts execution and discards all side effects from the transaction payload phase. The transaction is still included in the block and pays fees, but is flagged as reverted.