Skip to content

Flip WIRE snapshot magic for hex-dump readability#309

Open
heifner wants to merge 4 commits into
masterfrom
feature/snapshot-magic-byteswap
Open

Flip WIRE snapshot magic for hex-dump readability#309
heifner wants to merge 4 commits into
masterfrom
feature/snapshot-magic-byteswap

Conversation

@heifner
Copy link
Copy Markdown
Contributor

@heifner heifner commented Apr 23, 2026

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, E instead of E, R, I, W.

The value is stored little-endian as a uint32_t:

  • Before: 0x57495245 -> bytes on disk 45 52 49 57 ("ERIW")
  • After: 0x45524957 -> bytes on disk 57 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.

@heifner heifner changed the title Chain: flip WIRE snapshot magic for hex-dump readability Flip WIRE snapshot magic for hex-dump readability Apr 23, 2026
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
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.
@heifner heifner force-pushed the feature/snapshot-magic-byteswap branch from 85dd8e0 to 02c2401 Compare May 11, 2026 21:52
@heifner heifner changed the base branch from feature/kv-secondary-primary-id to master May 11, 2026 21:53
heifner added 3 commits May 11, 2026 17:46
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants