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(avm)!: remove tags from wire format #9198

Merged
merged 9 commits into from
Oct 11, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn brillig_to_avm(
.direct_operand(destination)
.build(),
),
tag: Some(AvmTypeTag::FIELD),
tag: None,
operands: vec![
make_operand(bits_needed, &lhs.to_usize()),
make_operand(bits_needed, &rhs.to_usize()),
Expand Down Expand Up @@ -181,7 +181,7 @@ pub fn brillig_to_avm(
.direct_operand(destination)
.build(),
),
tag: Some(tag_from_bit_size(BitSize::Integer(*bit_size))),
tag: None,
operands: vec![
make_operand(bits_needed, &lhs.to_usize()),
make_operand(bits_needed, &rhs.to_usize()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class AcirAvmRecursionConstraint : public ::testing::Test {

trace_builder.op_set(0, 15, 1, AvmMemoryTag::U8);
trace_builder.op_set(0, 12, 2, AvmMemoryTag::U8);
trace_builder.op_add(0, 1, 2, 3, AvmMemoryTag::U8);
trace_builder.op_sub(0, 3, 2, 3, AvmMemoryTag::U8);
trace_builder.op_mul(0, 1, 1, 3, AvmMemoryTag::U8);
trace_builder.op_add(0, 1, 2, 3);
trace_builder.op_sub(0, 3, 2, 3);
trace_builder.op_mul(0, 1, 1, 3);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize(); // Passing true enables a longer trace with lookups

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AvmRecursiveTests : public ::testing::Test {

trace_builder.op_set(0, 1, 1, AvmMemoryTag::U8);
trace_builder.op_set(0, 1, 2, AvmMemoryTag::U8);
trace_builder.op_add(0, 1, 2, 3, AvmMemoryTag::U8);
trace_builder.op_add(0, 1, 2, 3);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize(); // Passing true enables a longer trace with lookups

Expand Down
147 changes: 73 additions & 74 deletions barretenberg/cpp/src/barretenberg/vm/avm/tests/arithmetic.test.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions barretenberg/cpp/src/barretenberg/vm/avm/tests/bitwise.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ TEST_P(AvmBitwiseTestsAnd, AllAndTest)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_and(0, 0, 1, 2, mem_tag);
trace_builder.op_and(0, 0, 1, 2);
trace_builder.op_return(0, 2, 1);

auto trace = trace_builder.finalize();
Expand All @@ -511,7 +511,7 @@ TEST_P(AvmBitwiseTestsOr, AllOrTest)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_or(0, 0, 1, 2, mem_tag);
trace_builder.op_or(0, 0, 1, 2);
trace_builder.op_return(0, 2, 1);
auto trace = trace_builder.finalize();

Expand All @@ -528,7 +528,7 @@ TEST_P(AvmBitwiseTestsXor, AllXorTest)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_xor(0, 0, 1, 2, mem_tag);
trace_builder.op_xor(0, 0, 1, 2);
trace_builder.op_return(0, 2, 1);
auto trace = trace_builder.finalize();

Expand All @@ -546,7 +546,7 @@ TEST_P(AvmBitwiseTestsShr, AllShrTest)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_shr(0, 0, 1, 2, mem_tag);
trace_builder.op_shr(0, 0, 1, 2);
trace_builder.op_return(0, 2, 1);
auto trace = trace_builder.finalize();
common_validate_shift_op(trace, a, b, output, FF(0), FF(1), FF(2), mem_tag, true);
Expand All @@ -563,7 +563,7 @@ TEST_P(AvmBitwiseTestsShl, AllShlTest)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_shl(0, 0, 1, 2, mem_tag);
trace_builder.op_shl(0, 0, 1, 2);
trace_builder.op_return(0, 2, 1);
auto trace = trace_builder.finalize();

Expand Down Expand Up @@ -667,7 +667,7 @@ TEST_P(AvmBitwiseNegativeTestsAnd, AllNegativeTests)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_and(0, 0, 1, 2, mem_tag);
trace_builder.op_and(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)>&& select_row = [](Row r) { return r.main_sel_op_and == FF(1); };
Expand All @@ -686,7 +686,7 @@ TEST_P(AvmBitwiseNegativeTestsOr, AllNegativeTests)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_or(0, 0, 1, 2, mem_tag);
trace_builder.op_or(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)>&& select_row = [](Row r) { return r.main_sel_op_or == FF(1); };
Expand All @@ -704,7 +704,7 @@ TEST_P(AvmBitwiseNegativeTestsXor, AllNegativeTests)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_xor(0, 0, 1, 2, mem_tag);
trace_builder.op_xor(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)>&& select_row = [](Row r) { return r.main_sel_op_xor == FF(1); };
Expand All @@ -722,7 +722,7 @@ TEST_P(AvmBitwiseNegativeTestsShr, AllNegativeTests)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_shr(0, 0, 1, 2, mem_tag);
trace_builder.op_shr(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)>&& select_row = [](Row r) { return r.main_sel_op_shr == FF(1); };
Expand All @@ -741,7 +741,7 @@ TEST_P(AvmBitwiseNegativeTestsShl, AllNegativeTests)
const auto [a, b, output] = operands;
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
trace_builder.op_shl(0, 0, 1, 2, mem_tag);
trace_builder.op_shl(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)>&& select_row = [](Row r) { return r.main_sel_op_shl == FF(1); };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ TEST_P(AvmCmpTestsLT, ParamTest)
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
}
trace_builder.op_lt(0, 0, 1, 2, mem_tag);
trace_builder.op_lt(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();

Expand Down Expand Up @@ -159,7 +159,7 @@ TEST_P(AvmCmpTestsLTE, ParamTest)
trace_builder.op_set(0, a, 0, mem_tag);
trace_builder.op_set(0, b, 1, mem_tag);
}
trace_builder.op_lte(0, 0, 1, 2, mem_tag);
trace_builder.op_lte(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
auto row = std::ranges::find_if(trace.begin(), trace.end(), [](Row r) { return r.main_sel_op_lte == FF(1); });
Expand Down Expand Up @@ -335,7 +335,7 @@ TEST_P(AvmCmpNegativeTestsLT, ParamTest)
.set_full_precomputed_tables(false)
.set_range_check_required(false);
trace_builder.op_calldata_copy(0, 0, 3, 0);
trace_builder.op_lt(0, 0, 1, 2, AvmMemoryTag::FF);
trace_builder.op_lt(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)> select_row = [](Row r) { return r.main_sel_op_lt == FF(1); };
Expand All @@ -356,7 +356,7 @@ TEST_P(AvmCmpNegativeTestsLTE, ParamTest)
.set_full_precomputed_tables(false)
.set_range_check_required(false);
trace_builder.op_calldata_copy(0, 0, 3, 0);
trace_builder.op_lte(0, 0, 1, 2, AvmMemoryTag::FF);
trace_builder.op_lte(0, 0, 1, 2);
trace_builder.op_return(0, 0, 0);
auto trace = trace_builder.finalize();
std::function<bool(Row)> select_row = [](Row r) { return r.main_sel_op_lte == FF(1); };
Expand Down
Loading
Loading