Unverified Commit ae93a37a authored by Erin Swenson-Healey's avatar Erin Swenson-Healey Committed by GitHub
Browse files

feat(challenges): configurable challenge count (#54)

parent 24aaedac
......@@ -232,6 +232,7 @@ func VerifyPoSt(
sectorSize uint64,
sectorInfo SortedSectorInfo,
challengeSeed [32]byte,
challengeCount uint64,
proof []byte,
winners []Candidate,
proverID [32]byte,
......@@ -277,6 +278,7 @@ func VerifyPoSt(
resPtr := C.sector_builder_ffi_reexported_verify_post(
C.uint64_t(sectorSize),
(*[CommitmentBytesLen]C.uint8_t)(challengeSeedCBytes),
C.uint64_t(challengeCount),
sectorIdsPtr,
sectorIdsSize,
(*C.uint8_t)(flattenedCommRsCBytes),
......@@ -668,6 +670,7 @@ func GenerateCandidates(
sectorBuilderPtr unsafe.Pointer,
sectorInfo SortedSectorInfo,
challengeSeed [CommitmentBytesLen]byte,
challengeCount uint64,
faults []uint64,
) ([]Candidate, error) {
defer elapsed("GenerateCandidates")()
......@@ -700,6 +703,7 @@ func GenerateCandidates(
(*C.uint8_t)(cflattened),
C.size_t(len(flattened)),
(*[CommitmentBytesLen]C.uint8_t)(challengeSeedPtr),
C.uint64_t(challengeCount),
faultsPtr,
faultsSize,
)
......@@ -717,6 +721,7 @@ func GeneratePoSt(
sectorBuilderPtr unsafe.Pointer,
sectorInfo SortedSectorInfo,
challengeSeed [CommitmentBytesLen]byte,
challengeCount uint64,
winners []Candidate,
) ([]byte, error) {
defer elapsed("GeneratePoSt")()
......@@ -749,6 +754,7 @@ func GeneratePoSt(
(*C.uint8_t)(cflattened),
C.size_t(len(flattened)),
(*[CommitmentBytesLen]C.uint8_t)(challengeSeedPtr),
C.uint64_t(challengeCount),
winnersPtr,
winnersSize,
)
......
......@@ -178,15 +178,15 @@ func TestSectorBuilderLifecycle(t *testing.T) {
CommR: statusA.CommR,
})
candidates, err := sb.GenerateCandidates(ptr, sectorInfo, [32]byte{}, []uint64{})
candidates, err := sb.GenerateCandidates(ptr, sectorInfo, [32]byte{}, 2, []uint64{})
require.NoError(t, err)
// generate a PoSt
proofs, err := sb.GeneratePoSt(ptr, sectorInfo, [32]byte{}, candidates)
proofs, err := sb.GeneratePoSt(ptr, sectorInfo, [32]byte{}, 2, candidates)
require.NoError(t, err)
// verify the PoSt
isValid, err = sb.VerifyPoSt(1024, sectorInfo, [32]byte{}, proofs, candidates, proverID)
isValid, err = sb.VerifyPoSt(1024, sectorInfo, [32]byte{}, 2, proofs, candidates, proverID)
require.NoError(t, err)
require.True(t, isValid)
......
Subproject commit 9a0fe0dee0f1e56ab853c331ffa6a3017dbf2acd
Subproject commit 89f194c6ea5e745dd36ed30d67e3685ceb3c65aa
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment