verify

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BytesPerSymbol     = 31
	MaxCodingRatio     = 8
	MaxSRSPoints       = 1 << 28 // 2^28
	MaxAllowedBlobSize = uint64(MaxSRSPoints * BytesPerSymbol / MaxCodingRatio)
)
View Source
var (
	// cert verification flags
	CertVerificationDisabledFlagName = withFlagPrefix("cert-verification-disabled")
	EthRPCFlagName                   = withFlagPrefix("eth-rpc")
	SvcManagerAddrFlagName           = withFlagPrefix("svc-manager-addr")
	EthConfirmationDepthFlagName     = withFlagPrefix("eth-confirmation-depth")

	// kzg flags
	G1PathFlagName         = withFlagPrefix("g1-path")
	G2PowerOf2PathFlagName = withFlagPrefix("g2-power-of-2-path")
	CachePathFlagName      = withFlagPrefix("cache-path")
	MaxBlobLengthFlagName  = withFlagPrefix("max-blob-length")
)
View Source
var (
	// cert verification flags
	DeprecatedCertVerificationEnabledFlagName = withDeprecatedFlagPrefix("cert-verification-enabled")
	DeprecatedEthRPCFlagName                  = withDeprecatedFlagPrefix("eth-rpc")
	DeprecatedSvcManagerAddrFlagName          = withDeprecatedFlagPrefix("svc-manager-addr")
	DeprecatedEthConfirmationDepthFlagName    = withDeprecatedFlagPrefix("eth-confirmation-depth")

	// kzg flags
	DeprecatedG1PathFlagName        = withDeprecatedFlagPrefix("g1-path")
	DeprecatedG2TauFlagName         = withDeprecatedFlagPrefix("g2-tau-path")
	DeprecatedCachePathFlagName     = withDeprecatedFlagPrefix("cache-path")
	DeprecatedMaxBlobLengthFlagName = withDeprecatedFlagPrefix("max-blob-length")
)

TODO: we should also upstream these deprecated flags into the eigenda client if we upstream the changes before removing the deprecated flags

View Source
var ErrBatchMetadataHashNotFound = errors.New("BatchMetadataHash not found for BatchId")
View Source
var MaxBlobLengthBytes uint64

this var is set by the action in the MaxBlobLengthFlagName flag TODO: there's def a better way to deal with this... perhaps a generic flag that can parse the string into a uint64?

Functions

func CLIFlags added in v1.5.0

func CLIFlags(envPrefix, category string) []cli.Flag

CLIFlags ... used for Verifier configuration category is used to group the flags in the help output (see https://cli.urfave.org/v2/examples/flags/#grouping)

func DeprecatedCLIFlags added in v1.5.0

func DeprecatedCLIFlags(envPrefix, category string) []cli.Flag

CLIFlags ... used for Verifier configuration category is used to group the flags in the help output (see https://cli.urfave.org/v2/examples/flags/#grouping)

func HashBatchHashedMetadata added in v1.1.1

func HashBatchHashedMetadata(batchHeaderHash [32]byte, signatoryRecordHash [32]byte, blockNumber uint32) (geth_common.Hash, error)

HashBatchHashedMetadata hashes the given metadata into the commitment that will be stored in the contract replicates: https://github.com/Layr-Labs/eigenda-utils/blob/c4cbc9ec078aeca3e4a04bd278e2fb136bf3e6de/src/libraries/EigenDAHasher.sol#L19-L25

func HashBatchMetadata added in v1.1.1

func HashBatchMetadata(bh *binding.IEigenDAServiceManagerBatchHeader, sigHash [32]byte, blockNum uint32) (geth_common.Hash, error)

HashBatchMetadata regenerates a batch data hash replicates: https://github.com/Layr-Labs/eigenda-utils/blob/c4cbc9ec078aeca3e4a04bd278e2fb136bf3e6de/src/libraries/EigenDAHasher.sol#L46-L54

func HashBlobHeader added in v1.1.1

func HashBlobHeader(blobHeader BlobHeader) (geth_common.Hash, error)

HashBlobHeader function to hash BlobHeader

func HashEncodeBlobHeader added in v1.1.1

func HashEncodeBlobHeader(header BlobHeader) (geth_common.Hash, error)

Function to hash and encode header

func ProcessInclusionProof added in v1.1.1

func ProcessInclusionProof(proof []byte, leaf common.Hash, index uint64) (common.Hash, error)

ProcessInclusionProof processes the Merkle root proof

Types

type BlobHeader added in v1.2.0

type BlobHeader struct {
	Commitment       G1Point
	DataLength       uint32
	QuorumBlobParams []QuorumBlobParam
}

BlobHeader struct to represent BlobHeader in Solidity

type CertVerifier added in v1.1.1

type CertVerifier struct {
	// contains filtered or unexported fields
}

CertVerifier verifies the DA certificate against on-chain EigenDA contracts to ensure disperser returned fields haven't been tampered with

func NewCertVerifier added in v1.1.1

func NewCertVerifier(cfg *Config, l log.Logger) (*CertVerifier, error)

func (*CertVerifier) VerifyBatch added in v1.1.1

func (cv *CertVerifier) VerifyBatch(
	header *binding.IEigenDAServiceManagerBatchHeader, id uint32, recordHash [32]byte, confirmationNumber uint32,
) error

verifies on-chain batch ID for equivalence to certificate batch header fields

func (*CertVerifier) VerifyMerkleProof added in v1.1.1

func (cv *CertVerifier) VerifyMerkleProof(inclusionProof []byte, root []byte,
	blobIndex uint32, blobHeader BlobHeader) error

verifies the blob batch inclusion proof against the blob root hash

type Certificate added in v1.2.0

type Certificate disperser.BlobInfo

func (*Certificate) BatchHeaderRoot added in v1.2.0

func (c *Certificate) BatchHeaderRoot() []byte

func (*Certificate) BlobIndex added in v1.2.0

func (c *Certificate) BlobIndex() uint32

func (*Certificate) Proof added in v1.2.0

func (*Certificate) ReadBlobHeader added in v1.2.0

func (c *Certificate) ReadBlobHeader() BlobHeader

type Config added in v1.1.1

type Config struct {
	KzgConfig   *kzg.KzgConfig
	VerifyCerts bool
	// below 3 fields are only required if VerifyCerts is true
	RPCURL               string
	SvcManagerAddr       string
	EthConfirmationDepth uint64
}

func ReadConfig added in v1.5.0

func ReadConfig(ctx *cli.Context) Config

type G1Point added in v1.2.0

type G1Point struct {
	X *big.Int
	Y *big.Int
}

G1Point struct to represent G1Point in Solidity

type QuorumBlobParam added in v1.2.0

type QuorumBlobParam struct {
	QuorumNumber                    uint8
	AdversaryThresholdPercentage    uint8
	ConfirmationThresholdPercentage uint8
	ChunkLength                     uint32
}

QuorumBlobParam struct to represent QuorumBlobParam in Solidity

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

TODO: right now verification and confirmation depth are tightly coupled. we should decouple them

func NewVerifier

func NewVerifier(cfg *Config, l log.Logger) (*Verifier, error)

func (*Verifier) Commit

func (v *Verifier) Commit(blob []byte) (*bn254.G1Affine, error)

compute kzg-bn254 commitment of raw blob data using SRS

func (*Verifier) VerifyCert added in v1.1.1

func (v *Verifier) VerifyCert(cert *Certificate) error

verifies V0 eigenda certificate type

func (*Verifier) VerifyCommitment added in v1.1.1

func (v *Verifier) VerifyCommitment(expectedCommit *common.G1Commitment, blob []byte) error

Verify regenerates a commitment from the blob and asserts equivalence to the commitment in the certificate TODO: Optimize implementation by opening a point on the commitment instead

func (*Verifier) VerifySecurityParams added in v1.1.1

func (v *Verifier) VerifySecurityParams(blobHeader BlobHeader, batchHeader binding.IEigenDAServiceManagerBatchHeader) error

VerifySecurityParams ensures that returned security parameters are valid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL