-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Overview
Add program-aware bytecode analysis to the Rust SDK for automatic preprocessing configuration.
Tasks
Step 1: Bytecode Analysis in Program
- Add
preprocessing_requirements(threshold: usize) -> (usize, usize)method toProgramstruct - Add
count_multiplications()to parse bytecode and count MUL instructions - Add
count_random_share_consumers()for other preprocessing-consuming ops - Detect loops and emit warning
- Cache analysis results in
Programstruct
Step 2: Server Builder Integration
- Modify
with_program()to trigger automatic analysis - Store calculated preprocessing values in builder
- Add
with_preprocessing_preset(PreprocessingPreset)method - Modify
with_preprocessing()to override calculated values - Add
PreprocessingPresetenum (Minimal, Standard, Production)
Step 3: Validation & Error Handling
- In
build(): Error if no program AND no explicit preprocessing - Log calculated values at INFO level
- Warn if user override < calculated requirements
Files to Modify
src/program.rs(bytecode analysis methods)src/mpcaas/server.rs(builder integration)src/lib.rs(re-exports)src/prelude.rs(PreprocessingPreset export)examples/honeybadger_mpc_demo.rs(remove explicit preprocessing)examples/README.md(document automatic behavior)
Testing
- Unit tests for
count_multiplications()with various bytecode - Unit tests for
preprocessing_requirements()calculation - Integration test: server builds with only
.with_program()
Reference
- RFC-0001
- Algorithm:
n_triples = mul_count + 2,n_random_shares = 2 + 2 * n_triples