diff --git a/compact/nodes.go b/compact/nodes.go index c53a96a..41c0854 100644 --- a/compact/nodes.go +++ b/compact/nodes.go @@ -22,11 +22,11 @@ import "math/bits" // from 0, which corresponds to the tree leaves. Within each level, nodes are // numbered with consecutive indices starting from 0. // -// L4: ┌───────0───────┐ ... -// L3: ┌───0───┐ ┌───1───┐ ┌─── ... -// L2: ┌─0─┐ ┌─1─┐ ┌─2─┐ ┌─3─┐ ┌─4─┐ ... -// L1: ┌0┐ ┌1┐ ┌2┐ ┌3┐ ┌4┐ ┌5┐ ┌6┐ ┌7┐ ┌8┐ ┌9┐ ... -// L0: 0 1 2 3 4 5 6 7 8 9 ... ... ... ... ... ... +// L4: ┌───────0───────┐ ... +// L3: ┌───0───┐ ┌───1───┐ ┌─── ... +// L2: ┌─0─┐ ┌─1─┐ ┌─2─┐ ┌─3─┐ ┌─4─┐ ... +// L1: ┌0┐ ┌1┐ ┌2┐ ┌3┐ ┌4┐ ┌5┐ ┌6┐ ┌7┐ ┌8┐ ┌9┐ ... +// L0: 0 1 2 3 4 5 6 7 8 9 ... ... ... ... ... ... // // When the tree is not perfect, the nodes that would complement it to perfect // are called ephemeral. Algorithms that operate with ephemeral nodes still map diff --git a/compact/range.go b/compact/range.go index a34c0be..0952646 100644 --- a/compact/range.go +++ b/compact/range.go @@ -234,9 +234,9 @@ func getMergePath(begin, mid, end uint64) (uint, uint) { // some integers m, k >= 0. // // The sequence of sizes is returned encoded as bitmasks left and right, where: -// - a 1 bit in a bitmask denotes a sub-range of the corresponding size 2^k -// - left mask bits in LSB-to-MSB order encode the left part of the sequence -// - right mask bits in MSB-to-LSB order encode the right part +// - a 1 bit in a bitmask denotes a sub-range of the corresponding size 2^k +// - left mask bits in LSB-to-MSB order encode the left part of the sequence +// - right mask bits in MSB-to-LSB order encode the right part // // The corresponding values of m are not returned (they can be calculated from // begin and the sub-range sizes). diff --git a/proof/proof_test.go b/proof/proof_test.go index 11aa1c1..660eede 100644 --- a/proof/proof_test.go +++ b/proof/proof_test.go @@ -26,21 +26,21 @@ import ( // TestInclusion contains inclusion proof tests. For reference, consider the // following example of a tree from RFC 6962: // -// hash <== Level 3 -// / \ -// / \ -// / \ -// / \ -// / \ -// k l <== Level 2 -// / \ / \ -// / \ / \ -// / \ / \ -// g h i [ ] <== Level 1 -// / \ / \ / \ / -// a b c d e f j <== Level 0 -// | | | | | | | -// d0 d1 d2 d3 d4 d5 d6 +// hash <== Level 3 +// / \ +// / \ +// / \ +// / \ +// / \ +// k l <== Level 2 +// / \ / \ +// / \ / \ +// / \ / \ +// g h i [ ] <== Level 1 +// / \ / \ / \ / +// a b c d e f j <== Level 0 +// | | | | | | | +// d0 d1 d2 d3 d4 d5 d6 // // Our storage node layers are always populated from the bottom up, hence the // gap at level 1, index 3 in the above picture. @@ -133,21 +133,21 @@ func TestInclusion(t *testing.T) { // TestConsistency contains consistency proof tests. For reference, consider // the following example: // -// hash5 hash7 -// / \ / \ -// / \ / \ -// / \ / \ -// / \ / \ -// / \ / \ -// k [ ] --> k l -// / \ / / \ / \ -// / \ / / \ / \ -// / \ / / \ / \ -// g h [ ] g h i [ ] -// / \ / \ / / \ / \ / \ / -// a b c d e a b c d e f j -// | | | | | | | | | | | | -// d0 d1 d2 d3 d4 d0 d1 d2 d3 d4 d5 d6 +// hash5 hash7 +// / \ / \ +// / \ / \ +// / \ / \ +// / \ / \ +// / \ / \ +// k [ ] --> k l +// / \ / / \ / \ +// / \ / / \ / \ +// / \ / / \ / \ +// g h [ ] g h i [ ] +// / \ / \ / / \ / \ / \ / +// a b c d e a b c d e f j +// | | | | | | | | | | | | +// d0 d1 d2 d3 d4 d0 d1 d2 d3 d4 d5 d6 // // The consistency proof between tree size 5 and 7 consists of nodes e, f, j, // and k. The node j is taken instead of its missing parent.