blocks

package
v7.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: GPL-3.0 Imports: 31 Imported by: 4

Documentation

Overview

Code generated by hack/gen-logs.sh; DO NOT EDIT. This file is created and regenerated automatically. Anything added here might get removed.

Index

Constants

View Source
const (
	KZGOffset = kzgRootIndex * field_params.MaxBlobCommitmentsPerBlock
)

Variables

View Source
var (
	PayloadToHeaderElectra = PayloadToHeaderDeneb
	PayloadToHeaderFulu    = PayloadToHeaderDeneb
)
View Source
var (
	// ErrUnsupportedSignedBeaconBlock is returned when the struct type is not a supported signed
	// beacon block type.
	ErrUnsupportedSignedBeaconBlock = errors.New("unsupported signed beacon block")

	// ErrNilObject is returned in a constructor when the underlying object is nil.
	ErrNilObject = errors.New("received nil object")
	// ErrNilSignedBeaconBlock is returned when a nil signed beacon block is received.
	ErrNilSignedBeaconBlock = errors.New("signed beacon block can't be nil")
	// ErrNilBeaconBlock is returned when a nil beacon block is received.
	ErrNilBeaconBlock = errors.New("beacon block can't be nil")
)
View Source
var (
	// ErrUnsupportedVersion for beacon block methods.
	ErrUnsupportedVersion = errors.New("unsupported beacon block version")
)

Functions

func BeaconBlockContainerToSignedBeaconBlock

func BeaconBlockContainerToSignedBeaconBlock(obj *eth.BeaconBlockContainer) (interfaces.ReadOnlySignedBeaconBlock, error)

BeaconBlockContainerToSignedBeaconBlock converts BeaconBlockContainer (API response) to a SignedBeaconBlock. This is particularly useful for using the values from API calls.

func BeaconBlockIsNil

func BeaconBlockIsNil(b interfaces.ReadOnlySignedBeaconBlock) error

BeaconBlockIsNil checks if any composite field of input signed beacon block is nil. Access to these nil fields will result in run time panic, it is recommended to run these checks as first line of defense.

func BlockBuiltOnEnvelope added in v7.1.5

func BlockBuiltOnEnvelope(env interfaces.ROSignedExecutionPayloadEnvelope, blk ROBlock) (bool, error)

BlockBuiltOnEnvelope checks if the block's parent hash matches the envelope's execution block hash.

func BuildSignedBeaconBlock

func BuildSignedBeaconBlock(blk interfaces.ReadOnlyBeaconBlock, signature []byte) (interfaces.SignedBeaconBlock, error)

BuildSignedBeaconBlock assembles a block.ReadOnlySignedBeaconBlock interface compatible struct from a given beacon block and the appropriate signature. This method may be used to easily create a signed beacon block.

func BuildSignedBeaconBlockFromExecutionPayload

func BuildSignedBeaconBlockFromExecutionPayload(blk interfaces.ReadOnlySignedBeaconBlock, payload any) (interfaces.SignedBeaconBlock, error)

BuildSignedBeaconBlockFromExecutionPayload takes a signed, blinded beacon block and converts into a full, signed beacon block by specifying an execution payload. nolint:gocognit

func ComputeBlockBodyFieldRoots

func ComputeBlockBodyFieldRoots(ctx context.Context, blockBody *BeaconBlockBody) ([][]byte, error)

func IsEmptyExecutionData

func IsEmptyExecutionData(data interfaces.ExecutionData) (bool, error)

IsEmptyExecutionData checks if an execution data is empty underneath. If a single field has a non-zero value, this function will return false.

func LeavesFromCommitments

func LeavesFromCommitments(commitments [][]byte) [][]byte

LeavesFromCommitments hashes each commitment to construct a slice of roots

func MergeAvailableIntoPartsMetadata added in v7.1.6

func MergeAvailableIntoPartsMetadata(base *ethpb.PartialDataColumnPartsMetadata, additionalAvailable bitfield.Bitlist) (*ethpb.PartialDataColumnPartsMetadata, error)

MergeAvailableIntoPartsMetadata returns a new parts metadata whose available cells are the union of base's available cells and additionalAvailable. The base argument is not modified.

func MerkleProofKZGCommitment

func MerkleProofKZGCommitment(body interfaces.ReadOnlyBeaconBlockBody, index int) ([][]byte, error)

MerkleProofKZGCommitment constructs a Merkle proof of inclusion of the KZG commitment of index `index` into the Beacon Block with the given `body`

func MerkleProofKZGCommitmentFromComponents

func MerkleProofKZGCommitmentFromComponents(components *MerkleProofComponents, index int) ([][]byte, error)

MerkleProofKZGCommitmentFromComponents constructs a Merkle proof for a specific index using pre-computed components, avoiding redundant calculations.

func MerkleProofKZGCommitments

func MerkleProofKZGCommitments(body interfaces.ReadOnlyBeaconBlockBody) ([][]byte, error)

MerkleProofKZGCommitments constructs a Merkle proof of inclusion of the KZG commitments into the Beacon Block with the given `body`

func NewBeaconBlock

func NewBeaconBlock(i any) (interfaces.ReadOnlyBeaconBlock, error)

NewBeaconBlock creates a beacon block from a protobuf beacon block.

func NewBeaconBlockBody

func NewBeaconBlockBody(i any) (interfaces.ReadOnlyBeaconBlockBody, error)

NewBeaconBlockBody creates a beacon block body from a protobuf beacon block body.

func NewPartsMetaWithNoAvailableAndNoRequests added in v7.1.6

func NewPartsMetaWithNoAvailableAndNoRequests(n uint64) *ethpb.PartialDataColumnPartsMetadata

NewPartsMetaWithNoAvailableAndNoRequests creates metadata for n parts where no parts are marked as available and no requests are set.

func NewSignedBeaconBlock

func NewSignedBeaconBlock(i any) (interfaces.SignedBeaconBlock, error)

NewSignedBeaconBlock creates a signed beacon block from a protobuf signed beacon block.

func NewWrappedExecutionData

func NewWrappedExecutionData(v proto.Message) (interfaces.ExecutionData, error)

NewWrappedExecutionData creates an appropriate execution payload wrapper based on the incoming type.

func PayloadProof

func PayloadProof(ctx context.Context, block interfaces.ReadOnlyBeaconBlock) ([][]byte, error)

func PayloadToHeader

func PayloadToHeader(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeader, error)

PayloadToHeader converts `payload` into execution payload header format.

func PayloadToHeaderCapella

func PayloadToHeaderCapella(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeaderCapella, error)

PayloadToHeaderCapella converts `payload` into execution payload header format.

func PayloadToHeaderDeneb

func PayloadToHeaderDeneb(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeaderDeneb, error)

PayloadToHeaderDeneb converts `payload` into execution payload header format.

func VerifyKZGInclusionProof

func VerifyKZGInclusionProof(blob ROBlob) error

VerifyKZGInclusionProof verifies the Merkle proof in a Blob sidecar against the beacon block body root.

func WrappedExecutionPayload

func WrappedExecutionPayload(p *enginev1.ExecutionPayload) (interfaces.ExecutionData, error)

WrappedExecutionPayload is a constructor which wraps a protobuf execution payload into an interface.

func WrappedExecutionPayloadCapella

func WrappedExecutionPayloadCapella(p *enginev1.ExecutionPayloadCapella) (interfaces.ExecutionData, error)

WrappedExecutionPayloadCapella is a constructor which wraps a protobuf execution payload into an interface.

func WrappedExecutionPayloadDeneb

func WrappedExecutionPayloadDeneb(p *enginev1.ExecutionPayloadDeneb) (interfaces.ExecutionData, error)

WrappedExecutionPayloadDeneb is a constructor which wraps a protobuf execution payload into an interface.

func WrappedExecutionPayloadGloas added in v7.1.5

func WrappedExecutionPayloadGloas(p *enginev1.ExecutionPayloadGloas) (interfaces.ExecutionData, error)

WrappedExecutionPayloadGloas is a constructor which wraps a protobuf execution payload into an interface.

func WrappedExecutionPayloadHeader

func WrappedExecutionPayloadHeader(p *enginev1.ExecutionPayloadHeader) (interfaces.ExecutionData, error)

WrappedExecutionPayloadHeader is a constructor which wraps a protobuf execution header into an interface.

func WrappedExecutionPayloadHeaderCapella

func WrappedExecutionPayloadHeaderCapella(p *enginev1.ExecutionPayloadHeaderCapella) (interfaces.ExecutionData, error)

WrappedExecutionPayloadHeaderCapella is a constructor which wraps a protobuf execution header into an interface.

func WrappedExecutionPayloadHeaderDeneb

func WrappedExecutionPayloadHeaderDeneb(p *enginev1.ExecutionPayloadHeaderDeneb) (interfaces.ExecutionData, error)

WrappedExecutionPayloadHeaderDeneb is a constructor which wraps a protobuf execution header into an interface.

func WrappedROBlindedExecutionPayloadEnvelope added in v7.1.5

func WrappedROBlindedExecutionPayloadEnvelope(p *ethpb.BlindedExecutionPayloadEnvelope) (interfaces.ROBlindedExecutionPayloadEnvelope, error)

WrappedROBlindedExecutionPayloadEnvelope wraps a blinded execution payload envelope proto in a read-only interface.

func WrappedROExecutionPayloadBid added in v7.1.3

func WrappedROExecutionPayloadBid(pb *ethpb.ExecutionPayloadBid) (interfaces.ROExecutionPayloadBid, error)

WrappedROExecutionPayloadBid creates a new read-only execution payload bid wrapper for the Gloas fork from the given protobuf message.

func WrappedROExecutionPayloadEnvelope added in v7.1.4

func WrappedROExecutionPayloadEnvelope(p *ethpb.ExecutionPayloadEnvelope) (interfaces.ROExecutionPayloadEnvelope, error)

WrappedROExecutionPayloadEnvelope wraps an execution payload envelope proto in a read-only interface.

func WrappedROSignedExecutionPayloadBid added in v7.1.3

func WrappedROSignedExecutionPayloadBid(pb *ethpb.SignedExecutionPayloadBid) (interfaces.ROSignedExecutionPayloadBid, error)

WrappedROSignedExecutionPayloadBid creates a new read-only signed execution payload bid wrapper from the given protobuf message.

func WrappedROSignedExecutionPayloadEnvelope added in v7.1.4

func WrappedROSignedExecutionPayloadEnvelope(s *ethpb.SignedExecutionPayloadEnvelope) (interfaces.ROSignedExecutionPayloadEnvelope, error)

WrappedROSignedExecutionPayloadEnvelope wraps a signed execution payload envelope proto in a read-only interface.

Types

type BeaconBlock

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

BeaconBlock is the main beacon block structure. It can represent any block type.

func (*BeaconBlock) AsSignRequestObject

func (b *BeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, error)

AsSignRequestObject returns the underlying sign request object.

func (*BeaconBlock) Body

Body returns the underlying block body.

func (*BeaconBlock) HashTreeRoot

func (b *BeaconBlock) HashTreeRoot() ([field_params.RootLength]byte, error)

HashTreeRoot returns the ssz root of the block.

func (*BeaconBlock) HashTreeRootWith

func (b *BeaconBlock) HashTreeRootWith(h *ssz.Hasher) error

HashTreeRootWith ssz hashes the BeaconBlock object with a hasher.

func (*BeaconBlock) IsBlinded

func (b *BeaconBlock) IsBlinded() bool

IsBlinded checks if the beacon block is a blinded block.

func (*BeaconBlock) IsNil

func (b *BeaconBlock) IsNil() bool

IsNil checks if the beacon block is nil.

func (*BeaconBlock) MarshalSSZ

func (b *BeaconBlock) MarshalSSZ() ([]byte, error)

MarshalSSZ marshals the block into its respective ssz form.

func (*BeaconBlock) MarshalSSZTo

func (b *BeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo marshals the beacon block's ssz form to the provided byte buffer.

func (*BeaconBlock) ParentRoot

func (b *BeaconBlock) ParentRoot() [field_params.RootLength]byte

ParentRoot returns the parent root of beacon block.

func (*BeaconBlock) ProposerIndex

func (b *BeaconBlock) ProposerIndex() primitives.ValidatorIndex

ProposerIndex returns the proposer index of the beacon block.

func (*BeaconBlock) Proto

func (b *BeaconBlock) Proto() (proto.Message, error)

Proto converts the beacon block to a protobuf object.

func (*BeaconBlock) SizeSSZ

func (b *BeaconBlock) SizeSSZ() int

SizeSSZ returns the size of the serialized block.

WARNING: This function panics. It is required to change the signature of fastssz's SizeSSZ() interface function to avoid panicking. Changing the signature causes very problematic issues with wealdtech deps. For the time being panicking is preferable. lint:nopanic -- Panic is communicated in godoc.

func (*BeaconBlock) Slot

func (b *BeaconBlock) Slot() primitives.Slot

Slot returns the respective slot of the block.

func (*BeaconBlock) StateRoot

func (b *BeaconBlock) StateRoot() [field_params.RootLength]byte

StateRoot returns the state root of the beacon block.

func (*BeaconBlock) UnmarshalSSZ

func (b *BeaconBlock) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ unmarshals the beacon block from its relevant ssz form. nolint:gocognit

func (*BeaconBlock) Version

func (b *BeaconBlock) Version() int

Version of the underlying protobuf object.

type BeaconBlockBody

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

BeaconBlockBody is the main beacon block body structure. It can represent any block type.

func (*BeaconBlockBody) Attestations

func (b *BeaconBlockBody) Attestations() []eth.Att

Attestations returns the stored attestations in the block.

func (*BeaconBlockBody) AttesterSlashings

func (b *BeaconBlockBody) AttesterSlashings() []eth.AttSlashing

AttesterSlashings returns the attester slashings in the block.

func (*BeaconBlockBody) BLSToExecutionChanges

func (b *BeaconBlockBody) BLSToExecutionChanges() ([]*eth.SignedBLSToExecutionChange, error)

func (*BeaconBlockBody) BlobKzgCommitments

func (b *BeaconBlockBody) BlobKzgCommitments() ([][]byte, error)

BlobKzgCommitments returns the blob kzg commitments in the block.

func (*BeaconBlockBody) Deposits

func (b *BeaconBlockBody) Deposits() []*eth.Deposit

Deposits returns the stored deposits in the block.

func (*BeaconBlockBody) Eth1Data

func (b *BeaconBlockBody) Eth1Data() *eth.Eth1Data

Eth1Data returns the eth1 data in the block.

func (*BeaconBlockBody) Execution

func (b *BeaconBlockBody) Execution() (interfaces.ExecutionData, error)

Execution returns the execution payload of the block body.

func (*BeaconBlockBody) ExecutionRequests

func (b *BeaconBlockBody) ExecutionRequests() (*enginev1.ExecutionRequests, error)

ExecutionRequests returns the execution requests

func (*BeaconBlockBody) Graffiti

Graffiti returns the graffiti in the block.

func (*BeaconBlockBody) HashTreeRoot

func (b *BeaconBlockBody) HashTreeRoot() ([field_params.RootLength]byte, error)

HashTreeRoot returns the ssz root of the block body.

func (*BeaconBlockBody) IsBlinded

func (b *BeaconBlockBody) IsBlinded() bool

IsBlinded checks if the beacon block body is a blinded block body.

func (*BeaconBlockBody) IsNil

func (b *BeaconBlockBody) IsNil() bool

IsNil checks if the block body is nil.

func (*BeaconBlockBody) ParentExecutionRequests added in v7.1.5

func (b *BeaconBlockBody) ParentExecutionRequests() (*enginev1.ExecutionRequestsGloas, error)

ParentExecutionRequests returns the parent's deferred execution requests.

func (*BeaconBlockBody) PayloadAttestations added in v7.1.0

func (b *BeaconBlockBody) PayloadAttestations() ([]*eth.PayloadAttestation, error)

PayloadAttestations returns the payload attestations in the block.

func (*BeaconBlockBody) ProposerSlashings

func (b *BeaconBlockBody) ProposerSlashings() []*eth.ProposerSlashing

ProposerSlashings returns the proposer slashings in the block.

func (*BeaconBlockBody) Proto

func (b *BeaconBlockBody) Proto() (proto.Message, error)

Proto converts the beacon block body to a protobuf object. nolint:gocognit

func (*BeaconBlockBody) RandaoReveal

RandaoReveal returns the randao reveal from the block body.

func (*BeaconBlockBody) SignedExecutionPayloadBid added in v7.1.0

func (b *BeaconBlockBody) SignedExecutionPayloadBid() (*eth.SignedExecutionPayloadBid, error)

SignedExecutionPayloadBid returns the signed execution payload header in the block.

func (*BeaconBlockBody) SyncAggregate

func (b *BeaconBlockBody) SyncAggregate() (*eth.SyncAggregate, error)

SyncAggregate returns the sync aggregate in the block.

func (*BeaconBlockBody) Version

func (b *BeaconBlockBody) Version() int

Version returns the version of the beacon block body

func (*BeaconBlockBody) VoluntaryExits

func (b *BeaconBlockBody) VoluntaryExits() []*eth.SignedVoluntaryExit

VoluntaryExits returns the voluntary exits in the block.

type BlockWithROBlobsSlice

type BlockWithROBlobsSlice []BlockWithROSidecars

BlockWithROBlobsSlice gives convenient access to getting a slice of just the ROBlocks, and defines sorting helpers.

func (BlockWithROBlobsSlice) Len

func (s BlockWithROBlobsSlice) Len() int

Len is the number of elements in the collection.

func (BlockWithROBlobsSlice) Less

func (s BlockWithROBlobsSlice) Less(i, j int) bool

Less reports whether the element with index i must sort before the element with index j. ROBlocks are ordered first by their slot, with a lexicographic sort of roots breaking ties for slots with duplicate blocks.

func (BlockWithROBlobsSlice) ROBlocks

func (s BlockWithROBlobsSlice) ROBlocks() []ROBlock

func (BlockWithROBlobsSlice) Swap

func (s BlockWithROBlobsSlice) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type BlockWithROSidecars

type BlockWithROSidecars struct {
	Block   ROBlock
	Blobs   []ROBlob
	Columns []VerifiedRODataColumn
}

BlockWithROSidecars is a wrapper that collects the block and blob values together. This is helpful because these values are collated from separate RPC requests.

type CellProofBundle added in v7.1.6

type CellProofBundle struct {
	ColumnIndex uint64
	Commitment  []byte
	Cell        []byte
	Proof       []byte
}

CellProofBundle contains a cell, its proof, and the corresponding commitment/index information.

func RODataColumnsToCellProofBundles added in v7.1.6

func RODataColumnsToCellProofBundles(sidecars []RODataColumn) ([]CellProofBundle, error)

RODataColumnsToCellProofBundles flattens the cells, commitments and proofs of the given data column sidecars into CellProofBundles.

type GetPayloadResponse

type GetPayloadResponse struct {
	ExecutionData   interfaces.ExecutionData
	BlobsBundler    pb.BlobsBundler
	OverrideBuilder bool
	// todo: should we convert this to Gwei up front?
	Bid                    primitives.Wei
	ExecutionRequests      *pb.ExecutionRequests
	ExecutionRequestsGloas *pb.ExecutionRequestsGloas
}

GetPayloadResponse represents the result of unmarshaling an execution engine GetPayloadResponseV(1|2|3|4|5) value.

func NewGetPayloadResponse

func NewGetPayloadResponse(msg proto.Message) (*GetPayloadResponse, error)

type MerkleProofComponents

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

MerkleProofComponents contains pre-computed components for efficient proof generation

func PrecomputeMerkleProofComponents

func PrecomputeMerkleProofComponents(body interfaces.ReadOnlyBeaconBlockBody) (*MerkleProofComponents, error)

PrecomputeMerkleProofComponents pre-computes the expensive parts of Merkle proof generation that are shared across all blob indices for a given block body.

type PartialDataColumn added in v7.1.6

type PartialDataColumn struct {
	*ethpb.DataColumnSidecar

	Included bitfield.Bitlist

	// set to true when the node itself has Published this column. We only want
	// to republish in response to an incoming RPC after we publish this column
	// ourselves, as that is the point we know what cells we have or are
	// missing.
	Published bool
	// contains filtered or unexported fields
}

PartialDataColumn is a partially populated DataColumnSidecar used for exchanging cells with peers.

func NewPartialDataColumn added in v7.1.6

func NewPartialDataColumn(
	root [fieldparams.RootLength]byte,
	signedBlockHeader *ethpb.SignedBeaconBlockHeader,
	columnIndex uint64,
	kzgCommitments [][]byte,
	kzgInclusionProof [][]byte,
) (PartialDataColumn, error)

NewPartialDataColumn creates a new Partial Data Column for the given block. It does not validate the inputs. The caller is responsible for validating the block header and KZG Commitment Inclusion proof.

func NewPartialDataColumnFromVerifiedRODataColumn added in v7.1.6

func NewPartialDataColumnFromVerifiedRODataColumn(c VerifiedRODataColumn) (PartialDataColumn, error)

NewPartialDataColumnFromVerifiedRODataColumn builds a PartialDataColumn from an already verified RO data column, marking all of its cells as included.

func (*PartialDataColumn) CellsToVerifyFromPartialMessage added in v7.1.6

func (p *PartialDataColumn) CellsToVerifyFromPartialMessage(message *ethpb.PartialDataColumnSidecar) ([]uint64, []CellProofBundle, error)

CellsToVerifyFromPartialMessage returns cells from the partial message that need to be verified.

func (*PartialDataColumn) ClearPartsRequests added in v7.1.6

func (p *PartialDataColumn) ClearPartsRequests()

ClearPartsRequests removes any request bitmap override.

func (*PartialDataColumn) ExtendFromVerifiedCell added in v7.1.6

func (p *PartialDataColumn) ExtendFromVerifiedCell(cellIndex uint64, cell, proof []byte) bool

ExtendFromVerifiedCell extends this partial column with one verified cell. It returns false without modifying the column if the cell is already present or if cellIndex is out of range.

func (*PartialDataColumn) GroupID added in v7.1.6

func (p *PartialDataColumn) GroupID() []byte

GroupID returns the libp2p partial-messages group identifier. It returns a copy so callers cannot mutate the internal group identifier.

func (*PartialDataColumn) IsComplete added in v7.1.6

func (p *PartialDataColumn) IsComplete() bool

IsComplete returns true if all cells are now present in this column.

func (*PartialDataColumn) KzgCommitmentCount added in v7.1.6

func (p *PartialDataColumn) KzgCommitmentCount() uint64

KzgCommitmentCount returns the number of KZG commitments in the block header for this column, which in turn is equal to the number of cells in this column.

func (*PartialDataColumn) PartsMetadata added in v7.1.6

func (p *PartialDataColumn) PartsMetadata() (partialmessages.PartsMetadata, error)

PartsMetadata returns SSZ-encoded PartialDataColumnPartsMetadata.

func (*PartialDataColumn) PartsRequests added in v7.1.6

func (p *PartialDataColumn) PartsRequests() (bitfield.Bitlist, bool)

PartsRequests returns a cloned request bitmap override, if one is set.

func (*PartialDataColumn) PublishActionsFn added in v7.1.6

func (p *PartialDataColumn) PublishActionsFn(headerSentCache map[peer.ID]bool, onEagerPush func(peer.ID)) partialmessages.PublishActionsFn[PartialDataColumnPeerState]

PublishActionsFn returns a PublishActionsFn that, for each known peer, computes the next peer state and the publish action to send to that peer. headerSentCache tracks whether the block header has already been sent to a peer so it is only included once; it is updated as actions are produced. onEagerPush, if non-nil, is invoked for each peer that was eager pushed to.

func (*PartialDataColumn) SetPartsRequests added in v7.1.6

func (p *PartialDataColumn) SetPartsRequests(requests bitfield.Bitlist) error

SetPartsRequests overrides the request bitmap emitted in parts metadata.

type PartialDataColumnPeerState added in v7.1.6

type PartialDataColumnPeerState struct {
	Sent  *ethpb.PartialDataColumnPartsMetadata
	Recvd *ethpb.PartialDataColumnPartsMetadata
}

func (PartialDataColumnPeerState) Clone added in v7.1.6

Clone creates a deep copy of the PeerState. It clones the Recvd and Sent fields when they are non-nil, ensuring that modifications to the returned state do not affect the original.

type ROBlob

type ROBlob struct {
	*ethpb.BlobSidecar
	// contains filtered or unexported fields
}

ROBlob represents a read-only blob sidecar with its block root.

func NewROBlob

func NewROBlob(b *ethpb.BlobSidecar) (ROBlob, error)

NewROBlob creates a new ROBlob by computing the HashTreeRoot of the header.

func NewROBlobWithRoot

func NewROBlobWithRoot(b *ethpb.BlobSidecar, root [32]byte) (ROBlob, error)

NewROBlobWithRoot creates a new ROBlob with a given root.

func (*ROBlob) BlockRoot

func (b *ROBlob) BlockRoot() [32]byte

BlockRoot returns the root of the block.

func (*ROBlob) BlockRootSlice

func (b *ROBlob) BlockRootSlice() []byte

BlockRootSlice returns the block root as a byte slice. This is often more convenient/concise than setting a tmp var to BlockRoot(), just so that it can be sliced.

func (*ROBlob) BodyRoot

func (b *ROBlob) BodyRoot() [32]byte

BodyRoot returns the body root of the blob sidecar.

func (*ROBlob) ParentRoot

func (b *ROBlob) ParentRoot() [32]byte

ParentRoot returns the parent root of the blob sidecar.

func (*ROBlob) ParentRootSlice

func (b *ROBlob) ParentRootSlice() []byte

ParentRootSlice returns the parent root as a byte slice.

func (*ROBlob) ProposerIndex

func (b *ROBlob) ProposerIndex() primitives.ValidatorIndex

ProposerIndex returns the proposer index of the blob sidecar.

func (*ROBlob) Slot

func (b *ROBlob) Slot() primitives.Slot

Slot returns the slot of the blob sidecar.

type ROBlobSlice

type ROBlobSlice []ROBlob

ROBlobSlice is a custom type for a []ROBlob, allowing methods to be defined that act on a slice of ROBlob.

func (ROBlobSlice) Protos

func (s ROBlobSlice) Protos() []*ethpb.BlobSidecar

Protos is a helper to make a more concise conversion from []ROBlob->[]*ethpb.BlobSidecar.

type ROBlock

type ROBlock struct {
	interfaces.ReadOnlySignedBeaconBlock
	// contains filtered or unexported fields
}

ROBlock is a value that embeds a ReadOnlySignedBeaconBlock along with its block root ([32]byte). This allows the block root to be cached within a value that satisfies the ReadOnlySignedBeaconBlock interface. Since the root and slot for each ROBlock is known, slices can be efficiently sorted using ROBlockSlice.

func NewROBlock

NewROBlock creates a ROBlock from a ReadOnlySignedBeaconBlock. It uses the HashTreeRoot method of the given ReadOnlySignedBeaconBlock.Block to compute the cached root.

func NewROBlockSlice

func NewROBlockSlice(blks []interfaces.ReadOnlySignedBeaconBlock) ([]ROBlock, error)

NewROBlockSlice is a helper method for converting a slice of the ReadOnlySignedBeaconBlock interface to a slice of ROBlock.

func NewROBlockWithRoot

func NewROBlockWithRoot(b interfaces.ReadOnlySignedBeaconBlock, root [32]byte) (ROBlock, error)

NewROBlockWithRoot creates an ROBlock embedding the given block with its root. It accepts the root as parameter rather than computing it internally, because in some cases a block is retrieved by its root and recomputing it is a waste.

func (ROBlock) ParentHash added in v7.1.5

func (b ROBlock) ParentHash() ([32]byte, error)

ParentHash returns the parent hash of a beacon block post-Gloas

func (ROBlock) Root

func (b ROBlock) Root() [32]byte

Root returns the block hash_tree_root for the embedded ReadOnlySignedBeaconBlock.Block().

func (ROBlock) RootSlice

func (b ROBlock) RootSlice() []byte

RootSlice returns a slice of the value returned by Root(). This is convenient because slicing the result of a func is not allowed, so only offering a fixed-length array version results in boilerplate code to

type ROBlockSlice

type ROBlockSlice []ROBlock

ROBlockSlice implements sort.Interface so that slices of ROBlocks can be easily sorted. A slice of ROBlock is sorted first by slot, with ties broken by cached block roots.

func (ROBlockSlice) Len

func (s ROBlockSlice) Len() int

Len is the number of elements in the collection.

func (ROBlockSlice) Less

func (s ROBlockSlice) Less(i, j int) bool

Less reports whether the element with index i must sort before the element with index j. ROBlocks are ordered first by their slot, with a lexicographic sort of roots breaking ties for slots with duplicate blocks.

func (ROBlockSlice) Swap

func (s ROBlockSlice) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type RODataColumn

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

RODataColumn represents a read-only data column sidecar with its block root. It supports both Fulu and Gloas fork variants. Only one of fulu/gloas is non-nil.

func NewRODataColumn

func NewRODataColumn(dc *ethpb.DataColumnSidecar) (RODataColumn, error)

NewRODataColumn creates a new RODataColumn from a Fulu DataColumnSidecar.

func NewRODataColumnGloas added in v7.1.5

func NewRODataColumnGloas(dc *ethpb.DataColumnSidecarGloas) (RODataColumn, error)

NewRODataColumnGloas creates a new RODataColumn from a Gloas DataColumnSidecarGloas.

func NewRODataColumnGloasWithRoot added in v7.1.5

func NewRODataColumnGloasWithRoot(dc *ethpb.DataColumnSidecarGloas, root [fieldparams.RootLength]byte) (RODataColumn, error)

NewRODataColumnGloasWithRoot creates a new RODataColumn from a Gloas DataColumnSidecarGloas with a given root.

func NewRODataColumnNoVerify added in v7.1.5

func NewRODataColumnNoVerify(dc *ethpb.DataColumnSidecar) RODataColumn

NewRODataColumnNoVerify creates an RODataColumn without validation. This should only be used in tests where intentionally malformed sidecars are needed to test error handling.

func NewRODataColumnWithRoot

func NewRODataColumnWithRoot(dc *ethpb.DataColumnSidecar, root [fieldparams.RootLength]byte) (RODataColumn, error)

NewRODataColumnWithRoot creates a new RODataColumn from a Fulu DataColumnSidecar with a given root.

func (*RODataColumn) BlockRoot

func (dc *RODataColumn) BlockRoot() [fieldparams.RootLength]byte

BlockRoot returns the root of the block.

func (*RODataColumn) Column added in v7.1.5

func (dc *RODataColumn) Column() [][]byte

Column returns the column cell data.

func (*RODataColumn) DataColumnSidecar added in v7.1.5

func (dc *RODataColumn) DataColumnSidecar() *ethpb.DataColumnSidecar

DataColumnSidecar returns the underlying Fulu proto, or nil if this is a Gloas sidecar.

func (*RODataColumn) DataColumnSidecarGloas added in v7.1.5

func (dc *RODataColumn) DataColumnSidecarGloas() *ethpb.DataColumnSidecarGloas

DataColumnSidecarGloas returns the underlying Gloas proto, or nil if this is a Fulu sidecar.

func (*RODataColumn) Index added in v7.1.5

func (dc *RODataColumn) Index() uint64

Index returns the column index.

func (*RODataColumn) IsGloas added in v7.1.5

func (dc *RODataColumn) IsGloas() bool

IsGloas returns true if this data column is a Gloas fork variant.

func (*RODataColumn) KzgCommitments added in v7.1.5

func (dc *RODataColumn) KzgCommitments() ([][]byte, error)

KzgCommitments returns the KZG commitments. For Fulu these are in the sidecar. For Gloas these come from the block's bid and must be set via SetBidCommitments.

func (*RODataColumn) KzgCommitmentsInclusionProof added in v7.1.5

func (dc *RODataColumn) KzgCommitmentsInclusionProof() ([][]byte, error)

KzgCommitmentsInclusionProof returns the inclusion proof. Returns an error for Gloas sidecars.

func (*RODataColumn) KzgProofs added in v7.1.5

func (dc *RODataColumn) KzgProofs() [][]byte

KzgProofs returns the KZG proofs.

func (*RODataColumn) MarshalSSZ added in v7.1.5

func (dc *RODataColumn) MarshalSSZ() ([]byte, error)

MarshalSSZ marshals the underlying proto to SSZ bytes. Works for both Fulu and Gloas sidecars.

func (*RODataColumn) MarshalSSZTo added in v7.1.5

func (dc *RODataColumn) MarshalSSZTo(buf []byte) ([]byte, error)

MarshalSSZTo marshals the underlying proto to the provided byte slice.

func (*RODataColumn) ParentRoot

func (dc *RODataColumn) ParentRoot() ([fieldparams.RootLength]byte, error)

ParentRoot returns the parent root. Returns an error for Gloas sidecars.

func (*RODataColumn) ProposerIndex

func (dc *RODataColumn) ProposerIndex() (primitives.ValidatorIndex, error)

ProposerIndex returns the proposer index. Returns an error for Gloas sidecars.

func (*RODataColumn) SetBidCommitments added in v7.1.5

func (dc *RODataColumn) SetBidCommitments(c [][]byte)

SetBidCommitments sets the KZG commitments from the block's bid to be used for gloas.

func (*RODataColumn) SignedBlockHeader added in v7.1.5

func (dc *RODataColumn) SignedBlockHeader() (*ethpb.SignedBeaconBlockHeader, error)

SignedBlockHeader returns the signed block header. Returns an error for Gloas sidecars.

func (*RODataColumn) SizeSSZ added in v7.1.5

func (dc *RODataColumn) SizeSSZ() int

SizeSSZ returns the SSZ encoded size of the underlying proto.

func (*RODataColumn) Slot

func (dc *RODataColumn) Slot() primitives.Slot

Slot returns the slot of the data column sidecar.

type SignedBeaconBlock

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

SignedBeaconBlock is the main signed beacon block structure. It can represent any block type.

func (*SignedBeaconBlock) Block

Block returns the underlying beacon block object.

func (*SignedBeaconBlock) Copy

Copy performs a deep copy of the signed beacon block object.

func (*SignedBeaconBlock) Header

Header converts the underlying protobuf object from blinded block to header format.

func (*SignedBeaconBlock) IsBlinded

func (b *SignedBeaconBlock) IsBlinded() bool

IsBlinded metadata on whether a block is blinded

func (*SignedBeaconBlock) IsNil

func (b *SignedBeaconBlock) IsNil() bool

IsNil checks if the underlying beacon block is nil.

func (*SignedBeaconBlock) MarshalSSZ

func (b *SignedBeaconBlock) MarshalSSZ() ([]byte, error)

MarshalSSZ marshals the signed beacon block to its relevant ssz form.

func (*SignedBeaconBlock) MarshalSSZTo

func (b *SignedBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo marshals the signed beacon block's ssz form to the provided byte buffer.

func (*SignedBeaconBlock) PbGenericBlock

func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, error)

PbGenericBlock returns a generic signed beacon block.

func (*SignedBeaconBlock) Proto

func (b *SignedBeaconBlock) Proto() (proto.Message, error)

Proto converts the signed beacon block to a protobuf object.

func (*SignedBeaconBlock) SetAttestations

func (b *SignedBeaconBlock) SetAttestations(atts []eth.Att) error

SetAttestations sets the attestations in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetAttesterSlashings

func (b *SignedBeaconBlock) SetAttesterSlashings(slashings []eth.AttSlashing) error

SetAttesterSlashings sets the attester slashings in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetBLSToExecutionChanges

func (b *SignedBeaconBlock) SetBLSToExecutionChanges(blsToExecutionChanges []*eth.SignedBLSToExecutionChange) error

SetBLSToExecutionChanges sets the BLS to execution changes in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetBlobKzgCommitments

func (b *SignedBeaconBlock) SetBlobKzgCommitments(c [][]byte) error

SetBlobKzgCommitments sets the blob kzg commitments in the block.

func (*SignedBeaconBlock) SetDeposits

func (b *SignedBeaconBlock) SetDeposits(d []*eth.Deposit)

SetDeposits sets the deposits in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetEth1Data

func (b *SignedBeaconBlock) SetEth1Data(e *eth.Eth1Data)

SetEth1Data sets the eth1 data in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetExecution

func (b *SignedBeaconBlock) SetExecution(e interfaces.ExecutionData) error

SetExecution sets the execution payload of the block body. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetExecutionRequests

func (b *SignedBeaconBlock) SetExecutionRequests(req *enginev1.ExecutionRequests) error

SetExecutionRequests sets the execution requests in the block.

func (*SignedBeaconBlock) SetGraffiti

func (b *SignedBeaconBlock) SetGraffiti(g []byte)

SetGraffiti sets the graffiti in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetParentExecutionRequests added in v7.1.5

func (b *SignedBeaconBlock) SetParentExecutionRequests(r *enginev1.ExecutionRequestsGloas) error

SetParentExecutionRequests sets the parent execution requests in the block.

func (*SignedBeaconBlock) SetParentRoot

func (b *SignedBeaconBlock) SetParentRoot(parentRoot []byte)

SetParentRoot sets the parent root of beacon block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetPayloadAttestations added in v7.1.0

func (b *SignedBeaconBlock) SetPayloadAttestations(pa []*eth.PayloadAttestation) error

SetPayloadAttestations sets the payload attestations in the block.

func (*SignedBeaconBlock) SetProposerIndex

func (b *SignedBeaconBlock) SetProposerIndex(proposerIndex primitives.ValidatorIndex)

SetProposerIndex sets the proposer index of the beacon block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetProposerSlashings

func (b *SignedBeaconBlock) SetProposerSlashings(p []*eth.ProposerSlashing)

SetProposerSlashings sets the proposer slashings in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetRandaoReveal

func (b *SignedBeaconBlock) SetRandaoReveal(r []byte)

SetRandaoReveal sets the randao reveal in the block body. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetSignature

func (b *SignedBeaconBlock) SetSignature(sig []byte)

SetSignature sets the signature of the signed beacon block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetSignedExecutionPayloadBid added in v7.1.0

func (b *SignedBeaconBlock) SetSignedExecutionPayloadBid(header *eth.SignedExecutionPayloadBid) error

SetSignedExecutionPayloadBid sets the signed execution payload header in the block.

func (*SignedBeaconBlock) SetSlot

func (b *SignedBeaconBlock) SetSlot(slot primitives.Slot)

SetSlot sets the respective slot of the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetStateRoot

func (b *SignedBeaconBlock) SetStateRoot(root []byte)

SetStateRoot sets the state root of the underlying beacon block This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetSyncAggregate

func (b *SignedBeaconBlock) SetSyncAggregate(s *eth.SyncAggregate) error

SetSyncAggregate sets the sync aggregate in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) SetVoluntaryExits

func (b *SignedBeaconBlock) SetVoluntaryExits(v []*eth.SignedVoluntaryExit)

SetVoluntaryExits sets the voluntary exits in the block. This function is not thread safe, it is only used during block creation.

func (*SignedBeaconBlock) Signature

Signature returns the respective block signature.

func (*SignedBeaconBlock) SizeSSZ

func (b *SignedBeaconBlock) SizeSSZ() int

SizeSSZ returns the size of the serialized signed block

WARNING: This function panics. It is required to change the signature of fastssz's SizeSSZ() interface function to avoid panicking. Changing the signature causes very problematic issues with wealdtech deps. For the time being panicking is preferable. lint:nopanic -- Panic warning is communicated in godoc commentary.

func (*SignedBeaconBlock) ToBlinded

ToBlinded converts a non-blinded block to its blinded equivalent.

func (*SignedBeaconBlock) Unblind

func (*SignedBeaconBlock) UnmarshalSSZ

func (b *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ unmarshals the sitime/slots/slottime.gogned beacon block from its relevant ssz form. nolint:gocognit

func (*SignedBeaconBlock) Version

func (b *SignedBeaconBlock) Version() int

Version of the underlying protobuf object.

type VerifiedROBlob

type VerifiedROBlob struct {
	ROBlob
}

VerifiedROBlob represents an ROBlob that has undergone full verification (eg block sig, inclusion proof, commitment check).

func NewVerifiedROBlob

func NewVerifiedROBlob(rob ROBlob) VerifiedROBlob

NewVerifiedROBlob "upgrades" an ROBlob to a VerifiedROBlob. This method should only be used by the verification package.

type VerifiedRODataColumn

type VerifiedRODataColumn struct {
	RODataColumn
}

VerifiedRODataColumn represents an RODataColumn that has undergone full verification (eg block sig, inclusion proof, commitment check).

func NewVerifiedRODataColumn

func NewVerifiedRODataColumn(roDataColumn RODataColumn) VerifiedRODataColumn

NewVerifiedRODataColumn "upgrades" an RODataColumn to a VerifiedRODataColumn. This method should only be used by the verification package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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