Skip to content

Commit

Permalink
conversion: use constants
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Apr 17, 2023
1 parent 4dcbb6a commit 1604357
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ func BatchNewLeafNode(nodesValues []BatchNewLeafNodeData) []LeafNode {
c2: Generator(),
}

var c1poly, c2poly [256]Fr
var c1poly, c2poly [NodeWidth]Fr

valsslice := make([][]byte, 256)
valsslice := make([][]byte, NodeWidth)
for idx := range nv.Values {
valsslice[idx] = nv.Values[idx]
}

fillSuffixTreePoly(c1poly[:], valsslice[:128])
fillSuffixTreePoly(c1poly[:], valsslice[:NodeWidth/2])
ret[i].c1 = cfg.CommitToPoly(c1poly[:], 0)
fillSuffixTreePoly(c2poly[:], valsslice[128:])
fillSuffixTreePoly(c2poly[:], valsslice[NodeWidth/2:])
ret[i].c2 = cfg.CommitToPoly(c2poly[:], 0)

c1c2points[2*i], c1c2points[2*i+1] = ret[i].c1, ret[i].c2
Expand All @@ -45,7 +45,7 @@ func BatchNewLeafNode(nodesValues []BatchNewLeafNodeData) []LeafNode {

toFrMultiple(c1c2frs, c1c2points)

var poly [256]Fr
var poly [NodeWidth]Fr
poly[0].SetUint64(1)
for i, nv := range nodesValues {
StemFromBytes(&poly[1], nv.Stem)
Expand Down Expand Up @@ -166,8 +166,8 @@ func GetInternalNodeCommitment(node *InternalNode, partialStem []byte) *Point {
// commitments of the children of the second level. This method is generally used if tree
// construction was done in partitions, and you want to glue them together without having
// the whole tree in memory.
func BuildFirstTwoLayers(commitments [256][256][32]byte) *InternalNode {
var secondLevelInternalNodes [256]*InternalNode
func BuildFirstTwoLayers(commitments [NodeWidth][NodeWidth][32]byte) *InternalNode {
var secondLevelInternalNodes [NodeWidth]*InternalNode

for stemFirstByte := range commitments {
for stemSecondByte := range commitments[stemFirstByte] {
Expand Down

0 comments on commit 1604357

Please sign in to comment.