Clearmatics Libsnark
0.1
C++ library for zkSNARK proofs
libsnark
relations
ram_computations
memory
delegated_ra_memory.hpp
Go to the documentation of this file.
1
12
#ifndef DELEGATED_RA_MEMORY_HPP_
13
#define DELEGATED_RA_MEMORY_HPP_
14
15
#include <
libsnark/common/data_structures/merkle_tree.hpp
>
16
#include <
libsnark/relations/ram_computations/memory/memory_interface.hpp
>
17
#include <map>
18
#include <memory>
19
#include <vector>
20
21
namespace
libsnark
22
{
23
24
template
<
typename
HashT>
class
delegated_ra_memory
:
public
memory_interface
25
{
26
private
:
27
libff::bit_vector int_to_tree_elem(
const
size_t
i)
const
;
28
size_t
int_from_tree_elem(
const
libff::bit_vector &v)
const
;
29
30
std::unique_ptr<merkle_tree<HashT>> contents;
31
32
public
:
33
delegated_ra_memory
(
const
size_t
num_addresses
,
const
size_t
value_size
);
34
delegated_ra_memory
(
35
const
size_t
num_addresses
,
36
const
size_t
value_size
,
37
const
std::vector<size_t> &contents_as_vector);
38
delegated_ra_memory
(
39
const
size_t
num_addresses
,
40
const
size_t
value_size
,
41
const
memory_contents
&contents_as_map);
42
43
size_t
get_value
(
const
size_t
address)
const
;
44
void
set_value
(
const
size_t
address,
const
size_t
value);
45
46
typename
HashT::hash_value_type
get_root
()
const
;
47
typename
HashT::merkle_authentication_path_type
get_path
(
48
const
size_t
address)
const
;
49
50
void
dump
()
const
;
51
};
52
53
}
// namespace libsnark
54
55
#include <
libsnark/relations/ram_computations/memory/delegated_ra_memory.tcc
>
56
57
#endif // DELEGATED_RA_MEMORY_HPP_
libsnark::delegated_ra_memory::get_value
size_t get_value(const size_t address) const
libsnark::delegated_ra_memory::set_value
void set_value(const size_t address, const size_t value)
delegated_ra_memory.tcc
libsnark
Definition:
accumulation_vector.hpp:18
libsnark::delegated_ra_memory::get_root
HashT::hash_value_type get_root() const
libsnark::memory_interface::value_size
size_t value_size
Definition:
memory_interface.hpp:41
libsnark::memory_contents
std::map< size_t, size_t > memory_contents
Definition:
memory_interface.hpp:25
libsnark::memory_interface::num_addresses
size_t num_addresses
Definition:
memory_interface.hpp:40
merkle_tree.hpp
libsnark::delegated_ra_memory::delegated_ra_memory
delegated_ra_memory(const size_t num_addresses, const size_t value_size)
libsnark::memory_interface
Definition:
memory_interface.hpp:37
libsnark::delegated_ra_memory::dump
void dump() const
libsnark::delegated_ra_memory
Definition:
delegated_ra_memory.hpp:24
memory_interface.hpp
libsnark::delegated_ra_memory::get_path
HashT::merkle_authentication_path_type get_path(const size_t address) const
Generated on Wed Jan 25 2023 11:05:58 for Clearmatics Libsnark by
1.8.17