Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
field.fuzzer.hpp File Reference

Field arithmetic fuzzer for testing cryptographic field operations. More...

#include "barretenberg/common/assert.hpp"
#include "barretenberg/common/log.hpp"
#include "barretenberg/numeric/uint256/uint256.hpp"
#include "barretenberg/numeric/uintx/uintx.hpp"
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstring>
#include <vector>

Go to the source code of this file.

Classes

struct  bb::VMSettings
 Settings structure to control which operations are enabled in the VM. More...
 
struct  bb::FieldVM< Field >
 Virtual machine for field arithmetic operations. More...
 
struct  bb::FieldVM< Field >::ParsedInstruction
 Structure to hold parsed instruction data. More...
 

Namespaces

namespace  bb
 Entry point for Barretenberg command-line interface.
 

Enumerations

enum class  bb::Instruction {
  bb::SET_VALUE , bb::ADD , bb::ADD_ASSIGN , bb::INCREMENT ,
  bb::MUL , bb::MUL_ASSIGN , bb::SUB , bb::SUB_ASSIGN ,
  bb::DIV , bb::DIV_ASSIGN , bb::INV , bb::NEG ,
  bb::SQR , bb::SQR_ASSIGN , bb::POW , bb::SQRT ,
  bb::IS_ZERO , bb::EQUAL , bb::NOT_EQUAL , bb::TO_MONTGOMERY ,
  bb::FROM_MONTGOMERY , bb::REDUCE_ONCE , bb::SELF_REDUCE , bb::BATCH_INVERT
}
 Enumeration of VM instructions that can be executed. More...
 

Variables

const size_t bb::INTERNAL_STATE_SIZE = 32
 Constant defining the number of elements in the VM's internal state.
 
const size_t bb::SETTINGS_SIZE = sizeof(VMSettings)
 
const size_t bb::INSTRUCTION_HEADER_SIZE = 1
 Size of instruction header in bytes.
 
const size_t bb::INDEX_SIZE = 1
 Size of index field in bytes.
 
const size_t bb::SET_VALUE_SIZE
 Size of SET_VALUE instruction.
 
const size_t bb::ADD_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 3
 Size of ADD instruction.
 
const size_t bb::ADD_ASSIGN_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of ADD_ASSIGN instruction.
 
const size_t bb::INCREMENT_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE
 Size of INCREMENT instruction.
 
const size_t bb::MUL_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 3
 Size of MUL instruction.
 
const size_t bb::MUL_ASSIGN_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of MUL_ASSIGN instruction.
 
const size_t bb::SUB_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 3
 Size of SUB instruction.
 
const size_t bb::SUB_ASSIGN_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of SUB_ASSIGN instruction.
 
const size_t bb::DIV_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 3
 Size of DIV instruction.
 
const size_t bb::DIV_ASSIGN_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of DIV_ASSIGN instruction.
 
const size_t bb::INV_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of INV instruction.
 
const size_t bb::NEG_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of NEG instruction.
 
const size_t bb::SQR_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of SQR instruction.
 
const size_t bb::SQR_ASSIGN_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE
 Size of SQR_ASSIGN instruction.
 
const size_t bb::POW_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 3 + sizeof(uint64_t)
 Size of POW instruction.
 
const size_t bb::SQRT_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of SQRT instruction.
 
const size_t bb::IS_ZERO_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE
 Size of IS_ZERO instruction.
 
const size_t bb::EQUAL_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of EQUAL instruction.
 
const size_t bb::NOT_EQUAL_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of NOT_EQUAL instruction.
 
const size_t bb::TO_MONTGOMERY_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of TO_MONTGOMERY instruction.
 
const size_t bb::FROM_MONTGOMERY_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of FROM_MONTGOMERY instruction.
 
const size_t bb::REDUCE_ONCE_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE * 2
 Size of REDUCE_ONCE instruction.
 
const size_t bb::SELF_REDUCE_SIZE = INSTRUCTION_HEADER_SIZE + INDEX_SIZE
 Size of SELF_REDUCE instruction.
 
const size_t bb::BATCH_INVERT_SIZE
 Size of BATCH_INVERT instruction.
 

Detailed Description

Field arithmetic fuzzer for testing cryptographic field operations.

This header provides a virtual machine for fuzzing field arithmetic operations across different elliptic curve fields. The VM supports various field operations including addition, multiplication, division, inversion, and more complex operations like batch inversion and Montgomery form conversions.

Author
Barretenberg Team
Date
2024

Definition in file field.fuzzer.hpp.