From 5b74b93f19939dcd194c141a08a2a58a60f0519d Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Fri, 25 Oct 2024 13:19:15 +0100 Subject: [PATCH] fix: verifySecurityParams func arguments after rebase --- verify/verifier.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/verify/verifier.go b/verify/verifier.go index 24e46ca8..59d1879c 100644 --- a/verify/verifier.go +++ b/verify/verifier.go @@ -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" @@ -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) } @@ -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 { @@ -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") }