Barretenberg
The ZK-SNARK library at the core of Aztec
|
Fuzzer for testing Poseidon2 and Pedersen hash Ultra circuits against native implementations. More...
#include "barretenberg/circuit_checker/circuit_checker.hpp"
#include "barretenberg/crypto/pedersen_hash/pedersen.hpp"
#include "barretenberg/crypto/poseidon2/poseidon2.hpp"
#include "barretenberg/ecc/fields/field.fuzzer.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include "barretenberg/numeric/uint256/uint256.hpp"
#include "barretenberg/stdlib/hash/pedersen/pedersen.hpp"
#include "barretenberg/stdlib/hash/poseidon2/poseidon2.hpp"
#include "barretenberg/stdlib/primitives/curves/bn254.hpp"
#include <cassert>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <vector>
Go to the source code of this file.
Typedefs | |
using | Fr = fr |
using | native_poseidon2 = crypto::Poseidon2< crypto::Poseidon2Bn254ScalarFieldParams > |
using | native_pedersen = crypto::pedersen_hash |
Functions | |
std::vector< Fr > | parse_input_and_generate_elements (const uint8_t *data, size_t size) |
Parse input structure and generate field elements using FieldVM. | |
template<typename Builder > | |
bool | test_poseidon2_circuit (const std::vector< Fr > &inputs) |
Test Poseidon2 circuit with specified builder type. | |
template<typename Builder > | |
bool | test_pedersen_circuit (const std::vector< Fr > &inputs) |
Test Pedersen circuit with specified builder type. | |
int | LLVMFuzzerTestOneInput (const uint8_t *Data, size_t Size) |
Main fuzzer entry point. | |
Fuzzer for testing Poseidon2 and Pedersen hash Ultra circuits against native implementations.
This fuzzer implements differential testing of both Poseidon2 and Pedersen hash function circuits by comparing Ultra circuit outputs with native implementation results. The fuzzer:
Definition in file poseidon2_pedersen.fuzzer.cpp.
Definition at line 42 of file poseidon2_pedersen.fuzzer.cpp.
using native_pedersen = crypto::pedersen_hash |
Definition at line 44 of file poseidon2_pedersen.fuzzer.cpp.
Definition at line 43 of file poseidon2_pedersen.fuzzer.cpp.
int LLVMFuzzerTestOneInput | ( | const uint8_t * | Data, |
size_t | Size | ||
) |
Main fuzzer entry point.
Data | Input data from libfuzzer |
Size | Size of input data |
Definition at line 210 of file poseidon2_pedersen.fuzzer.cpp.
std::vector< Fr > parse_input_and_generate_elements | ( | const uint8_t * | data, |
size_t | size | ||
) |
Parse input structure and generate field elements using FieldVM.
data | Raw input data |
size | Data size |
Definition at line 55 of file poseidon2_pedersen.fuzzer.cpp.
Test Pedersen circuit with specified builder type.
Builder | Circuit builder type |
inputs | Vector of field elements to hash |
Definition at line 157 of file poseidon2_pedersen.fuzzer.cpp.
Test Poseidon2 circuit with specified builder type.
Builder | Circuit builder type |
inputs | Vector of field elements to hash |
Definition at line 105 of file poseidon2_pedersen.fuzzer.cpp.