Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
aztec_types.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5
8
9namespace bb::avm2 {
10
13using PC = uint32_t;
15// In typescript the EthAddress is a byte vector, but in our circuit implementation
16// it's represented as a field element for simplicity
17using EthAddress = FF;
18
33
34using InternalCallId = uint32_t;
35
55
57 DEPLOYER = 0,
58 CLASS_ID = 1,
59 INIT_HASH = 2,
60 MAX = INIT_HASH,
61};
62
64// Keys, Instances, Classes
66
81
92
99
101// Size Effect Types
103
112
121
122struct PublicLog {
124 std::array<FF, PUBLIC_LOG_SIZE_IN_FIELDS> fields;
126
127 bool operator==(const PublicLog& other) const = default;
128
130};
131
135
136 bool operator==(const PublicDataWrite& other) const = default;
137
139};
140
142// Gas Types
144
153
154struct Gas {
155 uint32_t l2Gas;
156 uint32_t daGas;
157
158 bool operator==(const Gas& other) const = default;
159
160 Gas operator+(const Gas& other) const { return { l2Gas + other.l2Gas, daGas + other.daGas }; }
161 Gas operator-(const Gas& other) const { return { l2Gas - other.l2Gas, daGas - other.daGas }; }
162
164};
165
176
178// Public Call Requests
180
191
201
213
215// Accumulated Data Types
217
227
229 std::array<FF, MAX_NOTE_HASHES_PER_TX> noteHashes;
230 std::array<FF, MAX_NULLIFIERS_PER_TX> nullifiers;
232
233 bool operator==(const PrivateToAvmAccumulatedData& other) const = default;
234
236};
237
249
251// Global Variables
253
268
270// Tree Snapshots
272
276
278 bool operator==(const AppendOnlyTreeSnapshot& other) const = default;
279 friend std::ostream& operator<<(std::ostream& os, const AppendOnlyTreeSnapshot& obj)
280 {
281 os << "root: " << obj.root << ", nextAvailableLeafIndex: " << obj.nextAvailableLeafIndex;
282 return os;
283 }
284
286};
287
298
299struct TreeState {
301 uint32_t counter;
302
303 bool operator==(const TreeState& other) const = default;
304};
305
314
318
319 bool operator==(const SideEffectStates& other) const = default;
320};
321
322} // namespace bb::avm2
group_elements::affine_element< Fq, Fr, Params > affine_element
Definition group.hpp:42
uint32_t PC
@ NR_NOTE_INSERTION
@ R_NULLIFIER_INSERTION
@ NR_L2_TO_L1_MESSAGE
@ R_L2_TO_L1_MESSAGE
@ NR_NULLIFIER_INSERTION
FF ContractClassId
uint32_t InternalCallId
AvmFlavorSettings::FF FF
Definition field.hpp:10
size_t hash_as_tuple(const Ts &... ts)
Definition utils.hpp:22
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
unsigned __int128 uint128_t
Definition serialize.hpp:44
MSGPACK_FIELDS(root, nextAvailableLeafIndex)
bool operator==(const AppendOnlyTreeSnapshot &other) const =default
std::size_t hash() const noexcept
friend std::ostream & operator<<(std::ostream &os, const AppendOnlyTreeSnapshot &obj)
MSGPACK_FIELDS(noteHashes, nullifiers, l2ToL1Msgs, publicLogs, publicDataWrites)
bool operator==(const AvmAccumulatedDataArrayLengths &other) const =default
std::array< PublicLog, MAX_PUBLIC_LOGS_PER_TX > publicLogs
std::array< FF, MAX_NULLIFIERS_PER_TX > nullifiers
std::array< PublicDataWrite, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX > publicDataWrites
std::array< ScopedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_TX > l2ToL1Msgs
std::array< FF, MAX_NOTE_HASHES_PER_TX > noteHashes
MSGPACK_FIELDS(noteHashes, nullifiers, l2ToL1Msgs, publicLogs, publicDataWrites)
bool operator==(const AvmAccumulatedData &other) const =default
std::vector< uint8_t > packed_bytecode
bool operator==(const ContractInstance &other) const =default
ContractClassId original_class_id
ContractClassId current_class_id
bool operator==(const GasFees &other) const =default
MSGPACK_FIELDS(feePerDaGas, feePerL2Gas)
MSGPACK_FIELDS(l2Gas, daGas)
Gas operator+(const Gas &other) const
Gas operator-(const Gas &other) const
bool operator==(const Gas &other) const =default
MSGPACK_FIELDS(gasLimits, teardownGasLimits, maxFeesPerGas, maxPriorityFeesPerGas)
bool operator==(const GasSettings &other) const =default
MSGPACK_FIELDS(chainId, version, blockNumber, slotNumber, timestamp, coinbase, feeRecipient, gasFees)
bool operator==(const GlobalVariables &other) const =default
MSGPACK_FIELDS(recipient, content)
bool operator==(const L2ToL1Message &other) const =default
bool operator==(const PrivateToAvmAccumulatedDataArrayLengths &other) const =default
MSGPACK_FIELDS(noteHashes, nullifiers, l2ToL1Msgs)
MSGPACK_FIELDS(noteHashes, nullifiers, l2ToL1Msgs)
std::array< ScopedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_TX > l2ToL1Msgs
std::array< FF, MAX_NULLIFIERS_PER_TX > nullifiers
bool operator==(const PrivateToAvmAccumulatedData &other) const =default
std::array< FF, MAX_NOTE_HASHES_PER_TX > noteHashes
MSGPACK_FIELDS(setupCalls, appLogicCalls, teardownCall)
bool operator==(const PublicCallRequestArrayLengths &other) const =default
bool operator==(const PublicCallRequest &other) const =default
MSGPACK_FIELDS(msgSender, contractAddress, isStaticCall, calldataHash)
bool operator==(const PublicDataWrite &other) const =default
MSGPACK_FIELDS(leafSlot, value)
AffinePoint nullifier_key
AffinePoint tagging_key
AffinePoint incoming_viewing_key
bool operator==(const PublicKeys &other) const =default
AffinePoint outgoing_viewing_key
std::vector< FF > to_fields() const
AztecAddress contractAddress
bool operator==(const PublicLog &other) const =default
MSGPACK_FIELDS(contractAddress, fields, emittedLength)
std::array< FF, PUBLIC_LOG_SIZE_IN_FIELDS > fields
bool operator==(const ScopedL2ToL1Message &other) const =default
MSGPACK_FIELDS(message, contractAddress)
bool operator==(const SideEffectStates &other) const =default
bool operator==(const TreeSnapshots &other) const =default
MSGPACK_FIELDS(l1ToL2MessageTree, noteHashTree, nullifierTree, publicDataTree)
AppendOnlyTreeSnapshot noteHashTree
AppendOnlyTreeSnapshot nullifierTree
AppendOnlyTreeSnapshot l1ToL2MessageTree
AppendOnlyTreeSnapshot publicDataTree
bool operator==(const TreeState &other) const =default
AppendOnlyTreeSnapshot tree
bool operator==(const TreeStates &other) const =default