We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OKVS中实现的编码和解码逻辑应该是:Key*P=Value,P理论上应该是一个随机数组,但是我在实际测试时发现P中明显存在value数据,请问这本来就这么设计吗?还是我哪里设置有问题?
bazel run //psi/psi/core/vole_psi/okvs:baxos_test //paxos_test同样存在该问题。 ` namespace psi::psi::okvs {
class BaxosTest : public testing::TestWithParamstd::size_t {};
TEST_P(BaxosTest, WORKS) { size_t items_num = GetParam(); size_t bin_size = items_num / 4; size_t weight = 3; // statistical security parameter size_t ssp = 40;
Baxos baxos; yacl::crypto::Prg<uint128_t> prng(yacl::crypto::RandU128());
uint128_t seed; prng.Fill(absl::MakeSpan(&seed, 1));
SPDLOG_INFO("items_num:{}, bin_size:{}", items_num, bin_size);
baxos.Init(items_num, bin_size, weight, ssp, PaxosParam::DenseType::GF128, seed);
SPDLOG_INFO("baxos.size(): {}", baxos.size());
std::vector<uint128_t> items(items_num); std::vector<uint128_t> values(items_num); std::vector<uint128_t> values2(items_num); std::vector<uint128_t> p(baxos.size());
prng.Fill(absl::MakeSpan(items.data(), items.size())); prng.Fill(absl::MakeSpan(values.data(), values.size()));
auto start = std::chrono::high_resolution_clock::now(); baxos.Solve(absl::MakeSpan(items), absl::MakeSpan(values), absl::MakeSpan(p)); auto end = std::chrono::high_resolution_clock::now(); std::cout << "baxos.Solve size" << p.size(); std::chrono::duration<double, std::milli> elapsed = end - start; std::cout << "baxos.Solve took " << elapsed.count() << " milliseconds.\n";
for (const auto& innerVec : p) { // for (const auto& element : innerVec) { std::cout << innerVec << " "; // } std::cout << std::endl; }
for (const auto& innerVec : values) { // for (const auto& element : innerVec) { std::cout << innerVec << " "; // } std::cout << std::endl; } size_t k = 0; for (size_t i = 0; i < values.size(); i++) { for (size_t j = 0; j < p.size(); j++) { if (p[j] == values[i]) { // std::cout << "valuesp:" << i << std::endl; k++; } } } std::cout << "count: " << k << std::endl; start = std::chrono::high_resolution_clock::now(); baxos.Decode(absl::MakeSpan(items), absl::MakeSpan(values2), absl::MakeSpan(p)); end = std::chrono::high_resolution_clock::now(); elapsed = end - start; std::cout << "baxos.Decode took " << elapsed.count() << " milliseconds.\n";
if (std::memcmp(values2.data(), values.data(), values.size() * sizeof(uint128_t)) != 0) { for (uint64_t i = 0; i < items_num; ++i) { EXPECT_EQ(std::memcmp(&values[i], &values2[i], sizeof(uint128_t)), 0); } } }
INSTANTIATE_TEST_SUITE_P(Works_Instances, BaxosTest, testing::Values(15));
} // namespace psi::psi::okvs `
结果: ` Running main() from gmock_main.cc [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from Works_Instances/BaxosTest [ RUN ] Works_Instances/BaxosTest.WORKS/0 [2024-07-05 03:27:56.630] [info] [baxos_test.cc:43] items_num:15, bin_size:3 [2024-07-05 03:27:56.631] [info] [baxos_test.cc:48] baxos.size(): 265 baxos.Solve size265baxos.Solve took 0.084167 milliseconds. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30249581019136461799913703116248529260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 264482226524464365223049826774360018070 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 297070843746093303118528725100684470190 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 319914869819946649309955289809349906505 0 0 326329356209774252584499154986720639053 0 0 0 0 0 0 94857184957107499938021084602682390890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 282432622376067604239800030988424235940 0 0 0 0 0 0 0 0 0 0 60542127553454401102716789245072047140 75377835026112524672441006935454381434 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 36933043176152668205754522843720319017 0 42139514444490055029471643400844337786 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 328152844493251641623901453218272922896 0 0 0 0 0 0 0 0 0 0 0 194629314372862775373800636331631656676 0 0 0 239385172818071565953594850162918447632 0 0 38640883360020630412977397758636309358 0 0 0 0 0 0 0 0 0 0 0 38640883360020630412977397758636309358 194629314372862775373800636331631656676 57143744327010333286401672076945547235 6884410884816999675291523560055973892 297070843746093303118528725100684470190 30249581019136461799913703116248529260 94857184957107499938021084602682390890 282432622376067604239800030988424235940 60542127553454401102716789245072047140 42139514444490055029471643400844337786 75377835026112524672441006935454381434 88767996193783301854506181464606643968 264482226524464365223049826774360018070 36933043176152668205754522843720319017 239385172818071565953594850162918447632 count: 12 baxos.Decode took 0.059291 milliseconds. [ OK ] Works_Instances/BaxosTest.WORKS/0 (1 ms) [----------] 1 test from Works_Instances/BaxosTest (1 ms total)
[----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (1 ms total) [ PASSED ] 1 test. `
OKVS生成的P不显示原本value。
0.4.0
mac
16c16G
The text was updated successfully, but these errors were encountered:
@Yinbenxin 感谢反馈,我们将尽快确认你提出的问题并给出回复。
Sorry, something went wrong.
@Yinbenxin
bazel run//psi/psi/core/vole_psi/okvs.baxos_test
RandU128
yacl:crypto::Prg<uint128_t> prng(yacl::crypto::FastRandU128()));
P
Item
qxzhou1010
6fj
No branches or pull requests
Describe the bug
OKVS中实现的编码和解码逻辑应该是:Key*P=Value,P理论上应该是一个随机数组,但是我在实际测试时发现P中明显存在value数据,请问这本来就这么设计吗?还是我哪里设置有问题?
Steps To Reproduce
bazel run //psi/psi/core/vole_psi/okvs:baxos_test
//paxos_test同样存在该问题。
`
namespace psi::psi::okvs {
class BaxosTest : public testing::TestWithParamstd::size_t {};
TEST_P(BaxosTest, WORKS) {
size_t items_num = GetParam();
size_t bin_size = items_num / 4;
size_t weight = 3;
// statistical security parameter
size_t ssp = 40;
Baxos baxos;
yacl::crypto::Prg<uint128_t> prng(yacl::crypto::RandU128());
uint128_t seed;
prng.Fill(absl::MakeSpan(&seed, 1));
SPDLOG_INFO("items_num:{}, bin_size:{}", items_num, bin_size);
baxos.Init(items_num, bin_size, weight, ssp, PaxosParam::DenseType::GF128,
seed);
SPDLOG_INFO("baxos.size(): {}", baxos.size());
std::vector<uint128_t> items(items_num);
std::vector<uint128_t> values(items_num);
std::vector<uint128_t> values2(items_num);
std::vector<uint128_t> p(baxos.size());
prng.Fill(absl::MakeSpan(items.data(), items.size()));
prng.Fill(absl::MakeSpan(values.data(), values.size()));
auto start = std::chrono::high_resolution_clock::now();
baxos.Solve(absl::MakeSpan(items), absl::MakeSpan(values), absl::MakeSpan(p));
auto end = std::chrono::high_resolution_clock::now();
std::cout << "baxos.Solve size" << p.size();
std::chrono::duration<double, std::milli> elapsed = end - start;
std::cout << "baxos.Solve took " << elapsed.count() << " milliseconds.\n";
for (const auto& innerVec : p) {
// for (const auto& element : innerVec) {
std::cout << innerVec << " ";
// }
std::cout << std::endl;
}
for (const auto& innerVec : values) {
// for (const auto& element : innerVec) {
std::cout << innerVec << " ";
// }
std::cout << std::endl;
}
size_t k = 0;
for (size_t i = 0; i < values.size(); i++) {
for (size_t j = 0; j < p.size(); j++) {
if (p[j] == values[i]) {
// std::cout << "valuesp:" << i << std::endl;
k++;
}
}
}
std::cout << "count: " << k << std::endl;
start = std::chrono::high_resolution_clock::now();
baxos.Decode(absl::MakeSpan(items), absl::MakeSpan(values2),
absl::MakeSpan(p));
end = std::chrono::high_resolution_clock::now();
elapsed = end - start;
std::cout << "baxos.Decode took " << elapsed.count() << " milliseconds.\n";
if (std::memcmp(values2.data(), values.data(),
values.size() * sizeof(uint128_t)) != 0) {
for (uint64_t i = 0; i < items_num; ++i) {
EXPECT_EQ(std::memcmp(&values[i], &values2[i], sizeof(uint128_t)), 0);
}
}
}
INSTANTIATE_TEST_SUITE_P(Works_Instances, BaxosTest, testing::Values(15));
} // namespace psi::psi::okvs
`
结果:
`
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Works_Instances/BaxosTest
[ RUN ] Works_Instances/BaxosTest.WORKS/0
[2024-07-05 03:27:56.630] [info] [baxos_test.cc:43] items_num:15, bin_size:3
[2024-07-05 03:27:56.631] [info] [baxos_test.cc:48] baxos.size(): 265
baxos.Solve size265baxos.Solve took 0.084167 milliseconds.
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
30249581019136461799913703116248529260
0
0
0
0
0
0
0
0
0
0
0
0
0
0
264482226524464365223049826774360018070
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
297070843746093303118528725100684470190
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
319914869819946649309955289809349906505
0
0
326329356209774252584499154986720639053
0
0
0
0
0
0
94857184957107499938021084602682390890
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
282432622376067604239800030988424235940
0
0
0
0
0
0
0
0
0
0
60542127553454401102716789245072047140
75377835026112524672441006935454381434
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
36933043176152668205754522843720319017
0
42139514444490055029471643400844337786
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
328152844493251641623901453218272922896
0
0
0
0
0
0
0
0
0
0
0
194629314372862775373800636331631656676
0
0
0
239385172818071565953594850162918447632
0
0
38640883360020630412977397758636309358
0
0
0
0
0
0
0
0
0
0
0
38640883360020630412977397758636309358
194629314372862775373800636331631656676
57143744327010333286401672076945547235
6884410884816999675291523560055973892
297070843746093303118528725100684470190
30249581019136461799913703116248529260
94857184957107499938021084602682390890
282432622376067604239800030988424235940
60542127553454401102716789245072047140
42139514444490055029471643400844337786
75377835026112524672441006935454381434
88767996193783301854506181464606643968
264482226524464365223049826774360018070
36933043176152668205754522843720319017
239385172818071565953594850162918447632
count: 12
baxos.Decode took 0.059291 milliseconds.
[ OK ] Works_Instances/BaxosTest.WORKS/0 (1 ms)
[----------] 1 test from Works_Instances/BaxosTest (1 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 1 test.
`
Expected behavior
OKVS生成的P不显示原本value。
Version
0.4.0
Operating system
mac
Hardware Resources
16c16G
The text was updated successfully, but these errors were encountered: