Title image: published under the hash of its patched bytes, not read back at every start #931
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/931"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T09:18:17Z.
Why
Every start spent time and memory on the title's image that it didn't need to:
publish::write_if_changedread the whole ofvictory-image-*.dll(115 MB for the title) just to compare it with the bytes it had just prepared.prepare()copied its input once more (to_vec) before patching.What
The published image is keyed on the hash of its patched bytes (first commit):
<images>/<128-bit BLAKE3 of the patched bytes>/victory-image-<build>.dll.VICTORY_WRITE_SITESlists still match. Only the folder is new.mainwrote the staging file without a flush), then renames. A rename refused because another runner published the same bytes first and has them mapped counts as success.prepare_owned(Vec<u8>)patches the bytes where they were read. The runner and the title's DLLs use it, andprepare(&[u8])stays as a wrapper.Both hashes run on several threads (second commit):
victory_loader::hashsplits the input where BLAKE3's tree does (left_subtree_len), hashes each half as a subtree on its own thread (blake3::hazmat), and joins them.blake3::hash, with no new dependency.Numbers
Publish step = read the exe, prepare, publish an image that's already there. The test binary padded to 115 MB stands in for the title. Warm cache, 9 runs per process, alternating rounds:
main's way (read back and compare,to_vec)BLAKE3 of 115 MB on its own: 18.3 ms on one thread, 3.7 ms on 8 (
hash::tests::bench_hash).Tests
publish::tests:prepare::tests::prepared_in_place_as_from_a_copy:prepare_ownedgives the same bytes and hash asprepare.hash::tests::the_same_hash_as_blake3s_own: compares againstblake3::hashat every length around chunk and power-of-two boundaries, for 1–9 threads and several piece sizes. Also at a real size.publish::tests::bench_publish_stepandhash::tests::bench_hash.CI steps run locally on this branch:
cargo clippy --workspace --all-targets --locked -- -D warnings: passes.--all-features: passes.cargo test --workspace --locked --no-fail-fast: passes. 1,134 passed, 0 failed, 51 ignored.Clippy: the four findings that stop CI on main (Rust 1.98)is the same commit as in #816 and #819. Without it,mainitself fails clippy. Drop it ifmainfixes them first.Not covered:
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T09:31:26Z.
Review: APPROVED
Tested locally merged onto
main(63b902f).cargo xtask policypassed (295 files ok).cargo test -p victory-loader --libpassed (53 passed; 0 failed; 2 ignored, includinghash::tests::the_same_hash_as_blake3s_own,publish::tests::an_unchanged_image_is_not_rewritten,changed_bytes_publish_a_new_image_and_remove_the_old,a_damaged_or_truncated_image_is_replaced, andprepare::tests::prepared_in_place_as_from_a_copy).cargo check -p victorysucceeded cleanly with 0 warnings.Nice startup speedup avoiding re-reading the published title image on every launch while maintaining full content-hash verification. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.