|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Differential fuzzer for cycle_group elliptic curve operations. More...
#include "barretenberg/circuit_checker/circuit_checker.hpp"#include "barretenberg/numeric/random/engine.hpp"#include "barretenberg/numeric/uint256/uint256.hpp"#include "barretenberg/stdlib/primitives/group/cycle_group.hpp"#include "barretenberg/common/fuzzer.hpp"Go to the source code of this file.
Macros | |
| #define | HAVOC_TESTING |
| #define | PUT_RANDOM_BYTE_IF_LUCKY(variable) |
Enumerations | |
| enum class | SpecialScalarValue : uint8_t { One = 0 , MinusOne , SquareRootOfOne , InverseSquareRootOfOne , RootOfUnity13 , Two , HalfModulus , Zero , COUNT } |
| Special scalar field values used for mutation testing. More... | |
Functions | |
| size_t | LLVMFuzzerMutate (uint8_t *Data, size_t Size, size_t MaxSize) |
| template<typename FF > | |
| FF | get_special_scalar_value (SpecialScalarValue type) |
| Generate a special scalar field value for testing. | |
| int | LLVMFuzzerInitialize (int *argc, char ***argv) |
| size_t | LLVMFuzzerTestOneInput (const uint8_t *Data, size_t Size) |
| Fuzzer entry function. | |
Variables | |
| bool | circuit_should_fail = false |
| FastRandom | VarianceRNG (0) |
| constexpr size_t | MINIMUM_MUL_ELEMENTS = 0 |
| constexpr size_t | MAXIMUM_MUL_ELEMENTS = 8 |
| constexpr uint8_t | SPECIAL_VALUE_COUNT_NO_ZERO = static_cast<uint8_t>(SpecialScalarValue::Zero) |
| constexpr uint8_t | SPECIAL_VALUE_COUNT = static_cast<uint8_t>(SpecialScalarValue::COUNT) |
Differential fuzzer for cycle_group elliptic curve operations.
Implements an instruction-based differential fuzzer that validates the cycle_group implementation by executing random sequences of operations both in-circuit (using cycle_group) and natively, then comparing the results. The architecture is as follows:
┌─────────────┐ │ Fuzzer Input│ │ (raw bytes) │ └──────┬──────┘ │ ├──> Parser ──> Instruction Sequence │ v ExecutionHandler (maintains parallel state): ┌─────────────────────────────────────────┐ │ Native: GroupElement + ScalarField │ (ground truth) │ Circuit: cycle_group + cycle_scalar │ └─────────────────────────────────────────┘ │ ├──> Execute each instruction in both representations │ v Verify: cycle_group.get_value() == native_result CircuitChecker::check(circuit)
Definition in file cycle_group.fuzzer.hpp.
| #define HAVOC_TESTING |
Definition at line 49 of file cycle_group.fuzzer.hpp.
| #define PUT_RANDOM_BYTE_IF_LUCKY | ( | variable | ) |
|
strong |
Special scalar field values used for mutation testing.
rng.next() % SPECIAL_VALUE_COUNT for all valuesrng.next() % SPECIAL_VALUE_COUNT_NO_ZERO for values excluding Zero (One through HalfModulus) | Enumerator | |
|---|---|
| One | |
| MinusOne | |
| SquareRootOfOne | |
| InverseSquareRootOfOne | |
| RootOfUnity13 | |
| Two | |
| HalfModulus | |
| Zero | |
| COUNT | |
Definition at line 76 of file cycle_group.fuzzer.hpp.
|
inline |
Generate a special scalar field value for testing.
| FF | Field type (e.g., ScalarField) |
| type | Which special value to generate |
Definition at line 100 of file cycle_group.fuzzer.hpp.
| int LLVMFuzzerInitialize | ( | int * | argc, |
| char *** | argv | ||
| ) |
This is used, when we need to determine the probabilities of various mutations. Left here for posterity
Write mutation settings to log
Definition at line 1596 of file cycle_group.fuzzer.hpp.
| size_t LLVMFuzzerMutate | ( | uint8_t * | Data, |
| size_t | Size, | ||
| size_t | MaxSize | ||
| ) |
| size_t LLVMFuzzerTestOneInput | ( | const uint8_t * | Data, |
| size_t | Size | ||
| ) |
Fuzzer entry function.
Definition at line 1719 of file cycle_group.fuzzer.hpp.
| bool circuit_should_fail = false |
Definition at line 53 of file cycle_group.fuzzer.hpp.
|
constexpr |
Definition at line 64 of file cycle_group.fuzzer.hpp.
|
constexpr |
Definition at line 63 of file cycle_group.fuzzer.hpp.
|
constexpr |
Definition at line 92 of file cycle_group.fuzzer.hpp.
|
constexpr |
Definition at line 89 of file cycle_group.fuzzer.hpp.
| FastRandom VarianceRNG(0) | ( | 0 | ) |