diff --git a/avm-transpiler/Cargo.lock b/avm-transpiler/Cargo.lock index f5d473b4a95d..fcb68171212f 100644 --- a/avm-transpiler/Cargo.lock +++ b/avm-transpiler/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "acir" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acir_field", "base64 0.21.7", @@ -16,6 +16,7 @@ dependencies = [ "prost", "prost-build", "protoc-prebuilt", + "rmp-serde", "serde", "serde-big-array", "strum", @@ -25,7 +26,7 @@ dependencies = [ [[package]] name = "acir_field" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "ark-bn254", "ark-ff", @@ -38,7 +39,7 @@ dependencies = [ [[package]] name = "acvm" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acir", "acvm_blackbox_solver", @@ -52,7 +53,7 @@ dependencies = [ [[package]] name = "acvm_blackbox_solver" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acir", "blake2", @@ -452,7 +453,7 @@ dependencies = [ [[package]] name = "bn254_blackbox_solver" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acir", "acvm_blackbox_solver", @@ -467,7 +468,7 @@ dependencies = [ [[package]] name = "brillig" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acir_field", "serde", @@ -475,7 +476,7 @@ dependencies = [ [[package]] name = "brillig_vm" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acir", "acvm_blackbox_solver", @@ -905,7 +906,7 @@ dependencies = [ [[package]] name = "fm" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "codespan-reporting", "iter-extended", @@ -1244,7 +1245,7 @@ checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "iter-extended" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" [[package]] name = "itertools" @@ -1350,7 +1351,7 @@ checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "noir_protobuf" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "color-eyre", "prost", @@ -1358,7 +1359,7 @@ dependencies = [ [[package]] name = "noirc_abi" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acvm", "iter-extended", @@ -1373,11 +1374,11 @@ dependencies = [ [[package]] name = "noirc_arena" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" [[package]] name = "noirc_errors" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acvm", "base64 0.21.7", @@ -1394,7 +1395,7 @@ dependencies = [ [[package]] name = "noirc_evaluator" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acvm", "bn254_blackbox_solver", @@ -1420,7 +1421,7 @@ dependencies = [ [[package]] name = "noirc_frontend" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acvm", "bn254_blackbox_solver", @@ -1449,7 +1450,7 @@ dependencies = [ [[package]] name = "noirc_printable_type" -version = "1.0.0-beta.3" +version = "1.0.0-beta.4" dependencies = [ "acvm", "serde", @@ -1789,6 +1790,28 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rmp" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + [[package]] name = "rustc-demangle" version = "0.1.24" diff --git a/l1-contracts/bootstrap.sh b/l1-contracts/bootstrap.sh index 88030d85310b..f24fce3f84a3 100755 --- a/l1-contracts/bootstrap.sh +++ b/l1-contracts/bootstrap.sh @@ -7,6 +7,7 @@ cmd=${1:-} # We rely on noir-projects for the verifier contract. export hash=$(cache_content_hash \ .rebuild_patterns \ + ../noir/.rebuild_patterns \ ../noir-projects/noir-protocol-circuits \ ../barretenberg/cpp/.rebuild_patterns ) diff --git a/noir-projects/aztec-nr/aztec/Nargo.toml b/noir-projects/aztec-nr/aztec/Nargo.toml index 4afbf005e821..20a224d84e84 100644 --- a/noir-projects/aztec-nr/aztec/Nargo.toml +++ b/noir-projects/aztec-nr/aztec/Nargo.toml @@ -7,3 +7,4 @@ type = "lib" [dependencies] protocol_types = { path = "../../noir-protocol-circuits/crates/types" } sha256 = { tag = "v0.1.2", git = "https://github.com/noir-lang/sha256" } +poseidon = { tag = "v0.1.0", git = "https://github.com/noir-lang/poseidon" } diff --git a/noir-projects/aztec-nr/aztec/src/macros/functions/stub_registry.nr b/noir-projects/aztec-nr/aztec/src/macros/functions/stub_registry.nr index 078fe5642861..7c9ed2332d54 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/functions/stub_registry.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/functions/stub_registry.nr @@ -1,4 +1,5 @@ -use std::{collections::umap::UHashMap, hash::{BuildHasherDefault, poseidon2::Poseidon2Hasher}}; +use poseidon::poseidon2::Poseidon2Hasher; +use std::{collections::umap::UHashMap, hash::BuildHasherDefault}; comptime mut global STUBS: UHashMap> = UHashMap::default(); diff --git a/noir-projects/aztec-nr/aztec/src/macros/notes.nr b/noir-projects/aztec-nr/aztec/src/macros/notes.nr index 0b2fd068a00d..f5d0ba35f8c5 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/notes.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/notes.nr @@ -1,8 +1,9 @@ use crate::{macros::utils::AsStrQuote, note::note_getter_options::PropertySelector}; +use poseidon::poseidon2::Poseidon2Hasher; use protocol_types::meta::{derive_packable_and_get_packed_len, generate_serialize_to_fields}; use std::{ collections::umap::UHashMap, - hash::{BuildHasherDefault, Hash, Hasher, poseidon2::Poseidon2Hasher}, + hash::{BuildHasherDefault, Hash, Hasher}, meta::{type_of, unquote}, }; diff --git a/noir-projects/aztec-nr/aztec/src/macros/storage.nr b/noir-projects/aztec-nr/aztec/src/macros/storage.nr index ea87c39c2d46..4e4ed23bbe09 100644 --- a/noir-projects/aztec-nr/aztec/src/macros/storage.nr +++ b/noir-projects/aztec-nr/aztec/src/macros/storage.nr @@ -1,4 +1,5 @@ -use std::{collections::umap::UHashMap, hash::{BuildHasherDefault, poseidon2::Poseidon2Hasher}}; +use poseidon::poseidon2::Poseidon2Hasher; +use std::{collections::umap::UHashMap, hash::BuildHasherDefault}; use super::utils::AsStrQuote; use super::utils::get_storage_size; diff --git a/noir-projects/aztec-nr/aztec/src/oracle/aes128_decrypt.nr b/noir-projects/aztec-nr/aztec/src/oracle/aes128_decrypt.nr index 2b80c872d4a8..9e8a56da28b3 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/aes128_decrypt.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/aes128_decrypt.nr @@ -21,6 +21,7 @@ mod test { utils::{array::subarray::subarray, point::point_from_x_coord}, }; use super::aes128_decrypt_oracle; + use poseidon::poseidon2::Poseidon2; use std::aes128::aes128_encrypt; global TEST_PLAINTEXT_LENGTH: u32 = 10; @@ -89,7 +90,7 @@ mod test { ); let mac_preimage = 0x42; - let mac = std::hash::poseidon2::Poseidon2::hash([mac_preimage], 1); + let mac = Poseidon2::hash([mac_preimage], 1); let mac_as_bytes = mac.to_be_bytes::(); let plaintext: [u8; TEST_PLAINTEXT_LENGTH] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; diff --git a/noir/noir-repo-ref b/noir/noir-repo-ref index 2ca8d89893e2..137e677f6158 100644 --- a/noir/noir-repo-ref +++ b/noir/noir-repo-ref @@ -1 +1 @@ -nightly-2025-04-01 +nightly-2025-04-10 diff --git a/noir/noir-repo.patch b/noir/noir-repo.patch index 251e7451afd0..3334d22548d1 100644 --- a/noir/noir-repo.patch +++ b/noir/noir-repo.patch @@ -19,7 +19,7 @@ index 30dd2a7..a2712fd 100644 }, "include": [ "src/**/*.ts" --- +-- 2.43.0 From ee8c3e8be962996922078637aaea70fccbadeb5c Mon Sep 17 00:00:00 2001 @@ -36,103 +36,11 @@ index 3349018..c93fe8e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ codegen - + mutants.out mutants.out.old + +# Artifacts created by `noir/bootstrap.sh build_packages` +**/package.tgz --- -2.43.0 - -From 81a04bb4f515684349084bb20fc24a0f39434aa4 Mon Sep 17 00:00:00 2001 -From: sirasistant -Date: Sat, 5 Apr 2025 14:57:05 +0000 -Subject: [PATCH 4/4] nondeterminism fix? - ---- - .../brillig_gen/constant_allocation.rs | 25 ++++++++++--------- - 1 file changed, 13 insertions(+), 12 deletions(-) - -diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/constant_allocation.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/constant_allocation.rs -index d49876e..d244b6a 100644 ---- a/compiler/noirc_evaluator/src/brillig/brillig_gen/constant_allocation.rs -+++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/constant_allocation.rs -@@ -1,7 +1,8 @@ - //! This module analyzes the usage of constants in a given function and decides an allocation point for them. - //! The allocation point will be the common dominator of all the places where the constant is used. - //! By allocating in the common dominator, we can cache the constants for all subsequent uses. --use fxhash::{FxHashMap as HashMap, FxHashSet as HashSet}; -+ -+use std::collections::{BTreeMap, BTreeSet}; - - use crate::ssa::ir::{ - basic_block::BasicBlockId, -@@ -16,7 +17,7 @@ use crate::ssa::ir::{ - - use super::variable_liveness::{collect_variables_of_value, variables_used_in_instruction}; - --#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] - pub(crate) enum InstructionLocation { - Instruction(InstructionId), - Terminator, -@@ -24,10 +25,10 @@ pub(crate) enum InstructionLocation { - - #[derive(Default)] - pub(crate) struct ConstantAllocation { -- constant_usage: HashMap>>, -- allocation_points: HashMap>>, -+ constant_usage: BTreeMap>>, -+ allocation_points: BTreeMap>>, - dominator_tree: DominatorTree, -- blocks_within_loops: HashSet, -+ blocks_within_loops: BTreeSet, - } - - impl ConstantAllocation { -@@ -37,8 +38,8 @@ impl ConstantAllocation { - let mut dominator_tree = DominatorTree::with_cfg_and_post_order(&cfg, &post_order); - let blocks_within_loops = find_all_blocks_within_loops(func, &cfg, &mut dominator_tree); - let mut instance = ConstantAllocation { -- constant_usage: HashMap::default(), -- allocation_points: HashMap::default(), -+ constant_usage: BTreeMap::default(), -+ allocation_points: BTreeMap::default(), - dominator_tree, - blocks_within_loops, - }; -@@ -164,7 +165,7 @@ impl ConstantAllocation { - current_block - } - -- pub(crate) fn get_constants(&self) -> HashSet { -+ pub(crate) fn get_constants(&self) -> BTreeSet { - self.constant_usage.keys().copied().collect() - } - } -@@ -178,8 +179,8 @@ fn find_all_blocks_within_loops( - func: &Function, - cfg: &ControlFlowGraph, - dominator_tree: &mut DominatorTree, --) -> HashSet { -- let mut blocks_in_loops = HashSet::default(); -+) -> BTreeSet { -+ let mut blocks_in_loops = BTreeSet::default(); - for block_id in func.reachable_blocks() { - let block = &func.dfg[block_id]; - let successors = block.successors(); -@@ -199,8 +200,8 @@ fn find_blocks_in_loop( - header: BasicBlockId, - back_edge_start: BasicBlockId, - cfg: &ControlFlowGraph, --) -> HashSet { -- let mut blocks = HashSet::default(); -+) -> BTreeSet { -+ let mut blocks = BTreeSet::default(); - blocks.insert(header); - - let mut insert = |block, stack: &mut Vec| { --- +-- 2.43.0 -