Clarify guarantees for Hash#1870
Conversation
|
Claude finished @mootz12's task in 1m 25s —— View job Review — Clarify guarantees for
|
There was a problem hiding this comment.
Pull request overview
This PR updates Soroban SDK documentation to accurately describe what the crypto::Hash<N> type does (and does not) guarantee about byte provenance, especially across contract ABI boundaries.
Changes:
- Clarifies that
Hash<N>returned fromCrypto::sha256/Crypto::keccak256has host/SDK provenance guarantees. - Clarifies that
Hash<N>used as a general contract argument is ABI-represented asBytesN<N>, and therefore does not prove caller-supplied bytes came from a hash function. - Updates the migration guide text for
CustomAccountInterface::__check_authto describe the host-constructedsignature_payloadguarantee more precisely.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| soroban-sdk/src/crypto.rs | Refines Hash<N> rustdoc to distinguish guaranteed provenance from hash-returning APIs vs. untrusted ABI inputs. |
| soroban-sdk/src/_migrating.rs | Updates v20→v21 migration notes to clarify Hash<32> vs BytesN<32> ABI-compatibility and provenance in host-managed __check_auth. |
What
Update the
Hashdocs to clarify what guarantees the type provides.Hash<N>values returned by SDK crypto functions are produced by secure cryptographic hash functions, and host-managed__check_authreceives a host-constructed authentication payload hash. However,Hash<N>is represented at contract boundaries asBytesN<N>, so accepting it as a general contract argument does not prove that caller-supplied bytes came from a hash function.Why
The previous docs overstated the construction/provenance guarantees of
Hash<N>.Known limitations
None