Skip to content

Commit

Permalink
fix: verifySecurityParams func arguments after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed Oct 25, 2024
1 parent 46d156a commit 5b74b93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions verify/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/log"

"github.com/Layr-Labs/eigenda/api/grpc/common"
"github.com/Layr-Labs/eigenda/api/grpc/disperser"
"github.com/Layr-Labs/eigenda/encoding/kzg"
kzgverifier "github.com/Layr-Labs/eigenda/encoding/kzg/verifier"
"github.com/Layr-Labs/eigenda/encoding/rs"
Expand Down Expand Up @@ -79,7 +80,7 @@ func (v *Verifier) VerifyCert(ctx context.Context, cert *Certificate) error {

// 3 - verify security parameters
batchHeader := cert.Proof().GetBatchMetadata().GetBatchHeader()
err = v.verifySecurityParams(cert.ReadBlobHeader(), batchHeader.QuorumNumbers, batchHeader.QuorumSignedPercentages)
err = v.verifySecurityParams(cert.ReadBlobHeader(), batchHeader)
if err != nil {
return fmt.Errorf("failed to verify security parameters: %w", err)
}
Expand Down Expand Up @@ -133,13 +134,13 @@ func (v *Verifier) VerifyCommitment(expectedCommit *common.G1Commitment, blob []
}

// verifySecurityParams ensures that returned security parameters are valid
func (v *Verifier) verifySecurityParams(blobHeader BlobHeader, batchQuorumNumbers []byte, batchQuorumSignedPercentages []byte) error {
func (v *Verifier) verifySecurityParams(blobHeader BlobHeader, batchHeader *disperser.BatchHeader) error {
confirmedQuorums := make(map[uint8]bool)

// require that the security param in each blob is met
for i := 0; i < len(blobHeader.QuorumBlobParams); i++ {
if batchQuorumNumbers[i] != blobHeader.QuorumBlobParams[i].QuorumNumber {
return fmt.Errorf("quorum number mismatch, expected: %d, got: %d", batchQuorumNumbers[i], blobHeader.QuorumBlobParams[i].QuorumNumber)
if batchHeader.QuorumNumbers[i] != blobHeader.QuorumBlobParams[i].QuorumNumber {
return fmt.Errorf("quorum number mismatch, expected: %d, got: %d", batchHeader.QuorumNumbers[i], blobHeader.QuorumBlobParams[i].QuorumNumber)
}

if blobHeader.QuorumBlobParams[i].AdversaryThresholdPercentage > blobHeader.QuorumBlobParams[i].ConfirmationThresholdPercentage {
Expand All @@ -157,7 +158,7 @@ func (v *Verifier) verifySecurityParams(blobHeader BlobHeader, batchQuorumNumber
return fmt.Errorf("adversary threshold percentage must be greater than or equal to quorum adversary threshold percentage")
}

if batchQuorumSignedPercentages[i] < blobHeader.QuorumBlobParams[i].ConfirmationThresholdPercentage {
if batchHeader.QuorumSignedPercentages[i] < blobHeader.QuorumBlobParams[i].ConfirmationThresholdPercentage {
return fmt.Errorf("signed stake for quorum must be greater than or equal to confirmation threshold percentage")
}

Expand Down

0 comments on commit 5b74b93

Please sign in to comment.