Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
fixtures.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
12
13namespace bb::avm2::testing {
14
15std::vector<FF> random_fields(size_t n);
16
17// WARNING: Cryptographically insecure randomness routines for testing purposes only.
18std::vector<uint8_t> random_bytes(size_t n);
19
22
24
25// This generates a random instruction for a given wire opcode. The output will conform to
26// the wire format specified in WireOpCode_WIRE_FORMAT. The format specifies a vector of
27// OperandType and we generate a random value for each operand conforming to the OperandType.
28// For OperandTypes:
29// INDIRECT8, UINT8: single random byte
30// INDIRECT16, UINT16: 2 random bytes
31// UINTXX: random bytes conforming to the size in bytes of the operand
32// FF: random field
33// TAG: random tag within the enum MemoryTag range
34// We do not provide any guarantee beyond the above static format restrictions.
35// For instance, next pc destination in JUMP might overflow the bytecode, etc, ....
36// Also, immediate operands which correspond to an enum value might fall outside
37// the prescribed range (for instance: GETENVVAR_16 and GETCONTRACTINSTANCE).
38// Note that indirect value might have toggled bits which are not relevant to the
39// wire opcode. It is in principle not an issue as these bits are ignored during
40// address resolution.
44ContractClass random_contract_class(size_t bytecode_size = 20);
45
46// A routine which provides a minimal trace and public inputs which should provide
47// a good coverage over the different sub-traces but yet as short as necessary.
48// TODO: Enhance trace with values in other sub-traces. At the moment, only
49// alu contains non-zero values.
51
56bool skip_slow_tests();
57
58} // namespace bb::avm2::testing
std::vector< PublicCallRequestWithCalldata > random_enqueued_calls(size_t n)
Definition fixtures.cpp:60
ContractClass random_contract_class(size_t bytecode_size)
Definition fixtures.cpp:174
std::vector< uint8_t > random_bytes(size_t n)
Definition fixtures.cpp:33
Operand random_operand(OperandType operand_type)
Definition fixtures.cpp:77
bool skip_slow_tests()
Check if slow tests should be skipped.
Definition fixtures.cpp:199
Instruction random_instruction(WireOpCode w_opcode)
Definition fixtures.cpp:125
ContractInstance random_contract_instance()
Definition fixtures.cpp:158
TestTraceContainer empty_trace()
Definition fixtures.cpp:153
std::vector< ScopedL2ToL1Message > random_l2_to_l1_messages(size_t n)
Definition fixtures.cpp:43
std::vector< FF > random_fields(size_t n)
Definition fixtures.cpp:23
std::pair< tracegen::TraceContainer, PublicInputs > get_minimal_trace_with_pi()
Definition fixtures.cpp:182
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13