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

feat: Sync from noir #7862

Merged
merged 19 commits into from
Aug 13, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
Loading