Skip to content

Commit

Permalink
chore: Sync to noir-lang/noir
Browse files Browse the repository at this point in the history
feat!: renamings of state var wrappers (AztecProtocol/aztec-packages#4739)
chore(ci): enforce formatting of noir rust code (AztecProtocol/aztec-packages#4765)
chore: bootstrap improvements. (AztecProtocol/aztec-packages#4711)
refactor: using Tuples in `TxEffect`s and renaming note commitments (AztecProtocol/aztec-packages#4717)
chore: Build nargo against Ubuntu 20 for better compatability (AztecProtocol/aztec-packages#4710)
fix(dsl): Add full recursive verification test (AztecProtocol/aztec-packages#4658)
feat!: autogenerate compute_note_hash_and_nullifier (AztecProtocol/aztec-packages#4610)
chore: add struct for each bigint modulus (AztecProtocol/aztec-packages#4422)
chore: switch noir pull to master branch (AztecProtocol/aztec-packages#4581)
  • Loading branch information
AztecBot committed Feb 27, 2024
1 parent 78ef013 commit 6ae8ada
Show file tree
Hide file tree
Showing 29 changed files with 733 additions and 215 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM rust:bookworm
FROM rust:bullseye
WORKDIR /usr/src/noir
COPY . .
RUN ./scripts/bootstrap_native.sh

# When running the container, mount the users home directory to same location.
FROM ubuntu:lunar
FROM ubuntu:focal
# Install Tini as nargo doesn't handle signals properly.
# Install git as nargo needs it to clone.
RUN apt-get update && apt-get install -y git tini && rm -rf /var/lib/apt/lists/* && apt-get clean
COPY --from=0 /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/noir/target/release/nargo"]
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/noir/target/release/nargo"]
1 change: 1 addition & 0 deletions aztec_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ repository.workspace = true

[dependencies]
noirc_frontend.workspace = true
noirc_errors.workspace = true
iter-extended.workspace = true
convert_case = "0.6.0"
269 changes: 237 additions & 32 deletions aztec_macros/src/lib.rs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ if [ -n "$CMD" ]; then
fi
fi

# Attempt to just pull artefacts from CI and exit on success.
./bootstrap_cache.sh && exit

./scripts/bootstrap_native.sh
./scripts/bootstrap_packages.sh
4 changes: 4 additions & 0 deletions bootstrap_cache.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -eu

[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1

cd "$(dirname "$0")"
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null

Expand All @@ -9,3 +11,5 @@ extract_repo noir-packages /usr/src/noir/packages ./
echo -e "\033[1mRetrieving nargo from remote cache...\033[0m"
extract_repo noir /usr/src/noir/target/release ./target/

remove_old_images noir-packages
remove_old_images noir
14 changes: 14 additions & 0 deletions compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ impl DefCollector {
// Add the current crate to the collection of DefMaps
context.def_maps.insert(crate_id, def_collector.def_map);

// TODO(#4653): generalize this function
for macro_processor in &macro_processors {
macro_processor
.process_unresolved_traits_impls(
&crate_id,
context,
&def_collector.collected_traits_impls,
&mut def_collector.collected_functions,
)
.unwrap_or_else(|(macro_err, file_id)| {
errors.push((macro_err.into(), file_id));
});
}

inject_prelude(crate_id, context, crate_root, &mut def_collector.collected_imports);
for submodule in submodules {
inject_prelude(
Expand Down
5 changes: 5 additions & 0 deletions compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ impl CrateDefMap {
pub fn modules(&self) -> &Arena<ModuleData> {
&self.modules
}

pub fn modules_mut(&mut self) -> &mut Arena<ModuleData> {
&mut self.modules
}

pub fn krate(&self) -> CrateId {
self.krate
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/noirc_frontend/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ impl Context<'_, '_> {
self.def_maps.get(crate_id)
}

pub fn def_map_mut(&mut self, crate_id: &CrateId) -> Option<&mut CrateDefMap> {
self.def_maps.get_mut(crate_id)
}

/// Return the CrateId for each crate that has been compiled
/// successfully
pub fn crates(&self) -> impl Iterator<Item = CrateId> + '_ {
Expand Down
11 changes: 11 additions & 0 deletions compiler/noirc_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub mod macros_api {
pub use noirc_errors::Span;

pub use crate::graph::CrateId;
use crate::hir::def_collector::dc_crate::{UnresolvedFunctions, UnresolvedTraitImpl};
pub use crate::hir::def_collector::errors::MacroError;
pub use crate::hir_def::expr::{HirExpression, HirLiteral};
pub use crate::hir_def::stmt::HirStatement;
Expand Down Expand Up @@ -74,6 +75,16 @@ pub mod macros_api {
crate_id: &CrateId,
context: &HirContext,
) -> Result<SortedModule, (MacroError, FileId)>;

// TODO(#4653): generalize this function
fn process_unresolved_traits_impls(
&self,
_crate_id: &CrateId,
_context: &mut HirContext,
_unresolved_traits_impls: &[UnresolvedTraitImpl],
_collected_functions: &mut Vec<UnresolvedFunctions>,
) -> Result<(), (MacroError, FileId)>;

/// Function to manipulate the AST after type checking has been completed.
/// The AST after type checking has been done is called the HIR.
fn process_typed_ast(
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ impl TraitId {
}

#[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)]
pub struct TraitImplId(usize);
pub struct TraitImplId(pub usize);

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TraitMethodId {
Expand Down
Loading

0 comments on commit 6ae8ada

Please sign in to comment.