Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cert verifier address provider #1368

Merged
merged 16 commits into from
Mar 7, 2025
28 changes: 28 additions & 0 deletions api/clients/v2/cert_verifier.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package clients

import (
"context"

"github.com/Layr-Labs/eigenda/api/clients/v2/coretypes"
disperser "github.com/Layr-Labs/eigenda/api/grpc/disperser/v2"
verifierBindings "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDACertVerifier"
)

// ICertVerifier is an interface for interacting with the EigenDACertVerifier contract.
type ICertVerifier interface {
// VerifyCertV2 calls the VerifyCertV2 view function on the EigenDACertVerifier contract.
//
// This method returns nil if the cert is successfully verified. Otherwise, it returns an error.
VerifyCertV2(ctx context.Context, eigenDACert *coretypes.EigenDACert) error

// GetNonSignerStakesAndSignature calls the getNonSignerStakesAndSignature view function on the EigenDACertVerifier
// contract, and returns the resulting NonSignerStakesAndSignature object.
GetNonSignerStakesAndSignature(
ctx context.Context,
signedBatch *disperser.SignedBatch,
) (*verifierBindings.NonSignerStakesAndSignature, error)

// GetQuorumNumbersRequired queries the cert verifier contract for the configured set of quorum numbers that must
// be set in the BlobHeader, and verified in VerifyDACertV2 and verifyDACertV2FromSignedBatch
GetQuorumNumbersRequired(ctx context.Context) ([]uint8, error)
}
10 changes: 10 additions & 0 deletions api/clients/v2/cert_verifier_address_provider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package clients

// CertVerifierAddressProvider defines an object which can translate block number to cert verifier address
//
// This provider uses block number as a key, since updates to a cert verifier address in a running system are
// coordinated by defining the block number at which a new cert verifier address takes effect.
type CertVerifierAddressProvider interface {
// GetCertVerifierAddress returns the EigenDACertVerifierAddress that is active at the input block number
GetCertVerifierAddress(blockNumber uint64) (string, error)
}
166 changes: 0 additions & 166 deletions api/clients/v2/config.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package verification
package coretypes

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package verification
package coretypes

import (
"math/big"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package verification
package coretypes

import (
"fmt"
Expand Down
52 changes: 26 additions & 26 deletions api/clients/v2/mock/cert_verifier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions api/clients/v2/payload_client_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package clients

import (
"github.com/Layr-Labs/eigenda/api/clients/codecs"
v2 "github.com/Layr-Labs/eigenda/core/v2"
)

// PayloadClientConfig contains configuration values that are needed by both PayloadRetriever and PayloadDisperser
type PayloadClientConfig struct {
// PayloadPolynomialForm is the initial form of a Payload after being encoded. The configured form does not imply
// any restrictions on the contents of a payload: it merely dictates how payload data is treated after being
// encoded.
//
// Since blobs sent to the disperser must be in coefficient form, the initial form of the encoded payload dictates
// what data processing must be performed during blob construction.
//
// The chosen form also dictates how the KZG commitment made to the blob can be used. If the encoded payload starts
// in PolynomialFormEval (meaning the data WILL be IFFTed before computing the commitment) then it will be possible
// to open points on the KZG commitment to prove that the field elements correspond to the commitment. If the
// encoded payload starts in PolynomialFormCoeff (meaning the data will NOT be IFFTed before computing the
// commitment) then it will not be possible to create a commitment opening: the blob will need to be supplied in its
// entirety to perform a verification that any part of the data matches the KZG commitment.
PayloadPolynomialForm codecs.PolynomialForm

// The BlobVersion to use when creating new blobs, or interpreting blob bytes.
//
// BlobVersion needs to point to a version defined in the threshold registry contract.
// https://github.com/Layr-Labs/eigenda/blob/3ed9ef6ed3eb72c46ce3050eb84af28f0afdfae2/contracts/src/interfaces/IEigenDAThresholdRegistry.sol#L6
BlobVersion v2.BlobVersion
}

// GetDefaultPayloadClientConfig creates a PayloadClientConfig with default values
func GetDefaultPayloadClientConfig() *PayloadClientConfig {
return &PayloadClientConfig{
PayloadPolynomialForm: codecs.PolynomialFormEval,
BlobVersion: 0,
}
}
3 changes: 1 addition & 2 deletions api/clients/v2/payload_retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"

"github.com/Layr-Labs/eigenda/api/clients/v2/coretypes"
"github.com/Layr-Labs/eigenda/api/clients/v2/verification"
)

// PayloadRetriever represents something that knows how to retrieve a payload from some backend using a verification.EigenDACert
Expand All @@ -13,5 +12,5 @@ import (
// bucket instead of from EigenDA relays or nodes.
type PayloadRetriever interface {
// GetPayload retrieves a payload from some backend, using the provided certificate
GetPayload(ctx context.Context, eigenDACert *verification.EigenDACert) (*coretypes.Payload, error)
GetPayload(ctx context.Context, eigenDACert *coretypes.EigenDACert) (*coretypes.Payload, error)
}
Loading
Loading