Checkpoint the party/runtime stack before share-program and malicious-mode work.
Ship the TLS mesh, composer, Beaver/Yao/leaf MPC, prep/online paths, apps, and docs so the tree is pushable before elevating share_expr, security_mode, and prep resume. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
695f8e84f7
commit
0d22946a0e
1835 changed files with 170291 additions and 2849 deletions
|
|
@ -10,6 +10,7 @@
|
|||
// incremental_test.cpp.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "dpf.hpp"
|
||||
#include "grotto/fixedpoint.hpp"
|
||||
|
|
@ -242,6 +243,10 @@ void assign_wildcard_leaf_local(Key0 & k0, Key1 & k1, const ShareT & shr0,
|
|||
{
|
||||
auto & w0 = std::get<I>(k0.leaf_nodes);
|
||||
auto & w1 = std::get<I>(k1.leaf_nodes);
|
||||
if (w0.is_ready())
|
||||
w0.begin_update();
|
||||
if (w1.is_ready())
|
||||
w1.begin_update();
|
||||
const auto b0 = w0.compute_and_get_blinded_output_share(shr0);
|
||||
const auto b1 = w1.compute_and_get_blinded_output_share(shr1);
|
||||
const auto l0 = w0.compute_and_get_leaf_share(b1);
|
||||
|
|
@ -552,7 +557,7 @@ TEST_F(StressScenariosTest, MlWildcardEvalPointThrowsBeforeAssign)
|
|||
auto [k0, k1] = dpf::make_dpf(x,
|
||||
dpf::at<8>(uint8_t{7}), dpf::at<12>(wc), uint16_t{1});
|
||||
// Slot 1 is an unassigned wildcard: evaluating it must throw.
|
||||
EXPECT_ANY_THROW((void)dpf::eval_point(dpf::out<1, 12>, k0, x));
|
||||
EXPECT_ANY_THROW(dpf::eval_point(dpf::out<1, 12>, k0, x));
|
||||
(void)k1;
|
||||
}
|
||||
|
||||
|
|
@ -2038,7 +2043,7 @@ TEST_F(StressScenariosTest, MlPackedSmallWildcardAtNonTerminalAssignAll)
|
|||
EXPECT_NE(KT::meta[0].group_id, KT::meta[8].group_id);
|
||||
|
||||
// Unassigned packed wildcards throw; deepest concrete still works.
|
||||
EXPECT_ANY_THROW((void)dpf::eval_point(dpf::out<0, 12>, k0, x));
|
||||
EXPECT_ANY_THROW(dpf::eval_point(dpf::out<0, 12>, k0, x));
|
||||
EXPECT_EQ(recon(*dpf::eval_point(dpf::out<8>, k0, x),
|
||||
*dpf::eval_point(dpf::out<8>, k1, x)),
|
||||
uint32_t{999});
|
||||
|
|
@ -2248,8 +2253,8 @@ TEST_F(StressScenariosTest, PrgCounterWrapperAesClassicEvalIncrements)
|
|||
const auto after_gen = prg::count();
|
||||
EXPECT_GT(after_gen, before);
|
||||
|
||||
(void)dpf::eval_point(k0, x);
|
||||
(void)dpf::eval_full(k0);
|
||||
dpf::eval_point(k0, x);
|
||||
dpf::eval_full(k0);
|
||||
const auto after_eval = prg::count();
|
||||
EXPECT_GT(after_eval, after_gen);
|
||||
|
||||
|
|
@ -2271,8 +2276,8 @@ TEST_F(StressScenariosTest, PrgCounterWrapperLowmcMultilevelEvalIncrements)
|
|||
|
||||
const auto bi2 = interior::count();
|
||||
const auto be2 = exterior::count();
|
||||
(void)dpf::eval_point(dpf::out<0, 8>, k0, x);
|
||||
(void)dpf::eval_full(dpf::out<1, 16>, k0);
|
||||
dpf::eval_point(dpf::out<0, 8>, k0, x);
|
||||
dpf::eval_full(dpf::out<1, 16>, k0);
|
||||
EXPECT_GT(interior::count(), bi2);
|
||||
EXPECT_GT(exterior::count(), be2);
|
||||
|
||||
|
|
@ -2302,3 +2307,80 @@ TEST_F(StressScenariosTest, PrgLowmcBothSidesPackedInterval)
|
|||
*dpf::eval_point(dpf::out<4>, k1, x)), uint32_t{55});
|
||||
}
|
||||
|
||||
TEST_F(StressScenariosTest, PairedInnerProductLeafAndAncestor)
|
||||
{
|
||||
using In = std::uint8_t;
|
||||
auto [k0, k1] = dpf::make_dpf(In{9}, std::uint32_t{7}, std::uint32_t{11});
|
||||
std::vector<std::array<std::uint32_t, 2>> rows;
|
||||
std::uint64_t expect = 0;
|
||||
for (In x = 4;; ++x)
|
||||
{
|
||||
const auto y0 = recon(*dpf::eval_point<0>(k0, x), *dpf::eval_point<0>(k1, x));
|
||||
const auto y1 = recon(*dpf::eval_point<1>(k0, x), *dpf::eval_point<1>(k1, x));
|
||||
const std::uint32_t w0 = x * 3u + 1u;
|
||||
const std::uint32_t w1 = x * 5u + 2u;
|
||||
rows.push_back({w0, w1});
|
||||
expect += static_cast<std::uint64_t>(y0) * w0
|
||||
+ static_cast<std::uint64_t>(y1) * w1;
|
||||
if (x == 12)
|
||||
break;
|
||||
}
|
||||
const auto a = dpf::eval_inner_product<0, 1>(dpf::paired, k0, In{4}, In{12}, rows);
|
||||
const auto b = dpf::eval_inner_product<0, 1>(dpf::paired, k1, In{4}, In{12}, rows);
|
||||
EXPECT_EQ(recon(a, b), expect);
|
||||
|
||||
const std::vector<In> pts{2, 9, 40};
|
||||
const std::vector<std::array<std::uint64_t, 2>> seq_rows{{1, 2}, {3, 4}, {5, 6}};
|
||||
std::uint64_t seq_expect = 0;
|
||||
for (std::size_t i = 0; i < pts.size(); ++i)
|
||||
{
|
||||
const auto y0 = recon(*dpf::eval_point<0>(k0, pts[i]),
|
||||
*dpf::eval_point<0>(k1, pts[i]));
|
||||
const auto y1 = recon(*dpf::eval_point<1>(k0, pts[i]),
|
||||
*dpf::eval_point<1>(k1, pts[i]));
|
||||
seq_expect += static_cast<std::uint64_t>(y0) * seq_rows[i][0]
|
||||
+ static_cast<std::uint64_t>(y1) * seq_rows[i][1];
|
||||
}
|
||||
EXPECT_EQ(recon(
|
||||
dpf::eval_sequence_inner_product<0, 1>(k0, pts.begin(), pts.end(), seq_rows),
|
||||
dpf::eval_sequence_inner_product<0, 1>(k1, pts.begin(), pts.end(), seq_rows)),
|
||||
seq_expect);
|
||||
const auto recipe = dpf::make_sequence_recipe<decltype(k0)>(pts.begin(), pts.end());
|
||||
EXPECT_EQ(recon(
|
||||
dpf::eval_sequence_inner_product<0, 1>(k0, recipe, pts.begin(), pts.end(), seq_rows),
|
||||
dpf::eval_sequence_inner_product<0, 1>(k1, recipe, pts.begin(), pts.end(), seq_rows)),
|
||||
seq_expect);
|
||||
|
||||
auto [a0, a1] = dpf::make_dpf(In{0x2a}, dpf::at<4>(std::uint8_t{5}), std::uint8_t{9});
|
||||
const std::vector<In> ap{0x20, 0x2a, 0x2b, 0x30};
|
||||
const std::vector<std::array<std::uint32_t, 2>> ar{{1, 1}, {2, 3}, {4, 5}, {6, 7}};
|
||||
std::uint64_t anc = 0;
|
||||
for (std::size_t i = 0; i < ap.size(); ++i)
|
||||
{
|
||||
const auto y0 = recon(*dpf::eval_point(dpf::out<0>, a0, ap[i]),
|
||||
*dpf::eval_point(dpf::out<0>, a1, ap[i]));
|
||||
const auto y1 = recon(*dpf::eval_point(dpf::out<1>, a0, ap[i]),
|
||||
*dpf::eval_point(dpf::out<1>, a1, ap[i]));
|
||||
anc += static_cast<std::uint64_t>(y0) * ar[i][0]
|
||||
+ static_cast<std::uint64_t>(y1) * ar[i][1];
|
||||
}
|
||||
EXPECT_EQ(recon(
|
||||
dpf::eval_sequence_inner_product<0, 1>(a0, ap.begin(), ap.end(), ar),
|
||||
dpf::eval_sequence_inner_product<0, 1>(a1, ap.begin(), ap.end(), ar)),
|
||||
anc);
|
||||
|
||||
std::vector<std::uint64_t> full(256);
|
||||
std::uint64_t full_expect = 0;
|
||||
for (unsigned x = 0; x < 256; ++x)
|
||||
{
|
||||
full[x] = (x * 3u + 1u) & 0x1fu;
|
||||
const auto y = recon(*dpf::eval_point(k0, static_cast<In>(x)),
|
||||
*dpf::eval_point(k1, static_cast<In>(x)));
|
||||
full_expect += static_cast<std::uint64_t>(y) * full[x];
|
||||
}
|
||||
EXPECT_EQ(recon(
|
||||
dpf::eval_full_inner_product<0>(dpf::paired, k0, full),
|
||||
dpf::eval_full_inner_product<0>(dpf::paired, k1, full)),
|
||||
full_expect);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue