From 725469dec2902b60212be762b7eeacfde427f7af Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 9 Feb 2024 10:09:13 +0000 Subject: [PATCH] Little cpp style improvements --- .../src/barretenberg/vm/avm_trace/AvmMini_common.hpp | 4 ++-- .../src/barretenberg/vm/avm_trace/AvmMini_opcode.hpp | 3 +-- .../barretenberg/vm/tests/AvmMini_execution.test.cpp | 10 ++++++---- .../cpp/src/barretenberg/vm/tests/helpers.test.hpp | 5 +++++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp index fdbf49ebe572..1a8508377e6f 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_common.hpp @@ -4,12 +4,12 @@ #include "barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp" #include +namespace avm_trace { + using Flavor = bb::AvmMiniFlavor; using FF = Flavor::FF; using Row = bb::AvmMiniFullRow; -namespace avm_trace { - // Number of rows static const size_t AVM_TRACE_SIZE = 256; enum class IntermRegister : uint32_t { IA = 0, IB = 1, IC = 2 }; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_opcode.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_opcode.hpp index c945f6158c61..ad4cc5928363 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_opcode.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/AvmMini_opcode.hpp @@ -4,7 +4,6 @@ #include namespace avm_trace { -using std::size_t; /** * All AVM opcodes (Keep in sync with TS counterpart code opcodes.ts) @@ -99,7 +98,7 @@ class Bytecode { public: static bool is_valid(uint8_t byte); static bool has_in_tag(OpCode); - static const std::unordered_map OPERANDS_NUM; + static const std::unordered_map OPERANDS_NUM; }; } // namespace avm_trace \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp index c6680631aeca..8477c8eff484 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/AvmMini_execution.test.cpp @@ -12,9 +12,15 @@ #include #include +namespace tests_avm { + using namespace bb; +using namespace avm_trace; +using bb::utils::hex_to_bytes; using namespace testing; + namespace { + void gen_proof_and_validate(std::vector const& bytecode, std::vector&& trace, std::vector const& calldata) @@ -32,10 +38,6 @@ void gen_proof_and_validate(std::vector const& bytecode, } } // namespace -namespace tests_avm { -using namespace avm_trace; -using bb::utils::hex_to_bytes; - class AvmMiniExecutionTests : public ::testing::Test { public: AvmMiniTraceBuilder trace_builder; diff --git a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp index 430c1cce45b0..d6071fe421ed 100644 --- a/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp @@ -11,6 +11,11 @@ EXPECT_TRUE(message.find(expectedMessage) != std::string::npos); \ } namespace tests_avm { + +using Flavor = bb::AvmMiniFlavor; +using FF = Flavor::FF; +using Row = bb::AvmMiniFullRow; + void validate_trace_proof(std::vector&& trace); void mutate_ic_in_trace(std::vector& trace, std::function&& selectRow,