Skip to content

Commit 0ebfd85

Browse files
committed
conversion: use constants
Signed-off-by: Ignacio Hagopian <[email protected]>
1 parent 5126adb commit 0ebfd85

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

conversion.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ func BatchNewLeafNode(nodesValues []BatchNewLeafNodeData) []LeafNode {
2727
c2: Generator(),
2828
}
2929

30-
var c1poly, c2poly [256]Fr
30+
var c1poly, c2poly [NodeWidth]Fr
3131

32-
valsslice := make([][]byte, 256)
32+
valsslice := make([][]byte, NodeWidth)
3333
for idx := range nv.Values {
3434
valsslice[idx] = nv.Values[idx]
3535
}
3636

37-
fillSuffixTreePoly(c1poly[:], valsslice[:128])
37+
fillSuffixTreePoly(c1poly[:], valsslice[:NodeWidth/2])
3838
ret[i].c1 = cfg.CommitToPoly(c1poly[:], 0)
39-
fillSuffixTreePoly(c2poly[:], valsslice[128:])
39+
fillSuffixTreePoly(c2poly[:], valsslice[NodeWidth/2:])
4040
ret[i].c2 = cfg.CommitToPoly(c2poly[:], 0)
4141

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

4646
toFrMultiple(c1c2frs, c1c2points)
4747

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

172172
for stemFirstByte := range commitments {
173173
for stemSecondByte := range commitments[stemFirstByte] {

0 commit comments

Comments
 (0)