From bab2af0a51a80782a7c633f286a0f0af65ab4356 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 May 2021 13:37:20 -0700 Subject: [PATCH 1/8] Fix test_bcs_transformation segfault --- libiop/tests/bcs/test_bcs_transformation.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libiop/tests/bcs/test_bcs_transformation.cpp b/libiop/tests/bcs/test_bcs_transformation.cpp index 23d6df51..90b46f75 100644 --- a/libiop/tests/bcs/test_bcs_transformation.cpp +++ b/libiop/tests/bcs/test_bcs_transformation.cpp @@ -63,9 +63,11 @@ bcs_transformation_parameters get_bcs_parameters(bool alge if (algebraic_hashchain) { bcs_parameters.hashchain_ = std::make_shared>(); + bcs_parameters.hash_enum = bcs_hash_type::high_alpha_poseidon_type; } else { bcs_parameters.hashchain_ = std::make_shared>(security_parameter); + bcs_parameters.hash_enum = bcs_hash_type::blake2b_type; } set_bcs_parameters_leafhash(bcs_parameters); From d45fb71742c843c6fef20a9c7fa1157ec37dcd3c Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 May 2021 13:58:16 -0700 Subject: [PATCH 2/8] try 1 --- depends/libff | 2 +- depends/libfqfft | 2 +- libiop/bcs/pow.tcc | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/depends/libff b/depends/libff index accdf9e7..04094606 160000 --- a/depends/libff +++ b/depends/libff @@ -1 +1 @@ -Subproject commit accdf9e761979ac8c95dced219cac0b4ad4a4799 +Subproject commit 04094606d6e90f4d6a2d6a9d32a3a5a660b67bd4 diff --git a/depends/libfqfft b/depends/libfqfft index 7d460caa..415d38df 160000 --- a/depends/libfqfft +++ b/depends/libfqfft @@ -1 +1 @@ -Subproject commit 7d460caa27b87574fe0e8144e6a3a66b7bcfe770 +Subproject commit 415d38df733b264d1ada69e1f6edc2f809c9b502 diff --git a/libiop/bcs/pow.tcc b/libiop/bcs/pow.tcc index 978c9614..e912ca75 100644 --- a/libiop/bcs/pow.tcc +++ b/libiop/bcs/pow.tcc @@ -95,6 +95,7 @@ hash_digest_type pow::solve_pow_internal( size_t pow_int = 0; while (this->verify_pow(node_hasher, challenge, pow) == false) { + printf("Trying %zx\n", pow[(num_words - 1)*sizeof(size_t)]); std::memcpy(&pow[(num_words - 1)*sizeof(size_t)], &pow_int, sizeof(size_t)); pow_int += 1; } From 2459ea2f6fb050cf46229c4cd43330976dbd7fb1 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 May 2021 14:01:42 -0700 Subject: [PATCH 3/8] try 2 --- libiop/tests/bcs/test_bcs_transformation.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libiop/tests/bcs/test_bcs_transformation.cpp b/libiop/tests/bcs/test_bcs_transformation.cpp index 90b46f75..dc48478f 100644 --- a/libiop/tests/bcs/test_bcs_transformation.cpp +++ b/libiop/tests/bcs/test_bcs_transformation.cpp @@ -70,6 +70,8 @@ bcs_transformation_parameters get_bcs_parameters(bool alge bcs_parameters.hash_enum = bcs_hash_type::blake2b_type; } set_bcs_parameters_leafhash(bcs_parameters); + bcs_parameters.pow_params_.cost_per_hash_ = 1; + bcs_parameters.pow_params_.work_parameter_ = 2; return bcs_parameters; } From f4b524de522df0dc51ee7bb427a3de9cdb306609 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 May 2021 14:04:07 -0700 Subject: [PATCH 4/8] Try #2 --- libiop/tests/bcs/test_bcs_transformation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libiop/tests/bcs/test_bcs_transformation.cpp b/libiop/tests/bcs/test_bcs_transformation.cpp index dc48478f..882db85c 100644 --- a/libiop/tests/bcs/test_bcs_transformation.cpp +++ b/libiop/tests/bcs/test_bcs_transformation.cpp @@ -69,9 +69,9 @@ bcs_transformation_parameters get_bcs_parameters(bool alge std::make_shared>(security_parameter); bcs_parameters.hash_enum = bcs_hash_type::blake2b_type; } - set_bcs_parameters_leafhash(bcs_parameters); - bcs_parameters.pow_params_.cost_per_hash_ = 1; - bcs_parameters.pow_params_.work_parameter_ = 2; + set_bcs_parameters_leafhash(bcs_parameters); // Work per hash. Todo generalize this w/ proper explanations of work amounts + const size_t work_per_hash = (bcs_parameters.hash_enum == 1) ? 1 : 128; + params.pow_params_ = pow_parameters(4, work_per_hash); return bcs_parameters; } From cc17e69ca22c6fd85fe3eb7f973085fbd8730b43 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 May 2021 14:04:40 -0700 Subject: [PATCH 5/8] try #4 --- libiop/tests/bcs/test_bcs_transformation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libiop/tests/bcs/test_bcs_transformation.cpp b/libiop/tests/bcs/test_bcs_transformation.cpp index 882db85c..20b28d71 100644 --- a/libiop/tests/bcs/test_bcs_transformation.cpp +++ b/libiop/tests/bcs/test_bcs_transformation.cpp @@ -71,7 +71,7 @@ bcs_transformation_parameters get_bcs_parameters(bool alge } set_bcs_parameters_leafhash(bcs_parameters); // Work per hash. Todo generalize this w/ proper explanations of work amounts const size_t work_per_hash = (bcs_parameters.hash_enum == 1) ? 1 : 128; - params.pow_params_ = pow_parameters(4, work_per_hash); + bcs_parameters.pow_params_ = pow_parameters(4, work_per_hash); return bcs_parameters; } From 8ca778ad5fc1d4ab2047eff7995fbd228c610b85 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 May 2021 14:06:45 -0700 Subject: [PATCH 6/8] Fix test_bcs_protocol_pow initialization --- libiop/bcs/pow.tcc | 1 - 1 file changed, 1 deletion(-) diff --git a/libiop/bcs/pow.tcc b/libiop/bcs/pow.tcc index e912ca75..978c9614 100644 --- a/libiop/bcs/pow.tcc +++ b/libiop/bcs/pow.tcc @@ -95,7 +95,6 @@ hash_digest_type pow::solve_pow_internal( size_t pow_int = 0; while (this->verify_pow(node_hasher, challenge, pow) == false) { - printf("Trying %zx\n", pow[(num_words - 1)*sizeof(size_t)]); std::memcpy(&pow[(num_words - 1)*sizeof(size_t)], &pow_int, sizeof(size_t)); pow_int += 1; } From ebe9b35b49a390afd6d1ac2dc93071b65b23ccd6 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Thu, 6 May 2021 11:58:41 -0700 Subject: [PATCH 7/8] Try printing this --- libiop/bcs/hashing/blake2b.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libiop/bcs/hashing/blake2b.cpp b/libiop/bcs/hashing/blake2b.cpp index ff980b6b..a91db942 100644 --- a/libiop/bcs/hashing/blake2b.cpp +++ b/libiop/bcs/hashing/blake2b.cpp @@ -29,6 +29,7 @@ binary_hash_digest blake2b_two_to_one_hash(const binary_hash_digest &first, const binary_hash_digest &second, const std::size_t digest_len_bytes) { + printf("%s, %s\n", first, second); const binary_hash_digest first_plus_second = first + second; binary_hash_digest result(digest_len_bytes, 'X'); From b2850d8257713d03a8f78ce2ce117d605a96e7fb Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Thu, 6 May 2021 12:00:19 -0700 Subject: [PATCH 8/8] use .c_str() --- libiop/bcs/hashing/blake2b.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libiop/bcs/hashing/blake2b.cpp b/libiop/bcs/hashing/blake2b.cpp index a91db942..fc838c1c 100644 --- a/libiop/bcs/hashing/blake2b.cpp +++ b/libiop/bcs/hashing/blake2b.cpp @@ -29,7 +29,7 @@ binary_hash_digest blake2b_two_to_one_hash(const binary_hash_digest &first, const binary_hash_digest &second, const std::size_t digest_len_bytes) { - printf("%s, %s\n", first, second); + printf("%s, %s\n", first.c_str(), second.c_str()); const binary_hash_digest first_plus_second = first + second; binary_hash_digest result(digest_len_bytes, 'X');