refactor: reuse impl_crypto_common! macro for Hash type#809
refactor: reuse impl_crypto_common! macro for Hash type#809wangzishuai1987 wants to merge 1 commit intojarchain:masterfrom
Conversation
Hash manually implemented to_hex, from_hex, and Deserialize with identical logic to the impl_crypto_common! macro used by all other crypto types. Replace the manual implementations with the shared macro, keeping only the Hash-specific methods (short_hex, ZERO, as_bytes). Contributes to jarchain#186.
Genesis ReviewComparison targets:
How to reviewPost a comment with the following format (rank from best to worst): Use the short commit hashes above and To meta-review another reviewer's comment, react with 👍 or 👎. |
|
/review Reuses the existing |
|
JAR Bot: Review recorded from @sorpaas (1 reviews, 0 meta-reviews). |
|
/review Updating to merge. Reuses the |
|
JAR Bot: Quorum reached — triggering merge. |
Summary
Contributes to #186 — eliminate code duplication across grey crates.
Hashmanually implementedto_hex,from_hex, andDeserializewith identical logic to theimpl_crypto_common!macro used by all other crypto types (Ed25519PublicKey,BlsPublicKey, etc.).Changes
to_hex/from_hexwithimpl_crypto_common!(Hash, "Hash")Deserializeimpl (now provided by macro)short_hex,ZERO,as_bytes) and customDebugTesting
All 103 grey-types tests pass. No behavior changes — pure refactoring.