Skip to content

test: add property-based test for AES envelope round-trip#341

Open
AugistineCreates wants to merge 4 commits into
ChainForgee:mainfrom
AugistineCreates:feat/upload-roundtrip-test
Open

test: add property-based test for AES envelope round-trip#341
AugistineCreates wants to merge 4 commits into
ChainForgee:mainfrom
AugistineCreates:feat/upload-roundtrip-test

Conversation

@AugistineCreates

@AugistineCreates AugistineCreates commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Closes #275

This PR introduces a property-based test utilizing fast-check to assert that the AES-256-GCM buffer encryption/decryption round-trip (the AES envelope) preserves checksum equality across the full range of evidence sizes from 1 KB up to 100 MB.

Key Changes

  • Dependency: Added fast-check (^4.9.0) to app/backend/package.json devDependencies.
  • Tests: Implemented property-based test in [upload-roundtrip.spec.ts]( covering sizes between 1 KB and 100 MB.

Implementation Details

  • Log-Uniform Distribution Mapping: To meet the CI performance budget of under 30 seconds for 1000 random sequences, the double value from fast-check is mapped using a piecewise log-uniform distribution. This biases testing toward small/medium buffers (90% between 1 KB and 1 MB) while still covering large uploads (10% between 1 MB and 100 MB).
  • Fast Buffer Construction: Instead of relying on slow random byte generators for large buffers, a random 4 KB pattern is repeated to fill the buffer, which significantly speeds up initialization.
  • Verification: Tests run successfully locally and complete in ~21 seconds for 1000 runs.

Copy link
Copy Markdown
Contributor

Hi 👋 Appreciate this PR! The CI is flagging a failing check — could you take a peek at the failed job and push a fix? Happy to help if you need a hand 🙏

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.

Property-based test that AES envelope survives round-trip across all evidence sizes

2 participants