Golden Serialization Tests
Last updated: 16 August 2026
Archived — describes a contract that does not exist
This page is in the archive: it documents a Soroban contract surface with no implementation in any Grainlify repository, verified 16 August 2026. Kept as a design record, not as a description of working software.
Golden serialization tests ensure that our on-chain data structures (XDR) remain consistent across contract upgrades. These tests capture the byte-level representation of key structs and assert that changes to the codebase do not unintentionally break on-chain compatibility.
Testing Strategy
- Fixtures: Stored in
contracts/program-escrow/src/serialization_goldens.rsas XDR hex strings. - Coverage: Covers all variants of core structs, including:
- Default/zero values
- Maximum/edge values (max
i128, max length strings) - Optional field states (
Some/None)
- Verification: Tests in
contracts/program-escrow/src/test_serialization_compatibility.rscompare live XDR serialization against these stored fixtures.
Adding New Fixtures
If you add a new storage type or modify an existing one:
- Update
contracts/program-escrow/src/lib.rswith the new structure. - Run the serialization compatibility test with a generation flag (e.g.,
GENERATE_GOLDENS=1 cargo test). - Verify the generated output in
serialization_goldens.rsbefore committing. - Ensure the new fixture follows the established format.