From cccaf984936d4792f8b6c39e6b500ad2e3f08817 Mon Sep 17 00:00:00 2001 From: Blade Doyle Date: Wed, 31 Mar 2021 11:43:04 -0700 Subject: [PATCH] enhance comment describing how a pow is hashed (#3623) Integrate feedback from Tromp Some more feedback from Tromp readability improvement --- core/src/pow/types.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/pow/types.rs b/core/src/pow/types.rs index 1773176b5..5c0ade670 100644 --- a/core/src/pow/types.rs +++ b/core/src/pow/types.rs @@ -318,8 +318,11 @@ impl ProofOfWork { /// /// The hash of the `Proof` is the hash of its packed nonces when serializing /// them at their exact bit size. The resulting bit sequence is padded to be -/// byte-aligned. -/// +/// byte-aligned. We form a PROOFSIZE*edge_bits integer by packing the PROOFSIZE edge +/// indices together, with edge index i occupying bits i * edge_bits through +/// (i+1) * edge_bits - 1, padding it with up to 7 0-bits to a multiple of 8 bits, +/// writing as a little endian byte array, and hashing with blake2b using 256 bit digest. + #[derive(Clone, PartialOrd, PartialEq, Serialize)] pub struct Proof { /// Power of 2 used for the size of the cuckoo graph