Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeCommitment(b []byte, c CommitmentMode) ([]byte, error)
- type CertCommitment
- type CertCommitmentV0
- type CertEncodingCommitment
- type CommitmentMeta
- type CommitmentMode
- type DAServiceOPCommitmentType
- type DaSvcCommitment
- type EigenDASvcCommitment
- type GenericCommitment
- type Keccak256Commitment
- type OPCommitment
- type OPCommitmentType
Constants ¶
const ( Keccak256CommitmentType OPCommitmentType = 0 GenericCommitmentType OPCommitmentType = 1 KeccakCommitmentString string = "KeccakCommitment" GenericCommitmentString string = "GenericCommitment" )
CommitmentType describes the binary format of the commitment. KeccakCommitmentStringType is the default commitment type for the centralized DA storage. GenericCommitmentType indicates an opaque bytestring that the op-node never opens.
Variables ¶
var ErrCommitmentMismatch = errors.New("commitment mismatch")
ErrCommitmentMismatch is returned when the commitment does not match the given input.
var ErrInvalidCommitment = errors.New("invalid commitment")
ErrInvalidCommitment is returned when the commitment cannot be parsed into a known commitment type.
Functions ¶
func EncodeCommitment ¶ added in v1.3.0
func EncodeCommitment(b []byte, c CommitmentMode) ([]byte, error)
Types ¶
type CertCommitment ¶ added in v1.3.0
type CertCommitment interface { CommitmentType() CertEncodingCommitment Encode() []byte Verify(input []byte) error }
OPCommitment is the binary representation of a commitment.
type CertCommitmentV0 ¶ added in v1.3.0
type CertCommitmentV0 []byte
func DecodeCertCommitment ¶ added in v1.3.0
func DecodeCertCommitment(commitment []byte) (CertCommitmentV0, error)
DecodeCertCommitment validates and casts the commitment into a Keccak256Commitment.
func NewV0CertCommitment ¶ added in v1.3.0
func NewV0CertCommitment(input []byte) CertCommitmentV0
NewV0CertCommitment creates a new commitment from the given input.
func (CertCommitmentV0) CommitmentType ¶ added in v1.3.0
func (c CertCommitmentV0) CommitmentType() CertEncodingCommitment
CommitmentType returns the commitment type of Keccak256.
func (CertCommitmentV0) Encode ¶ added in v1.3.0
func (c CertCommitmentV0) Encode() []byte
Encode adds a commitment type prefix self describing the commitment.
type CertEncodingCommitment ¶ added in v1.3.0
type CertEncodingCommitment byte
const (
CertV0 CertEncodingCommitment = 0
)
type CommitmentMeta ¶ added in v1.5.0
type CommitmentMeta struct { Mode CommitmentMode // CertVersion is shared for all modes and denotes version of the EigenDA certificate CertVersion uint8 }
type CommitmentMode ¶ added in v1.3.0
type CommitmentMode string
const ( OptimismKeccak CommitmentMode = "optimism_keccak256" OptimismGeneric CommitmentMode = "optimism_generic" Standard CommitmentMode = "standard" )
func StringToCommitmentMode ¶ added in v1.3.0
func StringToCommitmentMode(s string) (CommitmentMode, error)
type DAServiceOPCommitmentType ¶
type DAServiceOPCommitmentType byte
const (
EigenDACommitmentType DAServiceOPCommitmentType = 0
)
type DaSvcCommitment ¶ added in v1.3.0
type DaSvcCommitment interface { CommitmentType() DAServiceOPCommitmentType Encode() []byte Verify(input []byte) error }
OPCommitment is the binary representation of a commitment.
type EigenDASvcCommitment ¶ added in v1.3.0
type EigenDASvcCommitment []byte
func DecodeEigenDASvcCommitment ¶ added in v1.3.0
func DecodeEigenDASvcCommitment(commitment []byte) (EigenDASvcCommitment, error)
DecodeEigenDASvcCommitment validates and casts the commitment into a Keccak256Commitment.
func NewEigenDASvcCommitment ¶ added in v1.3.0
func NewEigenDASvcCommitment(input []byte) EigenDASvcCommitment
NewEigenDASvcCommitment creates a new commitment from the given input.
func (EigenDASvcCommitment) CommitmentType ¶ added in v1.3.0
func (c EigenDASvcCommitment) CommitmentType() DAServiceOPCommitmentType
CommitmentType returns the commitment type of Keccak256.
func (EigenDASvcCommitment) Encode ¶ added in v1.3.0
func (c EigenDASvcCommitment) Encode() []byte
Encode adds a commitment type prefix self describing the commitment.
type GenericCommitment ¶
type GenericCommitment []byte
GenericCommitment is an implementation of OPCommitment that treats the commitment as an opaque bytestring.
func DecodeGenericCommitment ¶ added in v1.3.0
func DecodeGenericCommitment(commitment []byte) (GenericCommitment, error)
DecodeGenericCommitment validates and casts the commitment into a GenericCommitment.
func NewGenericCommitment ¶ added in v1.3.0
func NewGenericCommitment(input []byte) GenericCommitment
NewGenericCommitment creates a new commitment from the given input.
func (GenericCommitment) CommitmentType ¶ added in v1.3.0
func (c GenericCommitment) CommitmentType() OPCommitmentType
CommitmentType returns the commitment type of Generic Commitment.
func (GenericCommitment) Encode ¶ added in v1.3.0
func (c GenericCommitment) Encode() []byte
Encode adds a commitment type prefix self describing the commitment.
func (GenericCommitment) Verify ¶ added in v1.3.0
func (c GenericCommitment) Verify(_ []byte) error
Verify always returns true for GenericCommitment because the DA Server must validate the data before returning it to the op-node.
type Keccak256Commitment ¶
type Keccak256Commitment []byte
Keccak256Commitment is an implementation of OPCommitment that uses Keccak256 as the commitment function.
func DecodeKeccak256 ¶ added in v1.3.0
func DecodeKeccak256(commitment []byte) (Keccak256Commitment, error)
DecodeKeccak256 validates and casts the commitment into a Keccak256Commitment.
func NewKeccak256Commitment ¶ added in v1.3.0
func NewKeccak256Commitment(input []byte) Keccak256Commitment
NewKeccak256Commitment creates a new commitment from the given input.
func (Keccak256Commitment) CommitmentType ¶ added in v1.3.0
func (c Keccak256Commitment) CommitmentType() OPCommitmentType
CommitmentType returns the commitment type of Keccak256.
func (Keccak256Commitment) Encode ¶ added in v1.3.0
func (c Keccak256Commitment) Encode() []byte
Encode adds a commitment type prefix self describing the commitment.
func (Keccak256Commitment) Verify ¶ added in v1.3.0
func (c Keccak256Commitment) Verify(input []byte) error
Verify checks if the commitment matches the given input.
type OPCommitment ¶
type OPCommitment interface { CommitmentType() OPCommitmentType Encode() []byte Verify(input []byte) error }
OPCommitment is the binary representation of a commitment.
func DecodeOPCommitment ¶ added in v1.3.0
func DecodeOPCommitment(input []byte) (OPCommitment, error)
DecodeOPCommitment parses the commitment into a known commitment type. The input type is determined by the first byte of the raw data. The input type is discarded and the commitment is passed to the appropriate constructor.
func NewOPCommitment ¶ added in v1.3.0
func NewOPCommitment(t OPCommitmentType, input []byte) OPCommitment
NewOPCommitment creates a new commitment from the given input and desired type.
type OPCommitmentType ¶
type OPCommitmentType byte
OPCommitmentType is the commitment type prefix.
func CommitmentTypeFromString ¶ added in v1.3.0
func CommitmentTypeFromString(s string) (OPCommitmentType, error)