mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-14 19:33:10 +00:00
truncate entropy to 31 bytes, otherwise it might be > than mod
This commit is contained in:
parent
09d20e06e6
commit
b33ddb347b
@ -18,6 +18,7 @@ import pkg/constantine/math/arithmetic
|
||||
import pkg/poseidon2
|
||||
import pkg/poseidon2/types
|
||||
import pkg/poseidon2/io
|
||||
import pkg/stew/arrayops
|
||||
|
||||
import ../../market
|
||||
import ../../blocktype as bt
|
||||
@ -86,9 +87,9 @@ proc getProofInput*(
|
||||
## Generate proofs as input to the proving circuit.
|
||||
##
|
||||
|
||||
without entropy =? Poseidon2Hash.fromBytes(entropy):
|
||||
error "Failed to parse entropy"
|
||||
return failure("Failed to parse entropy")
|
||||
let
|
||||
entropy = Poseidon2Hash.fromBytes(
|
||||
array[31, byte].initCopyFrom(entropy[0..30])) # truncate to 31 bytes, otherwise it _might_ be greater than mod
|
||||
|
||||
without verifyTree =? self.builder.verifyTree and
|
||||
verifyProof =? verifyTree.getProof(self.index) and
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user