Skip to content

Commit

Permalink
Move the default hasher one directory up (google#2580)
Browse files Browse the repository at this point in the history
The intermediate directory/package is empty, so move rfc6962/hasher to rfc6962.
It also used to be there previously, so this change brings backward compatibility for this
specific package back.
  • Loading branch information
pav-kv authored Jul 19, 2021
1 parent 65021e5 commit 1486ed5
Show file tree
Hide file tree
Showing 25 changed files with 29 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 20,7 @@
- `TrillianLog.QueueLeaves`
* Removed the incomplete Postgres storage backend (#1298).
* Deprecated `LogRootV1.Revision` field.
* Moved `rfc6962` hasher one directory up to eliminate empty leftover package.

### Storage refactoring
* `NodeReader.GetMerkleNodes` does not accept revisions anymore. The
Expand Down
2 changes: 1 addition & 1 deletion client/log_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 22,7 @@ import (
"time"

"github.com/google/trillian"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/testonly/integration"
"github.com/google/trillian/types"
"google.golang.org/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion client/log_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,7 @@ import (
"github.com/google/trillian"
"github.com/google/trillian/merkle/hashers"
"github.com/google/trillian/merkle/logverifier"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/types"
)

Expand Down
2 changes: 1 addition & 1 deletion client/log_verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 18,7 @@ import (
"testing"

"github.com/google/trillian"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/types"
)

Expand Down
2 changes: 1 addition & 1 deletion integration/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 30,7 @@ import (
"github.com/google/trillian/internal/merkle/inmemory"
"github.com/google/trillian/merkle/compact"
"github.com/google/trillian/merkle/logverifier"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/types"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/merkle/inmemory/merkle_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 24,7 @@ import (

_ "github.com/golang/glog"
"github.com/google/trillian/merkle/hashers"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
)

// Note test inputs came from the values used by the C code. The original
Expand Down
6 changes: 3 additions & 3 deletions log/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 25,7 @@ import (
"github.com/golang/glog"
"github.com/google/trillian"
"github.com/google/trillian/merkle/compact"
"github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/monitoring"
"github.com/google/trillian/quota"
"github.com/google/trillian/storage"
Expand Down Expand Up @@ -100,7 100,7 @@ func InitMetrics(mf monitoring.MetricFactory) {
// initCompactRangeFromStorage builds a compact range that matches the latest
// data in the database. Ensures that the root hash matches the passed in root.
func initCompactRangeFromStorage(ctx context.Context, root *types.LogRootV1, tx storage.TreeTX) (*compact.Range, error) {
fact := compact.RangeFactory{Hash: hasher.DefaultHasher.HashChildren}
fact := compact.RangeFactory{Hash: rfc6962.DefaultHasher.HashChildren}
if root.TreeSize == 0 {
return fact.NewEmptyRange(0), nil
}
Expand Down Expand Up @@ -378,7 378,7 @@ func IntegrateBatch(ctx context.Context, tree *trillian.Tree, limit int, guardWi
// Create the log root ready for signing.
if cr.End() == 0 {
// Override the nil root hash returned by the compact range.
newRoot = hasher.DefaultHasher.EmptyRoot()
newRoot = rfc6962.DefaultHasher.EmptyRoot()
}
newLogRoot = &types.LogRootV1{
RootHash: newRoot,
Expand Down
2 changes: 1 addition & 1 deletion log/sequencer_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 25,7 @@ import (
"github.com/google/trillian"
"github.com/google/trillian/extension"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/quota"
"github.com/google/trillian/storage"
stestonly "github.com/google/trillian/storage/testonly"
Expand Down
2 changes: 1 addition & 1 deletion log/sequencer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 25,7 @@ import (
"github.com/golang/mock/gomock"
"github.com/google/trillian"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/quota"
"github.com/google/trillian/storage"
"github.com/google/trillian/testonly"
Expand Down
2 changes: 1 addition & 1 deletion merkle/compact/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 26,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/merkle/testonly"

_ "github.com/golang/glog" // Required for flag handling
Expand Down
2 changes: 1 addition & 1 deletion merkle/log_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,7 @@ import (
_ "github.com/golang/glog" // Logging flags for overarching "go test" runs.
"github.com/google/go-cmp/cmp"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
)

// TestCalcInclusionProofNodeAddresses contains inclusion proof tests. For
Expand Down
2 changes: 1 addition & 1 deletion merkle/logverifier/log_verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@ import (

_ "github.com/golang/glog"
"github.com/google/trillian/internal/merkle/inmemory"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
)

type inclusionProofTestVector struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package hasher provides hashing functionality according to RFC6962.
package hasher
// Package rfc6962 provides hashing functionality according to RFC6962.
package rfc6962

import (
"crypto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hasher

package rfc6962

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion server/log_rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 24,7 @@ import (
"github.com/google/trillian/extension"
"github.com/google/trillian/merkle"
"github.com/google/trillian/merkle/hashers"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/monitoring"
"github.com/google/trillian/storage"
"github.com/google/trillian/trees"
Expand Down
2 changes: 1 addition & 1 deletion server/log_rpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 27,7 @@ import (
"github.com/google/trillian"
"github.com/google/trillian/extension"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/storage"
stestonly "github.com/google/trillian/storage/testonly"
"github.com/google/trillian/storage/tree"
Expand Down
2 changes: 1 addition & 1 deletion server/proof_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 22,7 @@ import (

"github.com/google/trillian/internal/merkle/inmemory"
"github.com/google/trillian/merkle"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/storage/testonly"
)

Expand Down
2 changes: 1 addition & 1 deletion storage/cache/subtree_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/storage/storagepb"
"github.com/google/trillian/storage/tree"

Expand Down
2 changes: 1 addition & 1 deletion storage/cloudspanner/log_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ import (
"cloud.google.com/go/spanner"
"github.com/golang/glog"
"github.com/google/trillian"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/storage"
"github.com/google/trillian/storage/cache"
"github.com/google/trillian/storage/cloudspanner/spannerpb"
Expand Down
2 changes: 1 addition & 1 deletion storage/memory/log_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 25,7 @@ import (
"github.com/google/btree"
"github.com/google/trillian"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/monitoring"
"github.com/google/trillian/storage"
"github.com/google/trillian/storage/cache"
Expand Down
2 changes: 1 addition & 1 deletion storage/mysql/log_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@ import (
"github.com/golang/glog"
"github.com/google/trillian"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/monitoring"
"github.com/google/trillian/storage"
"github.com/google/trillian/storage/cache"
Expand Down
2 changes: 1 addition & 1 deletion storage/mysql/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 29,7 @@ import (
"github.com/golang/glog"
"github.com/google/trillian"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/storage"
"github.com/google/trillian/storage/testdb"
storageto "github.com/google/trillian/storage/testonly"
Expand Down
2 changes: 1 addition & 1 deletion storage/testonly/fake_node_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,7 @@ import (

"github.com/golang/glog"
"github.com/google/trillian/merkle/compact"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/storage/tree"
)

Expand Down
2 changes: 1 addition & 1 deletion storage/tools/dump_tree/dumplib.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 32,7 @@ import (
"github.com/google/trillian/log"
"github.com/google/trillian/merkle/compact"
"github.com/google/trillian/merkle/hashers"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
"github.com/google/trillian/monitoring"
"github.com/google/trillian/quota"
"github.com/google/trillian/storage"
Expand Down
2 changes: 1 addition & 1 deletion storage/tools/hasher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@ import (
"fmt"

"github.com/golang/glog"
rfc6962 "github.com/google/trillian/merkle/rfc6962/hasher"
"github.com/google/trillian/merkle/rfc6962"
)

var base64Flag = flag.Bool("base64", false, "If true output in base64 instead of hex")
Expand Down

0 comments on commit 1486ed5

Please sign in to comment.