Skip to content

Commit

Permalink
Format code according to go1.19rc2
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mhutchinson authored and AlCutter committed Aug 22, 2022
1 parent f5e1dc5 commit 4b56b44
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions compact/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions compact/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
60 changes: 30 additions & 30 deletions proof/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4b56b44

Please sign in to comment.