docs(primitives): correct hash_payload docstring to match impl (B3)#38
Open
AquiGorka wants to merge 2 commits into
Open
docs(primitives): correct hash_payload docstring to match impl (B3)#38AquiGorka wants to merge 2 commits into
AquiGorka wants to merge 2 commits into
Conversation
Amount width 8->16 bytes (i128 LE), contract/address 32 bytes->~56-byte strkey string, and ordering 'original bundle order'->bucketed by condition type. Comment-only; no code/behavior/WASM change.
Replace the per-type bucket concatenation in hash_payload with the canonical XDR of the ordered Vec<Condition>. The prior encoding had no length prefixes, variant tags, or separators, so distinct condition lists could collide -- most sharply, ExtDeposit(X, a) and ExtWithdraw(X, a) over the same address and amount hashed to identical bytes, letting an untrusted submitter reinterpret a signed deposit as a withdraw. XDR is self-delimiting (length-prefixed vectors, variant-tagged enums) and order-preserving, matching equal_condition_sequence. Add tests for the deposit/withdraw collision and for order-sensitivity, and update the B3 docstring to describe the new encoding.
efb41c8 to
97922db
Compare
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.
Fixes audit finding B3 (informational, documentation-only). The
hash_payloaddocstring inmodules/primitives/src/lib.rscontradicted the implementation in three places; this corrects the prose to match the code. Comment-only — no code/behavior/WASM change, no version bump.Corrections
i128, impl usesto_le_bytes()).addr.to_string().to_bytes()).Rewritten as a field-by-field layout (contract bytes → per-type buckets → 4-byte LE
live_until_ledger→ sha256).Verification
modules/primitives/src/lib.rs— no code, noCargo.toml. WASM identical.cargo check -p moonlight-primitives --target wasm32v1-noneclean; file passesrustfmt.