Documentation ¶
Index ¶
- Constants
- Variables
- func BeaconBlockContainerToSignedBeaconBlock(obj *eth.BeaconBlockContainer) (interfaces.ReadOnlySignedBeaconBlock, error)
- func BeaconBlockIsNil(b interfaces.ReadOnlySignedBeaconBlock) error
- func BuildSignedBeaconBlock(blk interfaces.ReadOnlyBeaconBlock, signature []byte) (interfaces.SignedBeaconBlock, error)
- func BuildSignedBeaconBlockFromExecutionPayload(blk interfaces.ReadOnlySignedBeaconBlock, payload interface{}) (interfaces.SignedBeaconBlock, error)
- func IsEmptyExecutionData(data interfaces.ExecutionData) (bool, error)
- func MerkleProofKZGCommitment(body interfaces.ReadOnlyBeaconBlockBody, index int) ([][]byte, error)
- func NewBeaconBlock(i interface{}) (interfaces.ReadOnlyBeaconBlock, error)
- func NewBeaconBlockBody(i interface{}) (interfaces.ReadOnlyBeaconBlockBody, error)
- func NewSignedBeaconBlock(i interface{}) (interfaces.SignedBeaconBlock, error)
- func PayloadToHeader(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeader, error)
- func PayloadToHeaderCapella(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeaderCapella, error)
- func PayloadToHeaderDeneb(payload interfaces.ExecutionData) (*enginev1.ExecutionPayloadHeaderDeneb, error)
- func PayloadValueToGwei(value []byte) math.Gwei
- func PayloadValueToWei(value []byte) math.Wei
- func VerifyKZGInclusionProof(blob ROBlob) error
- func WrappedExecutionPayload(p *enginev1.ExecutionPayload) (interfaces.ExecutionData, error)
- func WrappedExecutionPayloadCapella(p *enginev1.ExecutionPayloadCapella, value math.Wei) (interfaces.ExecutionData, error)
- func WrappedExecutionPayloadDeneb(p *enginev1.ExecutionPayloadDeneb, value math.Wei) (interfaces.ExecutionData, error)
- func WrappedExecutionPayloadHeader(p *enginev1.ExecutionPayloadHeader) (interfaces.ExecutionData, error)
- func WrappedExecutionPayloadHeaderCapella(p *enginev1.ExecutionPayloadHeaderCapella, value math.Wei) (interfaces.ExecutionData, error)
- func WrappedExecutionPayloadHeaderDeneb(p *enginev1.ExecutionPayloadHeaderDeneb, value math.Wei) (interfaces.ExecutionData, error)
- type BeaconBlock
- func (b *BeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, error)
- func (b *BeaconBlock) Body() interfaces.ReadOnlyBeaconBlockBody
- func (b *BeaconBlock) Copy() (interfaces.ReadOnlyBeaconBlock, error)
- func (b *BeaconBlock) HashTreeRoot() ([field_params.RootLength]byte, error)
- func (b *BeaconBlock) HashTreeRootWith(h *ssz.Hasher) error
- func (b *BeaconBlock) IsBlinded() bool
- func (b *BeaconBlock) IsNil() bool
- func (b *BeaconBlock) MarshalSSZ() ([]byte, error)
- func (b *BeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error)
- func (b *BeaconBlock) ParentRoot() [field_params.RootLength]byte
- func (b *BeaconBlock) ProposerIndex() primitives.ValidatorIndex
- func (b *BeaconBlock) Proto() (proto.Message, error)
- func (b *BeaconBlock) SizeSSZ() int
- func (b *BeaconBlock) Slot() primitives.Slot
- func (b *BeaconBlock) StateRoot() [field_params.RootLength]byte
- func (b *BeaconBlock) UnmarshalSSZ(buf []byte) error
- func (b *BeaconBlock) Version() int
- type BeaconBlockBody
- func (b *BeaconBlockBody) Attestations() []*eth.Attestation
- func (b *BeaconBlockBody) AttesterSlashings() []*eth.AttesterSlashing
- func (b *BeaconBlockBody) BLSToExecutionChanges() ([]*eth.SignedBLSToExecutionChange, error)
- func (b *BeaconBlockBody) BlobKzgCommitments() ([][]byte, error)
- func (b *BeaconBlockBody) Deposits() []*eth.Deposit
- func (b *BeaconBlockBody) Eth1Data() *eth.Eth1Data
- func (b *BeaconBlockBody) Execution() (interfaces.ExecutionData, error)
- func (b *BeaconBlockBody) Graffiti() [field_params.RootLength]byte
- func (b *BeaconBlockBody) HashTreeRoot() ([field_params.RootLength]byte, error)
- func (b *BeaconBlockBody) IsBlinded() bool
- func (b *BeaconBlockBody) IsNil() bool
- func (b *BeaconBlockBody) ProposerSlashings() []*eth.ProposerSlashing
- func (b *BeaconBlockBody) Proto() (proto.Message, error)
- func (b *BeaconBlockBody) RandaoReveal() [field_params.BLSSignatureLength]byte
- func (b *BeaconBlockBody) SyncAggregate() (*eth.SyncAggregate, error)
- func (b *BeaconBlockBody) Version() int
- func (b *BeaconBlockBody) VoluntaryExits() []*eth.SignedVoluntaryExit
- type BlockWithROBlobs
- type BlockWithROBlobsSlice
- type ROBlob
- type ROBlobSlice
- type ROBlock
- type ROBlockSlice
- type SignedBeaconBlock
- func (b *SignedBeaconBlock) Block() interfaces.ReadOnlyBeaconBlock
- func (b *SignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error)
- func (b *SignedBeaconBlock) Header() (*eth.SignedBeaconBlockHeader, error)
- func (b *SignedBeaconBlock) IsBlinded() bool
- func (b *SignedBeaconBlock) IsNil() bool
- func (b *SignedBeaconBlock) MarshalSSZ() ([]byte, error)
- func (b *SignedBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error)
- func (b *SignedBeaconBlock) PbAltairBlock() (*eth.SignedBeaconBlockAltair, error)
- func (b *SignedBeaconBlock) PbBellatrixBlock() (*eth.SignedBeaconBlockBellatrix, error)
- func (b *SignedBeaconBlock) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error)
- func (b *SignedBeaconBlock) PbBlindedCapellaBlock() (*eth.SignedBlindedBeaconBlockCapella, error)
- func (b *SignedBeaconBlock) PbBlindedDenebBlock() (*eth.SignedBlindedBeaconBlockDeneb, error)
- func (b *SignedBeaconBlock) PbCapellaBlock() (*eth.SignedBeaconBlockCapella, error)
- func (b *SignedBeaconBlock) PbDenebBlock() (*eth.SignedBeaconBlockDeneb, error)
- func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, error)
- func (b *SignedBeaconBlock) PbPhase0Block() (*eth.SignedBeaconBlock, error)
- func (b *SignedBeaconBlock) Proto() (proto.Message, error)
- func (b *SignedBeaconBlock) SetAttestations(a []*eth.Attestation)
- func (b *SignedBeaconBlock) SetAttesterSlashings(a []*eth.AttesterSlashing)
- func (b *SignedBeaconBlock) SetBLSToExecutionChanges(blsToExecutionChanges []*eth.SignedBLSToExecutionChange) error
- func (b *SignedBeaconBlock) SetBlobKzgCommitments(c [][]byte) error
- func (b *SignedBeaconBlock) SetDeposits(d []*eth.Deposit)
- func (b *SignedBeaconBlock) SetEth1Data(e *eth.Eth1Data)
- func (b *SignedBeaconBlock) SetExecution(e interfaces.ExecutionData) error
- func (b *SignedBeaconBlock) SetGraffiti(g []byte)
- func (b *SignedBeaconBlock) SetParentRoot(parentRoot []byte)
- func (b *SignedBeaconBlock) SetProposerIndex(proposerIndex primitives.ValidatorIndex)
- func (b *SignedBeaconBlock) SetProposerSlashings(p []*eth.ProposerSlashing)
- func (b *SignedBeaconBlock) SetRandaoReveal(r []byte)
- func (b *SignedBeaconBlock) SetSignature(sig []byte)
- func (b *SignedBeaconBlock) SetSlot(slot primitives.Slot)
- func (b *SignedBeaconBlock) SetStateRoot(root []byte)
- func (b *SignedBeaconBlock) SetSyncAggregate(s *eth.SyncAggregate) error
- func (b *SignedBeaconBlock) SetVoluntaryExits(v []*eth.SignedVoluntaryExit)
- func (b *SignedBeaconBlock) Signature() [field_params.BLSSignatureLength]byte
- func (b *SignedBeaconBlock) SizeSSZ() int
- func (b *SignedBeaconBlock) ToBlinded() (interfaces.ReadOnlySignedBeaconBlock, error)
- func (b *SignedBeaconBlock) Unblind(e interfaces.ExecutionData) error
- func (b *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error
- func (b *SignedBeaconBlock) ValueInGwei() uint64
- func (b *SignedBeaconBlock) ValueInWei() math.Wei
- func (b *SignedBeaconBlock) Version() int
- type VerifiedROBlob
Constants ¶
const (
KZGOffset = 54 * field_params.MaxBlobCommitmentsPerBlock
)
Variables ¶
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") )
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 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 interface{}, ) (interfaces.SignedBeaconBlock, error)
BuildSignedBeaconBlockFromExecutionPayload takes a signed, blinded beacon block and converts into a full, signed beacon block by specifying an execution payload.
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 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 NewBeaconBlock ¶
func NewBeaconBlock(i interface{}) (interfaces.ReadOnlyBeaconBlock, error)
NewBeaconBlock creates a beacon block from a protobuf beacon block.
func NewBeaconBlockBody ¶
func NewBeaconBlockBody(i interface{}) (interfaces.ReadOnlyBeaconBlockBody, error)
NewBeaconBlockBody creates a beacon block body from a protobuf beacon block body.
func NewSignedBeaconBlock ¶
func NewSignedBeaconBlock(i interface{}) (interfaces.SignedBeaconBlock, error)
NewSignedBeaconBlock creates a signed beacon block from a protobuf signed beacon block.
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 PayloadValueToGwei ¶
PayloadValueToGwei returns a Gwei value given the payload's value
func PayloadValueToWei ¶
PayloadValueToWei returns a Wei value given the payload's value
func VerifyKZGInclusionProof ¶
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, value math.Wei) (interfaces.ExecutionData, error)
WrappedExecutionPayloadCapella is a constructor which wraps a protobuf execution payload into an interface.
func WrappedExecutionPayloadDeneb ¶
func WrappedExecutionPayloadDeneb(p *enginev1.ExecutionPayloadDeneb, value math.Wei) (interfaces.ExecutionData, error)
WrappedExecutionPayloadDeneb 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, value math.Wei) (interfaces.ExecutionData, error)
WrappedExecutionPayloadHeaderCapella is a constructor which wraps a protobuf execution header into an interface.
func WrappedExecutionPayloadHeaderDeneb ¶
func WrappedExecutionPayloadHeaderDeneb(p *enginev1.ExecutionPayloadHeaderDeneb, value math.Wei) (interfaces.ExecutionData, error)
WrappedExecutionPayloadHeaderDeneb is a constructor which wraps a protobuf execution header into an 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 ¶
func (b *BeaconBlock) Body() interfaces.ReadOnlyBeaconBlockBody
Body returns the underlying block body.
func (*BeaconBlock) Copy ¶
func (b *BeaconBlock) Copy() (interfaces.ReadOnlyBeaconBlock, error)
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.
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.
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.Attestation
Attestations returns the stored attestations in the block.
func (*BeaconBlockBody) AttesterSlashings ¶
func (b *BeaconBlockBody) AttesterSlashings() []*eth.AttesterSlashing
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) Graffiti ¶
func (b *BeaconBlockBody) Graffiti() [field_params.RootLength]byte
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) 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.
func (*BeaconBlockBody) RandaoReveal ¶
func (b *BeaconBlockBody) RandaoReveal() [field_params.BLSSignatureLength]byte
RandaoReveal returns the randao reveal from the block body.
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 BlockWithROBlobs ¶
BlockWithROBlobs is a wrapper that collects the block and blob values together. This is helpful because these values are collated from separate RPC requests.
type BlockWithROBlobsSlice ¶
type BlockWithROBlobsSlice []BlockWithROBlobs
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 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) BlockRootSlice ¶
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) ParentRoot ¶
ParentRoot returns the parent root of the blob sidecar.
func (*ROBlob) ParentRootSlice ¶
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 ¶
func NewROBlock(b interfaces.ReadOnlySignedBeaconBlock) (ROBlock, error)
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.
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 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 ¶
func (b *SignedBeaconBlock) Block() interfaces.ReadOnlyBeaconBlock
Block returns the underlying beacon block object.
func (*SignedBeaconBlock) Copy ¶
func (b *SignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error)
Copy performs a deep copy of the signed beacon block object.
func (*SignedBeaconBlock) Header ¶
func (b *SignedBeaconBlock) Header() (*eth.SignedBeaconBlockHeader, error)
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) PbAltairBlock ¶
func (b *SignedBeaconBlock) PbAltairBlock() (*eth.SignedBeaconBlockAltair, error)
PbAltairBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbBellatrixBlock ¶
func (b *SignedBeaconBlock) PbBellatrixBlock() (*eth.SignedBeaconBlockBellatrix, error)
PbBellatrixBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbBlindedBellatrixBlock ¶
func (b *SignedBeaconBlock) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error)
PbBlindedBellatrixBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbBlindedCapellaBlock ¶
func (b *SignedBeaconBlock) PbBlindedCapellaBlock() (*eth.SignedBlindedBeaconBlockCapella, error)
PbBlindedCapellaBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbBlindedDenebBlock ¶
func (b *SignedBeaconBlock) PbBlindedDenebBlock() (*eth.SignedBlindedBeaconBlockDeneb, error)
PbBlindedDenebBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbCapellaBlock ¶
func (b *SignedBeaconBlock) PbCapellaBlock() (*eth.SignedBeaconBlockCapella, error)
PbCapellaBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbDenebBlock ¶
func (b *SignedBeaconBlock) PbDenebBlock() (*eth.SignedBeaconBlockDeneb, error)
PbDenebBlock returns the underlying protobuf object.
func (*SignedBeaconBlock) PbGenericBlock ¶
func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, error)
PbGenericBlock returns a generic signed beacon block.
func (*SignedBeaconBlock) PbPhase0Block ¶
func (b *SignedBeaconBlock) PbPhase0Block() (*eth.SignedBeaconBlock, error)
PbPhase0Block returns the underlying protobuf object.
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(a []*eth.Attestation)
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(a []*eth.AttesterSlashing)
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) 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) 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) 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) 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 ¶
func (b *SignedBeaconBlock) Signature() [field_params.BLSSignatureLength]byte
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.
func (*SignedBeaconBlock) ToBlinded ¶
func (b *SignedBeaconBlock) ToBlinded() (interfaces.ReadOnlySignedBeaconBlock, error)
ToBlinded converts a non-blinded block to its blinded equivalent.
func (*SignedBeaconBlock) Unblind ¶
func (b *SignedBeaconBlock) Unblind(e interfaces.ExecutionData) error
func (*SignedBeaconBlock) UnmarshalSSZ ¶
func (b *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ unmarshals the signed beacon block from its relevant ssz form.
func (*SignedBeaconBlock) ValueInGwei ¶
func (b *SignedBeaconBlock) ValueInGwei() uint64
ValueInGwei metadata on the payload value returned by the builder.
func (*SignedBeaconBlock) ValueInWei ¶
func (b *SignedBeaconBlock) ValueInWei() math.Wei
ValueInWei metadata on the payload value returned by the builder.
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.