Skip to content

fix: revert encrypt workaround after Poulpy prepare fix#25

Merged
cedoor merged 1 commit into
mainfrom
refactor/revert-workaround
Apr 20, 2026
Merged

fix: revert encrypt workaround after Poulpy prepare fix#25
cedoor merged 1 commit into
mainfrom
refactor/revert-workaround

Conversation

@cedoor
Copy link
Copy Markdown
Owner

@cedoor cedoor commented Apr 20, 2026

  • Bump poulpy to rev 067fd785; encrypt via FheUint::encrypt_sk + glwe enc infos
  • Drop prepared cache on Ciphertext; eval_binary prepares operands with fhe_uint_prepare_tmp_bytes
  • Size scratch from Poulpy *_tmp_bytes for encrypt, decrypt, keygen, and each homomorphic op
  • encrypt now takes (value, sk) only; update README, example, and tests
  • Mark milestone issue refactor: revert encrypt workaround once upstream poulpy bug is fixed #24 done in README

Summary by CodeRabbit

  • API Changes

    • Simplified encrypt() method signature—evaluation key parameter no longer required, streamlining encryption calls.
  • Improvements

    • Streamlined internal ciphertext handling by eliminating cached intermediate state.
    • Completed upstream dependency workaround integration.
  • Documentation

    • Updated usage examples and README to reflect simplified encryption API.

- Bump poulpy to rev 067fd785; encrypt via FheUint::encrypt_sk + glwe enc infos
- Drop prepared cache on Ciphertext; eval_binary prepares operands with fhe_uint_prepare_tmp_bytes
- Size scratch from Poulpy *_tmp_bytes for encrypt, decrypt, keygen, and each homomorphic op
- encrypt now takes (value, sk) only; update README, example, and tests
- Mark milestone issue #24 done in README
@cedoor cedoor linked an issue Apr 20, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 430a5447-6597-46f4-b6b1-251586aa5c6c

📥 Commits

Reviewing files that changed from the base of the PR and between 20015a7 and 346ca90.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • Cargo.toml
  • README.md
  • examples/add_u32.rs
  • src/ciphertext.rs
  • src/context.rs
  • tests/bdd_parallel.rs
  • tests/ciphertext_serialization.rs
  • tests/evaluation_key_serialization.rs
  • tests/keygen_seeds.rs

📝 Walkthrough

Walkthrough

Cargo.toml dependencies updated to specific poulpy commit revisions. The codebase removes the cached "prepared" ciphertext mechanism from Ciphertext, changes Context::encrypt to no longer require an EvaluationKey parameter, and refactors eval_binary to rebuild FheUintPrepared operands on-demand during operations. All examples and tests are updated accordingly.

Changes

Cohort / File(s) Summary
Dependency Updates
Cargo.toml
Updated poulpy-* dependency revisions to 067fd785a1d9087f7d9fa437a8503a2d74ac737f.
Public API Signature Changes
src/context.rs
Changed encrypt signature to remove EvaluationKey parameter; rewrote eval_binary to rebuild FheUintPrepared operands on each call instead of relying on cached prepared state; adjusted imports for new preparation flow.
Struct Field Removal
src/ciphertext.rs
Removed prepared: Option<FheUintPrepared<...>> field from Ciphertext<T>; updated module-level documentation to reflect that prepared state is no longer cached or exposed.
Documentation & Examples
README.md, examples/add_u32.rs
Updated code examples and usage documentation to reflect new encrypt signature (removed EvaluationKey argument); marked related roadmap item as completed.
Test Updates
tests/bdd_parallel.rs, tests/ciphertext_serialization.rs, tests/evaluation_key_serialization.rs, tests/keygen_seeds.rs
Consistently updated all test encryption calls to use new signature without EvaluationKey parameter.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Context
    participant Ciphertext as Ciphertext<br/>(packed only)
    participant Backend as Backend<br/>(eval_binary)
    
    rect rgba(100, 200, 100, 0.5)
    Note over User,Backend: NEW FLOW: On-demand preparation
    User->>Context: encrypt(value, &sk)
    Context->>Ciphertext: new (inner only)
    Ciphertext-->>User: Ciphertext<T>
    
    User->>Context: add(&ct_a, &ct_b, &ek)
    Context->>Context: rebuild FheUintPrepared from ct_a.inner
    Context->>Context: rebuild FheUintPrepared from ct_b.inner
    Context->>Backend: eval(prepared_a, prepared_b)
    Backend-->>Context: result (packed)
    Context->>Ciphertext: new (inner only)
    Ciphertext-->>User: Ciphertext<T>
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 Prepared caches, now set free!
No more storing what we see,
Rebuild on demand, sleek and light,
The workaround takes its flight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of this PR: reverting the encrypt workaround now that Poulpy's underlying prepare bug has been fixed.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/revert-workaround

Comment @coderabbitai help to get the list of available commands and usage tips.

@cedoor cedoor merged commit 2033999 into main Apr 20, 2026
2 checks passed
@cedoor cedoor deleted the refactor/revert-workaround branch April 20, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: revert encrypt workaround once upstream poulpy bug is fixed

1 participant