Skip to content

Commit

Permalink
Switch fully over to transparency-dev merkle (#2646)
Browse files Browse the repository at this point in the history
I've tested this by deleting everything except coniks and smt from the merkle directory in trillian, and confirming that this repository still builds.
  • Loading branch information
mhutchinson authored Jan 4, 2022
1 parent 111e936 commit dd83b81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/merkletree/treetex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"math/bits"
"strings"

"github.com/google/trillian/merkle"
"github.com/google/trillian/merkle/compact"
"github.com/transparency-dev/merkle"
"github.com/transparency-dev/merkle/compact"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions internal/merkle/inmemory/merkle_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"errors"
"fmt"

"github.com/google/trillian/merkle/hashers"
"github.com/transparency-dev/merkle"
)

// TreeEntry is used for nodes in the tree for better readability. Just holds a hash but could be extended
Expand Down Expand Up @@ -102,7 +102,7 @@ type MerkleTree struct {
tree [][]TreeEntry
leavesProcessed int64
levelCount int64
hasher hashers.LogHasher
hasher merkle.LogHasher
}

// isPowerOfTwoPlusOne tests whether a number is (2^x)-1 for some x. From MerkleTreeMath in C++
Expand All @@ -128,7 +128,7 @@ func sibling(leaf int64) int64 {
}

// NewMerkleTree creates a new empty Merkle Tree using the specified Hasher.
func NewMerkleTree(hasher hashers.LogHasher) *MerkleTree {
func NewMerkleTree(hasher merkle.LogHasher) *MerkleTree {
return &MerkleTree{hasher: hasher}
}

Expand Down
10 changes: 5 additions & 5 deletions internal/merkle/inmemory/merkle_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"testing"

_ "github.com/golang/glog"
"github.com/google/trillian/merkle/hashers"
"github.com/google/trillian/merkle/rfc6962"
"github.com/transparency-dev/merkle"
"github.com/transparency-dev/merkle/rfc6962"
)

// Note test inputs came from the values used by the C++ code. The original
Expand Down Expand Up @@ -191,7 +191,7 @@ func downToPowerOfTwo(i int64) int64 {
}

// Reference implementation of Merkle hash, for cross-checking.
func referenceMerkleTreeHash(inputs [][]byte, treehasher hashers.LogHasher) ([]byte, error) {
func referenceMerkleTreeHash(inputs [][]byte, treehasher merkle.LogHasher) ([]byte, error) {
if len(inputs) == 0 {
return treehasher.EmptyRoot(), nil
}
Expand All @@ -214,7 +214,7 @@ func referenceMerkleTreeHash(inputs [][]byte, treehasher hashers.LogHasher) ([]b

// Reference implementation of Merkle paths. Path from leaf to root,
// excluding the leaf and root themselves.
func referenceMerklePath(inputs [][]byte, leaf int64, treehasher hashers.LogHasher) ([][]byte, error) {
func referenceMerklePath(inputs [][]byte, leaf int64, treehasher merkle.LogHasher) ([][]byte, error) {
var path [][]byte

inputLen := int64(len(inputs))
Expand Down Expand Up @@ -262,7 +262,7 @@ func referenceMerklePath(inputs [][]byte, leaf int64, treehasher hashers.LogHash
// Reference implementation of snapshot consistency.
// Call with haveRoot1 = true.
func referenceSnapshotConsistency(inputs [][]byte, snapshot2 int64,
snapshot1 int64, treehasher hashers.LogHasher, haveRoot1 bool) ([][]byte, error) {
snapshot1 int64, treehasher merkle.LogHasher, haveRoot1 bool) ([][]byte, error) {
var proof [][]byte

if snapshot1 == 0 || snapshot1 > snapshot2 {
Expand Down

0 comments on commit dd83b81

Please sign in to comment.