start LMDB grow_tree

This commit is contained in:
j-berman 2024-05-23 23:56:23 -07:00
parent e68ea2e054
commit af9b74fcc7
10 changed files with 217 additions and 29 deletions

View file

@ -521,7 +521,7 @@ void CurveTreesUnitTest::log_tree(const CurveTreesUnitTest::Tree &tree)
//----------------------------------------------------------------------------------------------------------------------
// Test helpers
//----------------------------------------------------------------------------------------------------------------------
static const std::vector<CurveTreesV1::LeafTuple> generate_random_leaves(const CurveTreesV1 &curve_trees,
const std::vector<CurveTreesV1::LeafTuple> generate_random_leaves(const CurveTreesV1 &curve_trees,
const std::size_t num_leaves)
{
std::vector<CurveTreesV1::LeafTuple> tuples;
@ -653,25 +653,10 @@ static void grow_tree_test(Helios &helios,
//----------------------------------------------------------------------------------------------------------------------
TEST(curve_trees, grow_tree)
{
// TODO: use static constant generators and hash init points
const std::size_t HELIOS_GENERATORS_LEN = 128;
const std::size_t SELENE_GENERATORS_LEN = 256;
// https://github.com/kayabaNerve/fcmp-plus-plus/blob
// /b2742e86f3d18155fd34dd1ed69cb8f79b900fce/crypto/fcmps/src/tests.rs#L81-L82
const std::size_t HELIOS_CHUNK_WIDTH = 38;
const std::size_t SELENE_CHUNK_WIDTH = 18;
CHECK_AND_ASSERT_THROW_MES(HELIOS_GENERATORS_LEN >= HELIOS_CHUNK_WIDTH, "helios generators < chunk width");
CHECK_AND_ASSERT_THROW_MES(SELENE_GENERATORS_LEN >= (SELENE_CHUNK_WIDTH * CurveTreesV1::LEAF_TUPLE_SIZE),
"selene generators < max chunk width");
const Helios::Generators HELIOS_GENERATORS = fcmp::tower_cycle::random_helios_generators(HELIOS_GENERATORS_LEN);
const Selene::Generators SELENE_GENERATORS = fcmp::tower_cycle::random_selene_generators(SELENE_GENERATORS_LEN);
const Helios::Point HELIOS_HASH_INIT_POINT = fcmp::tower_cycle::random_helios_hash_init_point();
const Selene::Point SELENE_HASH_INIT_POINT = fcmp::tower_cycle::random_selene_hash_init_point();
Helios helios(HELIOS_GENERATORS, HELIOS_HASH_INIT_POINT);
Selene selene(SELENE_GENERATORS, SELENE_HASH_INIT_POINT);