Skip to content

Commit

Permalink
enable chunk proof verify (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehao authored Jul 11, 2024
1 parent a2e8b6a commit 2392d34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions coordinator/internal/logic/submitproof/proof_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,21 @@ func (m *ProofReceiverLogic) HandleZkProof(ctx *gin.Context, proofParameter coor
if getHardForkErr != nil {
return ErrGetHardForkNameFailed
}
// Post-Bernoulli we do not verify chunk proofs.
// Verify batch proof
if message.ProofType(proofParameter.TaskType) == message.ProofTypeBatch {

switch message.ProofType(proofParameter.TaskType) {
case message.ProofTypeChunk:
var chunkProof message.ChunkProof
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &chunkProof); unmarshalErr != nil {
return unmarshalErr
}
success, verifyErr = m.verifier.VerifyChunkProof(&chunkProof, hardForkName)
case message.ProofTypeBatch:
var batchProof message.BatchProof
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &batchProof); unmarshalErr != nil {
return unmarshalErr
}
success, verifyErr = m.verifier.VerifyBatchProof(&batchProof, hardForkName)
}
// Verify bundle proof
if message.ProofType(proofParameter.TaskType) == message.ProofTypeBundle {
case message.ProofTypeBundle:
var bundleProof message.BundleProof
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &bundleProof); unmarshalErr != nil {
return unmarshalErr
Expand Down
2 changes: 1 addition & 1 deletion coordinator/internal/logic/verifier/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) {
}

// VerifyChunkProof return a mock verification result for a ChunkProof.
func (v *Verifier) VerifyChunkProof(proof *message.ChunkProof) (bool, error) {
func (v *Verifier) VerifyChunkProof(proof *message.ChunkProof, forkName string) (bool, error) {
if string(proof.Proof) == InvalidTestProof {
return false, nil
}
Expand Down

0 comments on commit 2392d34

Please sign in to comment.