mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-25 08:05:17 +00:00
Use arrays in Weso interfaces
This commit is contained in:
parent
3368c40d13
commit
2a53399b4a
@ -10,12 +10,12 @@ const intSizeBits = uint16(2048)
|
||||
|
||||
// WesolowskiSolve Solve and prove with the Wesolowski VDF using the given parameters.
|
||||
// Outputs the concatenated solution and proof (in this order).
|
||||
func WesolowskiSolve(challenge []uint8, difficulty uint32) []uint8 {
|
||||
return generated.WesolowskiSolve(intSizeBits, challenge, difficulty)
|
||||
func WesolowskiSolve(challenge [32]byte, difficulty uint32) [516]byte {
|
||||
return [516]byte(generated.WesolowskiSolve(intSizeBits, challenge[:], difficulty))
|
||||
}
|
||||
|
||||
// WesolowskiVerify Verify with the Wesolowski VDF using the given parameters.
|
||||
// `allegedSolution` is the output of `WesolowskiSolve`.
|
||||
func WesolowskiVerify(challenge []uint8, difficulty uint32, allegedSolution []uint8) bool {
|
||||
return generated.WesolowskiVerify(intSizeBits, challenge, difficulty, allegedSolution)
|
||||
func WesolowskiVerify(challenge [32]byte, difficulty uint32, allegedSolution [516]byte) bool {
|
||||
return generated.WesolowskiVerify(intSizeBits, challenge[:], difficulty, allegedSolution[:])
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ func getChallenge(seed string) [32]byte {
|
||||
func TestProveVerify(t *testing.T) {
|
||||
difficulty := uint32(10000)
|
||||
challenge := getChallenge("TestProveVerify")
|
||||
solution := vdf.WesolowskiSolve(challenge[:], difficulty)
|
||||
isOk := vdf.WesolowskiVerify(challenge[:], difficulty, solution)
|
||||
solution := vdf.WesolowskiSolve(challenge, difficulty)
|
||||
isOk := vdf.WesolowskiVerify(challenge, difficulty, solution)
|
||||
if !isOk {
|
||||
t.Fatalf("Verification failed")
|
||||
}
|
||||
@ -26,13 +26,13 @@ func TestProveRustVerifyNekro(t *testing.T) {
|
||||
challenge := getChallenge("TestProveRustVerifyNekro")
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
solution := vdf.WesolowskiSolve(challenge[:], difficulty)
|
||||
solution := vdf.WesolowskiSolve(challenge, difficulty)
|
||||
nekroVdf := nekrovdf.New(difficulty, challenge)
|
||||
isOk := nekroVdf.Verify([516]byte(solution))
|
||||
isOk := nekroVdf.Verify(solution)
|
||||
if !isOk {
|
||||
t.Fatalf("Verification failed")
|
||||
}
|
||||
challenge = sha3.Sum256(solution)
|
||||
challenge = sha3.Sum256(solution[:])
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ func TestProveNekroVerifyRust(t *testing.T) {
|
||||
nekroVdf := nekrovdf.New(difficulty, challenge)
|
||||
nekroVdf.Execute()
|
||||
proof := nekroVdf.GetOutput()
|
||||
isOk := vdf.WesolowskiVerify(challenge[:], difficulty, proof[:])
|
||||
isOk := vdf.WesolowskiVerify(challenge, difficulty, proof)
|
||||
if !isOk {
|
||||
t.Fatalf("Verification failed")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user