Skip to content

Commit

Permalink
chore!: Remove backend field from artifacts (#3819)
Browse files Browse the repository at this point in the history
# Description

In `kw/remove-partial-backend-code` we removed the opcodes supported
feature, which means that artifacts are no longer compiled based on a
backends feature set.


Closes #1388 

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*



## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
  • Loading branch information
kevaundray and TomAFrench authored Dec 16, 2023
1 parent ea18bed commit fa1cf5f
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 31 deletions.
6 changes: 0 additions & 6 deletions compiler/wasm/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ use wasm_bindgen::prelude::*;

use crate::errors::{CompileError, JsCompileError};

const BACKEND_IDENTIFIER: &str = "acvm-backend-barretenberg";

#[wasm_bindgen(typescript_custom_section)]
const DEPENDENCY_GRAPH: &'static str = r#"
export type DependencyGraph = {
Expand All @@ -32,14 +30,12 @@ export type DependencyGraph = {
export type CompiledContract = {
noir_version: string;
name: string;
backend: string;
functions: Array<any>;
events: Array<any>;
};
export type CompiledProgram = {
noir_version: string;
backend: string;
abi: any;
bytecode: string;
}
Expand Down Expand Up @@ -285,7 +281,6 @@ pub(crate) fn preprocess_program(program: CompiledProgram) -> CompileResult {

let preprocessed_program = PreprocessedProgram {
hash: program.hash,
backend: String::from(BACKEND_IDENTIFIER),
abi: program.abi,
noir_version: NOIR_ARTIFACT_VERSION_STRING.to_string(),
bytecode: program.circuit,
Expand Down Expand Up @@ -316,7 +311,6 @@ pub(crate) fn preprocess_contract(contract: CompiledContract) -> CompileResult {
let preprocessed_contract = PreprocessedContract {
noir_version: String::from(NOIR_ARTIFACT_VERSION_STRING),
name: contract.name,
backend: String::from(BACKEND_IDENTIFIER),
functions: preprocessed_functions,
events: contract.events,
};
Expand Down
2 changes: 0 additions & 2 deletions compiler/wasm/test/browser/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('noir wasm', () => {
expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version);
expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode);
expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi);
expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend);
}).timeout(20e3); // 20 seconds
});

Expand Down Expand Up @@ -81,7 +80,6 @@ describe('noir wasm', () => {
expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version);
expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode);
expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi);
expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend);
}).timeout(20e3); // 20 seconds
});
});
4 changes: 0 additions & 4 deletions compiler/wasm/test/node/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('noir wasm compilation', () => {
expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version);
expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode);
expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi);
expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend);
}).timeout(10e3);
});

Expand Down Expand Up @@ -71,7 +70,6 @@ describe('noir wasm compilation', () => {
expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version);
expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode);
expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi);
expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend);
}).timeout(10e3);
});

Expand Down Expand Up @@ -121,7 +119,6 @@ describe('noir wasm compilation', () => {
expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version);
expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode);
expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi);
expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend);
}).timeout(10e3);

it('matching nargos compilation - context-implementation-compile-api', async () => {
Expand All @@ -147,7 +144,6 @@ describe('noir wasm compilation', () => {
expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version);
expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode);
expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi);
expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend);
}).timeout(10e3);
});
});
2 changes: 1 addition & 1 deletion tooling/backend_interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod download;
mod proof_system;
mod smart_contract;

use bb_abstraction_leaks::ACVM_BACKEND_BARRETENBERG;
pub use bb_abstraction_leaks::ACVM_BACKEND_BARRETENBERG;
use bb_abstraction_leaks::BB_VERSION;
use cli::VersionCommand;
pub use download::download_backend;
Expand Down
2 changes: 0 additions & 2 deletions tooling/nargo/src/artifacts/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ pub struct PreprocessedContract {
pub noir_version: String,
/// The name of the contract.
pub name: String,
/// The identifier of the proving backend which this contract has been compiled for.
pub backend: String,
/// Each of the contract's functions are compiled into a separate program stored in this `Vec`.
pub functions: Vec<PreprocessedContractFunction>,
/// All the events defined inside the contract scope.
Expand Down
1 change: 0 additions & 1 deletion tooling/nargo/src/artifacts/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub struct PreprocessedProgram {
/// Used to short-circuit compilation in the case of the source code not changing since the last compilation.
pub hash: u64,

pub backend: String,
pub abi: Abi,

#[serde(
Expand Down
2 changes: 1 addition & 1 deletion tooling/nargo_cli/src/backends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn active_backend_file_path() -> PathBuf {
backends_directory().join(".selected_backend")
}

pub(crate) const ACVM_BACKEND_BARRETENBERG: &str = "acvm-backend-barretenberg";
pub(crate) use backend_interface::ACVM_BACKEND_BARRETENBERG;

pub(crate) fn clear_active_backend() {
let active_backend_file = active_backend_file_path();
Expand Down
5 changes: 0 additions & 5 deletions tooling/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ use super::fs::program::{
use super::NargoConfig;
use rayon::prelude::*;

// TODO(#1388): pull this from backend.
const BACKEND_IDENTIFIER: &str = "acvm-backend-barretenberg";

/// Compile the program and its secret execution trace into ACIR format
#[derive(Debug, Clone, Args)]
pub(crate) struct CompileCommand {
Expand Down Expand Up @@ -233,7 +230,6 @@ fn save_program(
) {
let preprocessed_program = PreprocessedProgram {
hash: program.hash,
backend: String::from(BACKEND_IDENTIFIER),
abi: program.abi,
noir_version: program.noir_version,
bytecode: program.circuit,
Expand Down Expand Up @@ -275,7 +271,6 @@ fn save_contract(contract: CompiledContract, package: &Package, circuit_dir: &Pa
let preprocessed_contract = PreprocessedContract {
noir_version: contract.noir_version,
name: contract.name,
backend: String::from(BACKEND_IDENTIFIER),
functions: preprocessed_functions,
events: contract.events,
};
Expand Down
8 changes: 1 addition & 7 deletions tooling/nargo_cli/src/cli/init_cmd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::backends::Backend;
use crate::errors::CliError;

use super::fs::{create_named_dir, write_to_file};
Expand Down Expand Up @@ -34,12 +33,7 @@ const BIN_EXAMPLE: &str = include_str!("./noir_template_files/binary.nr");
const CONTRACT_EXAMPLE: &str = include_str!("./noir_template_files/contract.nr");
const LIB_EXAMPLE: &str = include_str!("./noir_template_files/library.nr");

pub(crate) fn run(
// Backend is currently unused, but we might want to use it to inform the "new" template in the future
_backend: &Backend,
args: InitCommand,
config: NargoConfig,
) -> Result<(), CliError> {
pub(crate) fn run(args: InitCommand, config: NargoConfig) -> Result<(), CliError> {
let package_name = match args.name {
Some(name) => name,
None => {
Expand Down
2 changes: 1 addition & 1 deletion tooling/nargo_cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub(crate) fn start_cli() -> eyre::Result<()> {

match command {
NargoCommand::New(args) => new_cmd::run(&backend, args, config),
NargoCommand::Init(args) => init_cmd::run(&backend, args, config),
NargoCommand::Init(args) => init_cmd::run(args, config),
NargoCommand::Check(args) => check_cmd::run(&backend, args, config),
NargoCommand::Compile(args) => compile_cmd::run(&backend, args, config),
NargoCommand::Debug(args) => debug_cmd::run(&backend, args, config),
Expand Down
1 change: 0 additions & 1 deletion tooling/nargo_toml/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ struct PackageMetadata {
// We also state that ACIR and the compiler will upgrade in lockstep.
// so you will not need to supply an ACIR and compiler version
compiler_version: Option<String>,
backend: Option<String>,
license: Option<String>,
}

Expand Down

0 comments on commit fa1cf5f

Please sign in to comment.