Flip WIRE snapshot magic for hex-dump readability#309
Open
heifner wants to merge 4 commits into
Open
Conversation
heifner
added a commit
that referenced
this pull request
Apr 23, 2026
The magic byteswap was extracted to PR #309 targeting feature/kv-secondary-primary-id. This branch goes back to master's reference snapshot files and the original 0x57495245 magic; reference files will be regenerated on top of #309 when it lands. Reverted: - libraries/chain/include/sysio/chain/snapshot.hpp - magic restored to 0x57495245 - unittests/snapshots/{blocks.log,snap_v1.bin.gz,snap_v1.bin.json.gz, snap_v1.json.gz} - reverted to master - unittests/test-data/consensus_blockchain/snapshot - reverted to master - tests/sysio_util_snapshot_info_test.py - head_block_id reverted; flush fix retained
huangminghuang
approved these changes
May 7, 2026
Reverse the on-disk byte order of the snapshot v1 header magic so a hex dump of a snapshot file reads 'W','I','R','E' instead of 'E','R','I','W'. Stored little-endian as 0x45524957 -> bytes on disk 57 49 52 45. Pre-launch; no backward compatibility. Snapshots written with the old magic cannot be read after this change.
85dd8e0 to
02c2401
Compare
The snapshot magic flip changes the on-disk header bytes. Regenerated
via:
unit_test --run_test='snapshot_part2_tests/*' -- --sys-vm \
--save-snapshot --generate-snapshot-log
head_block_id in sysio_util_snapshot_info_test.py updated to match the
new fixture; blocks.log / blocks.index regenerated as a byproduct of
--generate-snapshot-log.
The snapshot regen run on this branch also drifted the action_mroot
that savanna_misc_tests/verify_block_compatibitity compares against.
Regenerated via:
unit_test -t "savanna_misc_tests/verify_block_compatibitity" \
-- --sys-vm --save-blockchain
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
Reverses the on-disk byte order of the snapshot v1 header magic so a hex dump of a snapshot file reads
W,I,R,Einstead ofE,R,I,W.The value is stored little-endian as a
uint32_t:0x57495245-> bytes on disk45 52 49 57("ERIW")0x45524957-> bytes on disk57 49 52 45("WIRE")Compatibility
No backward compatibility. Snapshots written with the old magic cannot be read after this change. Pre-launch, so the break is acceptable.