Skip to content

Commit

Permalink
fcmp++ tests: set up test for prove
Browse files Browse the repository at this point in the history
- Moved functions around in unit_tests/curve_trees.{h,cpp} to ease
using the in-memory Global tree across tests
- Introduced PathV1 struct, which is a path in the tree containing
whole chunks at each layer
- Implemented functions to get_path_at_leaf_idx and get_tree_root
on in-memory Global tree
  • Loading branch information
j-berman committed Oct 14, 2024
1 parent 8c568b6 commit 86b4541
Show file tree
Hide file tree
Showing 5 changed files with 590 additions and 388 deletions.
24 changes: 24 additions & 0 deletions src/fcmp_pp/curve_trees.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ static_assert(sizeof(OutputContext) == (8+32+32), "db expects 72 bytes for outpu

using OutputsByUnlockBlock = std::unordered_map<uint64_t, std::vector<OutputContext>>;

// Ed25519 points (can go from OutputTuple -> LeafTuple)
struct OutputTuple final
{
rct::key O;
rct::key I;
rct::key C;
};

// Struct composed of ec elems needed to get a full-fledged leaf tuple
struct PreLeafTuple final
{
Expand Down Expand Up @@ -320,6 +328,22 @@ const std::size_t SELENE_CHUNK_WIDTH = 18;
std::shared_ptr<CurveTreesV1> curve_trees_v1(
const std::size_t helios_chunk_width = HELIOS_CHUNK_WIDTH,
const std::size_t selene_chunk_width = SELENE_CHUNK_WIDTH);

// A path in the tree containing whole chunks at each layer
// - leaves contain a complete chunk of leaves, encoded as compressed ed25519 points
// - c2_layers[0] refers to the chunk of elems in the tree in the layer after leaves. The hash of the chunk of
// leaves is 1 member of the c2_layers[0] chunk. The rest of c2_layers[0] is the chunk of elems that hash is in.
// - layers alternate between C1 and C2
// - c1_layers[0] refers to the chunk of elems in the tree in the layer after c2_layers[0]. The hash of the chunk
// of c2_layers[0] is 1 member of the c1_layers[0] chunk. The rest of c1_layers[0] is the chunk of elems that hash
// is in.
// - c2_layers[1] refers to the chunk of elems in the tree in the layer after c1_layers[0] etc.
struct PathV1 final
{
std::vector<OutputTuple> leaves;
std::vector<std::vector<Helios::Point>> c1_layers;
std::vector<std::vector<Selene::Point>> c2_layers;
};
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
} //namespace curve_trees
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ set(unit_tests_sources
epee_serialization.cpp
epee_utils.cpp
expect.cpp
fcmp_pp.cpp
json_serialization.cpp
get_xtype_from_string.cpp
hashchain.cpp
Expand Down
Loading

0 comments on commit 86b4541

Please sign in to comment.