alias zero

This commit is contained in:
Dmitriy Ryajov 2023-12-22 17:14:51 -06:00
parent 21261ea82a
commit 7579409c7d
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
1 changed files with 6 additions and 1 deletions

View File

@ -27,6 +27,8 @@ const
KeyOddF = F.fromhex("0x2")
KeyOddAndBottomLayerF = F.fromhex("0x3")
Poseidon2Zero* = zero
type
Poseidon2Hash* = F
@ -39,6 +41,9 @@ type
Poseidon2Tree* = MerkleTree[Poseidon2Hash, PoseidonKeysEnum]
Poseidon2Proof* = MerkleProof[Poseidon2Hash, PoseidonKeysEnum]
func toArray32*(bytes: openArray[byte]): array[32, byte] =
result[0..<bytes.len] = bytes[0..<bytes.len]
converter toKey*(key: PoseidonKeysEnum): Poseidon2Hash =
case key:
of KeyNone: KeyNoneF
@ -60,7 +65,7 @@ func init*(
success compress( x, y, key.toKey )
var
self = Poseidon2Tree(compress: compressor, zero: zero)
self = Poseidon2Tree(compress: compressor, zero: Poseidon2Zero)
self.layers = ? merkleTreeWorker(self, leaves, isBottomLayer = true)
success self