From 4b56b44844e86f3be0319a78fb7307d6dc2d6daf Mon Sep 17 00:00:00 2001 From: Martin Hutchinson Date: Wed, 27 Jul 2022 16:36:42 +0100 Subject: [PATCH] Format code according to go1.19rc2 Go formatting of docs has changed a little in 1.19: https://tip.golang.org/doc/go1.19\#go-doc. This formats the code in this repo so the docs are consistent with that. Previous versions of gofmt won't change this, and this allows old and new tooling to render the docs in increasingly better ways. Announcement for 1.19rc2: https://groups.google.com/g/golang-announce/c/czoG5UpT0EU --- compact/nodes.go | 10 ++++---- compact/range.go | 6 ++--- proof/proof_test.go | 60 ++++++++++++++++++++++----------------------- 3 files changed, 38 insertions(+), 38 deletions(-) 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.