Skip to content

Commit

Permalink
internal/tlogx: replace NewTilesForSize with fixed upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
FiloSottile committed Mar 16, 2024
1 parent 0e8f0c2 commit 4a6a5bf
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 84 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/google/certificate-transparency-go v1.1.7
github.com/prometheus/client_golang v1.18.0
golang.org/x/crypto v0.19.0
golang.org/x/mod v0.15.0
golang.org/x/mod v0.16.1-0.20240315155916-aa51b25a4485
golang.org/x/net v0.21.0
golang.org/x/sync v0.6.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.16.1-0.20240315155916-aa51b25a4485 h1:q+SG4bdVkCi4aZRtT8t9M/gJk15iqs59Qzhm1EwPe/g=
golang.org/x/mod v0.16.1-0.20240315155916-aa51b25a4485/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/ctlog/ctlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ func (l *Log) sequencePool(ctx context.Context, p *pool) (err error) {
}

// Produce and upload new tree tiles.
tiles := tlogx.NewTilesForSize(TileHeight, l.tree.N, n)
tiles := tlog.NewTiles(TileHeight, l.tree.N, n)
for _, tile := range tiles {
tile := tile // tile is captured by the g.Go function.
data, err := tlog.ReadTileData(tile, hashReader)
Expand Down
34 changes: 0 additions & 34 deletions internal/tlogx/logx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,8 @@ import (
"unicode/utf8"

"golang.org/x/mod/sumdb/note"
"golang.org/x/mod/sumdb/tlog"
)

// NewTilesForSize is like [tlog.NewTiles] but only lists the largest partial
// tile for each coordinate.
//
// This makes only the tree of size newTreeSize retrievable, and not the trees
// of sizes oldTreeSize+1 to newTreeSize-1 (until the relevant full tiles are
// available), assuming tiles for oldTreeSize were similarly generated.
//
// NewTilesForSize also doesn't return tiles that have not grown since
// oldTreeSize; it's unclear why [tlog.NewTiles] does.
//
// Upstreamed as https://go.dev/cl/570295.
func NewTilesForSize(h int, oldTreeSize, newTreeSize int64) []tlog.Tile {
if h <= 0 {
panic(fmt.Sprintf("NewTilesForSize: invalid height %d", h))
}
var tiles []tlog.Tile
for level := 0; newTreeSize>>(h*level) > 0; level++ {
oldN := oldTreeSize >> (h * level)
newN := newTreeSize >> (h * level)
if oldN == newN {
continue
}
for n := oldN >> h; n < newN>>h; n++ {
tiles = append(tiles, tlog.Tile{H: h, L: int(level), N: n, W: 1 << h})
}
n := newN >> h
if w := int(newN - n<<h); w > 0 {
tiles = append(tiles, tlog.Tile{H: h, L: int(level), N: n, W: w})
}
}
return tiles
}

type verifier struct {
name string
hash uint32
Expand Down
46 changes: 0 additions & 46 deletions internal/tlogx/logx_test.go

This file was deleted.

0 comments on commit 4a6a5bf

Please sign in to comment.