Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
aztec_hash_policy.hpp
Go to the documentation of this file.
1#pragma once
2
6
7namespace bb::aztec {
8
19template <uint64_t Separator> struct AztecMerkleHashPolicyT : public crypto::merkle_tree::Poseidon2HashPolicy {
20 static bb::fr hash_pair(const bb::fr& lhs, const bb::fr& rhs)
21 {
22 return Poseidon2HashPolicy::hash_pair_with_separator(Separator, lhs, rhs);
23 }
24};
25
26// Per-tree instantiations for the 4 indexed trees.
31
32// Default policy, shared by the 3 append-only trees (note-hash, L1->L2, archive).
34
35// Leaf-type -> hash policy trait. Lets generic world-state template code pick the right per-tree
36// policy without hard-coding HashPolicy at every instantiation.
37template <typename Leaf> struct MerkleHashPolicyFor;
38template <> struct MerkleHashPolicyFor<crypto::merkle_tree::NullifierLeafValue> {
40};
41template <> struct MerkleHashPolicyFor<crypto::merkle_tree::PublicDataLeafValue> {
43};
44// Append-only tree leaves are bare fr (hash directly stored); they use the baseline policy.
45template <> struct MerkleHashPolicyFor<bb::fr> {
47};
48
49template <typename Leaf> using MerkleHashPolicyForT = typename MerkleHashPolicyFor<Leaf>::type;
50
51} // namespace bb::aztec
AztecMerkleHashPolicyT< DOM_SEP__MERKLE_HASH > AztecMerkleHashPolicy
AztecMerkleHashPolicyT< DOM_SEP__NULLIFIER_MERKLE > NullifierMerkleHashPolicy
typename MerkleHashPolicyFor< Leaf >::type MerkleHashPolicyForT
AztecMerkleHashPolicyT< DOM_SEP__PUBLIC_DATA_MERKLE > PublicDataMerkleHashPolicy
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
Aztec-specific hash policy for Merkle trees, parameterised by a tree-specific domain separator for in...
static bb::fr hash_pair(const bb::fr &lhs, const bb::fr &rhs)