fix: resolve #879 #880 #881 #882 — tests, shared royalty logic, docs, benchmarks - #971
Merged
fejilaup-cloud merged 1 commit intoSep 4, 2026
Conversation
… — tests, shared logic, docs AtomicIP#881 (security/bug): Cross-layer encryption key rotation compatibility - Add encryptionKeyRotationCompatibility.test.js (16 tests) - Document wire format [ 12-byte IV | 16-byte auth-tag | ciphertext ] - Verify JS 32-byte key ↔ contract BytesN<32> compatibility - Verify commitment = SHA-256(secret ∥ blinding_factor) derivation - Confirm rotation history accumulation matches contract behaviour - Add encryption byte format + key rotation docs to docs/atomic-swap.md AtomicIP#879 (bug): Royalty calculation consistency between swapRoyaltyTracker and batchRoyaltyDistributor - Extract canonical formula into src/royalty/royaltyCalculation.js - Add royaltyConsistency.test.js (31 tests) asserting both modules agree on totalRoyalty, sellerProceeds, per-beneficiary amounts, and dust - Document canonical formula in docs/atomic-swap.md AtomicIP#880 (testing): Property-based tests for batchFeeCalculator.js - Add fast-check@3.22.0 as dev dependency - Add batchFeeCalculator.property.test.js (15 tests) covering: non-negativity, bounded ceiling, monotonicity, split invariant, discount bounds, totals consistency, discount direction, override - Fix jest testMatch to use <rootDir> prefix so tests are discovered AtomicIP#882 (testing/performance): Compression benchmarks for batchCompressor.js - Add scripts/benchmark-batchCompressor.test.js (7 tests) measuring compression ratio and round-trip timing across 4 payload sizes - Add batchCompressor.fuzz.test.js (12 property-based round-trip tests) using fast-check with arbitrary swap object structures - Create docs/PERFORMANCE.md with baseline numbers (zlib deflate, Node v24.14.0, 200 iterations): 10.86× ratio for 100-swap batch
|
@darkcode123456 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #879,
Closes #880,
Closes #881,
Closes #882.
#881 — Encryption key rotation compatibility (security/bug)
New file:
src/__tests__/encryptionKeyRotationCompatibility.test.js(16 tests, all pass)[ 12-byte IV | 16-byte auth-tag | ciphertext ]BytesN<32>secret are the same type/sizeSHA-256(secret ∥ blinding_factor)matches contract logicdocs/atomic-swap.md#879 — Royalty calculation consistency (bug)
New file:
src/royalty/royaltyCalculation.js— canonical shared moduleNew file:
src/__tests__/royaltyConsistency.test.js(31 tests, all pass)swapRoyaltyTracker.jsandbatchRoyaltyDistributor.jstotalRoyalty,sellerProceeds, per-beneficiary amounts, and dust assignment for the same inputsdocs/atomic-swap.md#880 — Property-based tests for batchFeeCalculator (testing)
New file:
src/__tests__/batchFeeCalculator.property.test.js(15 tests, all pass)New dep:
fast-check@3.22.0(dev)Properties tested with 200 random runs each:
protocolFee + lpFee === netFeewithin float tolerance#882 — Compression benchmarks for batchCompressor (testing/performance)
New file:
scripts/benchmark-batchCompressor.test.js(7 tests, all pass)New file:
src/__tests__/batchCompressor.fuzz.test.js(12 tests, all pass)New file:
docs/PERFORMANCE.md— baseline numbersBenchmark results (Node v24.14.0, zlib deflate, 200 iterations):
Fuzz tests use fast-check to assert compress → decompress is a lossless identity for arbitrary swap structures (300 random runs).
What was tested
batchRoyaltyDistributor.test.js(3 tests) are unrelated to this PR