You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #1246, the crypto/zk/prover/pubsignals package contains some functions to get and set some attributes from/to zk circuit public signals. This is very helpful because the transformations required on this data (such as split, join or hash operations) are transparent to the rest of the code.
However, other parts of the code need to compare the result of this getter with information coming from the vochain. And that code has to transform the vochain data in the same way as the publis signals in order to be compared correctly.
To prevent this, the crypto/zk/prover/pubsignals package must include new helpers that take the vochain information as is and compare it with the public signals data, including all the necessary transformations and avoiding this logic in any part of the code that compares the two data.
For example, in the file vochain/transaction/proofs/zkproof/zkproof.go, to compare the process ID, it must be hashed before be compared, this kind of logic must be abstracted:
// verify the process idproofProcessID, err:=proof.ElectionID()
iferr!=nil {
returnfalse, nil, fmt.Errorf("failed on parsing process id from public inputs provided: %w", err)
}
hashedPid:=sha256.Sum256(process.ProcessId)
if!bytes.Equal(hashedPid[:], proofProcessID) {
returnfalse, nil, fmt.Errorf("process id mismatch %x != %x", process.ProcessId, proofProcessID)
}
It could be refactored to a helper:
// verify the process idif!proof.CmpElectionID(process.ProcessId) {
returnfalse, nil, fmt.Errorf("process id mismatch %x != %x", process.ProcessId, proofProcessID)
}
The text was updated successfully, but these errors were encountered:
As of #1246, the
crypto/zk/prover/pubsignals
package contains some functions to get and set some attributes from/to zk circuit public signals. This is very helpful because the transformations required on this data (such as split, join or hash operations) are transparent to the rest of the code.However, other parts of the code need to compare the result of this getter with information coming from the vochain. And that code has to transform the vochain data in the same way as the publis signals in order to be compared correctly.
To prevent this, the
crypto/zk/prover/pubsignals
package must include new helpers that take the vochain information as is and compare it with the public signals data, including all the necessary transformations and avoiding this logic in any part of the code that compares the two data.For example, in the file
vochain/transaction/proofs/zkproof/zkproof.go
, to compare the process ID, it must be hashed before be compared, this kind of logic must be abstracted:It could be refactored to a helper:
The text was updated successfully, but these errors were encountered: