Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1#pragma once
6
7#include <cstdlib>
8#include <functional>
9
10using namespace bb::avm2;
11using EthAddress = FF;
13
14const FF CHAIN_ID = 1;
15const FF VERSION = 1;
16const uint32_t BLOCK_NUMBER = 1;
17const FF SLOT_NUMBER = 1;
18const uint64_t TIMESTAMP = 1000000;
23const std::string TRANSACTION_HASH = "0xdeadbeef";
25const FF FIRST_NULLIFIER = FF("0x00000000000000000000000000000000000000000000000000000000deadbeef");
29const std::vector<FF> REVERTIBLE_ACCUMULATED_DATA_NULLIFIERS = {};
30const std::vector<FF> REVERTIBLE_ACCUMULATED_DATA_NOTE_HASHES = {};
33const FF MSG_SENDER = 100;
35const Gas GAS_USED_BY_PRIVATE = Gas{ .l2_gas = 0, .da_gas = 0 };
39const bool IS_STATIC_CALL = false;
40const Gas GAS_LIMIT = Gas{ .l2_gas = 1000000, .da_gas = 1000000 };
41// Fuzzer-specific logging macro (similar to vinfo but uses AVM_FUZZER_LOGGING env var)
42// Uses lazy evaluation to avoid string formatting overhead when logging is disabled
43inline void fuzz_info_(std::function<std::string()> func)
44{
45 static const bool enabled = std::getenv("AVM_FUZZER_LOGGING") != nullptr;
46 if (enabled) {
47 info(func());
48 }
49}
50
51#define fuzz_info(...) fuzz_info_([&]() { return format(__VA_ARGS__); })
52
53// =========== Pre defined functions ===========
54// SET[0] = 1, SET[1] = 1, ADD[0, 1, 2]
55const std::vector<uint8_t> ADD_8_BYTECODE = { 39, 0, 0, 2, 1, 39, 0, 1, 2, 1, 0, 0, 0, 1,
56 2, 40, 0, 0, 5, 4, 0, 1, 59, 0, 0, 5, 0, 2 };
57
58// SET[0] = 0, DIV[0, 0]
59const std::vector<uint8_t> ZERO_DIVISION_BYTECODE = { 39, 0, 0, 2, 0, 6, 0, 0, 0, 2, 40, 0,
60 0, 5, 4, 0, 1, 59, 0, 0, 5, 0, 0 };
61
62// SSTORE[10] = 200
63const std::vector<uint8_t> SSTORE_BYTECODE = { 39, 0, 10, 0, 200, 44, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
65 48, 0, 0, 10, 0, 10, 40, 0, 0, 5, 4, 0, 1, 59, 0, 0, 5, 0, 10 };
66
const std::optional< PublicCallRequestWithCalldata > TEARDOWN_ENQUEUED_CALLS
Definition constants.hpp:34
void fuzz_info_(std::function< std::string()> func)
Definition constants.hpp:43
const std::vector< ScopedL2ToL1Message > NON_REVERTIBLE_ACCUMULATED_DATA_L2_TO_L1_MESSAGES
Definition constants.hpp:28
const uint32_t BLOCK_NUMBER
Definition constants.hpp:16
const std::vector< FF > NON_REVERTIBLE_ACCUMULATED_DATA_NULLIFIERS
Definition constants.hpp:26
const AztecAddress FEE_RECIPIENT
Definition constants.hpp:20
const Gas GAS_LIMIT
Definition constants.hpp:40
const std::vector< FF > NON_REVERTIBLE_ACCUMULATED_DATA_NOTE_HASHES
Definition constants.hpp:27
constexpr GasFees EFFECTIVE_GAS_FEES
Definition constants.hpp:24
const std::vector< uint8_t > ZERO_DIVISION_BYTECODE
Definition constants.hpp:59
const FF FIRST_NULLIFIER
Definition constants.hpp:25
const AztecAddress FEE_PAYER
Definition constants.hpp:36
const std::vector< uint8_t > ADD_8_BYTECODE
Definition constants.hpp:55
const std::vector< PublicCallRequestWithCalldata > SETUP_ENQUEUED_CALLS
Definition constants.hpp:32
const std::vector< uint8_t > SSTORE_BYTECODE
Definition constants.hpp:63
const std::vector< std::vector< uint8_t > > PREDEFINED_FUNCTIONS
Definition constants.hpp:67
const FF TRANSACTION_FEE
Definition constants.hpp:38
const EthAddress COINBASE
Definition constants.hpp:19
const FF MSG_SENDER
Definition constants.hpp:33
const FF SLOT_NUMBER
Definition constants.hpp:17
const std::string TRANSACTION_HASH
Definition constants.hpp:23
const FF CHAIN_ID
Definition constants.hpp:14
constexpr uint128_t FEE_PER_DA_GAS
Definition constants.hpp:21
const std::vector< ScopedL2ToL1Message > REVERTIBLE_ACCUMULATED_DATA_L2_TO_L1_MESSAGES
Definition constants.hpp:31
const Gas GAS_USED_BY_PRIVATE
Definition constants.hpp:35
const std::vector< FF > REVERTIBLE_ACCUMULATED_DATA_NOTE_HASHES
Definition constants.hpp:30
const FF CONTRACT_ADDRESS
Definition constants.hpp:37
const std::vector< FF > REVERTIBLE_ACCUMULATED_DATA_NULLIFIERS
Definition constants.hpp:29
const FF VERSION
Definition constants.hpp:15
const bool IS_STATIC_CALL
Definition constants.hpp:39
const uint64_t TIMESTAMP
Definition constants.hpp:18
constexpr uint128_t FEE_PER_L2_GAS
Definition constants.hpp:22
void info(Args... args)
Definition log.hpp:89
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
unsigned __int128 uint128_t
Definition serialize.hpp:44
uint128_t fee_per_da_gas