From cc69af0b2508709f893360cd41abc7551ddac13a Mon Sep 17 00:00:00 2001 From: mhutchinson Date: Tue, 9 Nov 2021 17:27:17 +0000 Subject: [PATCH 1/4] Use the extracted merkle library The merkle library in this repo can be marked as deprecated after this. New clients would be better served by using the smaller module, especially for client-side code which will not need all the server-side dependencies that this repository has collected. --- client/log_client_test.go | 2 +- client/log_verifier.go | 2 +- client/log_verifier_test.go | 2 +- docs/merkletree/treetex/main.go | 2 +- go.mod | 1 + go.sum | 2 ++ integration/log.go | 4 ++-- internal/merkle/inmemory/merkle_tree_test.go | 2 +- log/sequencer.go | 4 ++-- log/sequencer_manager_test.go | 4 ++-- log/sequencer_test.go | 4 ++-- merkle/compact/range_test.go | 2 +- merkle/log_proofs.go | 2 +- merkle/log_proofs_test.go | 4 ++-- merkle/logverifier/log_verifier_test.go | 2 +- server/log_rpc_server.go | 2 +- server/log_rpc_server_test.go | 4 ++-- server/proof_fetcher.go | 2 +- server/proof_fetcher_test.go | 2 +- storage/cache/layout.go | 2 +- storage/cache/layout_test.go | 2 +- storage/cache/log_tile.go | 2 +- storage/cache/subtree_cache.go | 2 +- storage/cache/subtree_cache_test.go | 4 ++-- storage/cloudspanner/log_storage.go | 2 +- storage/cloudspanner/tree_storage.go | 2 +- storage/log_storage.go | 2 +- storage/memory/log_storage.go | 4 ++-- storage/mock_storage.go | 2 +- storage/mysql/log_storage.go | 4 ++-- storage/mysql/storage_test.go | 4 ++-- storage/testonly/fake_node_reader.go | 4 ++-- storage/tools/dump_tree/dumplib.go | 4 ++-- storage/tools/hasher/main.go | 2 +- storage/tree/node.go | 2 +- 35 files changed, 48 insertions(+), 45 deletions(-) diff --git a/client/log_client_test.go b/client/log_client_test.go index 0cdbc03688..8b9b8cedce 100644 --- a/client/log_client_test.go +++ b/client/log_client_test.go @@ -22,7 +22,7 @@ import ( "time" "github.com/google/trillian" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/testonly/integration" "github.com/google/trillian/types" "google.golang.org/protobuf/proto" diff --git a/client/log_verifier.go b/client/log_verifier.go index b9df35918b..f3503559a7 100644 --- a/client/log_verifier.go +++ b/client/log_verifier.go @@ -21,7 +21,7 @@ import ( "github.com/google/trillian" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/merkle/logverifier" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/types" ) diff --git a/client/log_verifier_test.go b/client/log_verifier_test.go index 3e1b9ee5ae..5bc80e9fca 100644 --- a/client/log_verifier_test.go +++ b/client/log_verifier_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/google/trillian" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/types" ) diff --git a/docs/merkletree/treetex/main.go b/docs/merkletree/treetex/main.go index f3ba96c98c..f9931b42c3 100644 --- a/docs/merkletree/treetex/main.go +++ b/docs/merkletree/treetex/main.go @@ -30,7 +30,7 @@ import ( "strings" "github.com/google/trillian/merkle" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" ) const ( diff --git a/go.mod b/go.mod index 56df47ffed..2bbde04b29 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,7 @@ require ( github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_model v0.2.0 github.com/pseudomuto/protoc-gen-doc v1.5.0 + github.com/transparency-dev/merkle v0.0.0-20211104134637-a76aeeada497 // indirect go.etcd.io/etcd/client/v3 v3.5.1 go.etcd.io/etcd/etcdctl/v3 v3.5.1 go.etcd.io/etcd/server/v3 v3.5.1 diff --git a/go.sum b/go.sum index 84a83450f0..eb6161fdcd 100644 --- a/go.sum +++ b/go.sum @@ -776,6 +776,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= +github.com/transparency-dev/merkle v0.0.0-20211104134637-a76aeeada497 h1:Kxv0z2YAoKxSpObcgBCyxwaPS06OExH16EB+anCe4Tg= +github.com/transparency-dev/merkle v0.0.0-20211104134637-a76aeeada497/go.mod h1:B8FIw5LTq6DaULoHsVFRzYIUDkl8yuSwCdZnOZGKL/A= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= diff --git a/integration/log.go b/integration/log.go index 8443b2365c..b658a203e3 100644 --- a/integration/log.go +++ b/integration/log.go @@ -28,9 +28,9 @@ import ( "github.com/google/trillian" "github.com/google/trillian/client/backoff" "github.com/google/trillian/internal/merkle/inmemory" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/logverifier" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/types" ) diff --git a/internal/merkle/inmemory/merkle_tree_test.go b/internal/merkle/inmemory/merkle_tree_test.go index 49775c5ec1..31f040aaa8 100644 --- a/internal/merkle/inmemory/merkle_tree_test.go +++ b/internal/merkle/inmemory/merkle_tree_test.go @@ -24,7 +24,7 @@ import ( _ "github.com/golang/glog" "github.com/google/trillian/merkle/hashers" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" ) // Note test inputs came from the values used by the C++ code. The original diff --git a/log/sequencer.go b/log/sequencer.go index a5453ac7c6..73c0a2e7bd 100644 --- a/log/sequencer.go +++ b/log/sequencer.go @@ -24,8 +24,8 @@ import ( "github.com/golang/glog" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/quota" "github.com/google/trillian/storage" diff --git a/log/sequencer_manager_test.go b/log/sequencer_manager_test.go index 55535953aa..d4d38cab04 100644 --- a/log/sequencer_manager_test.go +++ b/log/sequencer_manager_test.go @@ -24,8 +24,8 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/trillian" "github.com/google/trillian/extension" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/quota" "github.com/google/trillian/storage" stestonly "github.com/google/trillian/storage/testonly" diff --git a/log/sequencer_test.go b/log/sequencer_test.go index 4ff887dff7..8e40a00c06 100644 --- a/log/sequencer_test.go +++ b/log/sequencer_test.go @@ -24,8 +24,8 @@ import ( "github.com/golang/mock/gomock" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/quota" "github.com/google/trillian/storage" "github.com/google/trillian/testonly" diff --git a/merkle/compact/range_test.go b/merkle/compact/range_test.go index a1021bcf8e..f40548ecf0 100644 --- a/merkle/compact/range_test.go +++ b/merkle/compact/range_test.go @@ -26,7 +26,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/merkle/testonly" _ "github.com/golang/glog" // Required for flag handling diff --git a/merkle/log_proofs.go b/merkle/log_proofs.go index 84d1fd6092..122f687b19 100644 --- a/merkle/log_proofs.go +++ b/merkle/log_proofs.go @@ -18,7 +18,7 @@ import ( "errors" "math/bits" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/merkle/log_proofs_test.go b/merkle/log_proofs_test.go index d10ee8035e..7b30711cd8 100644 --- a/merkle/log_proofs_test.go +++ b/merkle/log_proofs_test.go @@ -20,8 +20,8 @@ import ( _ "github.com/golang/glog" // Logging flags for overarching "go test" runs. "github.com/google/go-cmp/cmp" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" ) // TestCalcInclusionProofNodeAddresses contains inclusion proof tests. For diff --git a/merkle/logverifier/log_verifier_test.go b/merkle/logverifier/log_verifier_test.go index 0ba28ab08b..20636a45aa 100644 --- a/merkle/logverifier/log_verifier_test.go +++ b/merkle/logverifier/log_verifier_test.go @@ -23,7 +23,7 @@ import ( _ "github.com/golang/glog" "github.com/google/trillian/internal/merkle/inmemory" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" ) type inclusionProofTestVector struct { diff --git a/server/log_rpc_server.go b/server/log_rpc_server.go index 65395878da..d4a05754d2 100644 --- a/server/log_rpc_server.go +++ b/server/log_rpc_server.go @@ -24,7 +24,7 @@ import ( "github.com/google/trillian/extension" "github.com/google/trillian/merkle" "github.com/google/trillian/merkle/hashers" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/trees" diff --git a/server/log_rpc_server_test.go b/server/log_rpc_server_test.go index 3c48d87dea..b6408aafef 100644 --- a/server/log_rpc_server_test.go +++ b/server/log_rpc_server_test.go @@ -26,8 +26,8 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/trillian" "github.com/google/trillian/extension" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage" stestonly "github.com/google/trillian/storage/testonly" "github.com/google/trillian/storage/tree" diff --git a/server/proof_fetcher.go b/server/proof_fetcher.go index 3ba75f22f5..cf91cb49b2 100644 --- a/server/proof_fetcher.go +++ b/server/proof_fetcher.go @@ -20,7 +20,7 @@ import ( "github.com/google/trillian" "github.com/google/trillian/merkle" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/tree" ) diff --git a/server/proof_fetcher_test.go b/server/proof_fetcher_test.go index 35b3ee15b2..a603bc16f2 100644 --- a/server/proof_fetcher_test.go +++ b/server/proof_fetcher_test.go @@ -22,7 +22,7 @@ import ( "github.com/google/trillian/internal/merkle/inmemory" "github.com/google/trillian/merkle" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage/testonly" ) diff --git a/storage/cache/layout.go b/storage/cache/layout.go index 4257ce62e3..76524aa1cf 100644 --- a/storage/cache/layout.go +++ b/storage/cache/layout.go @@ -17,7 +17,7 @@ package cache import ( "encoding/binary" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" ) // getTileID returns the path from the "virtual" root at level 64 to the root diff --git a/storage/cache/layout_test.go b/storage/cache/layout_test.go index 4b6eb2b258..b66f0ac881 100644 --- a/storage/cache/layout_test.go +++ b/storage/cache/layout_test.go @@ -19,7 +19,7 @@ import ( "fmt" "testing" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" ) func TestGetTileID(t *testing.T) { diff --git a/storage/cache/log_tile.go b/storage/cache/log_tile.go index 6cc6f02078..c191d0853d 100644 --- a/storage/cache/log_tile.go +++ b/storage/cache/log_tile.go @@ -18,7 +18,7 @@ import ( "encoding/binary" "fmt" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/storagepb" ) diff --git a/storage/cache/subtree_cache.go b/storage/cache/subtree_cache.go index 433cd4c058..f1b75df5db 100644 --- a/storage/cache/subtree_cache.go +++ b/storage/cache/subtree_cache.go @@ -20,7 +20,7 @@ import ( "fmt" "sync" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/storage/tree" diff --git a/storage/cache/subtree_cache_test.go b/storage/cache/subtree_cache_test.go index c1a0a9aaa8..bedfd265d5 100644 --- a/storage/cache/subtree_cache_test.go +++ b/storage/cache/subtree_cache_test.go @@ -20,8 +20,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/storage/tree" diff --git a/storage/cloudspanner/log_storage.go b/storage/cloudspanner/log_storage.go index 624833092c..b03564717f 100644 --- a/storage/cloudspanner/log_storage.go +++ b/storage/cloudspanner/log_storage.go @@ -28,7 +28,7 @@ import ( "cloud.google.com/go/spanner" "github.com/golang/glog" "github.com/google/trillian" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" "github.com/google/trillian/storage/cloudspanner/spannerpb" diff --git a/storage/cloudspanner/tree_storage.go b/storage/cloudspanner/tree_storage.go index 1f68d67a62..919111a027 100644 --- a/storage/cloudspanner/tree_storage.go +++ b/storage/cloudspanner/tree_storage.go @@ -25,7 +25,7 @@ import ( "cloud.google.com/go/spanner" "github.com/golang/glog" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" "github.com/google/trillian/storage/cloudspanner/spannerpb" diff --git a/storage/log_storage.go b/storage/log_storage.go index d6f0c46a90..4b1e3f1bd5 100644 --- a/storage/log_storage.go +++ b/storage/log_storage.go @@ -19,7 +19,7 @@ import ( "time" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/storage/tree" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/storage/memory/log_storage.go b/storage/memory/log_storage.go index 1926785eee..b334e55cd1 100644 --- a/storage/memory/log_storage.go +++ b/storage/memory/log_storage.go @@ -24,8 +24,8 @@ import ( "github.com/google/btree" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" diff --git a/storage/mock_storage.go b/storage/mock_storage.go index 49ae381e8f..1a37fdb8c9 100644 --- a/storage/mock_storage.go +++ b/storage/mock_storage.go @@ -11,7 +11,7 @@ import ( gomock "github.com/golang/mock/gomock" trillian "github.com/google/trillian" - compact "github.com/google/trillian/merkle/compact" + compact "github.com/transparency-dev/merkle/compact" tree "github.com/google/trillian/storage/tree" ) diff --git a/storage/mysql/log_storage.go b/storage/mysql/log_storage.go index 19295f391f..cdc3593565 100644 --- a/storage/mysql/log_storage.go +++ b/storage/mysql/log_storage.go @@ -27,8 +27,8 @@ import ( "github.com/golang/glog" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" diff --git a/storage/mysql/storage_test.go b/storage/mysql/storage_test.go index 4c3df7364c..489977a0a6 100644 --- a/storage/mysql/storage_test.go +++ b/storage/mysql/storage_test.go @@ -28,8 +28,8 @@ import ( "github.com/golang/glog" "github.com/google/trillian" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage" "github.com/google/trillian/storage/testdb" storageto "github.com/google/trillian/storage/testonly" diff --git a/storage/testonly/fake_node_reader.go b/storage/testonly/fake_node_reader.go index d65946d997..7e8ec85fd2 100644 --- a/storage/testonly/fake_node_reader.go +++ b/storage/testonly/fake_node_reader.go @@ -20,8 +20,8 @@ import ( "fmt" "github.com/golang/glog" - "github.com/google/trillian/merkle/compact" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage/tree" ) diff --git a/storage/tools/dump_tree/dumplib.go b/storage/tools/dump_tree/dumplib.go index d306c7eb9b..8b7b1c341a 100644 --- a/storage/tools/dump_tree/dumplib.go +++ b/storage/tools/dump_tree/dumplib.go @@ -30,9 +30,9 @@ import ( "github.com/golang/glog" "github.com/google/trillian" "github.com/google/trillian/log" - "github.com/google/trillian/merkle/compact" + "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/quota" "github.com/google/trillian/storage" diff --git a/storage/tools/hasher/main.go b/storage/tools/hasher/main.go index 51fd14c1c9..8ee270a30c 100644 --- a/storage/tools/hasher/main.go +++ b/storage/tools/hasher/main.go @@ -23,7 +23,7 @@ import ( "fmt" "github.com/golang/glog" - "github.com/google/trillian/merkle/rfc6962" + "github.com/transparency-dev/merkle/rfc6962" ) var base64Flag = flag.Bool("base64", false, "If true output in base64 instead of hex") diff --git a/storage/tree/node.go b/storage/tree/node.go index 97cb1db36b..107c49c2c8 100644 --- a/storage/tree/node.go +++ b/storage/tree/node.go @@ -15,7 +15,7 @@ // Package tree defines types that help navigating a tree in storage. package tree -import "github.com/google/trillian/merkle/compact" +import "github.com/transparency-dev/merkle/compact" // Node represents a single node in a Merkle tree. type Node struct { From b30c65018e2ded2d615c3b80de6742e5c8a3ecea Mon Sep 17 00:00:00 2001 From: mhutchinson Date: Thu, 11 Nov 2021 09:48:28 +0000 Subject: [PATCH 2/4] gofmt --- client/log_client_test.go | 2 +- client/log_verifier.go | 2 +- client/log_verifier_test.go | 2 +- integration/log.go | 4 ++-- log/sequencer.go | 4 ++-- log/sequencer_manager_test.go | 4 ++-- log/sequencer_test.go | 4 ++-- merkle/compact/range_test.go | 2 +- server/log_rpc_server.go | 2 +- server/log_rpc_server_test.go | 4 ++-- server/proof_fetcher.go | 2 +- server/proof_fetcher_test.go | 2 +- storage/cache/log_tile.go | 2 +- storage/cache/subtree_cache.go | 2 +- storage/cache/subtree_cache_test.go | 4 ++-- storage/cloudspanner/log_storage.go | 2 +- storage/cloudspanner/tree_storage.go | 2 +- storage/log_storage.go | 2 +- storage/memory/log_storage.go | 4 ++-- storage/mock_storage.go | 2 +- storage/mysql/log_storage.go | 4 ++-- storage/mysql/storage_test.go | 4 ++-- storage/testonly/fake_node_reader.go | 2 +- storage/tools/dump_tree/dumplib.go | 4 ++-- 24 files changed, 34 insertions(+), 34 deletions(-) diff --git a/client/log_client_test.go b/client/log_client_test.go index 8b9b8cedce..7c35af8bd2 100644 --- a/client/log_client_test.go +++ b/client/log_client_test.go @@ -22,9 +22,9 @@ import ( "time" "github.com/google/trillian" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/testonly/integration" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/protobuf/proto" "github.com/google/trillian/storage/testdb" diff --git a/client/log_verifier.go b/client/log_verifier.go index f3503559a7..5745165ec2 100644 --- a/client/log_verifier.go +++ b/client/log_verifier.go @@ -21,8 +21,8 @@ import ( "github.com/google/trillian" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/merkle/logverifier" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/rfc6962" ) // LogVerifier allows verification of output from Trillian Logs, both regular diff --git a/client/log_verifier_test.go b/client/log_verifier_test.go index 5bc80e9fca..8cd1edeb8d 100644 --- a/client/log_verifier_test.go +++ b/client/log_verifier_test.go @@ -18,8 +18,8 @@ import ( "testing" "github.com/google/trillian" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/rfc6962" ) func TestVerifyRootErrors(t *testing.T) { diff --git a/integration/log.go b/integration/log.go index b658a203e3..cb63cbcc3b 100644 --- a/integration/log.go +++ b/integration/log.go @@ -28,10 +28,10 @@ import ( "github.com/google/trillian" "github.com/google/trillian/client/backoff" "github.com/google/trillian/internal/merkle/inmemory" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/logverifier" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" ) // TestParameters bundles up all the settings for a test run diff --git a/log/sequencer.go b/log/sequencer.go index 73c0a2e7bd..27dc75199b 100644 --- a/log/sequencer.go +++ b/log/sequencer.go @@ -24,14 +24,14 @@ import ( "github.com/golang/glog" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/quota" "github.com/google/trillian/storage" "github.com/google/trillian/storage/tree" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/log/sequencer_manager_test.go b/log/sequencer_manager_test.go index d4d38cab04..3c51649a15 100644 --- a/log/sequencer_manager_test.go +++ b/log/sequencer_manager_test.go @@ -24,8 +24,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/trillian" "github.com/google/trillian/extension" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/quota" "github.com/google/trillian/storage" stestonly "github.com/google/trillian/storage/testonly" @@ -33,6 +31,8 @@ import ( "github.com/google/trillian/testonly" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/protobuf/proto" ) diff --git a/log/sequencer_test.go b/log/sequencer_test.go index 8e40a00c06..a93e671bec 100644 --- a/log/sequencer_test.go +++ b/log/sequencer_test.go @@ -24,13 +24,13 @@ import ( "github.com/golang/mock/gomock" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/quota" "github.com/google/trillian/storage" "github.com/google/trillian/testonly" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" stestonly "github.com/google/trillian/storage/testonly" "github.com/google/trillian/storage/tree" diff --git a/merkle/compact/range_test.go b/merkle/compact/range_test.go index f40548ecf0..69d965d11f 100644 --- a/merkle/compact/range_test.go +++ b/merkle/compact/range_test.go @@ -26,8 +26,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/merkle/testonly" + "github.com/transparency-dev/merkle/rfc6962" _ "github.com/golang/glog" // Required for flag handling ) diff --git a/server/log_rpc_server.go b/server/log_rpc_server.go index d4a05754d2..aad464fd3e 100644 --- a/server/log_rpc_server.go +++ b/server/log_rpc_server.go @@ -24,12 +24,12 @@ import ( "github.com/google/trillian/extension" "github.com/google/trillian/merkle" "github.com/google/trillian/merkle/hashers" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/trees" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/server/log_rpc_server_test.go b/server/log_rpc_server_test.go index b6408aafef..b76d0a3637 100644 --- a/server/log_rpc_server_test.go +++ b/server/log_rpc_server_test.go @@ -26,13 +26,13 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/trillian" "github.com/google/trillian/extension" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage" stestonly "github.com/google/trillian/storage/testonly" "github.com/google/trillian/storage/tree" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/genproto/googleapis/rpc/code" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/server/proof_fetcher.go b/server/proof_fetcher.go index cf91cb49b2..3637fdf82f 100644 --- a/server/proof_fetcher.go +++ b/server/proof_fetcher.go @@ -20,9 +20,9 @@ import ( "github.com/google/trillian" "github.com/google/trillian/merkle" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle/compact" ) // nodeReader provides read-only access to the tree nodes. diff --git a/server/proof_fetcher_test.go b/server/proof_fetcher_test.go index a603bc16f2..0c8feec057 100644 --- a/server/proof_fetcher_test.go +++ b/server/proof_fetcher_test.go @@ -22,8 +22,8 @@ import ( "github.com/google/trillian/internal/merkle/inmemory" "github.com/google/trillian/merkle" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage/testonly" + "github.com/transparency-dev/merkle/rfc6962" ) // An arbitrary tree revision to be used in tests. diff --git a/storage/cache/log_tile.go b/storage/cache/log_tile.go index c191d0853d..5264bcd28d 100644 --- a/storage/cache/log_tile.go +++ b/storage/cache/log_tile.go @@ -18,9 +18,9 @@ import ( "encoding/binary" "fmt" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/storagepb" + "github.com/transparency-dev/merkle/compact" ) const ( diff --git a/storage/cache/subtree_cache.go b/storage/cache/subtree_cache.go index f1b75df5db..28e080d089 100644 --- a/storage/cache/subtree_cache.go +++ b/storage/cache/subtree_cache.go @@ -20,10 +20,10 @@ import ( "fmt" "sync" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle/compact" "google.golang.org/protobuf/proto" ) diff --git a/storage/cache/subtree_cache_test.go b/storage/cache/subtree_cache_test.go index bedfd265d5..ea567eebb6 100644 --- a/storage/cache/subtree_cache_test.go +++ b/storage/cache/subtree_cache_test.go @@ -20,10 +20,10 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "github.com/golang/mock/gomock" ) diff --git a/storage/cloudspanner/log_storage.go b/storage/cloudspanner/log_storage.go index b03564717f..8a593a9054 100644 --- a/storage/cloudspanner/log_storage.go +++ b/storage/cloudspanner/log_storage.go @@ -28,11 +28,11 @@ import ( "cloud.google.com/go/spanner" "github.com/golang/glog" "github.com/google/trillian" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" "github.com/google/trillian/storage/cloudspanner/spannerpb" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/rfc6962" "go.opencensus.io/trace" "golang.org/x/sync/semaphore" "google.golang.org/grpc/codes" diff --git a/storage/cloudspanner/tree_storage.go b/storage/cloudspanner/tree_storage.go index 919111a027..11091a11aa 100644 --- a/storage/cloudspanner/tree_storage.go +++ b/storage/cloudspanner/tree_storage.go @@ -25,12 +25,12 @@ import ( "cloud.google.com/go/spanner" "github.com/golang/glog" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" "github.com/google/trillian/storage/cloudspanner/spannerpb" "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle/compact" "golang.org/x/sync/errgroup" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/storage/log_storage.go b/storage/log_storage.go index 4b1e3f1bd5..8f5ce03398 100644 --- a/storage/log_storage.go +++ b/storage/log_storage.go @@ -19,8 +19,8 @@ import ( "time" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle/compact" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/storage/memory/log_storage.go b/storage/memory/log_storage.go index b334e55cd1..13c0daaa84 100644 --- a/storage/memory/log_storage.go +++ b/storage/memory/log_storage.go @@ -24,13 +24,13 @@ import ( "github.com/google/btree" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" stree "github.com/google/trillian/storage/tree" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/storage/mock_storage.go b/storage/mock_storage.go index 1a37fdb8c9..f0757133bb 100644 --- a/storage/mock_storage.go +++ b/storage/mock_storage.go @@ -11,8 +11,8 @@ import ( gomock "github.com/golang/mock/gomock" trillian "github.com/google/trillian" - compact "github.com/transparency-dev/merkle/compact" tree "github.com/google/trillian/storage/tree" + compact "github.com/transparency-dev/merkle/compact" ) // MockAdminStorage is a mock of AdminStorage interface. diff --git a/storage/mysql/log_storage.go b/storage/mysql/log_storage.go index cdc3593565..280b3a3aff 100644 --- a/storage/mysql/log_storage.go +++ b/storage/mysql/log_storage.go @@ -27,13 +27,13 @@ import ( "github.com/golang/glog" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/storage/cache" "github.com/google/trillian/storage/tree" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/storage/mysql/storage_test.go b/storage/mysql/storage_test.go index 489977a0a6..bfb65d32f5 100644 --- a/storage/mysql/storage_test.go +++ b/storage/mysql/storage_test.go @@ -28,13 +28,13 @@ import ( "github.com/golang/glog" "github.com/google/trillian" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/storage" "github.com/google/trillian/storage/testdb" storageto "github.com/google/trillian/storage/testonly" stree "github.com/google/trillian/storage/tree" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" ) func TestNodeRoundTrip(t *testing.T) { diff --git a/storage/testonly/fake_node_reader.go b/storage/testonly/fake_node_reader.go index 7e8ec85fd2..f4eeff4a11 100644 --- a/storage/testonly/fake_node_reader.go +++ b/storage/testonly/fake_node_reader.go @@ -20,9 +20,9 @@ import ( "fmt" "github.com/golang/glog" + "github.com/google/trillian/storage/tree" "github.com/transparency-dev/merkle/compact" "github.com/transparency-dev/merkle/rfc6962" - "github.com/google/trillian/storage/tree" ) // This is a fake implementation of a NodeReader intended for use in testing Merkle path code. diff --git a/storage/tools/dump_tree/dumplib.go b/storage/tools/dump_tree/dumplib.go index 8b7b1c341a..40efa102c7 100644 --- a/storage/tools/dump_tree/dumplib.go +++ b/storage/tools/dump_tree/dumplib.go @@ -30,9 +30,7 @@ import ( "github.com/golang/glog" "github.com/google/trillian" "github.com/google/trillian/log" - "github.com/transparency-dev/merkle/compact" "github.com/google/trillian/merkle/hashers" - "github.com/transparency-dev/merkle/rfc6962" "github.com/google/trillian/monitoring" "github.com/google/trillian/quota" "github.com/google/trillian/storage" @@ -41,6 +39,8 @@ import ( "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle/compact" + "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/durationpb" From 883b66d135a8a29446a74a720119a9a3597dcce4 Mon Sep 17 00:00:00 2001 From: mhutchinson Date: Thu, 11 Nov 2021 10:46:30 +0000 Subject: [PATCH 3/4] Use more migrated code, but not in merkle packages --- client/log_verifier.go | 11 +++++------ docs/merkletree/treetex/main.go | 2 +- go.mod | 2 +- integration/log.go | 6 +++--- internal/merkle/inmemory/merkle_tree_test.go | 2 +- merkle/compact/range_test.go | 2 +- merkle/log_proofs.go | 2 +- merkle/log_proofs_test.go | 4 ++-- merkle/logverifier/log_verifier_test.go | 2 +- server/log_rpc_server.go | 11 +++++------ server/proof_fetcher.go | 5 ++--- server/proof_fetcher_test.go | 2 +- server/validate.go | 6 +++--- storage/cache/log_tile.go | 4 ++-- storage/cache/subtree_cache.go | 6 +++--- storage/tools/dump_tree/dumplib.go | 6 +++--- 16 files changed, 35 insertions(+), 38 deletions(-) diff --git a/client/log_verifier.go b/client/log_verifier.go index 5745165ec2..8153125f9a 100644 --- a/client/log_verifier.go +++ b/client/log_verifier.go @@ -19,9 +19,8 @@ import ( "fmt" "github.com/google/trillian" - "github.com/google/trillian/merkle/hashers" - "github.com/google/trillian/merkle/logverifier" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/rfc6962" ) @@ -30,15 +29,15 @@ import ( // after construction). type LogVerifier struct { // hasher is the hash strategy used to compute nodes in the Merkle tree. - hasher hashers.LogHasher - v logverifier.LogVerifier + hasher merkle.LogHasher + v merkle.LogVerifier } // NewLogVerifier returns an object that can verify output from Trillian Logs. -func NewLogVerifier(hasher hashers.LogHasher) *LogVerifier { +func NewLogVerifier(hasher merkle.LogHasher) *LogVerifier { return &LogVerifier{ hasher: hasher, - v: logverifier.New(hasher), + v: merkle.NewLogVerifier(hasher), } } diff --git a/docs/merkletree/treetex/main.go b/docs/merkletree/treetex/main.go index f9931b42c3..f3ba96c98c 100644 --- a/docs/merkletree/treetex/main.go +++ b/docs/merkletree/treetex/main.go @@ -30,7 +30,7 @@ import ( "strings" "github.com/google/trillian/merkle" - "github.com/transparency-dev/merkle/compact" + "github.com/google/trillian/merkle/compact" ) const ( diff --git a/go.mod b/go.mod index 2bbde04b29..20d0978dfa 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_model v0.2.0 github.com/pseudomuto/protoc-gen-doc v1.5.0 - github.com/transparency-dev/merkle v0.0.0-20211104134637-a76aeeada497 // indirect + github.com/transparency-dev/merkle v0.0.0-20211104134637-a76aeeada497 go.etcd.io/etcd/client/v3 v3.5.1 go.etcd.io/etcd/etcdctl/v3 v3.5.1 go.etcd.io/etcd/server/v3 v3.5.1 diff --git a/integration/log.go b/integration/log.go index cb63cbcc3b..5afe9736d1 100644 --- a/integration/log.go +++ b/integration/log.go @@ -28,8 +28,8 @@ import ( "github.com/google/trillian" "github.com/google/trillian/client/backoff" "github.com/google/trillian/internal/merkle/inmemory" - "github.com/google/trillian/merkle/logverifier" "github.com/google/trillian/types" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/compact" "github.com/transparency-dev/merkle/rfc6962" ) @@ -466,7 +466,7 @@ func checkInclusionProofsAtIndex(index int64, logID int64, tree *inmemory.Merkle // Verify inclusion proof. root := tree.RootAtSnapshot(treeSize).Hash() - verifier := logverifier.New(rfc6962.DefaultHasher) + verifier := merkle.NewLogVerifier(rfc6962.DefaultHasher) // Offset by 1 to make up for C++ / Go implementation differences. merkleLeafHash := tree.LeafHash(index + 1) if err := verifier.VerifyInclusionProof(index, treeSize, resp.Proof.Hashes, root, merkleLeafHash); err != nil { @@ -503,7 +503,7 @@ func checkConsistencyProof(consistParams consistencyProofParams, treeID int64, t return fmt.Errorf("requested tree size %d > available tree size %d", req.SecondTreeSize, root.TreeSize) } - verifier := logverifier.New(rfc6962.DefaultHasher) + verifier := merkle.NewLogVerifier(rfc6962.DefaultHasher) root1 := tree.RootAtSnapshot(req.FirstTreeSize).Hash() root2 := tree.RootAtSnapshot(req.SecondTreeSize).Hash() return verifier.VerifyConsistencyProof(req.FirstTreeSize, req.SecondTreeSize, diff --git a/internal/merkle/inmemory/merkle_tree_test.go b/internal/merkle/inmemory/merkle_tree_test.go index 31f040aaa8..49775c5ec1 100644 --- a/internal/merkle/inmemory/merkle_tree_test.go +++ b/internal/merkle/inmemory/merkle_tree_test.go @@ -24,7 +24,7 @@ import ( _ "github.com/golang/glog" "github.com/google/trillian/merkle/hashers" - "github.com/transparency-dev/merkle/rfc6962" + "github.com/google/trillian/merkle/rfc6962" ) // Note test inputs came from the values used by the C++ code. The original diff --git a/merkle/compact/range_test.go b/merkle/compact/range_test.go index 69d965d11f..a1021bcf8e 100644 --- a/merkle/compact/range_test.go +++ b/merkle/compact/range_test.go @@ -26,8 +26,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/google/trillian/merkle/rfc6962" "github.com/google/trillian/merkle/testonly" - "github.com/transparency-dev/merkle/rfc6962" _ "github.com/golang/glog" // Required for flag handling ) diff --git a/merkle/log_proofs.go b/merkle/log_proofs.go index 122f687b19..84d1fd6092 100644 --- a/merkle/log_proofs.go +++ b/merkle/log_proofs.go @@ -18,7 +18,7 @@ import ( "errors" "math/bits" - "github.com/transparency-dev/merkle/compact" + "github.com/google/trillian/merkle/compact" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/merkle/log_proofs_test.go b/merkle/log_proofs_test.go index 7b30711cd8..d10ee8035e 100644 --- a/merkle/log_proofs_test.go +++ b/merkle/log_proofs_test.go @@ -20,8 +20,8 @@ import ( _ "github.com/golang/glog" // Logging flags for overarching "go test" runs. "github.com/google/go-cmp/cmp" - "github.com/transparency-dev/merkle/compact" - "github.com/transparency-dev/merkle/rfc6962" + "github.com/google/trillian/merkle/compact" + "github.com/google/trillian/merkle/rfc6962" ) // TestCalcInclusionProofNodeAddresses contains inclusion proof tests. For diff --git a/merkle/logverifier/log_verifier_test.go b/merkle/logverifier/log_verifier_test.go index 20636a45aa..0ba28ab08b 100644 --- a/merkle/logverifier/log_verifier_test.go +++ b/merkle/logverifier/log_verifier_test.go @@ -23,7 +23,7 @@ import ( _ "github.com/golang/glog" "github.com/google/trillian/internal/merkle/inmemory" - "github.com/transparency-dev/merkle/rfc6962" + "github.com/google/trillian/merkle/rfc6962" ) type inclusionProofTestVector struct { diff --git a/server/log_rpc_server.go b/server/log_rpc_server.go index aad464fd3e..a510a38263 100644 --- a/server/log_rpc_server.go +++ b/server/log_rpc_server.go @@ -22,13 +22,12 @@ import ( "github.com/golang/glog" "github.com/google/trillian" "github.com/google/trillian/extension" - "github.com/google/trillian/merkle" - "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/monitoring" "github.com/google/trillian/storage" "github.com/google/trillian/trees" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -120,7 +119,7 @@ func (t *TrillianLogRPCServer) QueueLeaf(ctx context.Context, req *trillian.Queu return &trillian.QueueLeafResponse{QueuedLeaf: ret[0]}, nil } -func hashLeaves(leaves []*trillian.LogLeaf, hasher hashers.LogHasher) { +func hashLeaves(leaves []*trillian.LogLeaf, hasher merkle.LogHasher) { for _, leaf := range leaves { leaf.MerkleLeafHash = hasher.HashLeaf(leaf.LeafValue) if len(leaf.LeafIdentityHash) == 0 { @@ -398,7 +397,7 @@ func (t *TrillianLogRPCServer) GetLatestSignedLogRoot(ctx context.Context, req * return r, nil } -func tryGetConsistencyProof(ctx context.Context, firstTreeSize, secondTreeSize int64, tx storage.ReadOnlyLogTreeTX, hasher hashers.LogHasher) (*trillian.Proof, error) { +func tryGetConsistencyProof(ctx context.Context, firstTreeSize, secondTreeSize int64, tx storage.ReadOnlyLogTreeTX, hasher merkle.LogHasher) (*trillian.Proof, error) { nodeFetches, err := merkle.CalcConsistencyProofNodeAddresses(firstTreeSize, secondTreeSize) if err != nil { return nil, err @@ -545,7 +544,7 @@ func (t *TrillianLogRPCServer) closeAndLog(ctx context.Context, logID int64, tx // getInclusionProofForLeafIndex is used by multiple handlers. It does the storage fetching // and makes additional checks on the returned proof. Returns a Proof suitable for inclusion in // an RPC response -func getInclusionProofForLeafIndex(ctx context.Context, tx storage.ReadOnlyLogTreeTX, hasher hashers.LogHasher, size, leafIndex int64) (*trillian.Proof, error) { +func getInclusionProofForLeafIndex(ctx context.Context, tx storage.ReadOnlyLogTreeTX, hasher merkle.LogHasher, size, leafIndex int64) (*trillian.Proof, error) { // We have the tree size and leaf index so we know the nodes that we need to serve the proof proofNodeIDs, err := merkle.CalcInclusionProofNodeAddresses(size, leafIndex) if err != nil { @@ -554,7 +553,7 @@ func getInclusionProofForLeafIndex(ctx context.Context, tx storage.ReadOnlyLogTr return fetchNodesAndBuildProof(ctx, tx, hasher, leafIndex, proofNodeIDs) } -func (t *TrillianLogRPCServer) getTreeAndHasher(ctx context.Context, treeID int64, opts trees.GetOpts) (*trillian.Tree, hashers.LogHasher, error) { +func (t *TrillianLogRPCServer) getTreeAndHasher(ctx context.Context, treeID int64, opts trees.GetOpts) (*trillian.Tree, merkle.LogHasher, error) { tree, err := trees.GetTree(ctx, t.registry.AdminStorage, treeID, opts) if err != nil { return nil, nil, err diff --git a/server/proof_fetcher.go b/server/proof_fetcher.go index 3637fdf82f..3665ef7472 100644 --- a/server/proof_fetcher.go +++ b/server/proof_fetcher.go @@ -19,9 +19,8 @@ import ( "fmt" "github.com/google/trillian" - "github.com/google/trillian/merkle" - "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/compact" ) @@ -36,7 +35,7 @@ type nodeReader interface { // This includes rehashing where necessary to serve proofs for tree sizes between stored tree // revisions. This code only relies on the nodeReader interface so can be tested without // a complete storage implementation. -func fetchNodesAndBuildProof(ctx context.Context, nr nodeReader, th hashers.LogHasher, leafIndex int64, proofNodeFetches []merkle.NodeFetch) (*trillian.Proof, error) { +func fetchNodesAndBuildProof(ctx context.Context, nr nodeReader, th merkle.LogHasher, leafIndex int64, proofNodeFetches []merkle.NodeFetch) (*trillian.Proof, error) { ctx, spanEnd := spanFor(ctx, "fetchNodesAndBuildProof") defer spanEnd() proofNodes, err := fetchNodes(ctx, nr, proofNodeFetches) diff --git a/server/proof_fetcher_test.go b/server/proof_fetcher_test.go index 0c8feec057..db07f8ac42 100644 --- a/server/proof_fetcher_test.go +++ b/server/proof_fetcher_test.go @@ -21,8 +21,8 @@ import ( "testing" "github.com/google/trillian/internal/merkle/inmemory" - "github.com/google/trillian/merkle" "github.com/google/trillian/storage/testonly" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/rfc6962" ) diff --git a/server/validate.go b/server/validate.go index 149c74c4d9..078a2d796e 100644 --- a/server/validate.go +++ b/server/validate.go @@ -18,7 +18,7 @@ import ( "fmt" "github.com/google/trillian" - "github.com/google/trillian/merkle/hashers" + "github.com/transparency-dev/merkle" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -36,7 +36,7 @@ func validateGetInclusionProofRequest(req *trillian.GetInclusionProofRequest) er return nil } -func validateGetInclusionProofByHashRequest(req *trillian.GetInclusionProofByHashRequest, hasher hashers.LogHasher) error { +func validateGetInclusionProofByHashRequest(req *trillian.GetInclusionProofByHashRequest, hasher merkle.LogHasher) error { if req.TreeSize <= 0 { return status.Errorf(codes.InvalidArgument, "GetInclusionProofByHashRequest.TreeSize: %v, want > 0", req.TreeSize) } @@ -124,7 +124,7 @@ func validateLogLeaf(leaf *trillian.LogLeaf, errPrefix string) error { return nil } -func validateLeafHash(hash []byte, hasher hashers.LogHasher) error { +func validateLeafHash(hash []byte, hasher merkle.LogHasher) error { if got, want := len(hash), hasher.Size(); got != want { return fmt.Errorf("%d bytes, want %d", got, want) } diff --git a/storage/cache/log_tile.go b/storage/cache/log_tile.go index 5264bcd28d..f5689fec18 100644 --- a/storage/cache/log_tile.go +++ b/storage/cache/log_tile.go @@ -18,8 +18,8 @@ import ( "encoding/binary" "fmt" - "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/storagepb" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/compact" ) @@ -38,7 +38,7 @@ const ( // below for prepareLogTile. // // TODO(pavelkalinnikov): Unexport it after the refactoring. -func PopulateLogTile(st *storagepb.SubtreeProto, hasher hashers.LogHasher) error { +func PopulateLogTile(st *storagepb.SubtreeProto, hasher merkle.LogHasher) error { if st.Depth < 1 { return fmt.Errorf("populate log subtree with invalid depth: %d", st.Depth) } diff --git a/storage/cache/subtree_cache.go b/storage/cache/subtree_cache.go index 28e080d089..24360dedc5 100644 --- a/storage/cache/subtree_cache.go +++ b/storage/cache/subtree_cache.go @@ -20,9 +20,9 @@ import ( "fmt" "sync" - "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/storage/tree" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/compact" "google.golang.org/protobuf/proto" ) @@ -43,7 +43,7 @@ type GetSubtreesFunc func(ids [][]byte) ([]*storagepb.SubtreeProto, error) // SubtreeCache is not thread-safe: GetNodes, SetNodes and Flush methods must // be called sequentially. type SubtreeCache struct { - hasher hashers.LogHasher + hasher merkle.LogHasher // subtrees contains the Subtree data read from storage, and is updated by // calls to SetNodes. @@ -58,7 +58,7 @@ type SubtreeCache struct { // NewLogSubtreeCache creates and returns a SubtreeCache appropriate for use with a log // tree. The caller must supply a suitable LogHasher. -func NewLogSubtreeCache(hasher hashers.LogHasher) *SubtreeCache { +func NewLogSubtreeCache(hasher merkle.LogHasher) *SubtreeCache { if *populateConcurrency <= 0 { panic(fmt.Errorf("populate_subtree_concurrency must be set to >= 1")) } diff --git a/storage/tools/dump_tree/dumplib.go b/storage/tools/dump_tree/dumplib.go index 40efa102c7..03a0d91f21 100644 --- a/storage/tools/dump_tree/dumplib.go +++ b/storage/tools/dump_tree/dumplib.go @@ -30,7 +30,6 @@ import ( "github.com/golang/glog" "github.com/google/trillian" "github.com/google/trillian/log" - "github.com/google/trillian/merkle/hashers" "github.com/google/trillian/monitoring" "github.com/google/trillian/quota" "github.com/google/trillian/storage" @@ -39,6 +38,7 @@ import ( "github.com/google/trillian/storage/storagepb" "github.com/google/trillian/types" "github.com/google/trillian/util/clock" + "github.com/transparency-dev/merkle" "github.com/transparency-dev/merkle/compact" "github.com/transparency-dev/merkle/rfc6962" "google.golang.org/protobuf/encoding/prototext" @@ -221,7 +221,7 @@ func Main(args Options) string { return allRevisions(ls, tree.TreeId, rfc6962.DefaultHasher, formatter, args.Rebuild, args.HexKeys) } -func allRevisions(ls storage.LogStorage, treeID int64, hasher hashers.LogHasher, of func(*storagepb.SubtreeProto) string, rebuildInternal, hexKeysFlag bool) string { +func allRevisions(ls storage.LogStorage, treeID int64, hasher merkle.LogHasher, of func(*storagepb.SubtreeProto) string, rebuildInternal, hexKeysFlag bool) string { out := new(bytes.Buffer) memory.DumpSubtrees(ls, treeID, func(k string, v *storagepb.SubtreeProto) { if rebuildInternal { @@ -235,7 +235,7 @@ func allRevisions(ls storage.LogStorage, treeID int64, hasher hashers.LogHasher, return out.String() } -func latestRevisions(ls storage.LogStorage, treeID int64, hasher hashers.LogHasher, of func(*storagepb.SubtreeProto) string, rebuildInternal, hexKeysFlag bool) string { +func latestRevisions(ls storage.LogStorage, treeID int64, hasher merkle.LogHasher, of func(*storagepb.SubtreeProto) string, rebuildInternal, hexKeysFlag bool) string { out := new(bytes.Buffer) // vMap maps subtree prefixes (as strings) to the corresponding subtree proto and its revision vMap := make(map[string]treeAndRev) From b0c507514bcb6b3387c53acfdb33984f522f6cb1 Mon Sep 17 00:00:00 2001 From: mhutchinson Date: Thu, 11 Nov 2021 11:43:28 +0000 Subject: [PATCH 4/4] Added changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca1ffb55c3..90aa221fe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## HEAD +* Start using `github.com/transparency-dev/merkle` as a replacement to the + `merkle` libraries in this repository. This is not a breaking change, but + we recommend clients also migrate over to this library at the earliest + convenient time; the long term plan is to remove `merkle` from this repo. + ## v1.4.0 * Recommended go version for development: 1.17