Commit Graph
2 Commits
Author SHA1 Message Date
DeFiDude 290a1336eb Disable bz2 on Resource transfers — too heavy for MCU targets
- BZ2.cpp: no-op shim, keeps RNS::Compression symbols
- Stub the 7 vendored bzip2 1.0.8 .c files (~4500 lines removed)
- OutboundResource::init always sends uncompressed; default flipped
- InboundResource drops compressed payloads with a WARNING (no decode)
- library.json: defensive build.srcFilter excluding bzip2 sources

Companion fix lives in firmware repos: announce app_data must
advertise an empty supported_functionality list so Python LXMF
disables auto_compress for our destinations.
2026-04-23 17:38:07 -06:00
DeFiDude 166083aba7 Add bz2 compression for Resource transfer + 3 compression tests
Vendor libbzip2 (1.0.8, BSD license) for ESP32-compatible bz2
compression/decompression. This matches Python's bz2.compress()
and Rust's bzip2 crate for cross-platform Resource transfers.

C++ wrapper (Compression/BZ2.h):
- bz2_compress() — compress with blockSize100k=9
- bz2_decompress() — decompress with progressive buffer sizing
- try_compress() — compress only if smaller than original

Resource integration:
- OutboundResource::init() now compresses with bz2 if beneficial
- InboundResource::assemble() decompresses if compressed flag set
- ResourceFlags.compressed bit tracks compression state

3 new tests (test_resource_transfer):
- testBz2CompressDecompress — roundtrip verification
- testTryCompress — beneficial vs non-beneficial compression
- testBz2CrossPlatformFormat — BZh magic bytes match Python/Rust

Total: 137 tests, 136 pass (1 pre-existing allocator).
2026-03-24 17:15:42 -06:00