Skip to content

Commit

Permalink
Do minor cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: litt3 <[email protected]>
  • Loading branch information
litt3 committed Jan 31, 2025
1 parent 634fb5f commit 185501f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
10 changes: 5 additions & 5 deletions api/clients/v2/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package clients

import (
"fmt"
"errors"
"time"

"github.com/Layr-Labs/eigenda/api/clients/codecs"
Expand Down Expand Up @@ -123,11 +123,11 @@ func (cc *PayloadClientConfig) checkAndSetDefaults() error {
// BlobEncodingVersion may be 0, so don't do anything

if cc.EthRpcUrl == "" {
return fmt.Errorf("EthRpcUrl is required")
return errors.New("EthRpcUrl is required")
}

if cc.EigenDACertVerifierAddr == "" {
return fmt.Errorf("EigenDACertVerifierAddr is required")
return errors.New("EigenDACertVerifierAddr is required")
}

// Nothing to do for PayloadPolynomialForm
Expand Down Expand Up @@ -199,11 +199,11 @@ func (rc *DistributedPayloadRetrieverConfig) checkAndSetDefaults() error {
}

if rc.BlsOperatorStateRetrieverAddr == "" {
return fmt.Errorf("BlsOperatorStateRetrieverAddr is required")
return errors.New("BlsOperatorStateRetrieverAddr is required")
}

if rc.EigenDAServiceManagerAddr == "" {
return fmt.Errorf("EigenDAServiceManagerAddr is required")
return errors.New("EigenDAServiceManagerAddr is required")
}

defaultConfig := GetDefaultDistributedPayloadRetrieverConfig()
Expand Down
15 changes: 8 additions & 7 deletions api/clients/v2/distributed_payload_retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ func NewDistributedPayloadRetriever(

// GetPayload iteratively attempts to retrieve a given blob from the quorums listed in the EigenDACert.
//
// If the blob is successfully retrieved, then the blob is verified. If the verification succeeds, the blob is decoded
// to yield the payload (the original user data, with no padding or any modification), and the payload is returned.
// If the blob is successfully retrieved, then the blob verified against the EigenDACert. If the verification succeeds,
// the blob is decoded to yield the payload (the original user data, with no padding or any modification), and the
// payload is returned.
func (pr *DistributedPayloadRetriever) GetPayload(
ctx context.Context,
eigenDACert *verification.EigenDACert,
Expand All @@ -127,7 +128,7 @@ func (pr *DistributedPayloadRetriever) GetPayload(
}

blobHeader := eigenDACert.BlobInclusionInfo.BlobCertificate.BlobHeader
convertedCommitment, err := verification.BlobCommitmentsBindingToInternal(&blobHeader.Commitment)
commitment, err := verification.BlobCommitmentsBindingToInternal(&blobHeader.Commitment)
if err != nil {
return nil, fmt.Errorf("convert commitments binding to internal: %w", err)
}
Expand All @@ -138,7 +139,7 @@ func (pr *DistributedPayloadRetriever) GetPayload(
ctx,
*blobKey,
blobHeader.Version,
*convertedCommitment,
*commitment,
eigenDACert.BatchHeader.ReferenceBlockNumber,
quorumID)

Expand All @@ -151,13 +152,13 @@ func (pr *DistributedPayloadRetriever) GetPayload(
continue
}

err = verification.CheckBlobLength(blobBytes, convertedCommitment.Length)
err = verification.CheckBlobLength(blobBytes, commitment.Length)
if err != nil {
pr.logger.Warn("check blob length", "blobKey", blobKey.Hex(), "quorumID", quorumID, "error", err)
continue
}

valid, err := verification.GenerateAndCompareBlobCommitment(pr.g1Srs, blobBytes, convertedCommitment.Commitment)
valid, err := verification.GenerateAndCompareBlobCommitment(pr.g1Srs, blobBytes, commitment.Commitment)
if err != nil {
pr.logger.Warn(
"generate and compare blob commitment",
Expand Down Expand Up @@ -187,7 +188,7 @@ func (pr *DistributedPayloadRetriever) GetPayload(
return nil, fmt.Errorf("unable to retrieve payload from quorums %v", blobHeader.QuorumNumbers)
}

// getBlobWithTimeout attempts to get a blob from a given quorum, and times out based on config.FetchTimeout
// getBlobWithTimeout attempts to get a blob from a given quorum, and times out based on config.RetrievalTimeout
func (pr *DistributedPayloadRetriever) getBlobWithTimeout(
ctx context.Context,
blobKey corev2.BlobKey,
Expand Down
5 changes: 3 additions & 2 deletions api/clients/v2/relay_payload_retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ func NewRelayPayloadRetriever(
// GetPayload iteratively attempts to fetch a given blob with key blobKey from relays that have it, as claimed by the
// blob certificate. The relays are attempted in random order.
//
// If the blob is successfully retrieved, then the blob is verified. If the verification succeeds, the blob is decoded
// to yield the payload (the original user data, with no padding or any modification), and the payload is returned.
// If the blob is successfully retrieved, then the blob verified against the EigenDACert. If the verification succeeds,
// the blob is decoded to yield the payload (the original user data, with no padding or any modification), and the
// payload is returned.
func (pr *RelayPayloadRetriever) GetPayload(
ctx context.Context,
eigenDACert *verification.EigenDACert) ([]byte, error) {
Expand Down

0 comments on commit 185501f

Please sign in to comment.