Skip to content

Commit

Permalink
feat(coordinator): enhance batch proof sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Jul 1, 2024
1 parent a2536d5 commit cd0e780
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion common/types/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ type BatchProof struct {
}

// SanityCheck checks whether an BatchProof is in a legal format
// TODO: change to check Proof&Instance when upgrading to snark verifier v0.4
func (ap *BatchProof) SanityCheck() error {
if ap == nil {
return errors.New("agg_proof is nil")
Expand All @@ -225,5 +224,19 @@ func (ap *BatchProof) SanityCheck() error {
return fmt.Errorf("proof buffer has wrong length, expected: 32, got: %d", len(ap.Proof))
}

if len(ap.Instances) == 0 {
return errors.New("instance not ready")
}
if len(ap.Instances)%32 != 0 {
return fmt.Errorf("instance buffer has wrong length, expected: 32, got: %d", len(ap.Instances))
}

if len(ap.Vk) == 0 {
return errors.New("vk not ready")
}
if len(ap.Vk)%32 != 0 {
return fmt.Errorf("vk buffer has wrong length, expected: 32, got: %d", len(ap.Vk))
}

return nil
}
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.4.22"
var tag = "v4.4.23"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down

0 comments on commit cd0e780

Please sign in to comment.