Light Client consensus types (#14518)

* protos/SSZ

* interfaces

* types

* cleanup/dedup

* changelog

* use createBranch in headers

* error handling

---------

Co-authored-by: rkapka <radoslaw.kapka@gmail.com>
This commit is contained in:
Bastin
2024-10-08 19:07:56 +02:00
committed by GitHub
parent cfbfccb203
commit 7fc5c714a1
21 changed files with 5564 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- Light client support: Add light client database changes.
- Light client support: Implement capella and deneb changes.
- Light client support: Implement `BlockToLightClientHeader` function.
- Light client support: Consensus types.
- GetBeaconStateV2: add Electra case.
- Implement [consensus-specs/3875](https://github.com/ethereum/consensus-specs/pull/3875)
- Tests to ensure sepolia config matches the official upstream yaml

View File

@@ -243,8 +243,8 @@ func createDefaultLightClientUpdate() (*ethpbv2.LightClientUpdate, error) {
Pubkeys: pubKeys,
AggregatePubkey: make([]byte, fieldparams.BLSPubkeyLength),
}
nextSyncCommitteeBranch := make([][]byte, fieldparams.NextSyncCommitteeBranchDepth)
for i := 0; i < fieldparams.NextSyncCommitteeBranchDepth; i++ {
nextSyncCommitteeBranch := make([][]byte, fieldparams.SyncCommitteeBranchDepth)
for i := 0; i < fieldparams.SyncCommitteeBranchDepth; i++ {
nextSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength)
}
executionBranch := make([][]byte, executionBranchNumOfLeaves)

View File

@@ -91,7 +91,7 @@ func createLightClientBootstrapAltair(ctx context.Context, state state.BeaconSta
return nil, errors.Wrap(err, "could not get current sync committee proof")
}
branch := make([]string, fieldparams.NextSyncCommitteeBranchDepth)
branch := make([]string, fieldparams.SyncCommitteeBranchDepth)
for i, proof := range currentSyncCommitteeProof {
branch[i] = hexutil.Encode(proof)
}
@@ -159,7 +159,7 @@ func createLightClientBootstrapCapella(ctx context.Context, state state.BeaconSt
return nil, errors.Wrap(err, "could not get current sync committee proof")
}
branch := make([]string, fieldparams.NextSyncCommitteeBranchDepth)
branch := make([]string, fieldparams.SyncCommitteeBranchDepth)
for i, proof := range currentSyncCommitteeProof {
branch[i] = hexutil.Encode(proof)
}
@@ -227,7 +227,7 @@ func createLightClientBootstrapDeneb(ctx context.Context, state state.BeaconStat
return nil, errors.Wrap(err, "could not get current sync committee proof")
}
branch := make([]string, fieldparams.NextSyncCommitteeBranchDepth)
branch := make([]string, fieldparams.SyncCommitteeBranchDepth)
for i, proof := range currentSyncCommitteeProof {
branch[i] = hexutil.Encode(proof)
}
@@ -288,7 +288,7 @@ func newLightClientOptimisticUpdateFromBeaconState(
}
func IsSyncCommitteeUpdate(update *v2.LightClientUpdate) bool {
nextSyncCommitteeBranch := make([][]byte, fieldparams.NextSyncCommitteeBranchDepth)
nextSyncCommitteeBranch := make([][]byte, fieldparams.SyncCommitteeBranchDepth)
return !reflect.DeepEqual(update.NextSyncCommitteeBranch, nextSyncCommitteeBranch)
}

View File

@@ -13,7 +13,7 @@ import (
// When the update has relevant sync committee
func createNonEmptySyncCommitteeBranch() [][]byte {
res := make([][]byte, fieldparams.NextSyncCommitteeBranchDepth)
res := make([][]byte, fieldparams.SyncCommitteeBranchDepth)
res[0] = []byte("xyz")
return res
}
@@ -101,7 +101,7 @@ func TestIsBetterUpdate(t *testing.T) {
}},
},
},
NextSyncCommitteeBranch: make([][]byte, fieldparams.NextSyncCommitteeBranchDepth),
NextSyncCommitteeBranch: make([][]byte, fieldparams.SyncCommitteeBranchDepth),
SignatureSlot: 9999,
},
newUpdate: &ethpbv2.LightClientUpdate{
@@ -147,7 +147,7 @@ func TestIsBetterUpdate(t *testing.T) {
}},
},
},
NextSyncCommitteeBranch: make([][]byte, fieldparams.NextSyncCommitteeBranchDepth),
NextSyncCommitteeBranch: make([][]byte, fieldparams.SyncCommitteeBranchDepth),
SignatureSlot: 9999,
},
expectedResult: false,

View File

@@ -33,7 +33,9 @@ const (
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
BlobSidecarSize = 131928 // defined to match blob sidecar size in bazel ssz codegen
KzgCommitmentInclusionProofDepth = 17 // Merkle proof depth for blob_kzg_commitments list item
NextSyncCommitteeBranchDepth = 5 // NextSyncCommitteeBranchDepth defines the depth of the next sync committee branch.
ExecutionBranchDepth = 4 // ExecutionBranchDepth defines the number of leaves in a merkle proof of the execution payload header.
SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee.
FinalityBranchDepth = 6 // FinalityBranchDepth defines the number of leaves in a merkle proof of the finalized checkpoint root.
PendingBalanceDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
PendingPartialWithdrawalsLimit = 134217728 // Maximum number of pending partial withdrawals in the beacon state.
PendingConsolidationsLimit = 262144 // Maximum number of pending consolidations in the beacon state.

View File

@@ -33,7 +33,9 @@ const (
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
BlobSidecarSize = 131928 // defined to match blob sidecar size in bazel ssz codegen
KzgCommitmentInclusionProofDepth = 17 // Merkle proof depth for blob_kzg_commitments list item
NextSyncCommitteeBranchDepth = 5 // NextSyncCommitteeBranchDepth defines the depth of the next sync committee branch.
ExecutionBranchDepth = 4 // ExecutionBranchDepth defines the number of leaves in a merkle proof of the execution payload header.
SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee.
FinalityBranchDepth = 6 // FinalityBranchDepth defines the number of leaves in a merkle proof of the finalized checkpoint root.
PendingBalanceDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
PendingPartialWithdrawalsLimit = 64 // Maximum number of pending partial withdrawals in the beacon state.
PendingConsolidationsLimit = 64 // Maximum number of pending consolidations in the beacon state.

View File

@@ -5,6 +5,7 @@ go_library(
srcs = [
"beacon_block.go",
"error.go",
"light_client.go",
"utils.go",
"validator.go",
],

View File

@@ -0,0 +1,58 @@
package interfaces
import (
ssz "github.com/prysmaticlabs/fastssz"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
)
type LightClientExecutionBranch = [fieldparams.ExecutionBranchDepth][fieldparams.RootLength]byte
type LightClientSyncCommitteeBranch = [fieldparams.SyncCommitteeBranchDepth][fieldparams.RootLength]byte
type LightClientFinalityBranch = [fieldparams.FinalityBranchDepth][fieldparams.RootLength]byte
type LightClientHeader interface {
ssz.Marshaler
Version() int
Beacon() *pb.BeaconBlockHeader
Execution() (ExecutionData, error)
ExecutionBranch() (LightClientExecutionBranch, error)
}
type LightClientBootstrap interface {
ssz.Marshaler
Version() int
Header() LightClientHeader
CurrentSyncCommittee() *pb.SyncCommittee
CurrentSyncCommitteeBranch() LightClientSyncCommitteeBranch
}
type LightClientUpdate interface {
ssz.Marshaler
Version() int
AttestedHeader() LightClientHeader
NextSyncCommittee() *pb.SyncCommittee
NextSyncCommitteeBranch() LightClientSyncCommitteeBranch
FinalizedHeader() LightClientHeader
FinalityBranch() LightClientFinalityBranch
SyncAggregate() *pb.SyncAggregate
SignatureSlot() primitives.Slot
}
type LightClientFinalityUpdate interface {
ssz.Marshaler
Version() int
AttestedHeader() LightClientHeader
FinalizedHeader() LightClientHeader
FinalityBranch() LightClientFinalityBranch
SyncAggregate() *pb.SyncAggregate
SignatureSlot() primitives.Slot
}
type LightClientOptimisticUpdate interface {
ssz.Marshaler
Version() int
AttestedHeader() LightClientHeader
SyncAggregate() *pb.SyncAggregate
SignatureSlot() primitives.Slot
}

View File

@@ -0,0 +1,26 @@
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"bootstrap.go",
"finality_update.go",
"header.go",
"helpers.go",
"optimistic_update.go",
"update.go",
],
importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/light-client",
visibility = ["//visibility:public"],
deps = [
"//config/fieldparams:go_default_library",
"//consensus-types:go_default_library",
"//consensus-types/blocks:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
"//encoding/bytesutil:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//runtime/version:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
],
)

View File

@@ -0,0 +1,208 @@
package light_client
import (
"fmt"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
"google.golang.org/protobuf/proto"
)
func NewWrappedBootstrap(m proto.Message) (interfaces.LightClientBootstrap, error) {
if m == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
switch t := m.(type) {
case *pb.LightClientBootstrapAltair:
return NewWrappedBootstrapAltair(t)
case *pb.LightClientBootstrapCapella:
return NewWrappedBootstrapCapella(t)
case *pb.LightClientBootstrapDeneb:
return NewWrappedBootstrapDeneb(t)
default:
return nil, fmt.Errorf("cannot construct light client bootstrap from type %T", t)
}
}
type bootstrapAltair struct {
p *pb.LightClientBootstrapAltair
header interfaces.LightClientHeader
currentSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
}
var _ interfaces.LightClientBootstrap = &bootstrapAltair{}
func NewWrappedBootstrapAltair(p *pb.LightClientBootstrapAltair) (interfaces.LightClientBootstrap, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
header, err := NewWrappedHeaderAltair(p.Header)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
"sync committee",
p.CurrentSyncCommitteeBranch,
fieldparams.SyncCommitteeBranchDepth,
)
if err != nil {
return nil, err
}
return &bootstrapAltair{
p: p,
header: header,
currentSyncCommitteeBranch: branch,
}, nil
}
func (h *bootstrapAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
return h.p.MarshalSSZTo(dst)
}
func (h *bootstrapAltair) MarshalSSZ() ([]byte, error) {
return h.p.MarshalSSZ()
}
func (h *bootstrapAltair) SizeSSZ() int {
return h.p.SizeSSZ()
}
func (h *bootstrapAltair) Version() int {
return version.Altair
}
func (h *bootstrapAltair) Header() interfaces.LightClientHeader {
return h.header
}
func (h *bootstrapAltair) CurrentSyncCommittee() *pb.SyncCommittee {
return h.p.CurrentSyncCommittee
}
func (h *bootstrapAltair) CurrentSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
return h.currentSyncCommitteeBranch
}
type bootstrapCapella struct {
p *pb.LightClientBootstrapCapella
header interfaces.LightClientHeader
currentSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
}
var _ interfaces.LightClientBootstrap = &bootstrapCapella{}
func NewWrappedBootstrapCapella(p *pb.LightClientBootstrapCapella) (interfaces.LightClientBootstrap, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
header, err := NewWrappedHeaderCapella(p.Header)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
"sync committee",
p.CurrentSyncCommitteeBranch,
fieldparams.SyncCommitteeBranchDepth,
)
if err != nil {
return nil, err
}
return &bootstrapCapella{
p: p,
header: header,
currentSyncCommitteeBranch: branch,
}, nil
}
func (h *bootstrapCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
return h.p.MarshalSSZTo(dst)
}
func (h *bootstrapCapella) MarshalSSZ() ([]byte, error) {
return h.p.MarshalSSZ()
}
func (h *bootstrapCapella) SizeSSZ() int {
return h.p.SizeSSZ()
}
func (h *bootstrapCapella) Version() int {
return version.Capella
}
func (h *bootstrapCapella) Header() interfaces.LightClientHeader {
return h.header
}
func (h *bootstrapCapella) CurrentSyncCommittee() *pb.SyncCommittee {
return h.p.CurrentSyncCommittee
}
func (h *bootstrapCapella) CurrentSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
return h.currentSyncCommitteeBranch
}
type bootstrapDeneb struct {
p *pb.LightClientBootstrapDeneb
header interfaces.LightClientHeader
currentSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
}
var _ interfaces.LightClientBootstrap = &bootstrapDeneb{}
func NewWrappedBootstrapDeneb(p *pb.LightClientBootstrapDeneb) (interfaces.LightClientBootstrap, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
header, err := NewWrappedHeaderDeneb(p.Header)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
"sync committee",
p.CurrentSyncCommitteeBranch,
fieldparams.SyncCommitteeBranchDepth,
)
if err != nil {
return nil, err
}
return &bootstrapDeneb{
p: p,
header: header,
currentSyncCommitteeBranch: branch,
}, nil
}
func (h *bootstrapDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
return h.p.MarshalSSZTo(dst)
}
func (h *bootstrapDeneb) MarshalSSZ() ([]byte, error) {
return h.p.MarshalSSZ()
}
func (h *bootstrapDeneb) SizeSSZ() int {
return h.p.SizeSSZ()
}
func (h *bootstrapDeneb) Version() int {
return version.Deneb
}
func (h *bootstrapDeneb) Header() interfaces.LightClientHeader {
return h.header
}
func (h *bootstrapDeneb) CurrentSyncCommittee() *pb.SyncCommittee {
return h.p.CurrentSyncCommittee
}
func (h *bootstrapDeneb) CurrentSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
return h.currentSyncCommitteeBranch
}

View File

@@ -0,0 +1,251 @@
package light_client
import (
"fmt"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
"google.golang.org/protobuf/proto"
)
func NewWrappedFinalityUpdate(m proto.Message) (interfaces.LightClientFinalityUpdate, error) {
if m == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
switch t := m.(type) {
case *pb.LightClientFinalityUpdateAltair:
return NewWrappedFinalityUpdateAltair(t)
case *pb.LightClientFinalityUpdateCapella:
return NewWrappedFinalityUpdateCapella(t)
case *pb.LightClientFinalityUpdateDeneb:
return NewWrappedFinalityUpdateDeneb(t)
default:
return nil, fmt.Errorf("cannot construct light client finality update from type %T", t)
}
}
type finalityUpdateAltair struct {
p *pb.LightClientFinalityUpdateAltair
attestedHeader interfaces.LightClientHeader
finalizedHeader interfaces.LightClientHeader
finalityBranch interfaces.LightClientFinalityBranch
}
var _ interfaces.LightClientFinalityUpdate = &finalityUpdateAltair{}
func NewWrappedFinalityUpdateAltair(p *pb.LightClientFinalityUpdateAltair) (interfaces.LightClientFinalityUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader)
if err != nil {
return nil, err
}
finalizedHeader, err := NewWrappedHeaderAltair(p.FinalizedHeader)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientFinalityBranch](
"finality",
p.FinalityBranch,
fieldparams.FinalityBranchDepth,
)
if err != nil {
return nil, err
}
return &finalityUpdateAltair{
p: p,
attestedHeader: attestedHeader,
finalizedHeader: finalizedHeader,
finalityBranch: branch,
}, nil
}
func (u *finalityUpdateAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *finalityUpdateAltair) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *finalityUpdateAltair) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *finalityUpdateAltair) Version() int {
return version.Altair
}
func (u *finalityUpdateAltair) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *finalityUpdateAltair) FinalizedHeader() interfaces.LightClientHeader {
return u.finalizedHeader
}
func (u *finalityUpdateAltair) FinalityBranch() interfaces.LightClientFinalityBranch {
return u.finalityBranch
}
func (u *finalityUpdateAltair) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *finalityUpdateAltair) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}
type finalityUpdateCapella struct {
p *pb.LightClientFinalityUpdateCapella
attestedHeader interfaces.LightClientHeader
finalizedHeader interfaces.LightClientHeader
finalityBranch interfaces.LightClientFinalityBranch
}
var _ interfaces.LightClientFinalityUpdate = &finalityUpdateCapella{}
func NewWrappedFinalityUpdateCapella(p *pb.LightClientFinalityUpdateCapella) (interfaces.LightClientFinalityUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader)
if err != nil {
return nil, err
}
finalizedHeader, err := NewWrappedHeaderCapella(p.FinalizedHeader)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientFinalityBranch](
"finality",
p.FinalityBranch,
fieldparams.FinalityBranchDepth,
)
if err != nil {
return nil, err
}
return &finalityUpdateCapella{
p: p,
attestedHeader: attestedHeader,
finalizedHeader: finalizedHeader,
finalityBranch: branch,
}, nil
}
func (u *finalityUpdateCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *finalityUpdateCapella) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *finalityUpdateCapella) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *finalityUpdateCapella) Version() int {
return version.Capella
}
func (u *finalityUpdateCapella) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *finalityUpdateCapella) FinalizedHeader() interfaces.LightClientHeader {
return u.finalizedHeader
}
func (u *finalityUpdateCapella) FinalityBranch() interfaces.LightClientFinalityBranch {
return u.finalityBranch
}
func (u *finalityUpdateCapella) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *finalityUpdateCapella) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}
type finalityUpdateDeneb struct {
p *pb.LightClientFinalityUpdateDeneb
attestedHeader interfaces.LightClientHeader
finalizedHeader interfaces.LightClientHeader
finalityBranch interfaces.LightClientFinalityBranch
}
var _ interfaces.LightClientFinalityUpdate = &finalityUpdateDeneb{}
func NewWrappedFinalityUpdateDeneb(p *pb.LightClientFinalityUpdateDeneb) (interfaces.LightClientFinalityUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader)
if err != nil {
return nil, err
}
finalizedHeader, err := NewWrappedHeaderDeneb(p.FinalizedHeader)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientFinalityBranch](
"finality",
p.FinalityBranch,
fieldparams.FinalityBranchDepth,
)
if err != nil {
return nil, err
}
return &finalityUpdateDeneb{
p: p,
attestedHeader: attestedHeader,
finalizedHeader: finalizedHeader,
finalityBranch: branch,
}, nil
}
func (u *finalityUpdateDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *finalityUpdateDeneb) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *finalityUpdateDeneb) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *finalityUpdateDeneb) Version() int {
return version.Deneb
}
func (u *finalityUpdateDeneb) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *finalityUpdateDeneb) FinalizedHeader() interfaces.LightClientHeader {
return u.finalizedHeader
}
func (u *finalityUpdateDeneb) FinalityBranch() interfaces.LightClientFinalityBranch {
return u.finalityBranch
}
func (u *finalityUpdateDeneb) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *finalityUpdateDeneb) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}

View File

@@ -0,0 +1,192 @@
package light_client
import (
"fmt"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
"google.golang.org/protobuf/proto"
)
func NewWrappedHeader(m proto.Message) (interfaces.LightClientHeader, error) {
if m == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
switch t := m.(type) {
case *pb.LightClientHeaderAltair:
return NewWrappedHeaderAltair(t)
case *pb.LightClientHeaderCapella:
return NewWrappedHeaderCapella(t)
case *pb.LightClientHeaderDeneb:
return NewWrappedHeaderDeneb(t)
default:
return nil, fmt.Errorf("cannot construct light client header from type %T", t)
}
}
type headerAltair struct {
p *pb.LightClientHeaderAltair
}
var _ interfaces.LightClientHeader = &headerAltair{}
func NewWrappedHeaderAltair(p *pb.LightClientHeaderAltair) (interfaces.LightClientHeader, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
return &headerAltair{p: p}, nil
}
func (h *headerAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
return h.p.MarshalSSZTo(dst)
}
func (h *headerAltair) MarshalSSZ() ([]byte, error) {
return h.p.MarshalSSZ()
}
func (h *headerAltair) SizeSSZ() int {
return h.p.SizeSSZ()
}
func (h *headerAltair) Version() int {
return version.Altair
}
func (h *headerAltair) Beacon() *pb.BeaconBlockHeader {
return h.p.Beacon
}
func (h *headerAltair) Execution() (interfaces.ExecutionData, error) {
return nil, consensustypes.ErrNotSupported("Execution", version.Altair)
}
func (h *headerAltair) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) {
return interfaces.LightClientExecutionBranch{}, consensustypes.ErrNotSupported("ExecutionBranch", version.Altair)
}
type headerCapella struct {
p *pb.LightClientHeaderCapella
execution interfaces.ExecutionData
executionBranch interfaces.LightClientExecutionBranch
}
var _ interfaces.LightClientHeader = &headerCapella{}
func NewWrappedHeaderCapella(p *pb.LightClientHeaderCapella) (interfaces.LightClientHeader, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
execution, err := blocks.WrappedExecutionPayloadHeaderCapella(p.Execution)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientExecutionBranch](
"execution",
p.ExecutionBranch,
fieldparams.ExecutionBranchDepth,
)
if err != nil {
return nil, err
}
return &headerCapella{
p: p,
execution: execution,
executionBranch: branch,
}, nil
}
func (h *headerCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
return h.p.MarshalSSZTo(dst)
}
func (h *headerCapella) MarshalSSZ() ([]byte, error) {
return h.p.MarshalSSZ()
}
func (h *headerCapella) SizeSSZ() int {
return h.p.SizeSSZ()
}
func (h *headerCapella) Version() int {
return version.Capella
}
func (h *headerCapella) Beacon() *pb.BeaconBlockHeader {
return h.p.Beacon
}
func (h *headerCapella) Execution() (interfaces.ExecutionData, error) {
return h.execution, nil
}
func (h *headerCapella) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) {
return h.executionBranch, nil
}
type headerDeneb struct {
p *pb.LightClientHeaderDeneb
execution interfaces.ExecutionData
executionBranch interfaces.LightClientExecutionBranch
}
var _ interfaces.LightClientHeader = &headerDeneb{}
func NewWrappedHeaderDeneb(p *pb.LightClientHeaderDeneb) (interfaces.LightClientHeader, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
execution, err := blocks.WrappedExecutionPayloadHeaderDeneb(p.Execution)
if err != nil {
return nil, err
}
branch, err := createBranch[interfaces.LightClientExecutionBranch](
"execution",
p.ExecutionBranch,
fieldparams.ExecutionBranchDepth,
)
if err != nil {
return nil, err
}
return &headerDeneb{
p: p,
execution: execution,
executionBranch: branch,
}, nil
}
func (h *headerDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
return h.p.MarshalSSZTo(dst)
}
func (h *headerDeneb) MarshalSSZ() ([]byte, error) {
return h.p.MarshalSSZ()
}
func (h *headerDeneb) SizeSSZ() int {
return h.p.SizeSSZ()
}
func (h *headerDeneb) Version() int {
return version.Deneb
}
func (h *headerDeneb) Beacon() *pb.BeaconBlockHeader {
return h.p.Beacon
}
func (h *headerDeneb) Execution() (interfaces.ExecutionData, error) {
return h.execution, nil
}
func (h *headerDeneb) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) {
return h.executionBranch, nil
}

View File

@@ -0,0 +1,30 @@
package light_client
import (
"fmt"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
)
type branchConstraint interface {
~interfaces.LightClientExecutionBranch | ~interfaces.LightClientSyncCommitteeBranch | ~interfaces.LightClientFinalityBranch
}
func createBranch[T branchConstraint](name string, input [][]byte, depth int) (T, error) {
var zero T
if len(input) != depth {
return zero, fmt.Errorf("%s branch has %d leaves instead of expected %d", name, len(input), depth)
}
var branch T
for i, leaf := range input {
if len(leaf) != fieldparams.RootLength {
return zero, fmt.Errorf("%s branch leaf at index %d has length %d instead of expected %d", name, i, len(leaf), fieldparams.RootLength)
}
branch[i] = bytesutil.ToBytes32(leaf)
}
return branch, nil
}

View File

@@ -0,0 +1,178 @@
package light_client
import (
"fmt"
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
"google.golang.org/protobuf/proto"
)
func NewWrappedOptimisticUpdate(m proto.Message) (interfaces.LightClientOptimisticUpdate, error) {
if m == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
switch t := m.(type) {
case *pb.LightClientOptimisticUpdateAltair:
return NewWrappedOptimisticUpdateAltair(t)
case *pb.LightClientOptimisticUpdateCapella:
return NewWrappedOptimisticUpdateCapella(t)
case *pb.LightClientOptimisticUpdateDeneb:
return NewWrappedOptimisticUpdateDeneb(t)
default:
return nil, fmt.Errorf("cannot construct light client optimistic update from type %T", t)
}
}
type OptimisticUpdateAltair struct {
p *pb.LightClientOptimisticUpdateAltair
attestedHeader interfaces.LightClientHeader
}
var _ interfaces.LightClientOptimisticUpdate = &OptimisticUpdateAltair{}
func NewWrappedOptimisticUpdateAltair(p *pb.LightClientOptimisticUpdateAltair) (interfaces.LightClientOptimisticUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader)
if err != nil {
return nil, err
}
return &OptimisticUpdateAltair{
p: p,
attestedHeader: attestedHeader,
}, nil
}
func (u *OptimisticUpdateAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *OptimisticUpdateAltair) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *OptimisticUpdateAltair) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *OptimisticUpdateAltair) Version() int {
return version.Altair
}
func (u *OptimisticUpdateAltair) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *OptimisticUpdateAltair) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *OptimisticUpdateAltair) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}
type OptimisticUpdateCapella struct {
p *pb.LightClientOptimisticUpdateCapella
attestedHeader interfaces.LightClientHeader
}
var _ interfaces.LightClientOptimisticUpdate = &OptimisticUpdateCapella{}
func NewWrappedOptimisticUpdateCapella(p *pb.LightClientOptimisticUpdateCapella) (interfaces.LightClientOptimisticUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader)
if err != nil {
return nil, err
}
return &OptimisticUpdateCapella{
p: p,
attestedHeader: attestedHeader,
}, nil
}
func (u *OptimisticUpdateCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *OptimisticUpdateCapella) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *OptimisticUpdateCapella) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *OptimisticUpdateCapella) Version() int {
return version.Capella
}
func (u *OptimisticUpdateCapella) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *OptimisticUpdateCapella) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *OptimisticUpdateCapella) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}
type OptimisticUpdateDeneb struct {
p *pb.LightClientOptimisticUpdateDeneb
attestedHeader interfaces.LightClientHeader
}
var _ interfaces.LightClientOptimisticUpdate = &OptimisticUpdateDeneb{}
func NewWrappedOptimisticUpdateDeneb(p *pb.LightClientOptimisticUpdateDeneb) (interfaces.LightClientOptimisticUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader)
if err != nil {
return nil, err
}
return &OptimisticUpdateDeneb{
p: p,
attestedHeader: attestedHeader,
}, nil
}
func (u *OptimisticUpdateDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *OptimisticUpdateDeneb) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *OptimisticUpdateDeneb) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *OptimisticUpdateDeneb) Version() int {
return version.Deneb
}
func (u *OptimisticUpdateDeneb) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *OptimisticUpdateDeneb) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *OptimisticUpdateDeneb) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}

View File

@@ -0,0 +1,305 @@
package light_client
import (
"fmt"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
"google.golang.org/protobuf/proto"
)
func NewWrappedUpdate(m proto.Message) (interfaces.LightClientUpdate, error) {
if m == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
switch t := m.(type) {
case *pb.LightClientUpdateAltair:
return NewWrappedUpdateAltair(t)
case *pb.LightClientUpdateCapella:
return NewWrappedUpdateCapella(t)
case *pb.LightClientUpdateDeneb:
return NewWrappedUpdateDeneb(t)
default:
return nil, fmt.Errorf("cannot construct light client update from type %T", t)
}
}
type updateAltair struct {
p *pb.LightClientUpdateAltair
attestedHeader interfaces.LightClientHeader
nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
finalizedHeader interfaces.LightClientHeader
finalityBranch interfaces.LightClientFinalityBranch
}
var _ interfaces.LightClientUpdate = &updateAltair{}
func NewWrappedUpdateAltair(p *pb.LightClientUpdateAltair) (interfaces.LightClientUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader)
if err != nil {
return nil, err
}
finalizedHeader, err := NewWrappedHeaderAltair(p.FinalizedHeader)
if err != nil {
return nil, err
}
scBranch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
"sync committee",
p.NextSyncCommitteeBranch,
fieldparams.SyncCommitteeBranchDepth,
)
if err != nil {
return nil, err
}
finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch](
"finality",
p.FinalityBranch,
fieldparams.FinalityBranchDepth,
)
if err != nil {
return nil, err
}
return &updateAltair{
p: p,
attestedHeader: attestedHeader,
nextSyncCommitteeBranch: scBranch,
finalizedHeader: finalizedHeader,
finalityBranch: finalityBranch,
}, nil
}
func (u *updateAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *updateAltair) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *updateAltair) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *updateAltair) Version() int {
return version.Altair
}
func (u *updateAltair) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *updateAltair) NextSyncCommittee() *pb.SyncCommittee {
return u.p.NextSyncCommittee
}
func (u *updateAltair) NextSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
return u.nextSyncCommitteeBranch
}
func (u *updateAltair) FinalizedHeader() interfaces.LightClientHeader {
return u.finalizedHeader
}
func (u *updateAltair) FinalityBranch() interfaces.LightClientFinalityBranch {
return u.finalityBranch
}
func (u *updateAltair) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *updateAltair) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}
type updateCapella struct {
p *pb.LightClientUpdateCapella
attestedHeader interfaces.LightClientHeader
nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
finalizedHeader interfaces.LightClientHeader
finalityBranch interfaces.LightClientFinalityBranch
}
var _ interfaces.LightClientUpdate = &updateCapella{}
func NewWrappedUpdateCapella(p *pb.LightClientUpdateCapella) (interfaces.LightClientUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader)
if err != nil {
return nil, err
}
finalizedHeader, err := NewWrappedHeaderCapella(p.FinalizedHeader)
if err != nil {
return nil, err
}
scBranch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
"sync committee",
p.NextSyncCommitteeBranch,
fieldparams.SyncCommitteeBranchDepth,
)
if err != nil {
return nil, err
}
finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch](
"finality",
p.FinalityBranch,
fieldparams.FinalityBranchDepth,
)
if err != nil {
return nil, err
}
return &updateCapella{
p: p,
attestedHeader: attestedHeader,
nextSyncCommitteeBranch: scBranch,
finalizedHeader: finalizedHeader,
finalityBranch: finalityBranch,
}, nil
}
func (u *updateCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *updateCapella) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *updateCapella) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *updateCapella) Version() int {
return version.Capella
}
func (u *updateCapella) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *updateCapella) NextSyncCommittee() *pb.SyncCommittee {
return u.p.NextSyncCommittee
}
func (u *updateCapella) NextSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
return u.nextSyncCommitteeBranch
}
func (u *updateCapella) FinalizedHeader() interfaces.LightClientHeader {
return u.finalizedHeader
}
func (u *updateCapella) FinalityBranch() interfaces.LightClientFinalityBranch {
return u.finalityBranch
}
func (u *updateCapella) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *updateCapella) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}
type updateDeneb struct {
p *pb.LightClientUpdateDeneb
attestedHeader interfaces.LightClientHeader
nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
finalizedHeader interfaces.LightClientHeader
finalityBranch interfaces.LightClientFinalityBranch
}
var _ interfaces.LightClientUpdate = &updateDeneb{}
func NewWrappedUpdateDeneb(p *pb.LightClientUpdateDeneb) (interfaces.LightClientUpdate, error) {
if p == nil {
return nil, consensustypes.ErrNilObjectWrapped
}
attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader)
if err != nil {
return nil, err
}
finalizedHeader, err := NewWrappedHeaderDeneb(p.FinalizedHeader)
if err != nil {
return nil, err
}
scBranch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
"sync committee",
p.NextSyncCommitteeBranch,
fieldparams.SyncCommitteeBranchDepth,
)
if err != nil {
return nil, err
}
finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch](
"finality",
p.FinalityBranch,
fieldparams.FinalityBranchDepth,
)
if err != nil {
return nil, err
}
return &updateDeneb{
p: p,
attestedHeader: attestedHeader,
nextSyncCommitteeBranch: scBranch,
finalizedHeader: finalizedHeader,
finalityBranch: finalityBranch,
}, nil
}
func (u *updateDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
return u.p.MarshalSSZTo(dst)
}
func (u *updateDeneb) MarshalSSZ() ([]byte, error) {
return u.p.MarshalSSZ()
}
func (u *updateDeneb) SizeSSZ() int {
return u.p.SizeSSZ()
}
func (u *updateDeneb) Version() int {
return version.Deneb
}
func (u *updateDeneb) AttestedHeader() interfaces.LightClientHeader {
return u.attestedHeader
}
func (u *updateDeneb) NextSyncCommittee() *pb.SyncCommittee {
return u.p.NextSyncCommittee
}
func (u *updateDeneb) NextSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
return u.nextSyncCommitteeBranch
}
func (u *updateDeneb) FinalizedHeader() interfaces.LightClientHeader {
return u.finalizedHeader
}
func (u *updateDeneb) FinalityBranch() interfaces.LightClientFinalityBranch {
return u.finalityBranch
}
func (u *updateDeneb) SyncAggregate() *pb.SyncAggregate {
return u.p.SyncAggregate
}
func (u *updateDeneb) SignatureSlot() primitives.Slot {
return u.p.SignatureSlot
}

View File

@@ -81,6 +81,11 @@ ssz_altair_objs = [
"BeaconBlockBodyAltair",
"BeaconStateAltair",
"ContributionAndProof",
"LightClientBootstrapAltair",
"LightClientFinalityUpdateAltair",
"LightClientHeaderAltair",
"LightClientOptimisticUpdateAltair",
"LightClientUpdateAltair",
"SignedBeaconBlockAltair",
"SignedContributionAndProof",
"SyncAggregate",
@@ -110,6 +115,11 @@ ssz_capella_objs = [
"BlindedBeaconBlockCapella",
"BuilderBidCapella",
"HistoricalSummary",
"LightClientBootstrapCapella",
"LightClientFinalityUpdateCapella",
"LightClientHeaderCapella",
"LightClientOptimisticUpdateCapella",
"LightClientUpdateCapella",
"SignedBLSToExecutionChange",
"SignedBeaconBlockCapella",
"SignedBlindedBeaconBlockCapella",
@@ -127,6 +137,11 @@ ssz_deneb_objs = [
"BlobSidecar",
"BlobSidecars",
"BuilderBidDeneb",
"LightClientBootstrapDeneb",
"LightClientFinalityUpdateDeneb",
"LightClientHeaderDeneb",
"LightClientOptimisticUpdateDeneb",
"LightClientUpdateDeneb",
"SignedBeaconBlockContentsDeneb",
"SignedBeaconBlockDeneb",
"SignedBlindedBeaconBlockDeneb",
@@ -334,6 +349,7 @@ ssz_proto_files(
"beacon_block.proto",
"beacon_state.proto",
"blobs.proto",
"light_client.proto",
"sync_committee.proto",
"withdrawals.proto",
],

View File

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: bb838fc0c2dfdadd4a8274dd1b438b1051f7b84d7c8e7470900621284dba8f43
// Hash: 54ff8b768faa21e2d838e9f6be78af4dfeb76d3d46b32072c09faa16bd2393ea
package eth
import (
@@ -1747,6 +1747,651 @@ func (s *SyncAggregatorSelectionData) HashTreeRootWith(hh *ssz.Hasher) (err erro
return
}
// MarshalSSZ ssz marshals the LightClientHeaderAltair object
func (l *LightClientHeaderAltair) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientHeaderAltair object to a target array
func (l *LightClientHeaderAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'Beacon'
if l.Beacon == nil {
l.Beacon = new(BeaconBlockHeader)
}
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientHeaderAltair object
func (l *LightClientHeaderAltair) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 112 {
return ssz.ErrSize
}
// Field (0) 'Beacon'
if l.Beacon == nil {
l.Beacon = new(BeaconBlockHeader)
}
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderAltair object
func (l *LightClientHeaderAltair) SizeSSZ() (size int) {
size = 112
return
}
// HashTreeRoot ssz hashes the LightClientHeaderAltair object
func (l *LightClientHeaderAltair) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientHeaderAltair object with a hasher
func (l *LightClientHeaderAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Beacon'
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
return
}
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientBootstrapAltair object
func (l *LightClientBootstrapAltair) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientBootstrapAltair object to a target array
func (l *LightClientBootstrapAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'Header'
if l.Header == nil {
l.Header = new(LightClientHeaderAltair)
}
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
return
}
// Field (1) 'CurrentSyncCommittee'
if l.CurrentSyncCommittee == nil {
l.CurrentSyncCommittee = new(SyncCommittee)
}
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'CurrentSyncCommitteeBranch'
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
return
}
for ii := 0; ii < 5; ii++ {
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
return
}
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapAltair object
func (l *LightClientBootstrapAltair) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 24896 {
return ssz.ErrSize
}
// Field (0) 'Header'
if l.Header == nil {
l.Header = new(LightClientHeaderAltair)
}
if err = l.Header.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
// Field (1) 'CurrentSyncCommittee'
if l.CurrentSyncCommittee == nil {
l.CurrentSyncCommittee = new(SyncCommittee)
}
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[112:24736]); err != nil {
return err
}
// Field (2) 'CurrentSyncCommitteeBranch'
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
for ii := 0; ii < 5; ii++ {
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24736:24896][ii*32:(ii+1)*32]))
}
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24736:24896][ii*32:(ii+1)*32]...)
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapAltair object
func (l *LightClientBootstrapAltair) SizeSSZ() (size int) {
size = 24896
return
}
// HashTreeRoot ssz hashes the LightClientBootstrapAltair object
func (l *LightClientBootstrapAltair) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientBootstrapAltair object with a hasher
func (l *LightClientBootstrapAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Header'
if err = l.Header.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'CurrentSyncCommittee'
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'CurrentSyncCommitteeBranch'
{
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
return
}
subIndx := hh.Index()
for _, i := range l.CurrentSyncCommitteeBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientUpdateAltair object
func (l *LightClientUpdateAltair) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientUpdateAltair object to a target array
func (l *LightClientUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderAltair)
}
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (1) 'NextSyncCommittee'
if l.NextSyncCommittee == nil {
l.NextSyncCommittee = new(SyncCommittee)
}
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'NextSyncCommitteeBranch'
if size := len(l.NextSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
return
}
for ii := 0; ii < 5; ii++ {
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
return
}
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
}
// Field (3) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderAltair)
}
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (4) 'FinalityBranch'
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
for ii := 0; ii < 6; ii++ {
if size := len(l.FinalityBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
return
}
dst = append(dst, l.FinalityBranch[ii]...)
}
// Field (5) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (6) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
return
}
// UnmarshalSSZ ssz unmarshals the LightClientUpdateAltair object
func (l *LightClientUpdateAltair) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 25368 {
return ssz.ErrSize
}
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderAltair)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
// Field (1) 'NextSyncCommittee'
if l.NextSyncCommittee == nil {
l.NextSyncCommittee = new(SyncCommittee)
}
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[112:24736]); err != nil {
return err
}
// Field (2) 'NextSyncCommitteeBranch'
l.NextSyncCommitteeBranch = make([][]byte, 5)
for ii := 0; ii < 5; ii++ {
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24736:24896][ii*32:(ii+1)*32]))
}
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24736:24896][ii*32:(ii+1)*32]...)
}
// Field (3) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderAltair)
}
if err = l.FinalizedHeader.UnmarshalSSZ(buf[24896:25008]); err != nil {
return err
}
// Field (4) 'FinalityBranch'
l.FinalityBranch = make([][]byte, 6)
for ii := 0; ii < 6; ii++ {
if cap(l.FinalityBranch[ii]) == 0 {
l.FinalityBranch[ii] = make([]byte, 0, len(buf[25008:25200][ii*32:(ii+1)*32]))
}
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[25008:25200][ii*32:(ii+1)*32]...)
}
// Field (5) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[25200:25360]); err != nil {
return err
}
// Field (6) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25360:25368]))
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateAltair object
func (l *LightClientUpdateAltair) SizeSSZ() (size int) {
size = 25368
return
}
// HashTreeRoot ssz hashes the LightClientUpdateAltair object
func (l *LightClientUpdateAltair) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientUpdateAltair object with a hasher
func (l *LightClientUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'NextSyncCommittee'
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'NextSyncCommitteeBranch'
{
if size := len(l.NextSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
return
}
subIndx := hh.Index()
for _, i := range l.NextSyncCommitteeBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (3) 'FinalizedHeader'
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (4) 'FinalityBranch'
{
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
subIndx := hh.Index()
for _, i := range l.FinalityBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (5) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (6) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientFinalityUpdateAltair object
func (l *LightClientFinalityUpdateAltair) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateAltair object to a target array
func (l *LightClientFinalityUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderAltair)
}
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (1) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderAltair)
}
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'FinalityBranch'
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
for ii := 0; ii < 6; ii++ {
if size := len(l.FinalityBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
return
}
dst = append(dst, l.FinalityBranch[ii]...)
}
// Field (3) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (4) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
return
}
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateAltair object
func (l *LightClientFinalityUpdateAltair) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 584 {
return ssz.ErrSize
}
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderAltair)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
// Field (1) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderAltair)
}
if err = l.FinalizedHeader.UnmarshalSSZ(buf[112:224]); err != nil {
return err
}
// Field (2) 'FinalityBranch'
l.FinalityBranch = make([][]byte, 6)
for ii := 0; ii < 6; ii++ {
if cap(l.FinalityBranch[ii]) == 0 {
l.FinalityBranch[ii] = make([]byte, 0, len(buf[224:416][ii*32:(ii+1)*32]))
}
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[224:416][ii*32:(ii+1)*32]...)
}
// Field (3) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[416:576]); err != nil {
return err
}
// Field (4) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[576:584]))
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateAltair object
func (l *LightClientFinalityUpdateAltair) SizeSSZ() (size int) {
size = 584
return
}
// HashTreeRoot ssz hashes the LightClientFinalityUpdateAltair object
func (l *LightClientFinalityUpdateAltair) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateAltair object with a hasher
func (l *LightClientFinalityUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'FinalizedHeader'
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'FinalityBranch'
{
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
subIndx := hh.Index()
for _, i := range l.FinalityBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (3) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (4) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateAltair object
func (l *LightClientOptimisticUpdateAltair) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateAltair object to a target array
func (l *LightClientOptimisticUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderAltair)
}
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (1) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
return
}
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateAltair object
func (l *LightClientOptimisticUpdateAltair) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 280 {
return ssz.ErrSize
}
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderAltair)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
// Field (1) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[112:272]); err != nil {
return err
}
// Field (2) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[272:280]))
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateAltair object
func (l *LightClientOptimisticUpdateAltair) SizeSSZ() (size int) {
size = 280
return
}
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateAltair object
func (l *LightClientOptimisticUpdateAltair) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateAltair object with a hasher
func (l *LightClientOptimisticUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the SyncCommitteeMessage object
func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(s)

View File

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: a5507ef7d71897486989f37eb4dbb19fc2c49e7c47f244291a9f3122c9bfe546
// Hash: 7133c698cd96aab07bbef1347ea98e6ccbd2c5c30d1e7d0f32977b9a7335d9d3
package eth
import (
@@ -2729,6 +2729,877 @@ func (h *HistoricalSummary) HashTreeRootWith(hh *ssz.Hasher) (err error) {
return
}
// MarshalSSZ ssz marshals the LightClientHeaderCapella object
func (l *LightClientHeaderCapella) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientHeaderCapella object to a target array
func (l *LightClientHeaderCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(244)
// Field (0) 'Beacon'
if l.Beacon == nil {
l.Beacon = new(BeaconBlockHeader)
}
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
return
}
// Offset (1) 'Execution'
dst = ssz.WriteOffset(dst, offset)
if l.Execution == nil {
l.Execution = new(v1.ExecutionPayloadHeaderCapella)
}
offset += l.Execution.SizeSSZ()
// Field (2) 'ExecutionBranch'
if size := len(l.ExecutionBranch); size != 4 {
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
return
}
for ii := 0; ii < 4; ii++ {
if size := len(l.ExecutionBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.ExecutionBranch[ii]", size, 32)
return
}
dst = append(dst, l.ExecutionBranch[ii]...)
}
// Field (1) 'Execution'
if dst, err = l.Execution.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientHeaderCapella object
func (l *LightClientHeaderCapella) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 244 {
return ssz.ErrSize
}
tail := buf
var o1 uint64
// Field (0) 'Beacon'
if l.Beacon == nil {
l.Beacon = new(BeaconBlockHeader)
}
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
// Offset (1) 'Execution'
if o1 = ssz.ReadOffset(buf[112:116]); o1 > size {
return ssz.ErrOffset
}
if o1 != 244 {
return ssz.ErrInvalidVariableOffset
}
// Field (2) 'ExecutionBranch'
l.ExecutionBranch = make([][]byte, 4)
for ii := 0; ii < 4; ii++ {
if cap(l.ExecutionBranch[ii]) == 0 {
l.ExecutionBranch[ii] = make([]byte, 0, len(buf[116:244][ii*32:(ii+1)*32]))
}
l.ExecutionBranch[ii] = append(l.ExecutionBranch[ii], buf[116:244][ii*32:(ii+1)*32]...)
}
// Field (1) 'Execution'
{
buf = tail[o1:]
if l.Execution == nil {
l.Execution = new(v1.ExecutionPayloadHeaderCapella)
}
if err = l.Execution.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderCapella object
func (l *LightClientHeaderCapella) SizeSSZ() (size int) {
size = 244
// Field (1) 'Execution'
if l.Execution == nil {
l.Execution = new(v1.ExecutionPayloadHeaderCapella)
}
size += l.Execution.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientHeaderCapella object
func (l *LightClientHeaderCapella) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientHeaderCapella object with a hasher
func (l *LightClientHeaderCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Beacon'
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'Execution'
if err = l.Execution.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'ExecutionBranch'
{
if size := len(l.ExecutionBranch); size != 4 {
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
return
}
subIndx := hh.Index()
for _, i := range l.ExecutionBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientBootstrapCapella object
func (l *LightClientBootstrapCapella) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientBootstrapCapella object to a target array
func (l *LightClientBootstrapCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(24788)
// Offset (0) 'Header'
dst = ssz.WriteOffset(dst, offset)
if l.Header == nil {
l.Header = new(LightClientHeaderCapella)
}
offset += l.Header.SizeSSZ()
// Field (1) 'CurrentSyncCommittee'
if l.CurrentSyncCommittee == nil {
l.CurrentSyncCommittee = new(SyncCommittee)
}
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'CurrentSyncCommitteeBranch'
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
return
}
for ii := 0; ii < 5; ii++ {
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
return
}
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
}
// Field (0) 'Header'
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapCapella object
func (l *LightClientBootstrapCapella) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 24788 {
return ssz.ErrSize
}
tail := buf
var o0 uint64
// Offset (0) 'Header'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 24788 {
return ssz.ErrInvalidVariableOffset
}
// Field (1) 'CurrentSyncCommittee'
if l.CurrentSyncCommittee == nil {
l.CurrentSyncCommittee = new(SyncCommittee)
}
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
return err
}
// Field (2) 'CurrentSyncCommitteeBranch'
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
for ii := 0; ii < 5; ii++ {
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
}
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
}
// Field (0) 'Header'
{
buf = tail[o0:]
if l.Header == nil {
l.Header = new(LightClientHeaderCapella)
}
if err = l.Header.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapCapella object
func (l *LightClientBootstrapCapella) SizeSSZ() (size int) {
size = 24788
// Field (0) 'Header'
if l.Header == nil {
l.Header = new(LightClientHeaderCapella)
}
size += l.Header.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientBootstrapCapella object
func (l *LightClientBootstrapCapella) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientBootstrapCapella object with a hasher
func (l *LightClientBootstrapCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Header'
if err = l.Header.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'CurrentSyncCommittee'
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'CurrentSyncCommitteeBranch'
{
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
return
}
subIndx := hh.Index()
for _, i := range l.CurrentSyncCommitteeBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientUpdateCapella object
func (l *LightClientUpdateCapella) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientUpdateCapella object to a target array
func (l *LightClientUpdateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(25152)
// Offset (0) 'AttestedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
offset += l.AttestedHeader.SizeSSZ()
// Field (1) 'NextSyncCommittee'
if l.NextSyncCommittee == nil {
l.NextSyncCommittee = new(SyncCommittee)
}
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'NextSyncCommitteeBranch'
if size := len(l.NextSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
return
}
for ii := 0; ii < 5; ii++ {
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
return
}
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
}
// Offset (3) 'FinalizedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderCapella)
}
offset += l.FinalizedHeader.SizeSSZ()
// Field (4) 'FinalityBranch'
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
for ii := 0; ii < 6; ii++ {
if size := len(l.FinalityBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
return
}
dst = append(dst, l.FinalityBranch[ii]...)
}
// Field (5) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (6) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
// Field (0) 'AttestedHeader'
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (3) 'FinalizedHeader'
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientUpdateCapella object
func (l *LightClientUpdateCapella) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 25152 {
return ssz.ErrSize
}
tail := buf
var o0, o3 uint64
// Offset (0) 'AttestedHeader'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 25152 {
return ssz.ErrInvalidVariableOffset
}
// Field (1) 'NextSyncCommittee'
if l.NextSyncCommittee == nil {
l.NextSyncCommittee = new(SyncCommittee)
}
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
return err
}
// Field (2) 'NextSyncCommitteeBranch'
l.NextSyncCommitteeBranch = make([][]byte, 5)
for ii := 0; ii < 5; ii++ {
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
}
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
}
// Offset (3) 'FinalizedHeader'
if o3 = ssz.ReadOffset(buf[24788:24792]); o3 > size || o0 > o3 {
return ssz.ErrOffset
}
// Field (4) 'FinalityBranch'
l.FinalityBranch = make([][]byte, 6)
for ii := 0; ii < 6; ii++ {
if cap(l.FinalityBranch[ii]) == 0 {
l.FinalityBranch[ii] = make([]byte, 0, len(buf[24792:24984][ii*32:(ii+1)*32]))
}
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[24792:24984][ii*32:(ii+1)*32]...)
}
// Field (5) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[24984:25144]); err != nil {
return err
}
// Field (6) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25144:25152]))
// Field (0) 'AttestedHeader'
{
buf = tail[o0:o3]
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
// Field (3) 'FinalizedHeader'
{
buf = tail[o3:]
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderCapella)
}
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateCapella object
func (l *LightClientUpdateCapella) SizeSSZ() (size int) {
size = 25152
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
size += l.AttestedHeader.SizeSSZ()
// Field (3) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderCapella)
}
size += l.FinalizedHeader.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientUpdateCapella object
func (l *LightClientUpdateCapella) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientUpdateCapella object with a hasher
func (l *LightClientUpdateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'NextSyncCommittee'
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'NextSyncCommitteeBranch'
{
if size := len(l.NextSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
return
}
subIndx := hh.Index()
for _, i := range l.NextSyncCommitteeBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (3) 'FinalizedHeader'
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (4) 'FinalityBranch'
{
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
subIndx := hh.Index()
for _, i := range l.FinalityBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (5) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (6) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientFinalityUpdateCapella object
func (l *LightClientFinalityUpdateCapella) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateCapella object to a target array
func (l *LightClientFinalityUpdateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(368)
// Offset (0) 'AttestedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
offset += l.AttestedHeader.SizeSSZ()
// Offset (1) 'FinalizedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderCapella)
}
offset += l.FinalizedHeader.SizeSSZ()
// Field (2) 'FinalityBranch'
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
for ii := 0; ii < 6; ii++ {
if size := len(l.FinalityBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
return
}
dst = append(dst, l.FinalityBranch[ii]...)
}
// Field (3) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (4) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
// Field (0) 'AttestedHeader'
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (1) 'FinalizedHeader'
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateCapella object
func (l *LightClientFinalityUpdateCapella) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 368 {
return ssz.ErrSize
}
tail := buf
var o0, o1 uint64
// Offset (0) 'AttestedHeader'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 368 {
return ssz.ErrInvalidVariableOffset
}
// Offset (1) 'FinalizedHeader'
if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 {
return ssz.ErrOffset
}
// Field (2) 'FinalityBranch'
l.FinalityBranch = make([][]byte, 6)
for ii := 0; ii < 6; ii++ {
if cap(l.FinalityBranch[ii]) == 0 {
l.FinalityBranch[ii] = make([]byte, 0, len(buf[8:200][ii*32:(ii+1)*32]))
}
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[8:200][ii*32:(ii+1)*32]...)
}
// Field (3) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[200:360]); err != nil {
return err
}
// Field (4) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[360:368]))
// Field (0) 'AttestedHeader'
{
buf = tail[o0:o1]
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
// Field (1) 'FinalizedHeader'
{
buf = tail[o1:]
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderCapella)
}
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateCapella object
func (l *LightClientFinalityUpdateCapella) SizeSSZ() (size int) {
size = 368
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
size += l.AttestedHeader.SizeSSZ()
// Field (1) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderCapella)
}
size += l.FinalizedHeader.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientFinalityUpdateCapella object
func (l *LightClientFinalityUpdateCapella) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateCapella object with a hasher
func (l *LightClientFinalityUpdateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'FinalizedHeader'
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'FinalityBranch'
{
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
subIndx := hh.Index()
for _, i := range l.FinalityBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (3) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (4) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateCapella object
func (l *LightClientOptimisticUpdateCapella) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateCapella object to a target array
func (l *LightClientOptimisticUpdateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(172)
// Offset (0) 'AttestedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
offset += l.AttestedHeader.SizeSSZ()
// Field (1) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
// Field (0) 'AttestedHeader'
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateCapella object
func (l *LightClientOptimisticUpdateCapella) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 172 {
return ssz.ErrSize
}
tail := buf
var o0 uint64
// Offset (0) 'AttestedHeader'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 172 {
return ssz.ErrInvalidVariableOffset
}
// Field (1) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[4:164]); err != nil {
return err
}
// Field (2) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[164:172]))
// Field (0) 'AttestedHeader'
{
buf = tail[o0:]
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateCapella object
func (l *LightClientOptimisticUpdateCapella) SizeSSZ() (size int) {
size = 172
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderCapella)
}
size += l.AttestedHeader.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateCapella object
func (l *LightClientOptimisticUpdateCapella) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateCapella object with a hasher
func (l *LightClientOptimisticUpdateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the BLSToExecutionChange object
func (b *BLSToExecutionChange) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(b)

View File

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: 4c3e6932bf84838e8de21e5c121c14d03cbccb051c3990d3b924932f531f4d30
// Hash: b829ba09699058dc63b76a5eb5a03ce3d7d19b0d94b9e7fca06056f9f2f8b317
package eth
import (
@@ -3593,3 +3593,874 @@ func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) {
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientHeaderDeneb object
func (l *LightClientHeaderDeneb) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientHeaderDeneb object to a target array
func (l *LightClientHeaderDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(244)
// Field (0) 'Beacon'
if l.Beacon == nil {
l.Beacon = new(BeaconBlockHeader)
}
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
return
}
// Offset (1) 'Execution'
dst = ssz.WriteOffset(dst, offset)
if l.Execution == nil {
l.Execution = new(v1.ExecutionPayloadHeaderDeneb)
}
offset += l.Execution.SizeSSZ()
// Field (2) 'ExecutionBranch'
if size := len(l.ExecutionBranch); size != 4 {
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
return
}
for ii := 0; ii < 4; ii++ {
if size := len(l.ExecutionBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.ExecutionBranch[ii]", size, 32)
return
}
dst = append(dst, l.ExecutionBranch[ii]...)
}
// Field (1) 'Execution'
if dst, err = l.Execution.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientHeaderDeneb object
func (l *LightClientHeaderDeneb) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 244 {
return ssz.ErrSize
}
tail := buf
var o1 uint64
// Field (0) 'Beacon'
if l.Beacon == nil {
l.Beacon = new(BeaconBlockHeader)
}
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
return err
}
// Offset (1) 'Execution'
if o1 = ssz.ReadOffset(buf[112:116]); o1 > size {
return ssz.ErrOffset
}
if o1 != 244 {
return ssz.ErrInvalidVariableOffset
}
// Field (2) 'ExecutionBranch'
l.ExecutionBranch = make([][]byte, 4)
for ii := 0; ii < 4; ii++ {
if cap(l.ExecutionBranch[ii]) == 0 {
l.ExecutionBranch[ii] = make([]byte, 0, len(buf[116:244][ii*32:(ii+1)*32]))
}
l.ExecutionBranch[ii] = append(l.ExecutionBranch[ii], buf[116:244][ii*32:(ii+1)*32]...)
}
// Field (1) 'Execution'
{
buf = tail[o1:]
if l.Execution == nil {
l.Execution = new(v1.ExecutionPayloadHeaderDeneb)
}
if err = l.Execution.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderDeneb object
func (l *LightClientHeaderDeneb) SizeSSZ() (size int) {
size = 244
// Field (1) 'Execution'
if l.Execution == nil {
l.Execution = new(v1.ExecutionPayloadHeaderDeneb)
}
size += l.Execution.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientHeaderDeneb object
func (l *LightClientHeaderDeneb) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientHeaderDeneb object with a hasher
func (l *LightClientHeaderDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Beacon'
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'Execution'
if err = l.Execution.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'ExecutionBranch'
{
if size := len(l.ExecutionBranch); size != 4 {
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
return
}
subIndx := hh.Index()
for _, i := range l.ExecutionBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientBootstrapDeneb object
func (l *LightClientBootstrapDeneb) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientBootstrapDeneb object to a target array
func (l *LightClientBootstrapDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(24788)
// Offset (0) 'Header'
dst = ssz.WriteOffset(dst, offset)
if l.Header == nil {
l.Header = new(LightClientHeaderDeneb)
}
offset += l.Header.SizeSSZ()
// Field (1) 'CurrentSyncCommittee'
if l.CurrentSyncCommittee == nil {
l.CurrentSyncCommittee = new(SyncCommittee)
}
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'CurrentSyncCommitteeBranch'
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
return
}
for ii := 0; ii < 5; ii++ {
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
return
}
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
}
// Field (0) 'Header'
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapDeneb object
func (l *LightClientBootstrapDeneb) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 24788 {
return ssz.ErrSize
}
tail := buf
var o0 uint64
// Offset (0) 'Header'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 24788 {
return ssz.ErrInvalidVariableOffset
}
// Field (1) 'CurrentSyncCommittee'
if l.CurrentSyncCommittee == nil {
l.CurrentSyncCommittee = new(SyncCommittee)
}
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
return err
}
// Field (2) 'CurrentSyncCommitteeBranch'
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
for ii := 0; ii < 5; ii++ {
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
}
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
}
// Field (0) 'Header'
{
buf = tail[o0:]
if l.Header == nil {
l.Header = new(LightClientHeaderDeneb)
}
if err = l.Header.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapDeneb object
func (l *LightClientBootstrapDeneb) SizeSSZ() (size int) {
size = 24788
// Field (0) 'Header'
if l.Header == nil {
l.Header = new(LightClientHeaderDeneb)
}
size += l.Header.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientBootstrapDeneb object
func (l *LightClientBootstrapDeneb) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientBootstrapDeneb object with a hasher
func (l *LightClientBootstrapDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Header'
if err = l.Header.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'CurrentSyncCommittee'
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'CurrentSyncCommitteeBranch'
{
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
return
}
subIndx := hh.Index()
for _, i := range l.CurrentSyncCommitteeBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientUpdateDeneb object
func (l *LightClientUpdateDeneb) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientUpdateDeneb object to a target array
func (l *LightClientUpdateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(25152)
// Offset (0) 'AttestedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
offset += l.AttestedHeader.SizeSSZ()
// Field (1) 'NextSyncCommittee'
if l.NextSyncCommittee == nil {
l.NextSyncCommittee = new(SyncCommittee)
}
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'NextSyncCommitteeBranch'
if size := len(l.NextSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
return
}
for ii := 0; ii < 5; ii++ {
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
return
}
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
}
// Offset (3) 'FinalizedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderDeneb)
}
offset += l.FinalizedHeader.SizeSSZ()
// Field (4) 'FinalityBranch'
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
for ii := 0; ii < 6; ii++ {
if size := len(l.FinalityBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
return
}
dst = append(dst, l.FinalityBranch[ii]...)
}
// Field (5) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (6) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
// Field (0) 'AttestedHeader'
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (3) 'FinalizedHeader'
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientUpdateDeneb object
func (l *LightClientUpdateDeneb) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 25152 {
return ssz.ErrSize
}
tail := buf
var o0, o3 uint64
// Offset (0) 'AttestedHeader'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 25152 {
return ssz.ErrInvalidVariableOffset
}
// Field (1) 'NextSyncCommittee'
if l.NextSyncCommittee == nil {
l.NextSyncCommittee = new(SyncCommittee)
}
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
return err
}
// Field (2) 'NextSyncCommitteeBranch'
l.NextSyncCommitteeBranch = make([][]byte, 5)
for ii := 0; ii < 5; ii++ {
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
}
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
}
// Offset (3) 'FinalizedHeader'
if o3 = ssz.ReadOffset(buf[24788:24792]); o3 > size || o0 > o3 {
return ssz.ErrOffset
}
// Field (4) 'FinalityBranch'
l.FinalityBranch = make([][]byte, 6)
for ii := 0; ii < 6; ii++ {
if cap(l.FinalityBranch[ii]) == 0 {
l.FinalityBranch[ii] = make([]byte, 0, len(buf[24792:24984][ii*32:(ii+1)*32]))
}
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[24792:24984][ii*32:(ii+1)*32]...)
}
// Field (5) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[24984:25144]); err != nil {
return err
}
// Field (6) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25144:25152]))
// Field (0) 'AttestedHeader'
{
buf = tail[o0:o3]
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
// Field (3) 'FinalizedHeader'
{
buf = tail[o3:]
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderDeneb)
}
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateDeneb object
func (l *LightClientUpdateDeneb) SizeSSZ() (size int) {
size = 25152
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
size += l.AttestedHeader.SizeSSZ()
// Field (3) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderDeneb)
}
size += l.FinalizedHeader.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientUpdateDeneb object
func (l *LightClientUpdateDeneb) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientUpdateDeneb object with a hasher
func (l *LightClientUpdateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'NextSyncCommittee'
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'NextSyncCommitteeBranch'
{
if size := len(l.NextSyncCommitteeBranch); size != 5 {
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
return
}
subIndx := hh.Index()
for _, i := range l.NextSyncCommitteeBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (3) 'FinalizedHeader'
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (4) 'FinalityBranch'
{
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
subIndx := hh.Index()
for _, i := range l.FinalityBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (5) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (6) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientFinalityUpdateDeneb object
func (l *LightClientFinalityUpdateDeneb) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateDeneb object to a target array
func (l *LightClientFinalityUpdateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(368)
// Offset (0) 'AttestedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
offset += l.AttestedHeader.SizeSSZ()
// Offset (1) 'FinalizedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderDeneb)
}
offset += l.FinalizedHeader.SizeSSZ()
// Field (2) 'FinalityBranch'
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
for ii := 0; ii < 6; ii++ {
if size := len(l.FinalityBranch[ii]); size != 32 {
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
return
}
dst = append(dst, l.FinalityBranch[ii]...)
}
// Field (3) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (4) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
// Field (0) 'AttestedHeader'
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
// Field (1) 'FinalizedHeader'
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateDeneb object
func (l *LightClientFinalityUpdateDeneb) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 368 {
return ssz.ErrSize
}
tail := buf
var o0, o1 uint64
// Offset (0) 'AttestedHeader'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 368 {
return ssz.ErrInvalidVariableOffset
}
// Offset (1) 'FinalizedHeader'
if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 {
return ssz.ErrOffset
}
// Field (2) 'FinalityBranch'
l.FinalityBranch = make([][]byte, 6)
for ii := 0; ii < 6; ii++ {
if cap(l.FinalityBranch[ii]) == 0 {
l.FinalityBranch[ii] = make([]byte, 0, len(buf[8:200][ii*32:(ii+1)*32]))
}
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[8:200][ii*32:(ii+1)*32]...)
}
// Field (3) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[200:360]); err != nil {
return err
}
// Field (4) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[360:368]))
// Field (0) 'AttestedHeader'
{
buf = tail[o0:o1]
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
// Field (1) 'FinalizedHeader'
{
buf = tail[o1:]
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderDeneb)
}
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateDeneb object
func (l *LightClientFinalityUpdateDeneb) SizeSSZ() (size int) {
size = 368
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
size += l.AttestedHeader.SizeSSZ()
// Field (1) 'FinalizedHeader'
if l.FinalizedHeader == nil {
l.FinalizedHeader = new(LightClientHeaderDeneb)
}
size += l.FinalizedHeader.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientFinalityUpdateDeneb object
func (l *LightClientFinalityUpdateDeneb) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateDeneb object with a hasher
func (l *LightClientFinalityUpdateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'FinalizedHeader'
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'FinalityBranch'
{
if size := len(l.FinalityBranch); size != 6 {
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
return
}
subIndx := hh.Index()
for _, i := range l.FinalityBranch {
if len(i) != 32 {
err = ssz.ErrBytesLength
return
}
hh.Append(i)
}
hh.Merkleize(subIndx)
}
// Field (3) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (4) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateDeneb object
func (l *LightClientOptimisticUpdateDeneb) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(l)
}
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateDeneb object to a target array
func (l *LightClientOptimisticUpdateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
offset := int(172)
// Offset (0) 'AttestedHeader'
dst = ssz.WriteOffset(dst, offset)
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
offset += l.AttestedHeader.SizeSSZ()
// Field (1) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
return
}
// Field (2) 'SignatureSlot'
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
// Field (0) 'AttestedHeader'
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateDeneb object
func (l *LightClientOptimisticUpdateDeneb) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size < 172 {
return ssz.ErrSize
}
tail := buf
var o0 uint64
// Offset (0) 'AttestedHeader'
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
return ssz.ErrOffset
}
if o0 != 172 {
return ssz.ErrInvalidVariableOffset
}
// Field (1) 'SyncAggregate'
if l.SyncAggregate == nil {
l.SyncAggregate = new(SyncAggregate)
}
if err = l.SyncAggregate.UnmarshalSSZ(buf[4:164]); err != nil {
return err
}
// Field (2) 'SignatureSlot'
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[164:172]))
// Field (0) 'AttestedHeader'
{
buf = tail[o0:]
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
return err
}
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateDeneb object
func (l *LightClientOptimisticUpdateDeneb) SizeSSZ() (size int) {
size = 172
// Field (0) 'AttestedHeader'
if l.AttestedHeader == nil {
l.AttestedHeader = new(LightClientHeaderDeneb)
}
size += l.AttestedHeader.SizeSSZ()
return
}
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateDeneb object
func (l *LightClientOptimisticUpdateDeneb) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(l)
}
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateDeneb object with a hasher
func (l *LightClientOptimisticUpdateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'AttestedHeader'
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
return
}
// Field (1) 'SyncAggregate'
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
return
}
// Field (2) 'SignatureSlot'
hh.PutUint64(uint64(l.SignatureSlot))
hh.Merkleize(indx)
return
}

1759
proto/prysm/v1alpha1/light_client.pb.go generated Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,134 @@
// Copyright 2024 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1alpha1;
import "proto/eth/ext/options.proto";
import "proto/prysm/v1alpha1/beacon_block.proto";
import "proto/engine/v1/execution_engine.proto";
import "proto/prysm/v1alpha1/beacon_state.proto";
option csharp_namespace = "Ethereum.Eth.V1alpha1";
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/eth/v1alpha1;eth";
option java_multiple_files = true;
option java_outer_classname = "LightClientProto";
option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";
message LightClientHeaderAltair {
BeaconBlockHeader beacon = 1;
}
message LightClientHeaderCapella {
BeaconBlockHeader beacon = 1;
ethereum.engine.v1.ExecutionPayloadHeaderCapella execution = 2;
repeated bytes execution_branch = 3 [(ethereum.eth.ext.ssz_size) = "4,32"];
}
message LightClientHeaderDeneb {
BeaconBlockHeader beacon = 1;
ethereum.engine.v1.ExecutionPayloadHeaderDeneb execution = 2;
repeated bytes execution_branch = 3 [(ethereum.eth.ext.ssz_size) = "4,32"];
}
message LightClientBootstrapAltair {
LightClientHeaderAltair header = 1;
SyncCommittee current_sync_committee = 2;
repeated bytes current_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
}
message LightClientBootstrapCapella {
LightClientHeaderCapella header = 1;
SyncCommittee current_sync_committee = 2;
repeated bytes current_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
}
message LightClientBootstrapDeneb {
LightClientHeaderDeneb header = 1;
SyncCommittee current_sync_committee = 2;
repeated bytes current_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
}
message LightClientUpdateAltair {
LightClientHeaderAltair attested_header = 1;
SyncCommittee next_sync_committee = 2;
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
LightClientHeaderAltair finalized_header = 4;
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
SyncAggregate sync_aggregate = 6;
uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientUpdateCapella {
LightClientHeaderCapella attested_header = 1;
SyncCommittee next_sync_committee = 2;
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
LightClientHeaderCapella finalized_header = 4;
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
SyncAggregate sync_aggregate = 6;
uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientUpdateDeneb {
LightClientHeaderDeneb attested_header = 1;
SyncCommittee next_sync_committee = 2;
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
LightClientHeaderDeneb finalized_header = 4;
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
SyncAggregate sync_aggregate = 6;
uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientFinalityUpdateAltair {
LightClientHeaderAltair attested_header = 1;
LightClientHeaderAltair finalized_header = 2;
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
SyncAggregate sync_aggregate = 4;
uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientFinalityUpdateCapella {
LightClientHeaderCapella attested_header = 1;
LightClientHeaderCapella finalized_header = 2;
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
SyncAggregate sync_aggregate = 4;
uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientFinalityUpdateDeneb {
LightClientHeaderDeneb attested_header = 1;
LightClientHeaderDeneb finalized_header = 2;
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
SyncAggregate sync_aggregate = 4;
uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientOptimisticUpdateAltair {
LightClientHeaderAltair attested_header = 1;
SyncAggregate sync_aggregate = 2;
uint64 signature_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientOptimisticUpdateCapella {
LightClientHeaderCapella attested_header = 1;
SyncAggregate sync_aggregate = 2;
uint64 signature_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}
message LightClientOptimisticUpdateDeneb {
LightClientHeaderDeneb attested_header = 1;
SyncAggregate sync_aggregate = 2;
uint64 signature_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
}