barretenberg
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
ArithmeticFuzzHelper< T > Class Template Reference

A templated class containing most of the fuzzing logic for a generic Arithmetic class. More...

#include <fuzzer.hpp>

Static Public Member Functions

static std::vector< typename T::Instruction > crossoverInstructionVector (const std::vector< typename T::Instruction > &vecA, const std::vector< typename T::Instruction > &vecB, FastRandom &rng)
 Splice two instruction vectors into one randomly.
 
static std::vector< typename T::Instruction > parseDataIntoInstructions (const uint8_t *Data, size_t Size)
 Parses a given data buffer into a vector of instructions for testing the arithmetic.
 
static size_t writeInstructionsToBuffer (std::vector< typename T::Instruction > &instructions, uint8_t *Data, size_t MaxSize)
 Write instructions into the buffer until there are no instructions left or there is no more space.
 
template<typename Composer >
requires CheckableComposer<Composer>
static void executeInstructions (std::vector< typename T::Instruction > &instructions)
 Execute instructions in a loop.
 
static size_t MutateInstructionBuffer (uint8_t *Data, size_t Size, size_t MaxSize, FastRandom &rng)
 Interpret the data buffer as a series of arithmetic instructions and mutate it accordingly.
 

Detailed Description

template<typename T>
requires ArithmeticFuzzHelperConstraint<T>
class ArithmeticFuzzHelper< T >

A templated class containing most of the fuzzing logic for a generic Arithmetic class.

Template Parameters
T

Member Function Documentation

◆ crossoverInstructionVector()

template<typename T >
static std::vector< typename T::Instruction > ArithmeticFuzzHelper< T >::crossoverInstructionVector ( const std::vector< typename T::Instruction > &  vecA,
const std::vector< typename T::Instruction > &  vecB,
FastRandom rng 
)
inlinestatic

Splice two instruction vectors into one randomly.

Parameters
vecAFirst instruction vector
vecBSecond instruction vector
rngPRNG
Returns
Resulting vector of instructions

◆ executeInstructions()

template<typename T >
template<typename Composer >
requires CheckableComposer<Composer>
static void ArithmeticFuzzHelper< T >::executeInstructions ( std::vector< typename T::Instruction > &  instructions)
inlinestatic

Execute instructions in a loop.

Template Parameters
Composercomposer used
Parameters
instructions

◆ MutateInstructionBuffer()

template<typename T >
static size_t ArithmeticFuzzHelper< T >::MutateInstructionBuffer ( uint8_t *  Data,
size_t  Size,
size_t  MaxSize,
FastRandom rng 
)
inlinestatic

Interpret the data buffer as a series of arithmetic instructions and mutate it accordingly.

Parameters
DataPointer to the buffer
SizeThe initial filled size
MaxSizeThe size of the buffer
Returns
size_t The new length of data in the buffer

◆ parseDataIntoInstructions()

template<typename T >
static std::vector< typename T::Instruction > ArithmeticFuzzHelper< T >::parseDataIntoInstructions ( const uint8_t *  Data,
size_t  Size 
)
inlinestatic

Parses a given data buffer into a vector of instructions for testing the arithmetic.

Parameters
DataPointer to the data buffer
SizeData buffer size
Returns
A vector of instructions

◆ writeInstructionsToBuffer()

template<typename T >
static size_t ArithmeticFuzzHelper< T >::writeInstructionsToBuffer ( std::vector< typename T::Instruction > &  instructions,
uint8_t *  Data,
size_t  MaxSize 
)
inlinestatic

Write instructions into the buffer until there are no instructions left or there is no more space.

Parameters
instructionsVector of fuzzing instructions
DataPointer to data buffer
MaxSizeSize of buffer
Returns
How much of the buffer was filled with instructions

The documentation for this class was generated from the following file: