Skip to content

Commit

Permalink
Move IndexOnly from utxo to utils
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
  • Loading branch information
jimthematrix committed Jul 30, 2024
1 parent 781a434 commit 2f98169
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions zkp/golang/internal/smt/merkletree.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/hyperledger-labs/zeto/internal/node"
"github.com/hyperledger-labs/zeto/internal/storage"
"github.com/hyperledger-labs/zeto/internal/utxo"
"github.com/hyperledger-labs/zeto/internal/utils"
"github.com/hyperledger-labs/zeto/pkg/core"
)

Expand Down Expand Up @@ -137,7 +137,7 @@ func (mt *sparseMerkleTree) GenerateProof(k *big.Int, rootKey core.NodeIndex) (c
return p, value.BigInt(), nil
}
// We found a leaf whose entry didn't match the node index
p.existingNode, err = node.NewLeafNode(utxo.NewIndexOnly(idx))
p.existingNode, err = node.NewLeafNode(utils.NewIndexOnly(idx))
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions zkp/golang/internal/storage/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package storage

import (
"github.com/hyperledger-labs/zeto/internal/node"
"github.com/hyperledger-labs/zeto/internal/utxo"
"github.com/hyperledger-labs/zeto/internal/utils"
"github.com/hyperledger-labs/zeto/pkg/core"
"gorm.io/gorm"
)
Expand Down Expand Up @@ -82,7 +82,7 @@ func (s *sqlStorage) GetNode(ref core.NodeIndex) (core.Node, error) {
if err1 != nil {
return nil, err1
}
v := utxo.NewIndexOnly(idx)
v := utils.NewIndexOnly(idx)
newNode, err = node.NewLeafNode(v)
case core.NodeTypeBranch:
leftChild, err1 := node.NewNodeIndexFromHex(*n.LeftChild)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package utxo
package utils

import (
"github.com/hyperledger-labs/zeto/pkg/core"
Expand Down
3 changes: 2 additions & 1 deletion zkp/golang/pkg/utxo/utxo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package utxo
import (
"math/big"

"github.com/hyperledger-labs/zeto/internal/utils"
"github.com/hyperledger-labs/zeto/internal/utxo"
"github.com/hyperledger-labs/zeto/pkg/core"
"github.com/iden3/go-iden3-crypto/babyjub"
Expand All @@ -41,7 +42,7 @@ func NewNonFungibleNullifier(tokenId *big.Int, tokenUri *big.Int, owner *big.Int
}

func NewIndexOnly(index core.NodeIndex) core.Indexable {
return utxo.NewIndexOnly(index)
return utils.NewIndexOnly(index)
}

func HashTokenUri(tokenUri string) (*big.Int, error) {
Expand Down

0 comments on commit 2f98169

Please sign in to comment.