Skip to content

chore: minor changes moby/stairway#564

Open
titouantanguy wants to merge 30 commits intomainfrom
titouan/chore/minor-nist-bench
Open

chore: minor changes moby/stairway#564
titouantanguy wants to merge 30 commits intomainfrom
titouan/chore/minor-nist-bench

Conversation

@titouantanguy
Copy link
Copy Markdown
Contributor

Description of changes

Issue ticket number and link

PR Checklist

I attest that all checked items are satisfied. Any deviation is clearly justified above.

  • Title follows conventional commits (e.g. chore: ...).
  • Tests added for every new pub item and test coverage has not decreased.
  • Public APIs and non-obvious logic documented; unfinished work marked as TODO(#issue).
  • unwrap/expect/panic only in tests or for invariant bugs (documented if present).
  • No dependency version changes OR (if changed) only minimal required fixes.
  • No architectural protocol changes OR linked spec PR/issue provided.
  • No breaking deployment config changes OR devops label + infra notified + infra-team reviewer assigned.
  • No breaking gRPC / serialized data changes OR commit marked with ! and affected teams notified.
  • No modifications to existing versionized structs OR backward compatibility tests updated.
  • No critical business logic / crypto changes OR ≥2 reviewers assigned.
  • No new sensitive data fields added OR Zeroize + ZeroizeOnDrop implemented.
  • No new public storage data OR data is verifiable (signature / digest).
  • No unsafe; if unavoidable: minimal, justified, documented, and test/fuzz covered.
  • Strongly typed boundaries: typed inputs validated at the edge; no untyped values or errors cross modules.
  • Self-review completed.

Dependency Update Questionnaire (only if deps changed or added)

Answer in the Cargo.toml next to the dependency (or here if updating):

  1. Ownership changes or suspicious concentration?
  2. Low popularity?
  3. Unusual version jump?
  4. Lacking documentation?
  5. Missing CI?
  6. No security / disclosure policy?
  7. Significant size increase?

More details and explanations for the checklist and dependency updates can be found in CONTRIBUTING.md

@cla-bot cla-bot Bot added the cla-signed The CLA has been signed. label May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Consolidated Tests Results 2026-05-05 - 16:51:17

Test Results

passed 12 passed

Details

tests 12 tests
clock not captured
tool junit-to-ctrf
build build-and-test arrow-right test-reporter link #1917
pull-request chore: minor changes moby/stairway link #564

test-reporter: Run #1917

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
12 12 0 0 0 0 0 not captured

🎉 All tests passed!

Tests

View All Tests
Test Name Status Flaky Duration
k8s_test_crs_uniqueness 34.2s
k8s_test_insecure_keygen_encrypt_and_public_decrypt 2m 18s
k8s_test_insecure_keygen_encrypt_multiple_types 2m 32s
k8s_test_keygen_and_crs 2m 14s
k8s_test_keygen_uniqueness 5m 49s
k8s_test_crs_uniqueness 34.4s
k8s_test_insecure_keygen_encrypt_and_public_decrypt 2m 30s
k8s_test_insecure_keygen_encrypt_multiple_types 2m 32s
k8s_test_keygen_and_crs 2m 12s
k8s_test_keygen_uniqueness 5m 46s
k8s_test_centralized_insecure 55.4s
nightly_full_gen_tests_default_k8s_centralized_sequential_crs 1.8s

🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

@titouantanguy titouantanguy marked this pull request as ready for review May 5, 2026 11:15
@titouantanguy titouantanguy requested a review from a team as a code owner May 5, 2026 11:15
@titouantanguy titouantanguy force-pushed the titouan/chore/minor-nist-bench branch from 9469e5d to 6b32d44 Compare May 5, 2026 11:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors and expands the core/experiments reproducible benchmark tooling for TFHE and BGV, adds NIST-oriented runner/parser scripts for session stats, and introduces small runtime/CLI changes to support multi-ciphertext decryption flows and improved stats collection.

Changes:

  • Factor TFHE reproducible test logic into a shared tfhe_reproducible_common.sh and add small/large/malicious wrappers; add a BGV reproducible script.
  • Add NIST scripts to run threshold reproducible tests and parse per-party session_stats into CSV; wire session_stats folder creation/mounting into experiment setup and docker compose.
  • Extend CLIs and runtime code paths to handle “N ciphertexts per preprocess/decrypt” and to fail on mismatched expected plaintexts.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
core/experiments/test_scripts/tfhe_reproducible_small_session.sh TFHE small-session wrapper now delegates to shared common script.
core/experiments/test_scripts/tfhe_reproducible_small_session_malicious.sh Adds malicious small-session wrapper for TFHE reproducible runs.
core/experiments/test_scripts/tfhe_reproducible_large_session.sh Adds TFHE large-session wrapper delegating to shared common script.
core/experiments/test_scripts/tfhe_reproducible_common.sh New shared TFHE reproducible flow (keygen, CRS, reshare, multi-ctxt decrypt checks).
core/experiments/test_scripts/bgv_reproducible.sh New BGV reproducible runner using stairwayctl, including expected-hash and DDec loops.
core/experiments/src/choreography/tfhe_rs/grpc.rs Adds cached modswitched private keyset for Z64 and routes bitdec to it.
core/experiments/src/choreography/server_utils.rs Writes stats under session_stats/ and creates parent directory if missing.
core/experiments/src/bin/threshold-tfhe/mobygo.rs Adds --num-ctxts to decrypt-from-file, parses comma-delimited expected values, exits non-zero on mismatch.
core/experiments/src/bin/threshold-bgv/stairwayctl.rs Adds encrypt + threshold-decrypt-from-file commands and expected-value checking with non-zero exit on mismatch.
core/experiments/NIST_scripts/threshold-test-params.sh New script orchestrating TFHE/BGV reproducible threshold tests under docker.
core/experiments/NIST_scripts/session-stats-parser.py New parser aggregating per-party session stats into averaged CSV outputs.
core/experiments/NIST_scripts/non-threshold-zk-pok-bench.sh Adds a size bench output file and runs the new ZK PoK size bench.
core/experiments/NIST_scripts/non-threshold-tfhe-bench.sh Improves logging/UX for running and parsing non-threshold benches.
core/experiments/NIST_scripts/non-threshold-parser.py Extends CSV output to include serialized proof sizes.
core/experiments/NIST_scripts/build.sh Fixes path quoting for the experiments target dir.
core/experiments/NIST_scripts/.gitignore Ignores threshold/ output directory.
core/experiments/Makefile.toml Adds setup task for telemetry + session stats files; adjusts bench-run tasks; start-parties waits for health.
core/experiments/experiments/templates/docker-compose.yml.j2 Passes expected parties/threshold args; mounts temp/session_stats into containers.
core/experiments/Cargo.toml Removes cdylib crate-type; registers new size bench target.
core/experiments/benches/non-threshold/utilities.rs Adds shared SAMPLE_SIZE constant for Criterion configuration.
core/experiments/benches/non-threshold/tfhe-zk-pok/speed.rs Uses shared SAMPLE_SIZE for speed benches.
core/experiments/benches/non-threshold/tfhe-zk-pok/size.rs New bench printing serialized proof sizes for parsing.
core/experiments/benches/non-threshold/tfhe-rs/speed/keygen.rs Uses shared SAMPLE_SIZE.
core/experiments/benches/non-threshold/tfhe-rs/speed/erc20.rs Uses shared SAMPLE_SIZE.
core/experiments/benches/non-threshold/tfhe-rs/speed/basic_ops.rs Uses shared SAMPLE_SIZE.
core/experiments/benches/non-threshold/bgv/speed/keygen.rs Uses shared SAMPLE_SIZE.
core/experiments/benches/non-threshold/bgv/speed/basic_ops.rs Uses shared SAMPLE_SIZE.
Cargo.toml Reduces bench profile debug info to line-tables-only.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +3
SESSION_TYPE="small"
EXPECTED_KEY_HASH="86e53c36c19d03ef7794486d982e7cc8bba4ddea704b7b9587e43aed5e7a804e"
EXPECTED_RESHARED_KEY_HASH="b7f36bba2da051dca4740721a66da374c07cc657ede4bee3cea4ec198bd15b33"
Comment on lines +1 to +3
SESSION_TYPE="large"
EXPECTED_KEY_HASH="a1420068eea9184e833f31c859c1b10621e648966cff3697b9e151ab744f03df"
EXPECTED_RESHARED_KEY_HASH="5b13254b3c2dcb604b6653902a7ed74f0263abef98fa4a0b133972f40d84c7ef"
Comment on lines +1 to +3
SESSION_TYPE="small"
EXPECTED_KEY_HASH="86e53c36c19d03ef7794486d982e7cc8bba4ddea704b7b9587e43aed5e7a804e"
EXPECTED_RESHARED_KEY_HASH="b7f36bba2da051dca4740721a66da374c07cc657ede4bee3cea4ec198bd15b33"
DDEC_MODES="noise-flood-small bit-dec-small"
MAIN_PATH="./temp/tfhe_small_reproducible_malicious"
PARAMS="params-test-bk-sns"
SEED=42



if [ $2 = "GEN" ]; then
Comment on lines +331 to +341
let m: Vec<u32> = (0..N65536::VALUE)
.map(|i| ((params.value + i as u64) % PLAINTEXT_MODULUS.get().0) as u32)
.collect();

let ctxt = bgv_pk_encrypt(&mut rng, &m, &pk);

println!("Encrypted value {}", params.value);

let serialized = bc2wrap::serialize(&(m, ctxt))?;
std::fs::write(&params.output_file, serialized)?;
println!("Ciphertexts stored in {}", params.output_file);

/// Optional argument to check the received plaintext against an expected value.
/// The expected plaintext polynomial is value, value+1, value+2, ...
/// If more than one plaintext were decrypted, we make sure they are all equal to this epxectect plaintext polynomial.
Comment on lines +2 to +11
//! Speed benchmarks for ZK proof-of-knowledge operations.
//!
//! Measures wall-clock time for:
//! - CRS generation
//! - Proof generation (CRS pre-computed)
//! - Proof verification in TwoSteps mode (proof pre-computed)
//! - Proof verification in Batched mode (proof pre-computed)
//!
//! Run with:
//! cargo bench --bench non-threshold_tfhe-zk-pok_speed
Comment on lines +12 to +16
TFHE_RUN_4P_NAME = "tfhe-bench-run-4p"
TFHE_RUN_5P_NAME = "tfhe-bench-run-5p"
TFHE_RUN_NAMES = [TFHE_RUN_4P_NAME, TFHE_RUN_5P_NAME]
BGV_RUN_NAME = "bgv-bench-run"

Comment on lines +19 to +23
EXPECTED_LINES_PER_RUN = {
TFHE_RUN_4P_NAME: 34,
TFHE_RUN_5P_NAME: 34,
BGV_RUN_NAME: 11,
}
Comment on lines +24 to +26
if [ "$(docker ps -a -q)" ]; then
echo "Cleaning up docker containers..."
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we limit this to just known docker containers? Maybe it's fine as is, if we assume we only run the benchmarks on this machine.



#Bring parties alive based on provided yml file
[tasks.start-parties]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +43 to +44
TFHE_RUN_4P_NAME: build_tfhe_operation_labels(),
TFHE_RUN_5P_NAME: build_tfhe_operation_labels(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't fully figured out how it works, but this means we run the exact same operations for both 4 and 5 parties, correct?

#Run the full test suite for tfhe with centralized dkg
[tasks.bgv-test-fake-dkg]
command = "sh"
args = ["test_scripts/bgv_test_script_fake_dkg.sh", "temp/${EXPERIMENT_NAME}.toml"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also delete the script, or do we want to keep it?

#Checking every 30s
$MOBYGO_EXEC -c $1 status-check --sid $CURR_SID --keep-retry true --interval 30
#Get the key
mkdir -p $KEY_PATH
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already do that in L22

params.session_id_decrypt
);
} else {
println!(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is clearer?

Suggested change
println!(
eprintln!(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants