Skip to content

Commit

Permalink
feat: Sync from noir (#7862)
Browse files Browse the repository at this point in the history
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix: Do not duplicate redundant Brillig debug metadata
(noir-lang/noir#5696)
feat: add mutating FunctionDefinition functions
(noir-lang/noir#5685)
chore: Add docs tip about filenames between commands
(noir-lang/noir#5695)
fix: Add locations to most SSA instructions
(noir-lang/noir#5697)
feat: Add array_to_str_lossy
(noir-lang/noir#5613)
chore: Add parser support for `<MyType as Trait>::ident`
(noir-lang/noir#5688)
feat: add some `Module` comptime functions
(noir-lang/noir#5684)
chore: Release Noir(0.33.0)
(noir-lang/noir#5550)
feat: Derive `Ord` and `Hash` in the stdlib; add `std::meta::make_impl`
helper (noir-lang/noir#5683)
feat(ssa): Simple serialization of unoptimized SSA to file
(noir-lang/noir#5679)
feat: LSP closing brace hints
(noir-lang/noir#5686)
feat: Implement closures in the comptime interpreter
(noir-lang/noir#5682)
feat: add `FunctionDefinition::parameters`,
`FunctionDefinition::return_type` and `impl Eq for Quoted`
(noir-lang/noir#5681)
feat: add `Type::as_struct`
(noir-lang/noir#5680)
feat: LSP hover now includes "Go to" links
(noir-lang/noir#5677)
feat: add `Type` methods: `as_tuple`, `as_slice`, `as_array`,
`as_constant`, `is_bool` (noir-lang/noir#5678)
fix: Derive generic types (noir-lang/noir#5674)
feat: Add a limited form of arithmetic on generics
(noir-lang/noir#5625)
feat: add `Type::is_field` and `Type::as_integer`
(noir-lang/noir#5670)
fix: Fix where clause issue in items generated from attributes
(noir-lang/noir#5673)
feat(noir_js): Expose UltraHonk and integration tests
(noir-lang/noir#5656)
fix: workaround from_slice with nested slices
(noir-lang/noir#5648)
fix: Switch verify proof to arrays
(noir-lang/noir#5664)
feat: Resolve arguments to attributes
(noir-lang/noir#5649)
fix: Elaborate struct & trait annotations in the correct module
(noir-lang/noir#5643)
fix: let a trait impl that relies on another trait work
(noir-lang/noir#5646)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Maxim Vezenov <[email protected]>
  • Loading branch information
AztecBot and vezenovm authored Aug 13, 2024
1 parent fb574aa commit b1c7374
Show file tree
Hide file tree
Showing 314 changed files with 15,977 additions and 1,390 deletions.
2 changes: 1 addition & 1 deletion .noir-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
812262413770d2f20cba04eb0e3176320a3b704a
e4f7dbe63b55807b3ff0b4d6f47a8b7f847299fb
20 changes: 10 additions & 10 deletions avm-transpiler/Cargo.lock

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

36 changes: 22 additions & 14 deletions avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,23 +1060,31 @@ pub fn patch_debug_info_pcs(
brillig_pcs_to_avm_pcs: &[usize],
) -> Vec<DebugInfo> {
for patched_debug_info in debug_infos.iter_mut() {
// create a new map with all of its keys (OpcodeLocations) patched
let mut patched_locations: BTreeMap<OpcodeLocation, Vec<Location>> = BTreeMap::new();
for (original_opcode_location, source_locations) in patched_debug_info.locations.iter() {
match original_opcode_location {
OpcodeLocation::Brillig { acir_index, brillig_index } => {
let avm_opcode_location = OpcodeLocation::Brillig {
acir_index: *acir_index,
// patch the PC
brillig_index: brillig_pcs_to_avm_pcs[*brillig_index],
};
patched_locations.insert(avm_opcode_location, source_locations.clone());
let mut patched_brillig_locations = BTreeMap::new();
for (brillig_function_id, opcode_locations_map) in
patched_debug_info.brillig_locations.iter()
{
// create a new map with all of its keys (OpcodeLocations) patched
let mut patched_locations: BTreeMap<OpcodeLocation, Vec<Location>> = BTreeMap::new();
for (original_opcode_location, source_locations) in opcode_locations_map.iter() {
match original_opcode_location {
OpcodeLocation::Brillig { acir_index, brillig_index } => {
let avm_opcode_location = OpcodeLocation::Brillig {
acir_index: *acir_index,
// patch the PC
brillig_index: brillig_pcs_to_avm_pcs[*brillig_index],
};
patched_locations.insert(avm_opcode_location, source_locations.clone());
}
OpcodeLocation::Acir(_) => (),
}
OpcodeLocation::Acir(_) => (),
}
// insert the new map as a brillig locations map for the current function id
patched_brillig_locations.insert(*brillig_function_id, patched_locations);
}
// patch debug_info entry
patched_debug_info.locations = patched_locations;

// patch the `DebugInfo` entry
patched_debug_info.brillig_locations = patched_brillig_locations;
}
debug_infos
}
Expand Down
3 changes: 2 additions & 1 deletion avm-transpiler/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use acvm::acir::circuit::brillig::BrilligFunctionId;
use acvm::FieldElement;
use log::debug;

Expand All @@ -24,7 +25,7 @@ pub fn extract_brillig_from_acir_program(
let opcodes = &main_function.opcodes;
assert_eq!(opcodes.len(), 1, "An AVM program should only have a single `BrilligCall`");
match opcodes[0] {
Opcode::BrilligCall { id, .. } => assert_eq!(id, 0, "The ID of the `BrilligCall` must be 0 as we have a single `Brillig` function"),
Opcode::BrilligCall { id, .. } => assert_eq!(id, BrilligFunctionId(0), "The ID of the `BrilligCall` must be 0 as we have a single `Brillig` function"),
_ => panic!("Tried to extract a Brillig program from its ACIR wrapper opcode, but the opcode doesn't contain Brillig!"),
}
assert_eq!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"position": 1,
"collapsible": true,
"collapsed": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ impl Verifiable for RootParityInput {
fn verify(self) {
let inputs = ParityPublicInputs::serialize(self.public_inputs);
std::verify_proof(
self.verification_key.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
self.verification_key.key,
self.proof.fields,
inputs,
self.verification_key.hash
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ impl Verifiable for RootRollupParityInput {
fn verify(self) {
let inputs = ParityPublicInputs::serialize(self.public_inputs);
std::verify_proof(
self.verification_key.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
self.verification_key.key,
self.proof.fields,
inputs,
self.verification_key.hash
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ struct EmptyNestedCircuitPublicInputs {
impl Verifiable for EmptyNestedCircuitPublicInputs {
fn verify(self) {
std::verify_proof(
self.vk.key.as_slice(),
self.proof.fields.as_slice(),
&[],
self.vk.key,
self.proof.fields,
[],
self.vk.hash
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ impl Verifiable for PreviousRollupData {
fn verify(self) {
let inputs = BaseOrMergeRollupPublicInputs::serialize(self.base_or_merge_rollup_public_inputs);
std::verify_proof(
self.vk.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
self.vk.key,
self.proof.fields,
inputs,
self.vk.hash
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ impl Verifiable for KernelData {
fn verify(self) {
let inputs = KernelCircuitPublicInputs::serialize(self.public_inputs);
std::verify_proof(
self.vk.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
self.vk.key,
self.proof.fields,
inputs,
self.vk.hash
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ impl Verifiable for PublicKernelData {
fn verify(self) {
let inputs = PublicKernelCircuitPublicInputs::serialize(self.public_inputs);
std::verify_proof(
self.vk.key.as_slice(),
self.proof.fields.as_slice(),
inputs.as_slice(),
self.vk.key,
self.proof.fields,
inputs,
self.vk.hash
);
}
Expand Down
4 changes: 2 additions & 2 deletions noir/noir-repo/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
".": "0.32.0",
"acvm-repo": "0.48.0"
".": "0.33.0",
"acvm-repo": "0.49.0"
}
Loading

0 comments on commit b1c7374

Please sign in to comment.