Skip to content

Commit

Permalink
Little cpp style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Feb 9, 2024
1 parent e58eda8 commit 725469d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include "barretenberg/proof_system/circuit_builder/generated/AvmMini_circuit_builder.hpp"
#include <cstdint>

namespace avm_trace {

using Flavor = bb::AvmMiniFlavor;
using FF = Flavor::FF;
using Row = bb::AvmMiniFullRow<bb::fr>;

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 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <unordered_map>

namespace avm_trace {
using std::size_t;

/**
* All AVM opcodes (Keep in sync with TS counterpart code opcodes.ts)
Expand Down Expand Up @@ -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<OpCode, size_t> OPERANDS_NUM;
static const std::unordered_map<OpCode, std::size_t> OPERANDS_NUM;
};

} // namespace avm_trace
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
#include <string>
#include <utility>

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<uint8_t> const& bytecode,
std::vector<Row>&& trace,
std::vector<FF> const& calldata)
Expand All @@ -32,10 +38,6 @@ void gen_proof_and_validate(std::vector<uint8_t> 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;
Expand Down
5 changes: 5 additions & 0 deletions barretenberg/cpp/src/barretenberg/vm/tests/helpers.test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bb::fr>;

void validate_trace_proof(std::vector<Row>&& trace);
void mutate_ic_in_trace(std::vector<Row>& trace,
std::function<bool(Row)>&& selectRow,
Expand Down

0 comments on commit 725469d

Please sign in to comment.