barretenberg
Loading...
Searching...
No Matches
inner_proof_data.hpp
1#pragma once
2#include "barretenberg/ecc/curves/bn254/fr.hpp"
3#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
4#include "barretenberg/numeric/uint128/uint128.hpp"
5#include "barretenberg/numeric/uint256/uint256.hpp"
6#include <array>
7
8namespace join_split_example {
9namespace proofs {
10
11namespace InnerProofFields {
12enum {
13 PROOF_ID,
14 NOTE_COMMITMENT1,
15 NOTE_COMMITMENT2,
16 NULLIFIER1,
17 NULLIFIER2,
18 PUBLIC_VALUE,
19 PUBLIC_OWNER,
20 PUBLIC_ASSET_ID,
21 MERKLE_ROOT,
22 TX_FEE,
23 TX_FEE_ASSET_ID,
24 BRIDGE_CALL_DATA,
25 DEFI_DEPOSIT_VALUE,
26 DEFI_ROOT,
27 BACKWARD_LINK,
28 ALLOW_CHAIN,
29 NUM_FIELDS
30};
31} // namespace InnerProofFields
32
33namespace InnerProofOffsets {
34enum {
35 PROOF_ID = InnerProofFields::PROOF_ID * 32,
36 NOTE_COMMITMENT1 = InnerProofFields::NOTE_COMMITMENT1 * 32,
37 NOTE_COMMITMENT2 = InnerProofFields::NOTE_COMMITMENT2 * 32,
38 NULLIFIER1 = InnerProofFields::NULLIFIER1 * 32,
39 NULLIFIER2 = InnerProofFields::NULLIFIER2 * 32,
40 PUBLIC_VALUE = InnerProofFields::PUBLIC_VALUE * 32,
41 PUBLIC_OWNER = InnerProofFields::PUBLIC_OWNER * 32,
42 PUBLIC_ASSET_ID = InnerProofFields::PUBLIC_ASSET_ID * 32,
43 MERKLE_ROOT = InnerProofFields::MERKLE_ROOT * 32,
44 TX_FEE = InnerProofFields::TX_FEE * 32,
45 TX_FEE_ASSET_ID = InnerProofFields::TX_FEE_ASSET_ID * 32,
46 BRIDGE_CALL_DATA = InnerProofFields::BRIDGE_CALL_DATA * 32,
47 DEFI_DEPOSIT_VALUE = InnerProofFields::DEFI_DEPOSIT_VALUE * 32,
48 DEFI_ROOT = InnerProofFields::DEFI_ROOT * 32,
49 BACKWARD_LINK = InnerProofFields::BACKWARD_LINK * 32,
50 ALLOW_CHAIN = InnerProofFields::ALLOW_CHAIN * 32,
51};
52}
53
55 uint256_t proof_id;
56 barretenberg::fr note_commitment1;
57 barretenberg::fr note_commitment2;
58 uint256_t nullifier1;
59 uint256_t nullifier2;
60 uint256_t public_value;
61 barretenberg::fr public_owner;
62 uint256_t asset_id;
63
64 barretenberg::fr merkle_root;
65 uint256_t tx_fee;
66 uint256_t tx_fee_asset_id;
67 uint256_t bridge_call_data;
68 uint256_t defi_deposit_value;
69 barretenberg::fr defi_root;
70
71 barretenberg::fr backward_link;
72 uint256_t allow_chain;
73
74 inner_proof_data(std::vector<uint8_t> const& proof_data);
75};
76
77inline std::ostream& operator<<(std::ostream& os, inner_proof_data const& data)
78{
79 // clang-format off
80 return os << "{\n"
81 << " proof_id: " << data.proof_id << "\n"
82 << " note_commitment1: " << data.note_commitment1 << "\n"
83 << " note_commitment2: " << data.note_commitment2 << "\n"
84 << " nullifier1: " << data.nullifier1 << "\n"
85 << " nullifier2: " << data.nullifier2 << "\n"
86 << " public_value: " << data.public_value << "\n"
87 << " public_owner: " << data.public_owner << "\n"
88 << " asset_id: " << data.asset_id << "\n"
89 << " merkle_root: " << data.merkle_root << "\n"
90 << " tx_fee: " << data.tx_fee << "\n"
91 << " tx_fee_asset_id: " << data.tx_fee_asset_id << "\n"
92 << " bridge_call_data: " << data.bridge_call_data << "\n"
93 << " defi_deposit_value: " << data.defi_deposit_value << "\n"
94 << " defi_root: " << data.defi_root << "\n"
95 << " backward_link: " << data.backward_link << "\n"
96 << " allow_chain: " << data.allow_chain << "\n"
97 << "}";
98 // clang-format on
99}
100
101} // namespace proofs
102} // namespace join_split_example
Definition: uint256.hpp:25
Definition: inner_proof_data.hpp:54