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

chore!: Remove backend field from artifacts #3819

Merged
merged 15 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 10 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
6 changes: 0 additions & 6 deletions .github/workflows/publish-acvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ jobs:
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish acvm_stdlib
run: |
cargo publish --package acvm_stdlib
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }}

- name: Publish brillig_vm
run: |
cargo publish --package brillig_vm
Expand Down
8 changes: 0 additions & 8 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ members = [
"acvm-repo/acir",
"acvm-repo/acvm",
"acvm-repo/acvm_js",
"acvm-repo/stdlib",
"acvm-repo/brillig",
"acvm-repo/brillig_vm",
"acvm-repo/blackbox_solver",
Expand All @@ -53,7 +52,6 @@ repository = "https://github.com/noir-lang/noir/"
acir_field = { version = "0.37.0", path = "acvm-repo/acir_field", default-features = false }
acir = { version = "0.37.0", path = "acvm-repo/acir", default-features = false }
acvm = { version = "0.37.0", path = "acvm-repo/acvm" }
stdlib = { version = "0.37.0", package = "acvm_stdlib", path = "acvm-repo/stdlib", default-features = false }
brillig = { version = "0.37.0", path = "acvm-repo/brillig", default-features = false }
brillig_vm = { version = "0.37.0", path = "acvm-repo/brillig_vm", default-features = false }
acvm_blackbox_solver = { version = "0.37.0", path = "acvm-repo/blackbox_solver", default-features = false }
Expand Down
3 changes: 0 additions & 3 deletions acvm-repo/acir/src/circuit/black_box_functions.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! Black box functions are ACIR opcodes which rely on backends implementing support for specialized constraints.
//! This makes certain zk-snark unfriendly computations cheaper than if they were implemented in more basic constraints.
//!
//! It is possible to fallback to less efficient implementations written in ACIR in some cases.
//! These are implemented inside the ACVM stdlib.

use serde::{Deserialize, Serialize};
#[cfg(test)]
Expand Down
26 changes: 0 additions & 26 deletions acvm-repo/acir/src/circuit/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ pub enum Opcode {
},
}

#[derive(Clone, PartialEq, Eq, Debug)]
pub enum UnsupportedMemoryOpcode {
MemoryOp,
MemoryInit,
}

impl std::fmt::Display for UnsupportedMemoryOpcode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
UnsupportedMemoryOpcode::MemoryOp => write!(f, "MemoryOp"),
UnsupportedMemoryOpcode::MemoryInit => write!(f, "MemoryInit"),
}
}
}

impl Opcode {
// TODO We can add a domain separator by doing something like:
// TODO concat!("directive:", directive.name)
Expand All @@ -62,17 +47,6 @@ impl Opcode {
}
}

pub fn unsupported_opcode(&self) -> UnsupportedMemoryOpcode {
match self {
Opcode::MemoryOp { .. } => UnsupportedMemoryOpcode::MemoryOp,
Opcode::MemoryInit { .. } => UnsupportedMemoryOpcode::MemoryInit,
Opcode::BlackBoxFuncCall(_) => {
unreachable!("Unsupported Blackbox function should not be reported here")
}
_ => unreachable!("Opcode is supported"),
}
}

pub fn is_arithmetic(&self) -> bool {
matches!(self, Opcode::Arithmetic(_))
}
Expand Down
7 changes: 1 addition & 6 deletions acvm-repo/acvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,23 @@ thiserror.workspace = true
log.workspace = true

acir.workspace = true
stdlib.workspace = true
brillig_vm.workspace = true
acvm_blackbox_solver.workspace = true

indexmap = "1.7.0"

[features]
default = ["bn254", "testing"]
default = ["bn254"]
bn254 = [
"acir/bn254",
"stdlib/bn254",
"brillig_vm/bn254",
"acvm_blackbox_solver/bn254",
]
bls12_381 = [
"acir/bls12_381",
"stdlib/bls12_381",
"brillig_vm/bls12_381",
"acvm_blackbox_solver/bls12_381",
]
testing = ["stdlib/testing", "unstable-fallbacks"]
unstable-fallbacks = []

[dev-dependencies]
rand = "0.8.5"
Expand Down
24 changes: 4 additions & 20 deletions acvm-repo/acvm/src/compiler/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use acir::{
circuit::{opcodes::UnsupportedMemoryOpcode, Circuit, Opcode, OpcodeLocation},
BlackBoxFunc,
};
use thiserror::Error;
use acir::circuit::{Circuit, OpcodeLocation};

use crate::Language;

Expand All @@ -15,14 +11,6 @@ use optimizers::optimize_internal;
pub use transformers::transform;
use transformers::transform_internal;

#[derive(PartialEq, Eq, Debug, Error)]
pub enum CompileError {
#[error("The blackbox function {0} is not supported by the backend and acvm does not have a fallback implementation")]
UnsupportedBlackBox(BlackBoxFunc),
#[error("The opcode {0} is not supported by the backend and acvm does not have a fallback implementation")]
UnsupportedMemoryOpcode(UnsupportedMemoryOpcode),
}

/// This module moves and decomposes acir opcodes. The transformation map allows consumers of this module to map
/// metadata they had about the opcodes to the new opcode structure generated after the transformation.
#[derive(Debug)]
Expand Down Expand Up @@ -69,17 +57,13 @@ fn transform_assert_messages(
}

/// Applies [`ProofSystemCompiler`][crate::ProofSystemCompiler] specific optimizations to a [`Circuit`].
pub fn compile(
acir: Circuit,
np_language: Language,
is_opcode_supported: impl Fn(&Opcode) -> bool,
) -> Result<(Circuit, AcirTransformationMap), CompileError> {
pub fn compile(acir: Circuit, np_language: Language) -> (Circuit, AcirTransformationMap) {
let (acir, AcirTransformationMap { acir_opcode_positions }) = optimize_internal(acir);

let (mut acir, transformation_map) =
transform_internal(acir, np_language, is_opcode_supported, acir_opcode_positions)?;
transform_internal(acir, np_language, acir_opcode_positions);

acir.assert_messages = transform_assert_messages(acir.assert_messages, &transformation_map);

Ok((acir, transformation_map))
(acir, transformation_map)
}
158 changes: 0 additions & 158 deletions acvm-repo/acvm/src/compiler/transformers/fallback.rs

This file was deleted.

Loading
Loading