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!: update codegened acir parser #631

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@ jobs:
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 3 join_split_example_proofs_join_split_tests --gtest_filter=-*full_proof*
- *save_logs

bb-bin-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_test_script ./scripts/bin-test.sh barretenberg-x86_64-linux-clang-assert
# bb-bin-tests:
# docker:
# - image: aztecprotocol/alpine-build-image
# resource_class: small
# steps:
# - *checkout
# - *setup_env
# - run:
# name: "Test"
# command: cond_spot_run_test_script ./scripts/bin-test.sh barretenberg-x86_64-linux-clang-assert

benchmark-aggregator:
docker:
Expand Down Expand Up @@ -439,7 +439,7 @@ workflows:
- stdlib-recursion-turbo-tests: *bb_test
- stdlib-recursion-ultra-tests: *bb_test
- join-split-tests: *bb_test
- bb-bin-tests: *bb_test
# - bb-bin-tests: *bb_test
- benchmark-aggregator:
requires:
- barretenberg-tests
Expand Down
2 changes: 1 addition & 1 deletion acir_tests/run_acir_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e

BB=$PWD/${BB:-../cpp/build/bin/bb}
CRS_PATH=~/.bb-crs
BRANCH=master
BRANCH=acvm-0.21.0
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved

# Pull down the test vectors from the noir repo, if we don't have the folder already.
if [ ! -d acir_tests ]; then
Expand Down
1 change: 0 additions & 1 deletion cpp/bin-test/target/main.json

This file was deleted.

Binary file removed cpp/bin-test/target/witness.tr
Binary file not shown.
37 changes: 7 additions & 30 deletions cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,31 +209,6 @@ void handle_blackbox_func_call(Circuit::Opcode::BlackBoxFuncCall const& arg, aci
arg.value.value);
}

void handle_memory(Circuit::MemoryBlock const& mem_block, bool is_ram, acir_format& af)
{
std::vector<poly_triple> init;
std::vector<MemOp> trace;
auto len = mem_block.len;
for (size_t i = 0; i < len; ++i) {
init.push_back(serialize_arithmetic_gate(mem_block.trace[i].value));
}
for (size_t i = len; i < mem_block.trace.size(); ++i) {
auto index = serialize_arithmetic_gate(mem_block.trace[i].index);
auto value = serialize_arithmetic_gate(mem_block.trace[i].value);
auto op = mem_block.trace[i].operation;
if (!(op.mul_terms.empty() && op.linear_combinations.empty())) {
throw_or_abort("Expected constant.");
}
bool access_type(uint256_t(op.q_c));
trace.push_back(MemOp{
.access_type = static_cast<uint8_t>(access_type),
.index = index,
.value = value,
});
}
af.block_constraints.push_back(BlockConstraint{ .init = init, .trace = trace, .type = (BlockType)is_ram });
}

BlockConstraint handle_memory_init(Circuit::Opcode::MemoryInit const& mem_init)
{
BlockConstraint block{ .init = {}, .trace = {}, .type = BlockType::ROM };
Expand All @@ -256,10 +231,16 @@ BlockConstraint handle_memory_init(Circuit::Opcode::MemoryInit const& mem_init)
return block;
}

bool is_rom(Circuit::MemOp const& mem_op)
{
return mem_op.operation.mul_terms.size() == 0 && mem_op.operation.linear_combinations.size() == 0 &&
uint256_t(mem_op.operation.q_c) == 0;
}

void handle_memory_op(Circuit::Opcode::MemoryOp const& mem_op, BlockConstraint& block)
{
uint8_t access_type = 1;
if (mem_op.op.is_rom()) {
if (is_rom(mem_op.op)) {
access_type = 0;
}
if (block.type == BlockType::ROM && access_type == 1) {
Expand Down Expand Up @@ -289,10 +270,6 @@ acir_format circuit_buf_to_acir_format(std::vector<uint8_t> const& buf)
handle_arithmetic(arg, af);
} else if constexpr (std::is_same_v<T, Circuit::Opcode::BlackBoxFuncCall>) {
handle_blackbox_func_call(arg, af);
} else if constexpr (std::is_same_v<T, Circuit::Opcode::RAM>) {
handle_memory(arg.value, true, af);
} else if constexpr (std::is_same_v<T, Circuit::Opcode::ROM>) {
handle_memory(arg.value, false, af);
} else if constexpr (std::is_same_v<T, Circuit::Opcode::MemoryInit>) {
auto block = handle_memory_init(arg);
uint32_t block_id = arg.block_id.value;
Expand Down
Loading