Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: Serialize, Deserialize and NoteInterface as Traits #4135

Merged
merged 42 commits into from
Jan 30, 2024

Conversation

Thunkar
Copy link
Contributor

@Thunkar Thunkar commented Jan 18, 2024

Closes: #3756, #2838

Taking advantage of @jfecher's fantastic work in noir-lang/noir#4000, implemented Serialize<N> and Deserialize<N>. Together with NoteInterface, they make possible getting rid of all the serialization interfaces, which greatly simplify how the storage is handled and opens the door to further improvements. Still some clutter to go, the lengths are still needed in some places.

Brace yourself

I'm so sorry.

@Thunkar Thunkar self-assigned this Jan 19, 2024
@AztecBot
Copy link
Collaborator

AztecBot commented Jan 19, 2024

Benchmark results

No metrics with a significant change found.

Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Values are compared against data from master at commit 382dfbed and shown if the difference exceeds 1%.

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 8 txs 32 txs 128 txs
l1_rollup_calldata_size_in_bytes 45,412 179,524 716,068
l1_rollup_calldata_gas 221,764 866,824 3,448,468
l1_rollup_execution_gas 314,251 984,564 3,668,125
l2_block_processing_time_in_ms 1,162 (+1%) 4,356 17,359 (+1%)
note_successful_decrypting_time_in_ms 271 (+7%) 906 (+3%) 3,537 (+6%)
note_trial_decrypting_time_in_ms 84.3 (+30%) 52.8 (-72%) 141 (-4%)
l2_block_building_time_in_ms 16,626 (+1%) 65,893 (+2%) 263,903 (+1%)
l2_block_rollup_simulation_time_in_ms 11,879 46,939 189,310
l2_block_public_tx_process_time_in_ms 4,719 (+4%) 18,820 (+5%) 74,349 (+4%)

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 16 txs.

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms 13,587 (+2%) 26,456 (+3%)
note_history_successful_decrypting_time_in_ms 2,373 (+11%) 4,356 (+4%)
note_history_trial_decrypting_time_in_ms 85.6 (-50%) 199 (+13%)
node_database_size_in_bytes 17,309,776 33,230,928
pxe_database_size_in_bytes 29,923 59,478

Circuits stats

Stats on running time and I/O sizes collected for every circuit run across all benchmarks.

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 220 44,897 26,193
private-kernel-ordering 180 (+1%) 44,513 14,929 (+1%)
base-rollup 1,257 128,970 881
root-rollup 83.5 (+2%) 4,088 677
private-kernel-inner 321 (+3%) 72,056 26,193
public-kernel-private-input 223 (+3%) 32,615 (+1%) 26,193
public-kernel-non-first-iteration 222 (+4%) 32,657 (+1%) 26,193
merge-rollup 7.63 2,608 881

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 2 leaves 8 leaves 16 leaves 32 leaves 128 leaves 64 leaves 512 leaves 1024 leaves 2048 leaves 8192 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.2 11.2 (-1%) 12.7 17.0 (-1%) 22.6 (-1%) 64.5 (+1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.9 17.5 23.0 31.6 47.0 143 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.595 0.624 (-1%) 0.541 0.527 (-1%) 0.475 (-1%) 0.444 (+1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A N/A N/A N/A 80.8 (+3%) 47.6 238 459 896 (-1%) 3,554
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A N/A N/A N/A 159 96.0 543 1,055 2,079 8,223
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A N/A N/A N/A 0.500 (+5%) 0.488 0.435 0.430 0.427 0.426
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 107 (+3%) 56.7 (-1%) 348 683 1,372 (+1%) 5,422
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A N/A N/A N/A 197 104 691 1,363 2,707 10,771
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A N/A N/A N/A 0.503 (+2%) 0.496 (-1%) 0.474 0.471 0.476 (+1%) 0.471
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A 56.5 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A 94.1 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A 0.578 N/A N/A N/A N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 15,575 (+1%) 36,458 (+11%)

Transaction processing duration by data writes.

Metric 0 new commitments 1 new commitments
tx_pxe_processing_time_ms 401 (+2%) 1,142 (+2%)
Metric 1 public data writes
tx_sequencer_processing_time_ms 580 (+4%)

@Thunkar Thunkar marked this pull request as ready for review January 19, 2024 11:00
Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great job on getting this to work

@Thunkar
Copy link
Contributor Author

Thunkar commented Jan 29, 2024

@AztecProtocol/devrel docs are updated and I wrote a short migration guide, but might be missing something!

Copy link
Contributor

@sirasistant sirasistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing cleanup!! we finally have traits! 🚀 🚀 🚀

docs/docs/developers/testing/cheat_codes.md Show resolved Hide resolved
@Thunkar Thunkar enabled auto-merge (squash) January 30, 2024 14:38
@Thunkar Thunkar merged commit 9e6605c into master Jan 30, 2024
80 of 82 checks passed
@Thunkar Thunkar deleted the gj/serialize_deserialize_note-interface branch January 30, 2024 14:57
Thunkar added a commit that referenced this pull request Feb 2, 2024
Closes: #3198,
#2928

~~Requires #4135,
which is blocked by noir-lang/noir#4124

Automatic storage initialization via aztec macro. 

Full support of public and private state from
`dep::aztec::state_vars::*`, including Maps (and nested Maps!)
Limited support for custom types (as long as they have a single
serializable generic and their constructor is `::new(context,
storage_slot`).

~~Pending: better errors, code comments and some cleanup.~~

Hijacking my own
[comment](#4200 (comment))
for the explanation:

The idea behind this is that in 99% of cases, storage initialization
(that is, the `impl` for a given `struct Storage...` is redundant, and
the only need for its existence was assigning storage slots...which in
turn were necessary because we didn't know how to serialize the data
structures that were used in a given contract or how much space they
used once serialized (relevant for the public state).

After #4135 is
merged, both of those things don't have to be explicitly provided since
we're using traits, so the aztec macro can infer the implementation of
the Storage struct just by taking hints from the definition. An example:

```rust
    struct Storage {
        // MyAwesomeStuff implements Serialize<2>, so we assign it slot 1 (and remember that it will take 2 slots due to its size)
        public_var: PublicState<MyAwesomeSuff>, 
        // Right after the first one, assign it to slot: current_slot + previous_size = 3
        another_public_var: PublicState<MyAwesomeSuff>,
        // Private and Public state don't share slots since they "live" in different trees, but keeping the slot count simplifies implementation. 
        // Notes also implement Serialize<N>, but they only take up 1 slot anyways because of hashing, assign it slot 5
        a_singleton: Singleton<ANote>,
        // Maps derive slots via hashing, so we can assume they only "take" 1 slot. We assign it slot 6
        balances: Map<AztecAddress, Singleton<ANote>>,
        // Slot 7
        a_set: Set<ANote>,
        // Slot 8
        imm_singleton: ImmutableSingleton<ANote>,
        // Slot 9. 
        profiles: Map<AztecAddress, Map<Singleton<ANote>>>,
    }

```

We have all the info we need in the AST and HIR to build this
automatically:

```rust
impl Storage {
    fn init(context: Context) -> Self {
        Storage {
            public_var: PublicState::new(context, 1), // No need for serialization methods, taken from the the trait impl
            another_public_var: PublicState::new(context, 3),
            a_singleton: Singleton::new(context, 5),
            // Map init lambda always takes the same form for known storage structs
            balances: Map::new(context, 6, |context, slot| { 
                Singleton::new(context, slot) 
            }),
            a_set: Set::new(context, 7),
            imm_singleton: ImmutableSingleton::new(context, 8),
            // A map of maps is just nesting lambdas, we can infer this too
            profiles: Map::new(context, 9, |context, slot| { 
                Map::new(context, slot, |context, slot| { 
                    Singleton::new(context, slot) 
                })
            })
        }
    }
}

```

...as long as we use "canonical" storage implementations. This means
`AStoragePrimitive<SomethingSerializable>` and
`Map<SomethingWithToField, AStoragePrimitive<SomethingSerializable>>`.

**TLDR:** define the Storage struct, in 99% of cases the macro takes
care of the implementation!

Implementing custom storage will look just like it does know, the macro
will skip automatic generation if it finds one.

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
AztecBot pushed a commit to AztecProtocol/aztec-nr that referenced this pull request Feb 3, 2024
Closes: AztecProtocol/aztec-packages#3198,
AztecProtocol/aztec-packages#2928

~~Requires AztecProtocol/aztec-packages#4135,
which is blocked by noir-lang/noir#4124

Automatic storage initialization via aztec macro. 

Full support of public and private state from
`dep::aztec::state_vars::*`, including Maps (and nested Maps!)
Limited support for custom types (as long as they have a single
serializable generic and their constructor is `::new(context,
storage_slot`).

~~Pending: better errors, code comments and some cleanup.~~

Hijacking my own
[comment](AztecProtocol/aztec-packages#4200 (comment))
for the explanation:

The idea behind this is that in 99% of cases, storage initialization
(that is, the `impl` for a given `struct Storage...` is redundant, and
the only need for its existence was assigning storage slots...which in
turn were necessary because we didn't know how to serialize the data
structures that were used in a given contract or how much space they
used once serialized (relevant for the public state).

After AztecProtocol/aztec-packages#4135 is
merged, both of those things don't have to be explicitly provided since
we're using traits, so the aztec macro can infer the implementation of
the Storage struct just by taking hints from the definition. An example:

```rust
    struct Storage {
        // MyAwesomeStuff implements Serialize<2>, so we assign it slot 1 (and remember that it will take 2 slots due to its size)
        public_var: PublicState<MyAwesomeSuff>, 
        // Right after the first one, assign it to slot: current_slot + previous_size = 3
        another_public_var: PublicState<MyAwesomeSuff>,
        // Private and Public state don't share slots since they "live" in different trees, but keeping the slot count simplifies implementation. 
        // Notes also implement Serialize<N>, but they only take up 1 slot anyways because of hashing, assign it slot 5
        a_singleton: Singleton<ANote>,
        // Maps derive slots via hashing, so we can assume they only "take" 1 slot. We assign it slot 6
        balances: Map<AztecAddress, Singleton<ANote>>,
        // Slot 7
        a_set: Set<ANote>,
        // Slot 8
        imm_singleton: ImmutableSingleton<ANote>,
        // Slot 9. 
        profiles: Map<AztecAddress, Map<Singleton<ANote>>>,
    }

```

We have all the info we need in the AST and HIR to build this
automatically:

```rust
impl Storage {
    fn init(context: Context) -> Self {
        Storage {
            public_var: PublicState::new(context, 1), // No need for serialization methods, taken from the the trait impl
            another_public_var: PublicState::new(context, 3),
            a_singleton: Singleton::new(context, 5),
            // Map init lambda always takes the same form for known storage structs
            balances: Map::new(context, 6, |context, slot| { 
                Singleton::new(context, slot) 
            }),
            a_set: Set::new(context, 7),
            imm_singleton: ImmutableSingleton::new(context, 8),
            // A map of maps is just nesting lambdas, we can infer this too
            profiles: Map::new(context, 9, |context, slot| { 
                Map::new(context, slot, |context, slot| { 
                    Singleton::new(context, slot) 
                })
            })
        }
    }
}

```

...as long as we use "canonical" storage implementations. This means
`AStoragePrimitive<SomethingSerializable>` and
`Map<SomethingWithToField, AStoragePrimitive<SomethingSerializable>>`.

**TLDR:** define the Storage struct, in 99% of cases the macro takes
care of the implementation!

Implementing custom storage will look just like it does know, the macro
will skip automatic generation if it finds one.

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
rahul-kothari pushed a commit that referenced this pull request Feb 6, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-packages: 0.22.0</summary>

##
[0.22.0](aztec-packages-v0.21.0...aztec-packages-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([#4420](#4420))
* Add expression width into acir
([#4014](#4014))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([#4383](#4383))
* Unencrypted logs are not strings
([#4392](#4392))
* init storage macro
([#4200](#4200))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
* introduce compute_note_hash_for_(consumption/insertion)
([#4344](#4344))
* replace Note::compute_note_hash with Note::compute_note_content_hash
([#4342](#4342))
* Include contract class id in deployment info
([#4223](#4223))
* Serialize, Deserialize and NoteInterface as Traits
([#4135](#4135))

### Features

* Add aztec node to client execution and nuke state info provider
[#4320](#4320)
([#4401](#4401))
([2dec0cc](2dec0cc))
* Add bit size to const opcode
([#4385](#4385))
([b2a000e](b2a000e))
* Add expression width into acir
([#4014](#4014))
([f09e8fc](f09e8fc))
* Add meta_hwm to PrivateCircuitPublicInputs
([#4341](#4341))
([4f248b5](4f248b5))
* Add poseidon2 hashing to native transcript
([#3718](#3718))
([afcfa71](afcfa71))
* Adding slitherin detectors
([#4246](#4246))
([7cdc186](7cdc186))
* Allow using of current block in inclusion proofs
([#4285](#4285))
([728c5ac](728c5ac)),
closes
[#4274](#4274)
* **avm-transpiler:** Brillig to AVM transpiler
([#4227](#4227))
([c366c6e](c366c6e))
* **avm:** Add command to call avm proving in bb binary
([#4369](#4369))
([4f6d607](4f6d607)),
closes
[#4039](#4039)
* **avm:** Add revert tracking to the journal
([#4349](#4349))
([1615803](1615803))
* **avm:** Back in avm context with macro - refactor context
([#4438](#4438))
([ccf9b17](ccf9b17))
* **avm:** Complete SET instruction
([#4378](#4378))
([013891f](013891f))
* **avm:** Implement avm state getter opcodes within noir contracts
([#4402](#4402))
([9f2a6eb](9f2a6eb))
* **avm:** Implement serialization for all existing operations
([#4338](#4338))
([13e0683](13e0683))
* **avm:** Keep history of reads and writes in journal
([#4315](#4315))
([cdf1baf](cdf1baf))
* **aztec-nr:** Initial work for aztec public vm macro
([#4400](#4400))
([0024590](0024590))
* **bb:** Wasmtime and remote benchmarking
([#4204](#4204))
([fd27808](fd27808))
* Contract class registerer contract
([#4403](#4403))
([d953090](d953090)),
closes
[#4069](#4069)
[#4070](#4070)
* Crude stable var implementation
([#4289](#4289))
([5f9eee4](5f9eee4))
* **docs:** Docs deeper dive into unconstrained functions
([#4233](#4233))
([6af548e](6af548e))
* Emit single functions from class registerer
([#4429](#4429))
([19e03ad](19e03ad)),
closes
[#4427](#4427)
* Extend Historical Access APIs
[#4179](#4179)
([#4375](#4375))
([c918d8d](c918d8d))
* Folding `GoblinUltra` instances in ProtoGalaxy
([#4340](#4340))
([8569e7c](8569e7c))
* Hashing output of `serialize()` in noir + more tests
([#4365](#4365))
([5a71bb9](5a71bb9))
* Implementation for bigint opcodes
([#4288](#4288))
([b61dace](b61dace))
* Improve ivc bench
([#4242](#4242))
([9d28354](9d28354))
* Include contract class id in deployment info
([#4223](#4223))
([0ed4126](0ed4126)),
closes
[#4054](#4054)
* Init storage macro
([#4200](#4200))
([11d9697](11d9697))
* Memory only brillig
([#4215](#4215))
([018177b](018177b))
* Nullified note retrieval in get_notes and view_notes
([#4238](#4238))
([8d02eb7](8d02eb7))
* Private calls and initialization of undeployed contracts
([#4362](#4362))
([f31c181](f31c181)),
closes
[#4057](#4057)
[#4058](#4058)
[#4059](#4059)
* Sequencer processes transactions in phases
([#4345](#4345))
([78cc709](78cc709))
* Unencrypted logs are not strings
([#4392](#4392))
([25a7ea7](25a7ea7))
* Verify function against contract class id in private kernel
([#4337](#4337))
([e1d832d](e1d832d)),
closes
[#4056](#4056)


### Bug Fixes

* **avm-transpiler:** Avm-transpiler bootstrap by tying down rust
version
([#4347](#4347))
([09d0730](09d0730))
* **avm-transpiler:** Bump rust toolchain version for transpiler
([#4356](#4356))
([75e30b9](75e30b9))
* **avm:** Fix SendL2ToL1Message implementation
([#4367](#4367))
([ee560c3](ee560c3))
* Aztec binary fixes
([#4273](#4273))
([84e1f7d](84e1f7d))
* Bb build
([#4317](#4317))
([82f5f03](82f5f03))
* Load contract artifact from json
([#4352](#4352))
([47a0a79](47a0a79))
* Mac build
([#4336](#4336))
([aeb4cf0](aeb4cf0))
* **noir-contracts:** Disable transpilation for now
([#4372](#4372))
([37662b7](37662b7))
* Nr codegen to use new protocol types path
([#4353](#4353))
([84e63b1](84e63b1)),
closes
[#4193](#4193)
* Relative LogFn import
([#4328](#4328))
([1faead5](1faead5))
* Release the size of goblin translator
([#4259](#4259))
([6e1d958](6e1d958))
* Transpiler build
([#4386](#4386))
([032ddc5](032ddc5))


### Miscellaneous

* `PublicCircuitPublicInputs` and `PrivateCircuitPublicInputs` cleanup
([#4360](#4360))
([b92d690](b92d690))
* `toFields()`/`fromFields(...)` methods in more classes
([#4335](#4335))
([433b9eb](433b9eb))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
([9c965a7](9c965a7))
* Add bigint solver in ACVM and add a unit test for bigints in Noir
([#4415](#4415))
([e4a2fe9](e4a2fe9))
* Add bootstrap_cache for avm-transpiler
([#4357](#4357))
([bfebebb](bfebebb))
* Add disclaimer
([#4393](#4393))
([6895f52](6895f52))
* Add migration note for serialization change
([#4414](#4414))
([968a3a0](968a3a0))
* **avm:** Make interpreter a function not a class
([#4272](#4272))
([14e8c5c](14e8c5c))
* **avm:** Refactor AVM Simulator and fix issues
([#4424](#4424))
([a6179bd](a6179bd))
* Call stack item cleanup
([#4381](#4381))
([341b0a1](341b0a1))
* Check loading Nargo artifacts works in the cli
([#4355](#4355))
([43b58b3](43b58b3))
* Cleanup + various doc improvements
([#4282](#4282))
([648229c](648229c)),
closes
[#4264](#4264)
* Collapse bb::honk
([#4318](#4318))
([5853af4](5853af4))
* Consistent naming of serialization method
([#4379](#4379))
([148d5dc](148d5dc))
* Do not run forge fmt because not everyone has forge installed
([#4430](#4430))
([ecb6c3f](ecb6c3f))
* **docs:** Update broken link ref in slow_updates_tree.md
([#4339](#4339))
([2599d7f](2599d7f))
* Eth address tech debt cleanup
([#4442](#4442))
([153989f](153989f))
* Extract merge from UC and simplify
([#4343](#4343))
([54fd794](54fd794))
* Fix bb wasm build when using remote cache
([#4397](#4397))
([14e57cb](14e57cb))
* Fix clippy warnings in `avm-transpiler`
([#4416](#4416))
([e54ecd2](e54ecd2))
* Format l1-contracts after generating constants
([#4448](#4448))
([de11994](de11994))
* Git subrepo commit (merge) noir
([#4321](#4321))
([348d18a](348d18a))
* Git subrepo pull (merge) noir
([#4331](#4331))
([683f782](683f782))
* Implementing `deserialize()` in Noir structs
([#4384](#4384))
([e63bbae](e63bbae))
* Introduce compute_note_hash_for_(consumption/insertion)
([#4344](#4344))
([26a0d49](26a0d49))
* Optimize prove_note_validity
[#4418](#4418)
([#4426](#4426))
([4de2540](4de2540))
* Poseidon2 hash uses span instead of vector
([#4003](#4003))
([f63e7a9](f63e7a9))
* Reenable private kernel function tree checks
([#4358](#4358))
([e7db0da](e7db0da))
* Remove hardcoded storage slot values
([#4398](#4398))
([d2294a4](d2294a4))
* Rename bigint_neg into bigint_sub
([#4420](#4420))
([57824fe](57824fe))
* Replace Note::compute_note_hash with Note::compute_note_content_hash
([#4342](#4342))
([8368659](8368659))
* Replace relative paths to noir-protocol-circuits
([23de650](23de650))
* Replace relative paths to noir-protocol-circuits
([b8d427f](b8d427f))
* Replace relative paths to noir-protocol-circuits
([113dec1](113dec1))
* Replace relative paths to noir-protocol-circuits
([a79093b](a79093b))
* Replace relative paths to noir-protocol-circuits
([808b4eb](808b4eb))
* Serialize, Deserialize and NoteInterface as Traits
([#4135](#4135))
([9e6605c](9e6605c))
* Simpler noir sync
([#4376](#4376))
([665b35e](665b35e))
* Surpress chained macro warning
([#4396](#4396))
([5e9c790](5e9c790))
* Switch to macos-14 for m1 runners
([#3456](#3456))
([ca5b6f8](ca5b6f8))
* Testing `toFields()` length
([#4364](#4364))
([5d3fce3](5d3fce3))
* Typing contents of `MessageLoadOracleInputs`
([#4351](#4351))
([433babd](433babd))
* Update docs on comparators
([#4281](#4281))
([cc2ce9c](cc2ce9c))
* Updating block hash to be header.hash()
([#4286](#4286))
([d4125e1](d4125e1))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([#4383](#4383))
([14dd0b8](14dd0b8))


### Documentation

* Add simple api description for note_getter_options.status
([#4329](#4329))
([cc17afe](cc17afe))
* Document stable public state usage
([#4324](#4324))
([13f709b](13f709b)),
closes
[#4325](#4325)
* Minor quickstart fixes
([#4330](#4330))
([f85a870](f85a870))
* Update contract deployment section in YP
([#4290](#4290))
([e99a882](e99a882))
* **yp:** AVM circuit - user memory section
([#4323](#4323))
([8928fb1](8928fb1)),
closes
[#4043](#4043)
</details>

<details><summary>barretenberg.js: 0.22.0</summary>

##
[0.22.0](barretenberg.js-v0.21.0...barretenberg.js-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))

### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
([9c965a7](9c965a7))
</details>

<details><summary>barretenberg: 0.22.0</summary>

##
[0.22.0](barretenberg-v0.21.0...barretenberg-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([#4420](#4420))
* Add expression width into acir
([#4014](#4014))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))

### Features

* Add bit size to const opcode
([#4385](#4385))
([b2a000e](b2a000e))
* Add expression width into acir
([#4014](#4014))
([f09e8fc](f09e8fc))
* Add poseidon2 hashing to native transcript
([#3718](#3718))
([afcfa71](afcfa71))
* **avm:** Add command to call avm proving in bb binary
([#4369](#4369))
([4f6d607](4f6d607)),
closes
[#4039](#4039)
* **avm:** Back in avm context with macro - refactor context
([#4438](#4438))
([ccf9b17](ccf9b17))
* **bb:** Wasmtime and remote benchmarking
([#4204](#4204))
([fd27808](fd27808))
* Folding `GoblinUltra` instances in ProtoGalaxy
([#4340](#4340))
([8569e7c](8569e7c))
* Implementation for bigint opcodes
([#4288](#4288))
([b61dace](b61dace))
* Improve ivc bench
([#4242](#4242))
([9d28354](9d28354))
* Memory only brillig
([#4215](#4215))
([018177b](018177b))


### Bug Fixes

* Bb build
([#4317](#4317))
([82f5f03](82f5f03))
* Mac build
([#4336](#4336))
([aeb4cf0](aeb4cf0))
* Release the size of goblin translator
([#4259](#4259))
([6e1d958](6e1d958))


### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
([9c965a7](9c965a7))
* Collapse bb::honk
([#4318](#4318))
([5853af4](5853af4))
* Extract merge from UC and simplify
([#4343](#4343))
([54fd794](54fd794))
* Fix bb wasm build when using remote cache
([#4397](#4397))
([14e57cb](14e57cb))
* Poseidon2 hash uses span instead of vector
([#4003](#4003))
([f63e7a9](f63e7a9))
* Rename bigint_neg into bigint_sub
([#4420](#4420))
([57824fe](57824fe))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Feb 7, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-packages: 0.22.0</summary>

##
[0.22.0](AztecProtocol/aztec-packages@aztec-packages-v0.21.0...aztec-packages-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([#4420](AztecProtocol/aztec-packages#4420))
* Add expression width into acir
([#4014](AztecProtocol/aztec-packages#4014))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([#4383](AztecProtocol/aztec-packages#4383))
* Unencrypted logs are not strings
([#4392](AztecProtocol/aztec-packages#4392))
* init storage macro
([#4200](AztecProtocol/aztec-packages#4200))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](AztecProtocol/aztec-packages#4221))
* introduce compute_note_hash_for_(consumption/insertion)
([#4344](AztecProtocol/aztec-packages#4344))
* replace Note::compute_note_hash with Note::compute_note_content_hash
([#4342](AztecProtocol/aztec-packages#4342))
* Include contract class id in deployment info
([#4223](AztecProtocol/aztec-packages#4223))
* Serialize, Deserialize and NoteInterface as Traits
([#4135](AztecProtocol/aztec-packages#4135))

### Features

* Add aztec node to client execution and nuke state info provider
[#4320](AztecProtocol/aztec-packages#4320)
([#4401](AztecProtocol/aztec-packages#4401))
([2dec0cc](AztecProtocol/aztec-packages@2dec0cc))
* Add bit size to const opcode
([#4385](AztecProtocol/aztec-packages#4385))
([b2a000e](AztecProtocol/aztec-packages@b2a000e))
* Add expression width into acir
([#4014](AztecProtocol/aztec-packages#4014))
([f09e8fc](AztecProtocol/aztec-packages@f09e8fc))
* Add meta_hwm to PrivateCircuitPublicInputs
([#4341](AztecProtocol/aztec-packages#4341))
([4f248b5](AztecProtocol/aztec-packages@4f248b5))
* Add poseidon2 hashing to native transcript
([#3718](AztecProtocol/aztec-packages#3718))
([afcfa71](AztecProtocol/aztec-packages@afcfa71))
* Adding slitherin detectors
([#4246](AztecProtocol/aztec-packages#4246))
([7cdc186](AztecProtocol/aztec-packages@7cdc186))
* Allow using of current block in inclusion proofs
([#4285](AztecProtocol/aztec-packages#4285))
([728c5ac](AztecProtocol/aztec-packages@728c5ac)),
closes
[#4274](AztecProtocol/aztec-packages#4274)
* **avm-transpiler:** Brillig to AVM transpiler
([#4227](AztecProtocol/aztec-packages#4227))
([c366c6e](AztecProtocol/aztec-packages@c366c6e))
* **avm:** Add command to call avm proving in bb binary
([#4369](AztecProtocol/aztec-packages#4369))
([4f6d607](AztecProtocol/aztec-packages@4f6d607)),
closes
[#4039](AztecProtocol/aztec-packages#4039)
* **avm:** Add revert tracking to the journal
([#4349](AztecProtocol/aztec-packages#4349))
([1615803](AztecProtocol/aztec-packages@1615803))
* **avm:** Back in avm context with macro - refactor context
([#4438](AztecProtocol/aztec-packages#4438))
([ccf9b17](AztecProtocol/aztec-packages@ccf9b17))
* **avm:** Complete SET instruction
([#4378](AztecProtocol/aztec-packages#4378))
([013891f](AztecProtocol/aztec-packages@013891f))
* **avm:** Implement avm state getter opcodes within noir contracts
([#4402](AztecProtocol/aztec-packages#4402))
([9f2a6eb](AztecProtocol/aztec-packages@9f2a6eb))
* **avm:** Implement serialization for all existing operations
([#4338](AztecProtocol/aztec-packages#4338))
([13e0683](AztecProtocol/aztec-packages@13e0683))
* **avm:** Keep history of reads and writes in journal
([#4315](AztecProtocol/aztec-packages#4315))
([cdf1baf](AztecProtocol/aztec-packages@cdf1baf))
* **aztec-nr:** Initial work for aztec public vm macro
([#4400](AztecProtocol/aztec-packages#4400))
([0024590](AztecProtocol/aztec-packages@0024590))
* **bb:** Wasmtime and remote benchmarking
([#4204](AztecProtocol/aztec-packages#4204))
([fd27808](AztecProtocol/aztec-packages@fd27808))
* Contract class registerer contract
([#4403](AztecProtocol/aztec-packages#4403))
([d953090](AztecProtocol/aztec-packages@d953090)),
closes
[#4069](AztecProtocol/aztec-packages#4069)
[#4070](AztecProtocol/aztec-packages#4070)
* Crude stable var implementation
([#4289](AztecProtocol/aztec-packages#4289))
([5f9eee4](AztecProtocol/aztec-packages@5f9eee4))
* **docs:** Docs deeper dive into unconstrained functions
([#4233](AztecProtocol/aztec-packages#4233))
([6af548e](AztecProtocol/aztec-packages@6af548e))
* Emit single functions from class registerer
([#4429](AztecProtocol/aztec-packages#4429))
([19e03ad](AztecProtocol/aztec-packages@19e03ad)),
closes
[#4427](AztecProtocol/aztec-packages#4427)
* Extend Historical Access APIs
[#4179](AztecProtocol/aztec-packages#4179)
([#4375](AztecProtocol/aztec-packages#4375))
([c918d8d](AztecProtocol/aztec-packages@c918d8d))
* Folding `GoblinUltra` instances in ProtoGalaxy
([#4340](AztecProtocol/aztec-packages#4340))
([8569e7c](AztecProtocol/aztec-packages@8569e7c))
* Hashing output of `serialize()` in noir + more tests
([#4365](AztecProtocol/aztec-packages#4365))
([5a71bb9](AztecProtocol/aztec-packages@5a71bb9))
* Implementation for bigint opcodes
([#4288](AztecProtocol/aztec-packages#4288))
([b61dace](AztecProtocol/aztec-packages@b61dace))
* Improve ivc bench
([#4242](AztecProtocol/aztec-packages#4242))
([9d28354](AztecProtocol/aztec-packages@9d28354))
* Include contract class id in deployment info
([#4223](AztecProtocol/aztec-packages#4223))
([0ed4126](AztecProtocol/aztec-packages@0ed4126)),
closes
[#4054](AztecProtocol/aztec-packages#4054)
* Init storage macro
([#4200](AztecProtocol/aztec-packages#4200))
([11d9697](AztecProtocol/aztec-packages@11d9697))
* Memory only brillig
([#4215](AztecProtocol/aztec-packages#4215))
([018177b](AztecProtocol/aztec-packages@018177b))
* Nullified note retrieval in get_notes and view_notes
([#4238](AztecProtocol/aztec-packages#4238))
([8d02eb7](AztecProtocol/aztec-packages@8d02eb7))
* Private calls and initialization of undeployed contracts
([#4362](AztecProtocol/aztec-packages#4362))
([f31c181](AztecProtocol/aztec-packages@f31c181)),
closes
[#4057](AztecProtocol/aztec-packages#4057)
[#4058](AztecProtocol/aztec-packages#4058)
[#4059](AztecProtocol/aztec-packages#4059)
* Sequencer processes transactions in phases
([#4345](AztecProtocol/aztec-packages#4345))
([78cc709](AztecProtocol/aztec-packages@78cc709))
* Unencrypted logs are not strings
([#4392](AztecProtocol/aztec-packages#4392))
([25a7ea7](AztecProtocol/aztec-packages@25a7ea7))
* Verify function against contract class id in private kernel
([#4337](AztecProtocol/aztec-packages#4337))
([e1d832d](AztecProtocol/aztec-packages@e1d832d)),
closes
[#4056](AztecProtocol/aztec-packages#4056)


### Bug Fixes

* **avm-transpiler:** Avm-transpiler bootstrap by tying down rust
version
([#4347](AztecProtocol/aztec-packages#4347))
([09d0730](AztecProtocol/aztec-packages@09d0730))
* **avm-transpiler:** Bump rust toolchain version for transpiler
([#4356](AztecProtocol/aztec-packages#4356))
([75e30b9](AztecProtocol/aztec-packages@75e30b9))
* **avm:** Fix SendL2ToL1Message implementation
([#4367](AztecProtocol/aztec-packages#4367))
([ee560c3](AztecProtocol/aztec-packages@ee560c3))
* Aztec binary fixes
([#4273](AztecProtocol/aztec-packages#4273))
([84e1f7d](AztecProtocol/aztec-packages@84e1f7d))
* Bb build
([#4317](AztecProtocol/aztec-packages#4317))
([82f5f03](AztecProtocol/aztec-packages@82f5f03))
* Load contract artifact from json
([#4352](AztecProtocol/aztec-packages#4352))
([47a0a79](AztecProtocol/aztec-packages@47a0a79))
* Mac build
([#4336](AztecProtocol/aztec-packages#4336))
([aeb4cf0](AztecProtocol/aztec-packages@aeb4cf0))
* **noir-contracts:** Disable transpilation for now
([#4372](AztecProtocol/aztec-packages#4372))
([37662b7](AztecProtocol/aztec-packages@37662b7))
* Nr codegen to use new protocol types path
([#4353](AztecProtocol/aztec-packages#4353))
([84e63b1](AztecProtocol/aztec-packages@84e63b1)),
closes
[#4193](AztecProtocol/aztec-packages#4193)
* Relative LogFn import
([#4328](AztecProtocol/aztec-packages#4328))
([1faead5](AztecProtocol/aztec-packages@1faead5))
* Release the size of goblin translator
([#4259](AztecProtocol/aztec-packages#4259))
([6e1d958](AztecProtocol/aztec-packages@6e1d958))
* Transpiler build
([#4386](AztecProtocol/aztec-packages#4386))
([032ddc5](AztecProtocol/aztec-packages@032ddc5))


### Miscellaneous

* `PublicCircuitPublicInputs` and `PrivateCircuitPublicInputs` cleanup
([#4360](AztecProtocol/aztec-packages#4360))
([b92d690](AztecProtocol/aztec-packages@b92d690))
* `toFields()`/`fromFields(...)` methods in more classes
([#4335](AztecProtocol/aztec-packages#4335))
([433b9eb](AztecProtocol/aztec-packages@433b9eb))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](AztecProtocol/aztec-packages#4221))
([9c965a7](AztecProtocol/aztec-packages@9c965a7))
* Add bigint solver in ACVM and add a unit test for bigints in Noir
([#4415](AztecProtocol/aztec-packages#4415))
([e4a2fe9](AztecProtocol/aztec-packages@e4a2fe9))
* Add bootstrap_cache for avm-transpiler
([#4357](AztecProtocol/aztec-packages#4357))
([bfebebb](AztecProtocol/aztec-packages@bfebebb))
* Add disclaimer
([#4393](AztecProtocol/aztec-packages#4393))
([6895f52](AztecProtocol/aztec-packages@6895f52))
* Add migration note for serialization change
([#4414](AztecProtocol/aztec-packages#4414))
([968a3a0](AztecProtocol/aztec-packages@968a3a0))
* **avm:** Make interpreter a function not a class
([#4272](AztecProtocol/aztec-packages#4272))
([14e8c5c](AztecProtocol/aztec-packages@14e8c5c))
* **avm:** Refactor AVM Simulator and fix issues
([#4424](AztecProtocol/aztec-packages#4424))
([a6179bd](AztecProtocol/aztec-packages@a6179bd))
* Call stack item cleanup
([#4381](AztecProtocol/aztec-packages#4381))
([341b0a1](AztecProtocol/aztec-packages@341b0a1))
* Check loading Nargo artifacts works in the cli
([#4355](AztecProtocol/aztec-packages#4355))
([43b58b3](AztecProtocol/aztec-packages@43b58b3))
* Cleanup + various doc improvements
([#4282](AztecProtocol/aztec-packages#4282))
([648229c](AztecProtocol/aztec-packages@648229c)),
closes
[#4264](AztecProtocol/aztec-packages#4264)
* Collapse bb::honk
([#4318](AztecProtocol/aztec-packages#4318))
([5853af4](AztecProtocol/aztec-packages@5853af4))
* Consistent naming of serialization method
([#4379](AztecProtocol/aztec-packages#4379))
([148d5dc](AztecProtocol/aztec-packages@148d5dc))
* Do not run forge fmt because not everyone has forge installed
([#4430](AztecProtocol/aztec-packages#4430))
([ecb6c3f](AztecProtocol/aztec-packages@ecb6c3f))
* **docs:** Update broken link ref in slow_updates_tree.md
([#4339](AztecProtocol/aztec-packages#4339))
([2599d7f](AztecProtocol/aztec-packages@2599d7f))
* Eth address tech debt cleanup
([#4442](AztecProtocol/aztec-packages#4442))
([153989f](AztecProtocol/aztec-packages@153989f))
* Extract merge from UC and simplify
([#4343](AztecProtocol/aztec-packages#4343))
([54fd794](AztecProtocol/aztec-packages@54fd794))
* Fix bb wasm build when using remote cache
([#4397](AztecProtocol/aztec-packages#4397))
([14e57cb](AztecProtocol/aztec-packages@14e57cb))
* Fix clippy warnings in `avm-transpiler`
([#4416](AztecProtocol/aztec-packages#4416))
([e54ecd2](AztecProtocol/aztec-packages@e54ecd2))
* Format l1-contracts after generating constants
([#4448](AztecProtocol/aztec-packages#4448))
([de11994](AztecProtocol/aztec-packages@de11994))
* Git subrepo commit (merge) noir
([#4321](AztecProtocol/aztec-packages#4321))
([348d18a](AztecProtocol/aztec-packages@348d18a))
* Git subrepo pull (merge) noir
([#4331](AztecProtocol/aztec-packages#4331))
([683f782](AztecProtocol/aztec-packages@683f782))
* Implementing `deserialize()` in Noir structs
([#4384](AztecProtocol/aztec-packages#4384))
([e63bbae](AztecProtocol/aztec-packages@e63bbae))
* Introduce compute_note_hash_for_(consumption/insertion)
([#4344](AztecProtocol/aztec-packages#4344))
([26a0d49](AztecProtocol/aztec-packages@26a0d49))
* Optimize prove_note_validity
[#4418](AztecProtocol/aztec-packages#4418)
([#4426](AztecProtocol/aztec-packages#4426))
([4de2540](AztecProtocol/aztec-packages@4de2540))
* Poseidon2 hash uses span instead of vector
([#4003](AztecProtocol/aztec-packages#4003))
([f63e7a9](AztecProtocol/aztec-packages@f63e7a9))
* Reenable private kernel function tree checks
([#4358](AztecProtocol/aztec-packages#4358))
([e7db0da](AztecProtocol/aztec-packages@e7db0da))
* Remove hardcoded storage slot values
([#4398](AztecProtocol/aztec-packages#4398))
([d2294a4](AztecProtocol/aztec-packages@d2294a4))
* Rename bigint_neg into bigint_sub
([#4420](AztecProtocol/aztec-packages#4420))
([57824fe](AztecProtocol/aztec-packages@57824fe))
* Replace Note::compute_note_hash with Note::compute_note_content_hash
([#4342](AztecProtocol/aztec-packages#4342))
([8368659](AztecProtocol/aztec-packages@8368659))
* Replace relative paths to noir-protocol-circuits
([23de650](AztecProtocol/aztec-packages@23de650))
* Replace relative paths to noir-protocol-circuits
([b8d427f](AztecProtocol/aztec-packages@b8d427f))
* Replace relative paths to noir-protocol-circuits
([113dec1](AztecProtocol/aztec-packages@113dec1))
* Replace relative paths to noir-protocol-circuits
([a79093b](AztecProtocol/aztec-packages@a79093b))
* Replace relative paths to noir-protocol-circuits
([808b4eb](AztecProtocol/aztec-packages@808b4eb))
* Serialize, Deserialize and NoteInterface as Traits
([#4135](AztecProtocol/aztec-packages#4135))
([9e6605c](AztecProtocol/aztec-packages@9e6605c))
* Simpler noir sync
([#4376](AztecProtocol/aztec-packages#4376))
([665b35e](AztecProtocol/aztec-packages@665b35e))
* Surpress chained macro warning
([#4396](AztecProtocol/aztec-packages#4396))
([5e9c790](AztecProtocol/aztec-packages@5e9c790))
* Switch to macos-14 for m1 runners
([#3456](AztecProtocol/aztec-packages#3456))
([ca5b6f8](AztecProtocol/aztec-packages@ca5b6f8))
* Testing `toFields()` length
([#4364](AztecProtocol/aztec-packages#4364))
([5d3fce3](AztecProtocol/aztec-packages@5d3fce3))
* Typing contents of `MessageLoadOracleInputs`
([#4351](AztecProtocol/aztec-packages#4351))
([433babd](AztecProtocol/aztec-packages@433babd))
* Update docs on comparators
([#4281](AztecProtocol/aztec-packages#4281))
([cc2ce9c](AztecProtocol/aztec-packages@cc2ce9c))
* Updating block hash to be header.hash()
([#4286](AztecProtocol/aztec-packages#4286))
([d4125e1](AztecProtocol/aztec-packages@d4125e1))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([#4383](AztecProtocol/aztec-packages#4383))
([14dd0b8](AztecProtocol/aztec-packages@14dd0b8))


### Documentation

* Add simple api description for note_getter_options.status
([#4329](AztecProtocol/aztec-packages#4329))
([cc17afe](AztecProtocol/aztec-packages@cc17afe))
* Document stable public state usage
([#4324](AztecProtocol/aztec-packages#4324))
([13f709b](AztecProtocol/aztec-packages@13f709b)),
closes
[#4325](AztecProtocol/aztec-packages#4325)
* Minor quickstart fixes
([#4330](AztecProtocol/aztec-packages#4330))
([f85a870](AztecProtocol/aztec-packages@f85a870))
* Update contract deployment section in YP
([#4290](AztecProtocol/aztec-packages#4290))
([e99a882](AztecProtocol/aztec-packages@e99a882))
* **yp:** AVM circuit - user memory section
([#4323](AztecProtocol/aztec-packages#4323))
([8928fb1](AztecProtocol/aztec-packages@8928fb1)),
closes
[#4043](AztecProtocol/aztec-packages#4043)
</details>

<details><summary>barretenberg.js: 0.22.0</summary>

##
[0.22.0](AztecProtocol/aztec-packages@barretenberg.js-v0.21.0...barretenberg.js-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](AztecProtocol/aztec-packages#4221))

### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](AztecProtocol/aztec-packages#4221))
([9c965a7](AztecProtocol/aztec-packages@9c965a7))
</details>

<details><summary>barretenberg: 0.22.0</summary>

##
[0.22.0](AztecProtocol/aztec-packages@barretenberg-v0.21.0...barretenberg-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([#4420](AztecProtocol/aztec-packages#4420))
* Add expression width into acir
([#4014](AztecProtocol/aztec-packages#4014))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](AztecProtocol/aztec-packages#4221))

### Features

* Add bit size to const opcode
([#4385](AztecProtocol/aztec-packages#4385))
([b2a000e](AztecProtocol/aztec-packages@b2a000e))
* Add expression width into acir
([#4014](AztecProtocol/aztec-packages#4014))
([f09e8fc](AztecProtocol/aztec-packages@f09e8fc))
* Add poseidon2 hashing to native transcript
([#3718](AztecProtocol/aztec-packages#3718))
([afcfa71](AztecProtocol/aztec-packages@afcfa71))
* **avm:** Add command to call avm proving in bb binary
([#4369](AztecProtocol/aztec-packages#4369))
([4f6d607](AztecProtocol/aztec-packages@4f6d607)),
closes
[#4039](AztecProtocol/aztec-packages#4039)
* **avm:** Back in avm context with macro - refactor context
([#4438](AztecProtocol/aztec-packages#4438))
([ccf9b17](AztecProtocol/aztec-packages@ccf9b17))
* **bb:** Wasmtime and remote benchmarking
([#4204](AztecProtocol/aztec-packages#4204))
([fd27808](AztecProtocol/aztec-packages@fd27808))
* Folding `GoblinUltra` instances in ProtoGalaxy
([#4340](AztecProtocol/aztec-packages#4340))
([8569e7c](AztecProtocol/aztec-packages@8569e7c))
* Implementation for bigint opcodes
([#4288](AztecProtocol/aztec-packages#4288))
([b61dace](AztecProtocol/aztec-packages@b61dace))
* Improve ivc bench
([#4242](AztecProtocol/aztec-packages#4242))
([9d28354](AztecProtocol/aztec-packages@9d28354))
* Memory only brillig
([#4215](AztecProtocol/aztec-packages#4215))
([018177b](AztecProtocol/aztec-packages@018177b))


### Bug Fixes

* Bb build
([#4317](AztecProtocol/aztec-packages#4317))
([82f5f03](AztecProtocol/aztec-packages@82f5f03))
* Mac build
([#4336](AztecProtocol/aztec-packages#4336))
([aeb4cf0](AztecProtocol/aztec-packages@aeb4cf0))
* Release the size of goblin translator
([#4259](AztecProtocol/aztec-packages#4259))
([6e1d958](AztecProtocol/aztec-packages@6e1d958))


### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](AztecProtocol/aztec-packages#4221))
([9c965a7](AztecProtocol/aztec-packages@9c965a7))
* Collapse bb::honk
([#4318](AztecProtocol/aztec-packages#4318))
([5853af4](AztecProtocol/aztec-packages@5853af4))
* Extract merge from UC and simplify
([#4343](AztecProtocol/aztec-packages#4343))
([54fd794](AztecProtocol/aztec-packages@54fd794))
* Fix bb wasm build when using remote cache
([#4397](AztecProtocol/aztec-packages#4397))
([14e57cb](AztecProtocol/aztec-packages@14e57cb))
* Poseidon2 hash uses span instead of vector
([#4003](AztecProtocol/aztec-packages#4003))
([f63e7a9](AztecProtocol/aztec-packages@f63e7a9))
* Rename bigint_neg into bigint_sub
([#4420](AztecProtocol/aztec-packages#4420))
([57824fe](AztecProtocol/aztec-packages@57824fe))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
TomAFrench pushed a commit that referenced this pull request Feb 7, 2024
Closes: #3198,
#2928

~~Requires #4135,
which is blocked by noir-lang/noir#4124

Automatic storage initialization via aztec macro. 

Full support of public and private state from
`dep::aztec::state_vars::*`, including Maps (and nested Maps!)
Limited support for custom types (as long as they have a single
serializable generic and their constructor is `::new(context,
storage_slot`).

~~Pending: better errors, code comments and some cleanup.~~

Hijacking my own
[comment](#4200 (comment))
for the explanation:

The idea behind this is that in 99% of cases, storage initialization
(that is, the `impl` for a given `struct Storage...` is redundant, and
the only need for its existence was assigning storage slots...which in
turn were necessary because we didn't know how to serialize the data
structures that were used in a given contract or how much space they
used once serialized (relevant for the public state).

After #4135 is
merged, both of those things don't have to be explicitly provided since
we're using traits, so the aztec macro can infer the implementation of
the Storage struct just by taking hints from the definition. An example:

```rust
    struct Storage {
        // MyAwesomeStuff implements Serialize<2>, so we assign it slot 1 (and remember that it will take 2 slots due to its size)
        public_var: PublicState<MyAwesomeSuff>, 
        // Right after the first one, assign it to slot: current_slot + previous_size = 3
        another_public_var: PublicState<MyAwesomeSuff>,
        // Private and Public state don't share slots since they "live" in different trees, but keeping the slot count simplifies implementation. 
        // Notes also implement Serialize<N>, but they only take up 1 slot anyways because of hashing, assign it slot 5
        a_singleton: Singleton<ANote>,
        // Maps derive slots via hashing, so we can assume they only "take" 1 slot. We assign it slot 6
        balances: Map<AztecAddress, Singleton<ANote>>,
        // Slot 7
        a_set: Set<ANote>,
        // Slot 8
        imm_singleton: ImmutableSingleton<ANote>,
        // Slot 9. 
        profiles: Map<AztecAddress, Map<Singleton<ANote>>>,
    }

```

We have all the info we need in the AST and HIR to build this
automatically:

```rust
impl Storage {
    fn init(context: Context) -> Self {
        Storage {
            public_var: PublicState::new(context, 1), // No need for serialization methods, taken from the the trait impl
            another_public_var: PublicState::new(context, 3),
            a_singleton: Singleton::new(context, 5),
            // Map init lambda always takes the same form for known storage structs
            balances: Map::new(context, 6, |context, slot| { 
                Singleton::new(context, slot) 
            }),
            a_set: Set::new(context, 7),
            imm_singleton: ImmutableSingleton::new(context, 8),
            // A map of maps is just nesting lambdas, we can infer this too
            profiles: Map::new(context, 9, |context, slot| { 
                Map::new(context, slot, |context, slot| { 
                    Singleton::new(context, slot) 
                })
            })
        }
    }
}

```

...as long as we use "canonical" storage implementations. This means
`AStoragePrimitive<SomethingSerializable>` and
`Map<SomethingWithToField, AStoragePrimitive<SomethingSerializable>>`.

**TLDR:** define the Storage struct, in 99% of cases the macro takes
care of the implementation!

Implementing custom storage will look just like it does know, the macro
will skip automatic generation if it finds one.

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
TomAFrench pushed a commit that referenced this pull request Feb 7, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-packages: 0.22.0</summary>

##
[0.22.0](aztec-packages-v0.21.0...aztec-packages-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([#4420](#4420))
* Add expression width into acir
([#4014](#4014))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([#4383](#4383))
* Unencrypted logs are not strings
([#4392](#4392))
* init storage macro
([#4200](#4200))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
* introduce compute_note_hash_for_(consumption/insertion)
([#4344](#4344))
* replace Note::compute_note_hash with Note::compute_note_content_hash
([#4342](#4342))
* Include contract class id in deployment info
([#4223](#4223))
* Serialize, Deserialize and NoteInterface as Traits
([#4135](#4135))

### Features

* Add aztec node to client execution and nuke state info provider
[#4320](#4320)
([#4401](#4401))
([2dec0cc](2dec0cc))
* Add bit size to const opcode
([#4385](#4385))
([b2a000e](b2a000e))
* Add expression width into acir
([#4014](#4014))
([f09e8fc](f09e8fc))
* Add meta_hwm to PrivateCircuitPublicInputs
([#4341](#4341))
([4f248b5](4f248b5))
* Add poseidon2 hashing to native transcript
([#3718](#3718))
([afcfa71](afcfa71))
* Adding slitherin detectors
([#4246](#4246))
([7cdc186](7cdc186))
* Allow using of current block in inclusion proofs
([#4285](#4285))
([728c5ac](728c5ac)),
closes
[#4274](#4274)
* **avm-transpiler:** Brillig to AVM transpiler
([#4227](#4227))
([c366c6e](c366c6e))
* **avm:** Add command to call avm proving in bb binary
([#4369](#4369))
([4f6d607](4f6d607)),
closes
[#4039](#4039)
* **avm:** Add revert tracking to the journal
([#4349](#4349))
([1615803](1615803))
* **avm:** Back in avm context with macro - refactor context
([#4438](#4438))
([ccf9b17](ccf9b17))
* **avm:** Complete SET instruction
([#4378](#4378))
([013891f](013891f))
* **avm:** Implement avm state getter opcodes within noir contracts
([#4402](#4402))
([9f2a6eb](9f2a6eb))
* **avm:** Implement serialization for all existing operations
([#4338](#4338))
([13e0683](13e0683))
* **avm:** Keep history of reads and writes in journal
([#4315](#4315))
([cdf1baf](cdf1baf))
* **aztec-nr:** Initial work for aztec public vm macro
([#4400](#4400))
([0024590](0024590))
* **bb:** Wasmtime and remote benchmarking
([#4204](#4204))
([fd27808](fd27808))
* Contract class registerer contract
([#4403](#4403))
([d953090](d953090)),
closes
[#4069](#4069)
[#4070](#4070)
* Crude stable var implementation
([#4289](#4289))
([5f9eee4](5f9eee4))
* **docs:** Docs deeper dive into unconstrained functions
([#4233](#4233))
([6af548e](6af548e))
* Emit single functions from class registerer
([#4429](#4429))
([19e03ad](19e03ad)),
closes
[#4427](#4427)
* Extend Historical Access APIs
[#4179](#4179)
([#4375](#4375))
([c918d8d](c918d8d))
* Folding `GoblinUltra` instances in ProtoGalaxy
([#4340](#4340))
([8569e7c](8569e7c))
* Hashing output of `serialize()` in noir + more tests
([#4365](#4365))
([5a71bb9](5a71bb9))
* Implementation for bigint opcodes
([#4288](#4288))
([b61dace](b61dace))
* Improve ivc bench
([#4242](#4242))
([9d28354](9d28354))
* Include contract class id in deployment info
([#4223](#4223))
([0ed4126](0ed4126)),
closes
[#4054](#4054)
* Init storage macro
([#4200](#4200))
([11d9697](11d9697))
* Memory only brillig
([#4215](#4215))
([018177b](018177b))
* Nullified note retrieval in get_notes and view_notes
([#4238](#4238))
([8d02eb7](8d02eb7))
* Private calls and initialization of undeployed contracts
([#4362](#4362))
([f31c181](f31c181)),
closes
[#4057](#4057)
[#4058](#4058)
[#4059](#4059)
* Sequencer processes transactions in phases
([#4345](#4345))
([78cc709](78cc709))
* Unencrypted logs are not strings
([#4392](#4392))
([25a7ea7](25a7ea7))
* Verify function against contract class id in private kernel
([#4337](#4337))
([e1d832d](e1d832d)),
closes
[#4056](#4056)


### Bug Fixes

* **avm-transpiler:** Avm-transpiler bootstrap by tying down rust
version
([#4347](#4347))
([09d0730](09d0730))
* **avm-transpiler:** Bump rust toolchain version for transpiler
([#4356](#4356))
([75e30b9](75e30b9))
* **avm:** Fix SendL2ToL1Message implementation
([#4367](#4367))
([ee560c3](ee560c3))
* Aztec binary fixes
([#4273](#4273))
([84e1f7d](84e1f7d))
* Bb build
([#4317](#4317))
([82f5f03](82f5f03))
* Load contract artifact from json
([#4352](#4352))
([47a0a79](47a0a79))
* Mac build
([#4336](#4336))
([aeb4cf0](aeb4cf0))
* **noir-contracts:** Disable transpilation for now
([#4372](#4372))
([37662b7](37662b7))
* Nr codegen to use new protocol types path
([#4353](#4353))
([84e63b1](84e63b1)),
closes
[#4193](#4193)
* Relative LogFn import
([#4328](#4328))
([1faead5](1faead5))
* Release the size of goblin translator
([#4259](#4259))
([6e1d958](6e1d958))
* Transpiler build
([#4386](#4386))
([032ddc5](032ddc5))


### Miscellaneous

* `PublicCircuitPublicInputs` and `PrivateCircuitPublicInputs` cleanup
([#4360](#4360))
([b92d690](b92d690))
* `toFields()`/`fromFields(...)` methods in more classes
([#4335](#4335))
([433b9eb](433b9eb))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
([9c965a7](9c965a7))
* Add bigint solver in ACVM and add a unit test for bigints in Noir
([#4415](#4415))
([e4a2fe9](e4a2fe9))
* Add bootstrap_cache for avm-transpiler
([#4357](#4357))
([bfebebb](bfebebb))
* Add disclaimer
([#4393](#4393))
([6895f52](6895f52))
* Add migration note for serialization change
([#4414](#4414))
([968a3a0](968a3a0))
* **avm:** Make interpreter a function not a class
([#4272](#4272))
([14e8c5c](14e8c5c))
* **avm:** Refactor AVM Simulator and fix issues
([#4424](#4424))
([a6179bd](a6179bd))
* Call stack item cleanup
([#4381](#4381))
([341b0a1](341b0a1))
* Check loading Nargo artifacts works in the cli
([#4355](#4355))
([43b58b3](43b58b3))
* Cleanup + various doc improvements
([#4282](#4282))
([648229c](648229c)),
closes
[#4264](#4264)
* Collapse bb::honk
([#4318](#4318))
([5853af4](5853af4))
* Consistent naming of serialization method
([#4379](#4379))
([148d5dc](148d5dc))
* Do not run forge fmt because not everyone has forge installed
([#4430](#4430))
([ecb6c3f](ecb6c3f))
* **docs:** Update broken link ref in slow_updates_tree.md
([#4339](#4339))
([2599d7f](2599d7f))
* Eth address tech debt cleanup
([#4442](#4442))
([153989f](153989f))
* Extract merge from UC and simplify
([#4343](#4343))
([54fd794](54fd794))
* Fix bb wasm build when using remote cache
([#4397](#4397))
([14e57cb](14e57cb))
* Fix clippy warnings in `avm-transpiler`
([#4416](#4416))
([e54ecd2](e54ecd2))
* Format l1-contracts after generating constants
([#4448](#4448))
([de11994](de11994))
* Git subrepo commit (merge) noir
([#4321](#4321))
([348d18a](348d18a))
* Git subrepo pull (merge) noir
([#4331](#4331))
([683f782](683f782))
* Implementing `deserialize()` in Noir structs
([#4384](#4384))
([e63bbae](e63bbae))
* Introduce compute_note_hash_for_(consumption/insertion)
([#4344](#4344))
([26a0d49](26a0d49))
* Optimize prove_note_validity
[#4418](#4418)
([#4426](#4426))
([4de2540](4de2540))
* Poseidon2 hash uses span instead of vector
([#4003](#4003))
([f63e7a9](f63e7a9))
* Reenable private kernel function tree checks
([#4358](#4358))
([e7db0da](e7db0da))
* Remove hardcoded storage slot values
([#4398](#4398))
([d2294a4](d2294a4))
* Rename bigint_neg into bigint_sub
([#4420](#4420))
([57824fe](57824fe))
* Replace Note::compute_note_hash with Note::compute_note_content_hash
([#4342](#4342))
([8368659](8368659))
* Replace relative paths to noir-protocol-circuits
([23de650](23de650))
* Replace relative paths to noir-protocol-circuits
([b8d427f](b8d427f))
* Replace relative paths to noir-protocol-circuits
([113dec1](113dec1))
* Replace relative paths to noir-protocol-circuits
([a79093b](a79093b))
* Replace relative paths to noir-protocol-circuits
([808b4eb](808b4eb))
* Serialize, Deserialize and NoteInterface as Traits
([#4135](#4135))
([9e6605c](9e6605c))
* Simpler noir sync
([#4376](#4376))
([665b35e](665b35e))
* Surpress chained macro warning
([#4396](#4396))
([5e9c790](5e9c790))
* Switch to macos-14 for m1 runners
([#3456](#3456))
([ca5b6f8](ca5b6f8))
* Testing `toFields()` length
([#4364](#4364))
([5d3fce3](5d3fce3))
* Typing contents of `MessageLoadOracleInputs`
([#4351](#4351))
([433babd](433babd))
* Update docs on comparators
([#4281](#4281))
([cc2ce9c](cc2ce9c))
* Updating block hash to be header.hash()
([#4286](#4286))
([d4125e1](d4125e1))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([#4383](#4383))
([14dd0b8](14dd0b8))


### Documentation

* Add simple api description for note_getter_options.status
([#4329](#4329))
([cc17afe](cc17afe))
* Document stable public state usage
([#4324](#4324))
([13f709b](13f709b)),
closes
[#4325](#4325)
* Minor quickstart fixes
([#4330](#4330))
([f85a870](f85a870))
* Update contract deployment section in YP
([#4290](#4290))
([e99a882](e99a882))
* **yp:** AVM circuit - user memory section
([#4323](#4323))
([8928fb1](8928fb1)),
closes
[#4043](#4043)
</details>

<details><summary>barretenberg.js: 0.22.0</summary>

##
[0.22.0](barretenberg.js-v0.21.0...barretenberg.js-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))

### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
([9c965a7](9c965a7))
</details>

<details><summary>barretenberg: 0.22.0</summary>

##
[0.22.0](barretenberg-v0.21.0...barretenberg-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([#4420](#4420))
* Add expression width into acir
([#4014](#4014))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))

### Features

* Add bit size to const opcode
([#4385](#4385))
([b2a000e](b2a000e))
* Add expression width into acir
([#4014](#4014))
([f09e8fc](f09e8fc))
* Add poseidon2 hashing to native transcript
([#3718](#3718))
([afcfa71](afcfa71))
* **avm:** Add command to call avm proving in bb binary
([#4369](#4369))
([4f6d607](4f6d607)),
closes
[#4039](#4039)
* **avm:** Back in avm context with macro - refactor context
([#4438](#4438))
([ccf9b17](ccf9b17))
* **bb:** Wasmtime and remote benchmarking
([#4204](#4204))
([fd27808](fd27808))
* Folding `GoblinUltra` instances in ProtoGalaxy
([#4340](#4340))
([8569e7c](8569e7c))
* Implementation for bigint opcodes
([#4288](#4288))
([b61dace](b61dace))
* Improve ivc bench
([#4242](#4242))
([9d28354](9d28354))
* Memory only brillig
([#4215](#4215))
([018177b](018177b))


### Bug Fixes

* Bb build
([#4317](#4317))
([82f5f03](82f5f03))
* Mac build
([#4336](#4336))
([aeb4cf0](aeb4cf0))
* Release the size of goblin translator
([#4259](#4259))
([6e1d958](6e1d958))


### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([#4221](#4221))
([9c965a7](9c965a7))
* Collapse bb::honk
([#4318](#4318))
([5853af4](5853af4))
* Extract merge from UC and simplify
([#4343](#4343))
([54fd794](54fd794))
* Fix bb wasm build when using remote cache
([#4397](#4397))
([14e57cb](14e57cb))
* Poseidon2 hash uses span instead of vector
([#4003](#4003))
([f63e7a9](f63e7a9))
* Rename bigint_neg into bigint_sub
([#4420](#4420))
([57824fe](57824fe))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
michaelelliot pushed a commit to Swoir/noir_rs that referenced this pull request Feb 28, 2024
…ocol#4135)

Closes: AztecProtocol#3756,
AztecProtocol#2838


Taking advantage of @jfecher's fantastic work in
noir-lang/noir#4000, implemented `Serialize<N>`
and `Deserialize<N>`. Together with `NoteInterface`, they make possible
getting rid of all the serialization interfaces, which greatly simplify
how the storage is handled and opens the door to further improvements.
~~Still some clutter to go, the lengths are still needed in some
places.~~


![Brace yourself](https://i.imgflip.com/8crkve.jpg)

I'm so sorry.

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
michaelelliot pushed a commit to Swoir/noir_rs that referenced this pull request Feb 28, 2024
Closes: AztecProtocol#3198,
AztecProtocol#2928

~~Requires AztecProtocol#4135,
which is blocked by noir-lang/noir#4124

Automatic storage initialization via aztec macro. 

Full support of public and private state from
`dep::aztec::state_vars::*`, including Maps (and nested Maps!)
Limited support for custom types (as long as they have a single
serializable generic and their constructor is `::new(context,
storage_slot`).

~~Pending: better errors, code comments and some cleanup.~~

Hijacking my own
[comment](AztecProtocol#4200 (comment))
for the explanation:

The idea behind this is that in 99% of cases, storage initialization
(that is, the `impl` for a given `struct Storage...` is redundant, and
the only need for its existence was assigning storage slots...which in
turn were necessary because we didn't know how to serialize the data
structures that were used in a given contract or how much space they
used once serialized (relevant for the public state).

After AztecProtocol#4135 is
merged, both of those things don't have to be explicitly provided since
we're using traits, so the aztec macro can infer the implementation of
the Storage struct just by taking hints from the definition. An example:

```rust
    struct Storage {
        // MyAwesomeStuff implements Serialize<2>, so we assign it slot 1 (and remember that it will take 2 slots due to its size)
        public_var: PublicState<MyAwesomeSuff>, 
        // Right after the first one, assign it to slot: current_slot + previous_size = 3
        another_public_var: PublicState<MyAwesomeSuff>,
        // Private and Public state don't share slots since they "live" in different trees, but keeping the slot count simplifies implementation. 
        // Notes also implement Serialize<N>, but they only take up 1 slot anyways because of hashing, assign it slot 5
        a_singleton: Singleton<ANote>,
        // Maps derive slots via hashing, so we can assume they only "take" 1 slot. We assign it slot 6
        balances: Map<AztecAddress, Singleton<ANote>>,
        // Slot 7
        a_set: Set<ANote>,
        // Slot 8
        imm_singleton: ImmutableSingleton<ANote>,
        // Slot 9. 
        profiles: Map<AztecAddress, Map<Singleton<ANote>>>,
    }

```

We have all the info we need in the AST and HIR to build this
automatically:

```rust
impl Storage {
    fn init(context: Context) -> Self {
        Storage {
            public_var: PublicState::new(context, 1), // No need for serialization methods, taken from the the trait impl
            another_public_var: PublicState::new(context, 3),
            a_singleton: Singleton::new(context, 5),
            // Map init lambda always takes the same form for known storage structs
            balances: Map::new(context, 6, |context, slot| { 
                Singleton::new(context, slot) 
            }),
            a_set: Set::new(context, 7),
            imm_singleton: ImmutableSingleton::new(context, 8),
            // A map of maps is just nesting lambdas, we can infer this too
            profiles: Map::new(context, 9, |context, slot| { 
                Map::new(context, slot, |context, slot| { 
                    Singleton::new(context, slot) 
                })
            })
        }
    }
}

```

...as long as we use "canonical" storage implementations. This means
`AStoragePrimitive<SomethingSerializable>` and
`Map<SomethingWithToField, AStoragePrimitive<SomethingSerializable>>`.

**TLDR:** define the Storage struct, in 99% of cases the macro takes
care of the implementation!

Implementing custom storage will look just like it does know, the macro
will skip automatic generation if it finds one.

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
michaelelliot pushed a commit to Swoir/noir_rs that referenced this pull request Feb 28, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-packages: 0.22.0</summary>

##
[0.22.0](AztecProtocol/aztec-packages@aztec-packages-v0.21.0...aztec-packages-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([AztecProtocol#4420](AztecProtocol#4420))
* Add expression width into acir
([AztecProtocol#4014](AztecProtocol#4014))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([AztecProtocol#4383](AztecProtocol#4383))
* Unencrypted logs are not strings
([AztecProtocol#4392](AztecProtocol#4392))
* init storage macro
([AztecProtocol#4200](AztecProtocol#4200))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([AztecProtocol#4221](AztecProtocol#4221))
* introduce compute_note_hash_for_(consumption/insertion)
([AztecProtocol#4344](AztecProtocol#4344))
* replace Note::compute_note_hash with Note::compute_note_content_hash
([AztecProtocol#4342](AztecProtocol#4342))
* Include contract class id in deployment info
([AztecProtocol#4223](AztecProtocol#4223))
* Serialize, Deserialize and NoteInterface as Traits
([AztecProtocol#4135](AztecProtocol#4135))

### Features

* Add aztec node to client execution and nuke state info provider
[AztecProtocol#4320](AztecProtocol#4320)
([AztecProtocol#4401](AztecProtocol#4401))
([2dec0cc](AztecProtocol@2dec0cc))
* Add bit size to const opcode
([AztecProtocol#4385](AztecProtocol#4385))
([b2a000e](AztecProtocol@b2a000e))
* Add expression width into acir
([AztecProtocol#4014](AztecProtocol#4014))
([f09e8fc](AztecProtocol@f09e8fc))
* Add meta_hwm to PrivateCircuitPublicInputs
([AztecProtocol#4341](AztecProtocol#4341))
([4f248b5](AztecProtocol@4f248b5))
* Add poseidon2 hashing to native transcript
([AztecProtocol#3718](AztecProtocol#3718))
([afcfa71](AztecProtocol@afcfa71))
* Adding slitherin detectors
([AztecProtocol#4246](AztecProtocol#4246))
([7cdc186](AztecProtocol@7cdc186))
* Allow using of current block in inclusion proofs
([AztecProtocol#4285](AztecProtocol#4285))
([728c5ac](AztecProtocol@728c5ac)),
closes
[AztecProtocol#4274](AztecProtocol#4274)
* **avm-transpiler:** Brillig to AVM transpiler
([AztecProtocol#4227](AztecProtocol#4227))
([c366c6e](AztecProtocol@c366c6e))
* **avm:** Add command to call avm proving in bb binary
([AztecProtocol#4369](AztecProtocol#4369))
([4f6d607](AztecProtocol@4f6d607)),
closes
[AztecProtocol#4039](AztecProtocol#4039)
* **avm:** Add revert tracking to the journal
([AztecProtocol#4349](AztecProtocol#4349))
([1615803](AztecProtocol@1615803))
* **avm:** Back in avm context with macro - refactor context
([AztecProtocol#4438](AztecProtocol#4438))
([ccf9b17](AztecProtocol@ccf9b17))
* **avm:** Complete SET instruction
([AztecProtocol#4378](AztecProtocol#4378))
([013891f](AztecProtocol@013891f))
* **avm:** Implement avm state getter opcodes within noir contracts
([AztecProtocol#4402](AztecProtocol#4402))
([9f2a6eb](AztecProtocol@9f2a6eb))
* **avm:** Implement serialization for all existing operations
([AztecProtocol#4338](AztecProtocol#4338))
([13e0683](AztecProtocol@13e0683))
* **avm:** Keep history of reads and writes in journal
([AztecProtocol#4315](AztecProtocol#4315))
([cdf1baf](AztecProtocol@cdf1baf))
* **aztec-nr:** Initial work for aztec public vm macro
([AztecProtocol#4400](AztecProtocol#4400))
([0024590](AztecProtocol@0024590))
* **bb:** Wasmtime and remote benchmarking
([AztecProtocol#4204](AztecProtocol#4204))
([fd27808](AztecProtocol@fd27808))
* Contract class registerer contract
([AztecProtocol#4403](AztecProtocol#4403))
([d953090](AztecProtocol@d953090)),
closes
[AztecProtocol#4069](AztecProtocol#4069)
[AztecProtocol#4070](AztecProtocol#4070)
* Crude stable var implementation
([AztecProtocol#4289](AztecProtocol#4289))
([5f9eee4](AztecProtocol@5f9eee4))
* **docs:** Docs deeper dive into unconstrained functions
([AztecProtocol#4233](AztecProtocol#4233))
([6af548e](AztecProtocol@6af548e))
* Emit single functions from class registerer
([AztecProtocol#4429](AztecProtocol#4429))
([19e03ad](AztecProtocol@19e03ad)),
closes
[AztecProtocol#4427](AztecProtocol#4427)
* Extend Historical Access APIs
[AztecProtocol#4179](AztecProtocol#4179)
([AztecProtocol#4375](AztecProtocol#4375))
([c918d8d](AztecProtocol@c918d8d))
* Folding `GoblinUltra` instances in ProtoGalaxy
([AztecProtocol#4340](AztecProtocol#4340))
([8569e7c](AztecProtocol@8569e7c))
* Hashing output of `serialize()` in noir + more tests
([AztecProtocol#4365](AztecProtocol#4365))
([5a71bb9](AztecProtocol@5a71bb9))
* Implementation for bigint opcodes
([AztecProtocol#4288](AztecProtocol#4288))
([b61dace](AztecProtocol@b61dace))
* Improve ivc bench
([AztecProtocol#4242](AztecProtocol#4242))
([9d28354](AztecProtocol@9d28354))
* Include contract class id in deployment info
([AztecProtocol#4223](AztecProtocol#4223))
([0ed4126](AztecProtocol@0ed4126)),
closes
[AztecProtocol#4054](AztecProtocol#4054)
* Init storage macro
([AztecProtocol#4200](AztecProtocol#4200))
([11d9697](AztecProtocol@11d9697))
* Memory only brillig
([AztecProtocol#4215](AztecProtocol#4215))
([018177b](AztecProtocol@018177b))
* Nullified note retrieval in get_notes and view_notes
([AztecProtocol#4238](AztecProtocol#4238))
([8d02eb7](AztecProtocol@8d02eb7))
* Private calls and initialization of undeployed contracts
([AztecProtocol#4362](AztecProtocol#4362))
([f31c181](AztecProtocol@f31c181)),
closes
[AztecProtocol#4057](AztecProtocol#4057)
[AztecProtocol#4058](AztecProtocol#4058)
[AztecProtocol#4059](AztecProtocol#4059)
* Sequencer processes transactions in phases
([AztecProtocol#4345](AztecProtocol#4345))
([78cc709](AztecProtocol@78cc709))
* Unencrypted logs are not strings
([AztecProtocol#4392](AztecProtocol#4392))
([25a7ea7](AztecProtocol@25a7ea7))
* Verify function against contract class id in private kernel
([AztecProtocol#4337](AztecProtocol#4337))
([e1d832d](AztecProtocol@e1d832d)),
closes
[AztecProtocol#4056](AztecProtocol#4056)


### Bug Fixes

* **avm-transpiler:** Avm-transpiler bootstrap by tying down rust
version
([AztecProtocol#4347](AztecProtocol#4347))
([09d0730](AztecProtocol@09d0730))
* **avm-transpiler:** Bump rust toolchain version for transpiler
([AztecProtocol#4356](AztecProtocol#4356))
([75e30b9](AztecProtocol@75e30b9))
* **avm:** Fix SendL2ToL1Message implementation
([AztecProtocol#4367](AztecProtocol#4367))
([ee560c3](AztecProtocol@ee560c3))
* Aztec binary fixes
([AztecProtocol#4273](AztecProtocol#4273))
([84e1f7d](AztecProtocol@84e1f7d))
* Bb build
([AztecProtocol#4317](AztecProtocol#4317))
([82f5f03](AztecProtocol@82f5f03))
* Load contract artifact from json
([AztecProtocol#4352](AztecProtocol#4352))
([47a0a79](AztecProtocol@47a0a79))
* Mac build
([AztecProtocol#4336](AztecProtocol#4336))
([aeb4cf0](AztecProtocol@aeb4cf0))
* **noir-contracts:** Disable transpilation for now
([AztecProtocol#4372](AztecProtocol#4372))
([37662b7](AztecProtocol@37662b7))
* Nr codegen to use new protocol types path
([AztecProtocol#4353](AztecProtocol#4353))
([84e63b1](AztecProtocol@84e63b1)),
closes
[AztecProtocol#4193](AztecProtocol#4193)
* Relative LogFn import
([AztecProtocol#4328](AztecProtocol#4328))
([1faead5](AztecProtocol@1faead5))
* Release the size of goblin translator
([AztecProtocol#4259](AztecProtocol#4259))
([6e1d958](AztecProtocol@6e1d958))
* Transpiler build
([AztecProtocol#4386](AztecProtocol#4386))
([032ddc5](AztecProtocol@032ddc5))


### Miscellaneous

* `PublicCircuitPublicInputs` and `PrivateCircuitPublicInputs` cleanup
([AztecProtocol#4360](AztecProtocol#4360))
([b92d690](AztecProtocol@b92d690))
* `toFields()`/`fromFields(...)` methods in more classes
([AztecProtocol#4335](AztecProtocol#4335))
([433b9eb](AztecProtocol@433b9eb))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([AztecProtocol#4221](AztecProtocol#4221))
([9c965a7](AztecProtocol@9c965a7))
* Add bigint solver in ACVM and add a unit test for bigints in Noir
([AztecProtocol#4415](AztecProtocol#4415))
([e4a2fe9](AztecProtocol@e4a2fe9))
* Add bootstrap_cache for avm-transpiler
([AztecProtocol#4357](AztecProtocol#4357))
([bfebebb](AztecProtocol@bfebebb))
* Add disclaimer
([AztecProtocol#4393](AztecProtocol#4393))
([6895f52](AztecProtocol@6895f52))
* Add migration note for serialization change
([AztecProtocol#4414](AztecProtocol#4414))
([968a3a0](AztecProtocol@968a3a0))
* **avm:** Make interpreter a function not a class
([AztecProtocol#4272](AztecProtocol#4272))
([14e8c5c](AztecProtocol@14e8c5c))
* **avm:** Refactor AVM Simulator and fix issues
([AztecProtocol#4424](AztecProtocol#4424))
([a6179bd](AztecProtocol@a6179bd))
* Call stack item cleanup
([AztecProtocol#4381](AztecProtocol#4381))
([341b0a1](AztecProtocol@341b0a1))
* Check loading Nargo artifacts works in the cli
([AztecProtocol#4355](AztecProtocol#4355))
([43b58b3](AztecProtocol@43b58b3))
* Cleanup + various doc improvements
([AztecProtocol#4282](AztecProtocol#4282))
([648229c](AztecProtocol@648229c)),
closes
[AztecProtocol#4264](AztecProtocol#4264)
* Collapse bb::honk
([AztecProtocol#4318](AztecProtocol#4318))
([5853af4](AztecProtocol@5853af4))
* Consistent naming of serialization method
([AztecProtocol#4379](AztecProtocol#4379))
([148d5dc](AztecProtocol@148d5dc))
* Do not run forge fmt because not everyone has forge installed
([AztecProtocol#4430](AztecProtocol#4430))
([ecb6c3f](AztecProtocol@ecb6c3f))
* **docs:** Update broken link ref in slow_updates_tree.md
([AztecProtocol#4339](AztecProtocol#4339))
([2599d7f](AztecProtocol@2599d7f))
* Eth address tech debt cleanup
([AztecProtocol#4442](AztecProtocol#4442))
([153989f](AztecProtocol@153989f))
* Extract merge from UC and simplify
([AztecProtocol#4343](AztecProtocol#4343))
([54fd794](AztecProtocol@54fd794))
* Fix bb wasm build when using remote cache
([AztecProtocol#4397](AztecProtocol#4397))
([14e57cb](AztecProtocol@14e57cb))
* Fix clippy warnings in `avm-transpiler`
([AztecProtocol#4416](AztecProtocol#4416))
([e54ecd2](AztecProtocol@e54ecd2))
* Format l1-contracts after generating constants
([AztecProtocol#4448](AztecProtocol#4448))
([de11994](AztecProtocol@de11994))
* Git subrepo commit (merge) noir
([AztecProtocol#4321](AztecProtocol#4321))
([348d18a](AztecProtocol@348d18a))
* Git subrepo pull (merge) noir
([AztecProtocol#4331](AztecProtocol#4331))
([683f782](AztecProtocol@683f782))
* Implementing `deserialize()` in Noir structs
([AztecProtocol#4384](AztecProtocol#4384))
([e63bbae](AztecProtocol@e63bbae))
* Introduce compute_note_hash_for_(consumption/insertion)
([AztecProtocol#4344](AztecProtocol#4344))
([26a0d49](AztecProtocol@26a0d49))
* Optimize prove_note_validity
[AztecProtocol#4418](AztecProtocol#4418)
([AztecProtocol#4426](AztecProtocol#4426))
([4de2540](AztecProtocol@4de2540))
* Poseidon2 hash uses span instead of vector
([AztecProtocol#4003](AztecProtocol#4003))
([f63e7a9](AztecProtocol@f63e7a9))
* Reenable private kernel function tree checks
([AztecProtocol#4358](AztecProtocol#4358))
([e7db0da](AztecProtocol@e7db0da))
* Remove hardcoded storage slot values
([AztecProtocol#4398](AztecProtocol#4398))
([d2294a4](AztecProtocol@d2294a4))
* Rename bigint_neg into bigint_sub
([AztecProtocol#4420](AztecProtocol#4420))
([57824fe](AztecProtocol@57824fe))
* Replace Note::compute_note_hash with Note::compute_note_content_hash
([AztecProtocol#4342](AztecProtocol#4342))
([8368659](AztecProtocol@8368659))
* Replace relative paths to noir-protocol-circuits
([23de650](AztecProtocol@23de650))
* Replace relative paths to noir-protocol-circuits
([b8d427f](AztecProtocol@b8d427f))
* Replace relative paths to noir-protocol-circuits
([113dec1](AztecProtocol@113dec1))
* Replace relative paths to noir-protocol-circuits
([a79093b](AztecProtocol@a79093b))
* Replace relative paths to noir-protocol-circuits
([808b4eb](AztecProtocol@808b4eb))
* Serialize, Deserialize and NoteInterface as Traits
([AztecProtocol#4135](AztecProtocol#4135))
([9e6605c](AztecProtocol@9e6605c))
* Simpler noir sync
([AztecProtocol#4376](AztecProtocol#4376))
([665b35e](AztecProtocol@665b35e))
* Surpress chained macro warning
([AztecProtocol#4396](AztecProtocol#4396))
([5e9c790](AztecProtocol@5e9c790))
* Switch to macos-14 for m1 runners
([AztecProtocol#3456](AztecProtocol#3456))
([ca5b6f8](AztecProtocol@ca5b6f8))
* Testing `toFields()` length
([AztecProtocol#4364](AztecProtocol#4364))
([5d3fce3](AztecProtocol@5d3fce3))
* Typing contents of `MessageLoadOracleInputs`
([AztecProtocol#4351](AztecProtocol#4351))
([433babd](AztecProtocol@433babd))
* Update docs on comparators
([AztecProtocol#4281](AztecProtocol#4281))
([cc2ce9c](AztecProtocol@cc2ce9c))
* Updating block hash to be header.hash()
([AztecProtocol#4286](AztecProtocol#4286))
([d4125e1](AztecProtocol@d4125e1))
* Use NoteSerialize and NoteDeserialize traits for note specific
serialization
([AztecProtocol#4383](AztecProtocol#4383))
([14dd0b8](AztecProtocol@14dd0b8))


### Documentation

* Add simple api description for note_getter_options.status
([AztecProtocol#4329](AztecProtocol#4329))
([cc17afe](AztecProtocol@cc17afe))
* Document stable public state usage
([AztecProtocol#4324](AztecProtocol#4324))
([13f709b](AztecProtocol@13f709b)),
closes
[AztecProtocol#4325](AztecProtocol#4325)
* Minor quickstart fixes
([AztecProtocol#4330](AztecProtocol#4330))
([f85a870](AztecProtocol@f85a870))
* Update contract deployment section in YP
([AztecProtocol#4290](AztecProtocol#4290))
([e99a882](AztecProtocol@e99a882))
* **yp:** AVM circuit - user memory section
([AztecProtocol#4323](AztecProtocol#4323))
([8928fb1](AztecProtocol@8928fb1)),
closes
[AztecProtocol#4043](AztecProtocol#4043)
</details>

<details><summary>barretenberg.js: 0.22.0</summary>

##
[0.22.0](AztecProtocol/aztec-packages@barretenberg.js-v0.21.0...barretenberg.js-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([AztecProtocol#4221](AztecProtocol#4221))

### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([AztecProtocol#4221](AztecProtocol#4221))
([9c965a7](AztecProtocol@9c965a7))
</details>

<details><summary>barretenberg: 0.22.0</summary>

##
[0.22.0](AztecProtocol/aztec-packages@barretenberg-v0.21.0...barretenberg-v0.22.0)
(2024-02-06)


### ⚠ BREAKING CHANGES

* rename bigint_neg into bigint_sub
([AztecProtocol#4420](AztecProtocol#4420))
* Add expression width into acir
([AztecProtocol#4014](AztecProtocol#4014))
* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([AztecProtocol#4221](AztecProtocol#4221))

### Features

* Add bit size to const opcode
([AztecProtocol#4385](AztecProtocol#4385))
([b2a000e](AztecProtocol@b2a000e))
* Add expression width into acir
([AztecProtocol#4014](AztecProtocol#4014))
([f09e8fc](AztecProtocol@f09e8fc))
* Add poseidon2 hashing to native transcript
([AztecProtocol#3718](AztecProtocol#3718))
([afcfa71](AztecProtocol@afcfa71))
* **avm:** Add command to call avm proving in bb binary
([AztecProtocol#4369](AztecProtocol#4369))
([4f6d607](AztecProtocol@4f6d607)),
closes
[AztecProtocol#4039](AztecProtocol#4039)
* **avm:** Back in avm context with macro - refactor context
([AztecProtocol#4438](AztecProtocol#4438))
([ccf9b17](AztecProtocol@ccf9b17))
* **bb:** Wasmtime and remote benchmarking
([AztecProtocol#4204](AztecProtocol#4204))
([fd27808](AztecProtocol@fd27808))
* Folding `GoblinUltra` instances in ProtoGalaxy
([AztecProtocol#4340](AztecProtocol#4340))
([8569e7c](AztecProtocol@8569e7c))
* Implementation for bigint opcodes
([AztecProtocol#4288](AztecProtocol#4288))
([b61dace](AztecProtocol@b61dace))
* Improve ivc bench
([AztecProtocol#4242](AztecProtocol#4242))
([9d28354](AztecProtocol@9d28354))
* Memory only brillig
([AztecProtocol#4215](AztecProtocol#4215))
([018177b](AztecProtocol@018177b))


### Bug Fixes

* Bb build
([AztecProtocol#4317](AztecProtocol#4317))
([82f5f03](AztecProtocol@82f5f03))
* Mac build
([AztecProtocol#4336](AztecProtocol#4336))
([aeb4cf0](AztecProtocol@aeb4cf0))
* Release the size of goblin translator
([AztecProtocol#4259](AztecProtocol#4259))
([6e1d958](AztecProtocol@6e1d958))


### Miscellaneous

* **acir:** Move `is_recursive` flag to be part of the circuit
definition
([AztecProtocol#4221](AztecProtocol#4221))
([9c965a7](AztecProtocol@9c965a7))
* Collapse bb::honk
([AztecProtocol#4318](AztecProtocol#4318))
([5853af4](AztecProtocol@5853af4))
* Extract merge from UC and simplify
([AztecProtocol#4343](AztecProtocol#4343))
([54fd794](AztecProtocol@54fd794))
* Fix bb wasm build when using remote cache
([AztecProtocol#4397](AztecProtocol#4397))
([14e57cb](AztecProtocol@14e57cb))
* Poseidon2 hash uses span instead of vector
([AztecProtocol#4003](AztecProtocol#4003))
([f63e7a9](AztecProtocol@f63e7a9))
* Rename bigint_neg into bigint_sub
([AztecProtocol#4420](AztecProtocol#4420))
([57824fe](AztecProtocol@57824fe))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
superstar0402 added a commit to superstar0402/aztec-nr that referenced this pull request Aug 16, 2024
Closes: AztecProtocol/aztec-packages#3198,
AztecProtocol/aztec-packages#2928

~~Requires AztecProtocol/aztec-packages#4135,
which is blocked by noir-lang/noir#4124

Automatic storage initialization via aztec macro. 

Full support of public and private state from
`dep::aztec::state_vars::*`, including Maps (and nested Maps!)
Limited support for custom types (as long as they have a single
serializable generic and their constructor is `::new(context,
storage_slot`).

~~Pending: better errors, code comments and some cleanup.~~

Hijacking my own
[comment](AztecProtocol/aztec-packages#4200 (comment))
for the explanation:

The idea behind this is that in 99% of cases, storage initialization
(that is, the `impl` for a given `struct Storage...` is redundant, and
the only need for its existence was assigning storage slots...which in
turn were necessary because we didn't know how to serialize the data
structures that were used in a given contract or how much space they
used once serialized (relevant for the public state).

After AztecProtocol/aztec-packages#4135 is
merged, both of those things don't have to be explicitly provided since
we're using traits, so the aztec macro can infer the implementation of
the Storage struct just by taking hints from the definition. An example:

```rust
    struct Storage {
        // MyAwesomeStuff implements Serialize<2>, so we assign it slot 1 (and remember that it will take 2 slots due to its size)
        public_var: PublicState<MyAwesomeSuff>, 
        // Right after the first one, assign it to slot: current_slot + previous_size = 3
        another_public_var: PublicState<MyAwesomeSuff>,
        // Private and Public state don't share slots since they "live" in different trees, but keeping the slot count simplifies implementation. 
        // Notes also implement Serialize<N>, but they only take up 1 slot anyways because of hashing, assign it slot 5
        a_singleton: Singleton<ANote>,
        // Maps derive slots via hashing, so we can assume they only "take" 1 slot. We assign it slot 6
        balances: Map<AztecAddress, Singleton<ANote>>,
        // Slot 7
        a_set: Set<ANote>,
        // Slot 8
        imm_singleton: ImmutableSingleton<ANote>,
        // Slot 9. 
        profiles: Map<AztecAddress, Map<Singleton<ANote>>>,
    }

```

We have all the info we need in the AST and HIR to build this
automatically:

```rust
impl Storage {
    fn init(context: Context) -> Self {
        Storage {
            public_var: PublicState::new(context, 1), // No need for serialization methods, taken from the the trait impl
            another_public_var: PublicState::new(context, 3),
            a_singleton: Singleton::new(context, 5),
            // Map init lambda always takes the same form for known storage structs
            balances: Map::new(context, 6, |context, slot| { 
                Singleton::new(context, slot) 
            }),
            a_set: Set::new(context, 7),
            imm_singleton: ImmutableSingleton::new(context, 8),
            // A map of maps is just nesting lambdas, we can infer this too
            profiles: Map::new(context, 9, |context, slot| { 
                Map::new(context, slot, |context, slot| { 
                    Singleton::new(context, slot) 
                })
            })
        }
    }
}

```

...as long as we use "canonical" storage implementations. This means
`AStoragePrimitive<SomethingSerializable>` and
`Map<SomethingWithToField, AStoragePrimitive<SomethingSerializable>>`.

**TLDR:** define the Storage struct, in 99% of cases the macro takes
care of the implementation!

Implementing custom storage will look just like it does know, the macro
will skip automatic generation if it finds one.

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Combine type serialization properties into one export
5 participants