-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement cert verifier address provider (#1368)
Signed-off-by: litt3 <[email protected]>
- Loading branch information
Showing
28 changed files
with
659 additions
and
629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package clients | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// CertVerifierAddressProvider defines an object which can translate block number to cert verifier address | ||
// | ||
// This provider uses reference block number as a key, since updates to a cert verifier address in a running system are | ||
// coordinated by defining the reference block number at which a new cert verifier address takes effect. Specifically, | ||
// a blob shall be verified by the latest defined cert verifier contract with a reference block number key that doesn't | ||
// exceed the reference block number of the blob's batch. | ||
type CertVerifierAddressProvider interface { | ||
// GetCertVerifierAddress returns the EigenDACertVerifierAddress that is active at the input reference block number | ||
GetCertVerifierAddress(ctx context.Context, referenceBlockNumber uint64) (common.Address, error) | ||
} |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ients/v2/verification/conversion_utils.go → api/clients/v2/coretypes/conversion_utils.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package verification | ||
package coretypes | ||
|
||
import ( | ||
"fmt" | ||
|
2 changes: 1 addition & 1 deletion
2
.../v2/verification/conversion_utils_test.go → ...nts/v2/coretypes/conversion_utils_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package verification | ||
package coretypes | ||
|
||
import ( | ||
"math/big" | ||
|
2 changes: 1 addition & 1 deletion
2
api/clients/v2/verification/eigenda_cert.go → api/clients/v2/coretypes/eigenda_cert.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package verification | ||
package coretypes | ||
|
||
import ( | ||
"fmt" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |
Oops, something went wrong.