Add storage key XDR snapshot test (#331)#337
Open
legend-esc wants to merge 1 commit into
Open
Conversation
- Add storage_snapshot.rs test that serializes every StorageKey variant to XDR hex and compares against committed baseline - Create tests/snapshots/storage_keys.json baseline with all 91 key XDR values, sorted alphabetically - Collision check: no two keys produce identical XDR - Add CI step: cargo test -p split storage_snapshot - Add README Storage Key Registry section with policy docs - Fix pre-existing compilation bugs blocking the build: - arch_after symbol too long (10 > 9) → arch_af - Remove non-existent InvoiceExt2 fields - Remove duplicate code block in load_invoice - Close unclosed reveal_confidential_total function
|
@legend-esc 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
Adds a snapshot test that serialises every storage key to XDR hex and compares against a committed baseline. Any accidental layout change (e.g. renamed symbol, added/removed field) fails CI, preventing silent data migrations.
Changes
New files
contracts/split/src/storage_snapshot.rs— snapshot test that serializes all 91 storage keys to XDR hex, asserts no collisions, and compares against the committed baselinetests/snapshots/storage_keys.json— baseline snapshot with XDR hex for every key, sorted alphabeticallyModified files
contracts/split/src/lib.rs— addedmod storage_snapshotin thecfg(test)block.github/workflows/test.yml— addedcargo test -p split storage_snapshotCI stepREADME.md— added "Storage Key Registry" section documenting the snapshot policy and how to update the baselinePre-existing fixes (included to unblock compilation)
Four bugs in
lib.rsthat prevented building were fixed:symbol_short!("arch_after")→"arch_af"(10 chars exceeded 9-char max)InvoiceExt2fields (substitute_recipient_approvals,creation_timestamp,min_payment_increment)load_invoicecausing unclosed delimiterreveal_confidential_totalfunctionCloses #331