Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed May 21, 2024
1 parent f904e73 commit 8f4187c
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 792 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ New L2 to L1 messages contains messages that are delivered to the [l1 outbox](/p

## Public Context

The Public Context includes all of the information passed from the `Public VM` into the execution environment. It is very similar to the [Private Context](#the-private-context), however it has some minor differences (detailed below).

### Public Context Inputs

In the current version of the system, the public context is almost a clone of the private execution context.

#include_code public-context-inputs /noir-projects/aztec-nr/aztec/src/context/inputs/public_context_inputs.nr rust
The Public Context includes all of the information passed from the `Public VM` into the execution environment. Its interface is very similar to the [Private Context](#the-private-context), however it has some minor differences (detailed below).

### Public Global Variables

Expand Down
20 changes: 20 additions & 0 deletions docs/docs/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ keywords: [sandbox, cli, aztec, notes, migration, updating, upgrading]

Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them.

## TBD

## Public execution migrated to the Aztec Virtual Machine

Before this change, public bytecode was executed using the same simulator as in private: the ACIR simulator (and internally, the Brillig VM). On the Aztec.nr side, public functions accessed the context through `PublicContext`.

After this change, public bytecode will be run using the AVM simulator (the simulator for our upcoming zkVM). This bytecode is generated from Noir contracts in two steps: First, `nargo compile` produces an artifact which has Brillig bytecode for public functions, just as it did before. Second: the `avm-transpiler` takes that artifact, and it transpiles Brillig bytecode to AVM bytecode. This final artifact can now be deployed and used with the new public runtime.

On the Aztec.nr side, public functions keep accessing the context using `PublicContext` but the underlying implementation is switch with what formerly was the `AvmContext`.

**What does this mean for me?**

It should be mostly transparent, with a few caveats:
* Not all Noir blackbox functions are supported by the AVM. Only `Sha256`, `PedersenHash`, `Poseidon2Permutation`, `Keccak256`, and `ToRadix` are supported.
* For public functions, `context.nullifier_exists(...)` will now also consider pending nullifiers.
* The following methods of `PublicContext` are not supported anymore: `fee_recipient`, `fee_per_da_gas`, `fee_per_l2_gas`, `call_public_function_no_args`, `static_call_public_function_no_args`, `delegate_call_public_function_no_args`, `call_public_function_with_packed_args`, `set_return_hash`, `finish`. However, in terms of functionality, the new context's interface should be equivalent (unless otherwise specified in this list).
* Delegate calls are not yet supported in the AVM.
* If you have types with custom serialization that you use across external contracts calls, you might need to modify its serialization to match how Noir would serialize it. This is a known problem unrelated to the AVM, but triggered more often when using it.
* A few error messages might change format, so you might need to change your test assertions.

## 0.41.0


Expand Down
Loading

0 comments on commit 8f4187c

Please sign in to comment.