Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
feat!: Migrate to ACVM 0.21.0 (#234)
Browse files Browse the repository at this point in the history
* feat!: Migrate to ACVM 0.21.0

* chore: use crates.io release

* chore: update Cargo.lock
  • Loading branch information
TomAFrench committed Jul 26, 2023
1 parent 5c0a158 commit 15c8676
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 85 deletions.
57 changes: 14 additions & 43 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
crate-type = ["cdylib", "lib"]

[dependencies]
acvm = { version = "0.20.0", features = ["bn254"] }
acvm = { version = "0.21.0", features = ["bn254"] }
bincode = "1.3.3"
bytesize = "1.2"
reqwest = { version = "0.11.16", default-features = false, features = [
Expand Down Expand Up @@ -50,4 +50,4 @@ tokio = { version = "1.0", features = ["macros"] }
[features]
default = ["native"]
native = ["dep:barretenberg-sys"]
wasm = ["dep:wasmer", "dep:rust-embed", "dep:getrandom"]
wasm = ["dep:wasmer", "dep:rust-embed", "dep:getrandom"]
3 changes: 0 additions & 3 deletions src/acvm_interop/proof_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ impl ProofSystemCompiler for Barretenberg {
match opcode {
Opcode::Arithmetic(_) => true,
Opcode::Directive(_) => true,
Opcode::Block(_) => false,
Opcode::ROM(_) => true,
Opcode::RAM(_) => true,
Opcode::Brillig(_) => true,
Opcode::MemoryInit { .. } => true,
Opcode::MemoryOp { .. } => true,
Expand Down
39 changes: 2 additions & 37 deletions src/barretenberg_structures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;

use acvm::acir::circuit::opcodes::{BlackBoxFuncCall, FunctionInput, MemoryBlock};
use acvm::acir::circuit::opcodes::{BlackBoxFuncCall, FunctionInput};
use acvm::acir::circuit::{Circuit, Opcode};
use acvm::acir::native_types::Expression;
use acvm::acir::BlackBoxFunc;
Expand Down Expand Up @@ -741,32 +741,6 @@ impl BlockConstraint {

buffer
}

fn from_memory_block(b: &MemoryBlock, is_ram_block: bool) -> BlockConstraint {
let mut init = Vec::new();
let mut trace = Vec::new();
let len = b.len as usize;
for op in b.trace.iter().take(len) {
assert_eq!(op.operation, Expression::one());
init.push(serialize_arithmetic_gates(&op.value));
}
for op in b.trace.iter().skip(len) {
let index = serialize_arithmetic_gates(&op.index);
let value = serialize_arithmetic_gates(&op.value);
let bb_op = MemOpBarretenberg {
is_store: op.operation.to_const().unwrap().to_u128() as i8,
index,
value,
};
trace.push(bb_op);
}
let is_ram = i8::from(is_ram_block);
BlockConstraint {
init,
trace,
is_ram,
}
}
}

#[derive(Clone, Hash, Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -832,7 +806,7 @@ impl TryFrom<&Circuit> for ConstraintSystem {
let mut logic_constraints: Vec<LogicConstraint> = Vec::new();
let mut sha256_constraints: Vec<Sha256Constraint> = Vec::new();
let mut blake2s_constraints: Vec<Blake2sConstraint> = Vec::new();
let mut block_constraints: Vec<BlockConstraint> = Vec::new();
let block_constraints: Vec<BlockConstraint> = Vec::new();
let mut keccak_constraints: Vec<Keccak256Constraint> = Vec::new();
let mut keccak_var_constraints: Vec<Keccak256VarConstraint> = Vec::new();
let mut pedersen_constraints: Vec<PedersenConstraint> = Vec::new();
Expand Down Expand Up @@ -1339,15 +1313,6 @@ impl TryFrom<&Circuit> for ConstraintSystem {
Opcode::Directive(_) | Opcode::Brillig(_) => {
// Directives, Oracles and Brillig are only needed by the pwg
}
Opcode::Block(_) => {
// Block is managed by ACVM
}
Opcode::RAM(block) => {
block_constraints.push(BlockConstraint::from_memory_block(block, true))
}
Opcode::ROM(block) => {
block_constraints.push(BlockConstraint::from_memory_block(block, false))
}
Opcode::MemoryOp { block_id, op } => {
let block = blocks
.get_mut(&block_id.0)
Expand Down

0 comments on commit 15c8676

Please sign in to comment.