Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 39 additions & 16 deletions avm-transpiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions l1-contracts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions noir-projects/aztec-nr/aztec/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Original file line number Diff line number Diff line change
@@ -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<Module, [Quoted], BuildHasherDefault<Poseidon2Hasher>> =
UHashMap::default();
Expand Down
3 changes: 2 additions & 1 deletion noir-projects/aztec-nr/aztec/src/macros/notes.nr
Original file line number Diff line number Diff line change
@@ -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},
};

Expand Down
3 changes: 2 additions & 1 deletion noir-projects/aztec-nr/aztec/src/macros/storage.nr
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion noir-projects/aztec-nr/aztec/src/oracle/aes128_decrypt.nr
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::<TEST_MAC_LENGTH>();

let plaintext: [u8; TEST_PLAINTEXT_LENGTH] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo-ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2025-04-01
nightly-2025-04-10
98 changes: 3 additions & 95 deletions noir/noir-repo.patch
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ index 30dd2a7..a2712fd 100644
},
"include": [
"src/**/*.ts"
--
--
2.43.0

From ee8c3e8be962996922078637aaea70fccbadeb5c Mon Sep 17 00:00:00 2001
Expand All @@ -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 <sirasistant@gmail.com>
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<ValueId, HashMap<BasicBlockId, Vec<InstructionLocation>>>,
- allocation_points: HashMap<BasicBlockId, HashMap<InstructionLocation, Vec<ValueId>>>,
+ constant_usage: BTreeMap<ValueId, BTreeMap<BasicBlockId, Vec<InstructionLocation>>>,
+ allocation_points: BTreeMap<BasicBlockId, BTreeMap<InstructionLocation, Vec<ValueId>>>,
dominator_tree: DominatorTree,
- blocks_within_loops: HashSet<BasicBlockId>,
+ blocks_within_loops: BTreeSet<BasicBlockId>,
}

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<ValueId> {
+ pub(crate) fn get_constants(&self) -> BTreeSet<ValueId> {
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<BasicBlockId> {
- let mut blocks_in_loops = HashSet::default();
+) -> BTreeSet<BasicBlockId> {
+ 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<BasicBlockId> {
- let mut blocks = HashSet::default();
+) -> BTreeSet<BasicBlockId> {
+ let mut blocks = BTreeSet::default();
blocks.insert(header);

let mut insert = |block, stack: &mut Vec<BasicBlockId>| {
--
--
2.43.0