From 499c866c2df845cf8295e62693121f1832642f3b Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 22:06:07 +0700 Subject: [PATCH 1/4] extract from lc-p2p branch --- api/server/structs/conversions_lightclient.go | 36 ++++- beacon-chain/core/light-client/lightclient.go | 49 ++++--- beacon-chain/rpc/eth/light-client/helpers.go | 30 ++++- config/fieldparams/mainnet.go | 1 + consensus-types/interfaces/light_client.go | 7 +- consensus-types/light-client/BUILD.bazel | 2 + consensus-types/light-client/bootstrap.go | 8 +- .../light-client/finality_update.go | 125 ++++++++++++++++-- consensus-types/light-client/header.go | 74 ++++++++++- consensus-types/light-client/helpers.go | 2 +- consensus-types/light-client/update.go | 125 +++++++----------- proto/prysm/v1alpha1/BUILD.bazel | 16 ++- proto/prysm/v1alpha1/light_client.proto | 10 +- 13 files changed, 349 insertions(+), 136 deletions(-) diff --git a/api/server/structs/conversions_lightclient.go b/api/server/structs/conversions_lightclient.go index 0c809c70b14..48d0a5167a1 100644 --- a/api/server/structs/conversions_lightclient.go +++ b/api/server/structs/conversions_lightclient.go @@ -20,21 +20,31 @@ func LightClientUpdateFromConsensus(update interfaces.LightClientUpdate) (*Light if err != nil { return nil, errors.Wrap(err, "could not marshal finalized light client header") } - finalityBranch := update.FinalityBranch() var scBranch [][32]byte + var finalityBranch [][32]byte if update.Version() >= version.Electra { - b, err := update.NextSyncCommitteeBranchElectra() + scb, err := update.NextSyncCommitteeBranchElectra() if err != nil { return nil, err } - scBranch = b[:] + scBranch = scb[:] + fb, err := update.FinalityBranchElectra() + if err != nil { + return nil, err + } + finalityBranch = fb[:] } else { b, err := update.NextSyncCommitteeBranch() if err != nil { return nil, err } scBranch = b[:] + fb, err := update.FinalityBranch() + if err != nil { + return nil, err + } + finalityBranch = fb[:] } return &LightClientUpdate{ @@ -42,7 +52,7 @@ func LightClientUpdateFromConsensus(update interfaces.LightClientUpdate) (*Light NextSyncCommittee: SyncCommitteeFromConsensus(update.NextSyncCommittee()), NextSyncCommitteeBranch: branchToJSON(scBranch), FinalizedHeader: finalizedHeader, - FinalityBranch: branchToJSON(finalityBranch[:]), + FinalityBranch: branchToJSON(finalityBranch), SyncAggregate: SyncAggregateFromConsensus(update.SyncAggregate()), SignatureSlot: fmt.Sprintf("%d", update.SignatureSlot()), }, nil @@ -57,12 +67,26 @@ func LightClientFinalityUpdateFromConsensus(update interfaces.LightClientFinalit if err != nil { return nil, errors.Wrap(err, "could not marshal finalized light client header") } - finalityBranch := update.FinalityBranch() + + var finalityBranch [][32]byte + if update.Version() >= version.Electra { + b, err := update.FinalityBranchElectra() + if err != nil { + return nil, err + } + finalityBranch = b[:] + } else { + b, err := update.FinalityBranch() + if err != nil { + return nil, err + } + finalityBranch = b[:] + } return &LightClientFinalityUpdate{ AttestedHeader: attestedHeader, FinalizedHeader: finalizedHeader, - FinalityBranch: branchToJSON(finalityBranch[:]), + FinalityBranch: branchToJSON(finalityBranch), SyncAggregate: SyncAggregateFromConsensus(update.SyncAggregate()), SignatureSlot: fmt.Sprintf("%d", update.SignatureSlot()), }, nil diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index f8df29ba6b6..d59c86a1cc1 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -23,10 +23,6 @@ import ( "google.golang.org/protobuf/proto" ) -const ( - FinalityBranchNumOfLeaves = 6 -) - func NewLightClientFinalityUpdateFromBeaconState( ctx context.Context, currentSlot primitives.Slot, @@ -159,7 +155,7 @@ func NewLightClientUpdateFromBeaconState( updateAttestedPeriod := slots.SyncCommitteePeriod(slots.ToEpoch(attestedBlock.Block().Slot())) // update = LightClientUpdate() - result, err := CreateDefaultLightClientUpdate(currentSlot) + result, err := CreateDefaultLightClientUpdate(currentSlot, attestedBlock) if err != nil { return nil, errors.Wrap(err, "could not create default light client update") } @@ -243,7 +239,7 @@ func NewLightClientUpdateFromBeaconState( return result, nil } -func CreateDefaultLightClientUpdate(currentSlot primitives.Slot) (interfaces.LightClientUpdate, error) { +func CreateDefaultLightClientUpdate(currentSlot primitives.Slot, attestedBlock interfaces.ReadOnlySignedBeaconBlock) (interfaces.LightClientUpdate, error) { currentEpoch := slots.ToEpoch(currentSlot) syncCommitteeSize := params.BeaconConfig().SyncCommitteeSize @@ -270,8 +266,14 @@ func CreateDefaultLightClientUpdate(currentSlot primitives.Slot) (interfaces.Lig for i := 0; i < fieldparams.ExecutionBranchDepth; i++ { executionBranch[i] = make([]byte, 32) } - finalityBranch := make([][]byte, fieldparams.FinalityBranchDepth) - for i := 0; i < fieldparams.FinalityBranchDepth; i++ { + + var finalityBranch [][]byte + if attestedBlock.Version() >= version.Electra { + finalityBranch = make([][]byte, fieldparams.FinalityBranchDepthElectra) + } else { + finalityBranch = make([][]byte, fieldparams.FinalityBranchDepth) + } + for i := 0; i < len(finalityBranch); i++ { finalityBranch[i] = make([]byte, 32) } @@ -308,15 +310,28 @@ func CreateDefaultLightClientUpdate(currentSlot primitives.Slot) (interfaces.Lig FinalityBranch: finalityBranch, } } else { - m = &pb.LightClientUpdateElectra{ - AttestedHeader: &pb.LightClientHeaderDeneb{ - Beacon: &pb.BeaconBlockHeader{}, - Execution: &enginev1.ExecutionPayloadHeaderDeneb{}, - ExecutionBranch: executionBranch, - }, - NextSyncCommittee: nextSyncCommittee, - NextSyncCommitteeBranch: nextSyncCommitteeBranch, - FinalityBranch: finalityBranch, + if attestedBlock.Version() >= version.Electra { + m = &pb.LightClientUpdateElectra{ + AttestedHeader: &pb.LightClientHeaderDeneb{ + Beacon: &pb.BeaconBlockHeader{}, + Execution: &enginev1.ExecutionPayloadHeaderDeneb{}, + ExecutionBranch: executionBranch, + }, + NextSyncCommittee: nextSyncCommittee, + NextSyncCommitteeBranch: nextSyncCommitteeBranch, + FinalityBranch: finalityBranch, + } + } else { + m = &pb.LightClientUpdateDeneb{ + AttestedHeader: &pb.LightClientHeaderDeneb{ + Beacon: &pb.BeaconBlockHeader{}, + Execution: &enginev1.ExecutionPayloadHeaderDeneb{}, + ExecutionBranch: executionBranch, + }, + NextSyncCommittee: nextSyncCommittee, + NextSyncCommitteeBranch: nextSyncCommitteeBranch, + FinalityBranch: finalityBranch, + } } } diff --git a/beacon-chain/rpc/eth/light-client/helpers.go b/beacon-chain/rpc/eth/light-client/helpers.go index 4f6dee400b3..39779735bca 100644 --- a/beacon-chain/rpc/eth/light-client/helpers.go +++ b/beacon-chain/rpc/eth/light-client/helpers.go @@ -6,17 +6,17 @@ import ( "fmt" "reflect" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" + "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client" "github.com/prysmaticlabs/prysm/v5/runtime/version" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/prysmaticlabs/prysm/v5/api/server/structs" "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" - "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v5/time/slots" ) @@ -147,8 +147,20 @@ func HasRelevantSyncCommittee(update interfaces.LightClientUpdate) (bool, error) return !reflect.DeepEqual(branch, interfaces.LightClientSyncCommitteeBranch{}), nil } -func HasFinality(update interfaces.LightClientUpdate) bool { - return !reflect.DeepEqual(update.FinalityBranch(), interfaces.LightClientFinalityBranch{}) +func HasFinality(update interfaces.LightClientUpdate) (bool, error) { + if update.Version() >= version.Electra { + b, err := update.FinalityBranchElectra() + if err != nil { + return false, err + } + return !reflect.DeepEqual(b, interfaces.LightClientFinalityBranchElectra{}), nil + } + + b, err := update.FinalityBranch() + if err != nil { + return false, err + } + return !reflect.DeepEqual(b, interfaces.LightClientFinalityBranch{}), nil } func IsBetterUpdate(newUpdate, oldUpdate interfaces.LightClientUpdate) (bool, error) { @@ -187,8 +199,14 @@ func IsBetterUpdate(newUpdate, oldUpdate interfaces.LightClientUpdate) (bool, er } // Compare indication of any finality - newHasFinality := HasFinality(newUpdate) - oldHasFinality := HasFinality(oldUpdate) + newHasFinality, err := HasFinality(newUpdate) + if err != nil { + return false, err + } + oldHasFinality, err := HasFinality(oldUpdate) + if err != nil { + return false, err + } if newHasFinality != oldHasFinality { return newHasFinality, nil } diff --git a/config/fieldparams/mainnet.go b/config/fieldparams/mainnet.go index 3eb5e90b53e..c745aac44a5 100644 --- a/config/fieldparams/mainnet.go +++ b/config/fieldparams/mainnet.go @@ -37,6 +37,7 @@ const ( SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee. SyncCommitteeBranchDepthElectra = 6 // SyncCommitteeBranchDepthElectra 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. + FinalityBranchDepthElectra = 7 // FinalityBranchDepthElectra defines the number of leaves in a merkle proof of the finalized checkpoint root. PendingDepositsLimit = 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. diff --git a/consensus-types/interfaces/light_client.go b/consensus-types/interfaces/light_client.go index 89ea81f0767..b0d0dadaa2e 100644 --- a/consensus-types/interfaces/light_client.go +++ b/consensus-types/interfaces/light_client.go @@ -12,6 +12,7 @@ type LightClientExecutionBranch = [fieldparams.ExecutionBranchDepth][fieldparams type LightClientSyncCommitteeBranch = [fieldparams.SyncCommitteeBranchDepth][fieldparams.RootLength]byte type LightClientSyncCommitteeBranchElectra = [fieldparams.SyncCommitteeBranchDepthElectra][fieldparams.RootLength]byte type LightClientFinalityBranch = [fieldparams.FinalityBranchDepth][fieldparams.RootLength]byte +type LightClientFinalityBranchElectra = [fieldparams.FinalityBranchDepthElectra][fieldparams.RootLength]byte type LightClientHeader interface { ssz.Marshaler @@ -45,7 +46,8 @@ type LightClientUpdate interface { SetNextSyncCommitteeBranchElectra(branch [][]byte) error FinalizedHeader() LightClientHeader SetFinalizedHeader(header LightClientHeader) error - FinalityBranch() LightClientFinalityBranch + FinalityBranch() (LightClientFinalityBranch, error) + FinalityBranchElectra() (LightClientFinalityBranchElectra, error) SetFinalityBranch(branch [][]byte) error SyncAggregate() *pb.SyncAggregate SetSyncAggregate(sa *pb.SyncAggregate) @@ -59,7 +61,8 @@ type LightClientFinalityUpdate interface { Version() int AttestedHeader() LightClientHeader FinalizedHeader() LightClientHeader - FinalityBranch() LightClientFinalityBranch + FinalityBranch() (LightClientFinalityBranch, error) + FinalityBranchElectra() (LightClientFinalityBranchElectra, error) SyncAggregate() *pb.SyncAggregate SignatureSlot() primitives.Slot } diff --git a/consensus-types/light-client/BUILD.bazel b/consensus-types/light-client/BUILD.bazel index 151f22b522f..78432c8eecb 100644 --- a/consensus-types/light-client/BUILD.bazel +++ b/consensus-types/light-client/BUILD.bazel @@ -14,6 +14,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//config/fieldparams:go_default_library", + "//config/params:go_default_library", "//consensus-types:go_default_library", "//consensus-types/blocks:go_default_library", "//consensus-types/interfaces:go_default_library", @@ -21,6 +22,7 @@ go_library( "//encoding/bytesutil:go_default_library", "//proto/prysm/v1alpha1:go_default_library", "//runtime/version:go_default_library", + "//time/slots:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], ) diff --git a/consensus-types/light-client/bootstrap.go b/consensus-types/light-client/bootstrap.go index 33d8b2c78f7..1de819266d0 100644 --- a/consensus-types/light-client/bootstrap.go +++ b/consensus-types/light-client/bootstrap.go @@ -41,7 +41,7 @@ func NewWrappedBootstrapAltair(p *pb.LightClientBootstrapAltair) (interfaces.Lig if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeaderAltair(p.Header) + header, err := NewWrappedHeader(p.Header) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func NewWrappedBootstrapCapella(p *pb.LightClientBootstrapCapella) (interfaces.L if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeaderCapella(p.Header) + header, err := NewWrappedHeader(p.Header) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func NewWrappedBootstrapDeneb(p *pb.LightClientBootstrapDeneb) (interfaces.Light if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeaderDeneb(p.Header) + header, err := NewWrappedHeader(p.Header) if err != nil { return nil, err } @@ -233,7 +233,7 @@ func NewWrappedBootstrapElectra(p *pb.LightClientBootstrapElectra) (interfaces.L if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - header, err := NewWrappedHeaderDeneb(p.Header) + header, err := NewWrappedHeader(p.Header) if err != nil { return nil, err } diff --git a/consensus-types/light-client/finality_update.go b/consensus-types/light-client/finality_update.go index dad1259f2e7..51cbd240803 100644 --- a/consensus-types/light-client/finality_update.go +++ b/consensus-types/light-client/finality_update.go @@ -23,6 +23,8 @@ func NewWrappedFinalityUpdate(m proto.Message) (interfaces.LightClientFinalityUp return NewWrappedFinalityUpdateCapella(t) case *pb.LightClientFinalityUpdateDeneb: return NewWrappedFinalityUpdateDeneb(t) + case *pb.LightClientFinalityUpdateElectra: + return NewWrappedFinalityUpdateElectra(t) default: return nil, fmt.Errorf("cannot construct light client finality update from type %T", t) } @@ -70,8 +72,8 @@ func NewFinalityUpdateFromUpdate(update interfaces.LightClientUpdate) (interface finalityBranch: t.finalityBranch, }, nil case *updateElectra: - return &finalityUpdateDeneb{ - p: &pb.LightClientFinalityUpdateDeneb{ + return &finalityUpdateElectra{ + p: &pb.LightClientFinalityUpdateElectra{ AttestedHeader: t.p.AttestedHeader, FinalizedHeader: t.p.FinalizedHeader, FinalityBranch: t.p.FinalityBranch, @@ -100,11 +102,11 @@ func NewWrappedFinalityUpdateAltair(p *pb.LightClientFinalityUpdateAltair) (inte if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader) + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } - finalizedHeader, err := NewWrappedHeaderAltair(p.FinalizedHeader) + finalizedHeader, err := NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -153,8 +155,12 @@ func (u *finalityUpdateAltair) FinalizedHeader() interfaces.LightClientHeader { return u.finalizedHeader } -func (u *finalityUpdateAltair) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *finalityUpdateAltair) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return u.finalityBranch, nil +} + +func (u *finalityUpdateAltair) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version()) } func (u *finalityUpdateAltair) SyncAggregate() *pb.SyncAggregate { @@ -178,11 +184,11 @@ func NewWrappedFinalityUpdateCapella(p *pb.LightClientFinalityUpdateCapella) (in if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader) + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } - finalizedHeader, err := NewWrappedHeaderCapella(p.FinalizedHeader) + finalizedHeader, err := NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -231,8 +237,12 @@ func (u *finalityUpdateCapella) FinalizedHeader() interfaces.LightClientHeader { return u.finalizedHeader } -func (u *finalityUpdateCapella) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *finalityUpdateCapella) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return u.finalityBranch, nil +} + +func (u *finalityUpdateCapella) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version()) } func (u *finalityUpdateCapella) SyncAggregate() *pb.SyncAggregate { @@ -256,11 +266,11 @@ func NewWrappedFinalityUpdateDeneb(p *pb.LightClientFinalityUpdateDeneb) (interf if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader) + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } - finalizedHeader, err := NewWrappedHeaderDeneb(p.FinalizedHeader) + finalizedHeader, err := NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -309,8 +319,12 @@ func (u *finalityUpdateDeneb) FinalizedHeader() interfaces.LightClientHeader { return u.finalizedHeader } -func (u *finalityUpdateDeneb) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *finalityUpdateDeneb) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return u.finalityBranch, nil +} + +func (u *finalityUpdateDeneb) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version()) } func (u *finalityUpdateDeneb) SyncAggregate() *pb.SyncAggregate { @@ -320,3 +334,86 @@ func (u *finalityUpdateDeneb) SyncAggregate() *pb.SyncAggregate { func (u *finalityUpdateDeneb) SignatureSlot() primitives.Slot { return u.p.SignatureSlot } + +type finalityUpdateElectra struct { + p *pb.LightClientFinalityUpdateElectra + attestedHeader interfaces.LightClientHeader + finalizedHeader interfaces.LightClientHeader + finalityBranch interfaces.LightClientFinalityBranchElectra +} + +var _ interfaces.LightClientFinalityUpdate = &finalityUpdateElectra{} + +func NewWrappedFinalityUpdateElectra(p *pb.LightClientFinalityUpdateElectra) (interfaces.LightClientFinalityUpdate, error) { + if p == nil { + return nil, consensustypes.ErrNilObjectWrapped + } + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) + if err != nil { + return nil, err + } + finalizedHeader, err := NewWrappedHeader(p.FinalizedHeader) + if err != nil { + return nil, err + } + + finalityBranch, err := createBranch[interfaces.LightClientFinalityBranchElectra]( + "finality", + p.FinalityBranch, + fieldparams.FinalityBranchDepthElectra, + ) + if err != nil { + return nil, err + } + + return &finalityUpdateElectra{ + p: p, + attestedHeader: attestedHeader, + finalizedHeader: finalizedHeader, + finalityBranch: finalityBranch, + }, nil +} + +func (u *finalityUpdateElectra) MarshalSSZTo(dst []byte) ([]byte, error) { + return u.p.MarshalSSZTo(dst) +} + +func (u *finalityUpdateElectra) MarshalSSZ() ([]byte, error) { + return u.p.MarshalSSZ() +} + +func (u *finalityUpdateElectra) SizeSSZ() int { + return u.p.SizeSSZ() +} + +func (u *finalityUpdateElectra) Proto() proto.Message { + return u.p +} + +func (u *finalityUpdateElectra) Version() int { + return version.Electra +} + +func (u *finalityUpdateElectra) AttestedHeader() interfaces.LightClientHeader { + return u.attestedHeader +} + +func (u *finalityUpdateElectra) FinalizedHeader() interfaces.LightClientHeader { + return u.finalizedHeader +} + +func (u *finalityUpdateElectra) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return interfaces.LightClientFinalityBranch{}, consensustypes.ErrNotSupported("FinalityBranch", u.Version()) +} + +func (u *finalityUpdateElectra) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return u.finalityBranch, nil +} + +func (u *finalityUpdateElectra) SyncAggregate() *pb.SyncAggregate { + return u.p.SyncAggregate +} + +func (u *finalityUpdateElectra) SignatureSlot() primitives.Slot { + return u.p.SignatureSlot +} diff --git a/consensus-types/light-client/header.go b/consensus-types/light-client/header.go index 32b34422748..4ed8ce0de91 100644 --- a/consensus-types/light-client/header.go +++ b/consensus-types/light-client/header.go @@ -4,11 +4,13 @@ import ( "fmt" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" + "github.com/prysmaticlabs/prysm/v5/config/params" 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" + "github.com/prysmaticlabs/prysm/v5/time/slots" "google.golang.org/protobuf/proto" ) @@ -22,6 +24,9 @@ func NewWrappedHeader(m proto.Message) (interfaces.LightClientHeader, error) { case *pb.LightClientHeaderCapella: return NewWrappedHeaderCapella(t) case *pb.LightClientHeaderDeneb: + if slots.ToEpoch(t.Beacon.Slot) >= params.BeaconConfig().ElectraForkEpoch { + return NewWrappedHeaderElectra(t) + } return NewWrappedHeaderDeneb(t) default: return nil, fmt.Errorf("cannot construct light client header from type %T", t) @@ -66,11 +71,11 @@ func (h *headerAltair) Beacon() *pb.BeaconBlockHeader { } func (h *headerAltair) Execution() (interfaces.ExecutionData, error) { - return nil, consensustypes.ErrNotSupported("Execution", version.Altair) + return nil, consensustypes.ErrNotSupported("Execution", h.Version()) } func (h *headerAltair) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) { - return interfaces.LightClientExecutionBranch{}, consensustypes.ErrNotSupported("ExecutionBranch", version.Altair) + return interfaces.LightClientExecutionBranch{}, consensustypes.ErrNotSupported("ExecutionBranch", h.Version()) } type headerCapella struct { @@ -202,3 +207,68 @@ func (h *headerDeneb) Execution() (interfaces.ExecutionData, error) { func (h *headerDeneb) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) { return h.executionBranch, nil } + +type headerElectra struct { + p *pb.LightClientHeaderDeneb + execution interfaces.ExecutionData + executionBranch interfaces.LightClientExecutionBranch +} + +var _ interfaces.LightClientHeader = &headerElectra{} + +func NewWrappedHeaderElectra(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 &headerElectra{ + p: p, + execution: execution, + executionBranch: branch, + }, nil +} + +func (h *headerElectra) MarshalSSZTo(dst []byte) ([]byte, error) { + return h.p.MarshalSSZTo(dst) +} + +func (h *headerElectra) MarshalSSZ() ([]byte, error) { + return h.p.MarshalSSZ() +} + +func (h *headerElectra) SizeSSZ() int { + return h.p.SizeSSZ() +} + +func (h *headerElectra) Proto() proto.Message { + return h.p +} + +func (h *headerElectra) Version() int { + return version.Electra +} + +func (h *headerElectra) Beacon() *pb.BeaconBlockHeader { + return h.p.Beacon +} + +func (h *headerElectra) Execution() (interfaces.ExecutionData, error) { + return h.execution, nil +} + +func (h *headerElectra) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) { + return h.executionBranch, nil +} diff --git a/consensus-types/light-client/helpers.go b/consensus-types/light-client/helpers.go index 0d100314a4f..8a6313b4294 100644 --- a/consensus-types/light-client/helpers.go +++ b/consensus-types/light-client/helpers.go @@ -8,7 +8,7 @@ import ( ) type branchConstraint interface { - [4][32]byte | [5][32]byte | [6][32]byte + [4][fieldparams.RootLength]byte | [5][fieldparams.RootLength]byte | [6][fieldparams.RootLength]byte | [7][fieldparams.RootLength]byte } func createBranch[T branchConstraint](name string, input [][]byte, depth int) (T, error) { diff --git a/consensus-types/light-client/update.go b/consensus-types/light-client/update.go index f6fb739d299..4e0ffe4ea53 100644 --- a/consensus-types/light-client/update.go +++ b/consensus-types/light-client/update.go @@ -47,14 +47,15 @@ func NewWrappedUpdateAltair(p *pb.LightClientUpdateAltair) (interfaces.LightClie if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader) + + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } var finalizedHeader interfaces.LightClientHeader if p.FinalizedHeader != nil { - finalizedHeader, err = NewWrappedHeaderAltair(p.FinalizedHeader) + finalizedHeader, err = NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -111,17 +112,12 @@ func (u *updateAltair) AttestedHeader() interfaces.LightClientHeader { } func (u *updateAltair) SetAttestedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Altair { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Altair)) - } - u.attestedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderAltair) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderAltair{}) } u.p.AttestedHeader = proto - + u.attestedHeader = header return nil } @@ -162,22 +158,17 @@ func (u *updateAltair) FinalizedHeader() interfaces.LightClientHeader { } func (u *updateAltair) SetFinalizedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Altair { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Altair)) - } - u.finalizedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderAltair) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderAltair{}) } u.p.FinalizedHeader = proto - + u.finalizedHeader = header return nil } -func (u *updateAltair) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *updateAltair) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return u.finalityBranch, nil } func (u *updateAltair) SetFinalityBranch(branch [][]byte) error { @@ -186,12 +177,14 @@ func (u *updateAltair) SetFinalityBranch(branch [][]byte) error { return err } u.finalityBranch = b - u.p.FinalityBranch = branch - return nil } +func (u *updateAltair) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", version.Altair) +} + func (u *updateAltair) SyncAggregate() *pb.SyncAggregate { return u.p.SyncAggregate } @@ -225,14 +218,15 @@ func NewWrappedUpdateCapella(p *pb.LightClientUpdateCapella) (interfaces.LightCl if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader) + + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } var finalizedHeader interfaces.LightClientHeader if p.FinalizedHeader != nil { - finalizedHeader, err = NewWrappedHeaderCapella(p.FinalizedHeader) + finalizedHeader, err = NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -289,17 +283,12 @@ func (u *updateCapella) AttestedHeader() interfaces.LightClientHeader { } func (u *updateCapella) SetAttestedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Capella { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Capella)) - } - u.attestedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderCapella) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderCapella{}) } u.p.AttestedHeader = proto - + u.attestedHeader = header return nil } @@ -340,22 +329,17 @@ func (u *updateCapella) FinalizedHeader() interfaces.LightClientHeader { } func (u *updateCapella) SetFinalizedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Capella { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Capella)) - } - u.finalizedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderCapella) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderCapella{}) } u.p.FinalizedHeader = proto - + u.finalizedHeader = header return nil } -func (u *updateCapella) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *updateCapella) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return u.finalityBranch, nil } func (u *updateCapella) SetFinalityBranch(branch [][]byte) error { @@ -364,12 +348,14 @@ func (u *updateCapella) SetFinalityBranch(branch [][]byte) error { return err } u.finalityBranch = b - u.p.FinalityBranch = branch - return nil } +func (u *updateCapella) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version()) +} + func (u *updateCapella) SyncAggregate() *pb.SyncAggregate { return u.p.SyncAggregate } @@ -403,14 +389,15 @@ func NewWrappedUpdateDeneb(p *pb.LightClientUpdateDeneb) (interfaces.LightClient if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader) + + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } var finalizedHeader interfaces.LightClientHeader if p.FinalizedHeader != nil { - finalizedHeader, err = NewWrappedHeaderDeneb(p.FinalizedHeader) + finalizedHeader, err = NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -467,17 +454,12 @@ func (u *updateDeneb) AttestedHeader() interfaces.LightClientHeader { } func (u *updateDeneb) SetAttestedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Deneb { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Deneb)) - } - u.attestedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderDeneb) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderDeneb{}) } u.p.AttestedHeader = proto - + u.attestedHeader = header return nil } @@ -518,22 +500,17 @@ func (u *updateDeneb) FinalizedHeader() interfaces.LightClientHeader { } func (u *updateDeneb) SetFinalizedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Deneb { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Deneb)) - } - u.finalizedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderDeneb) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderDeneb{}) } u.p.FinalizedHeader = proto - + u.finalizedHeader = header return nil } -func (u *updateDeneb) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *updateDeneb) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return u.finalityBranch, nil } func (u *updateDeneb) SetFinalityBranch(branch [][]byte) error { @@ -542,12 +519,14 @@ func (u *updateDeneb) SetFinalityBranch(branch [][]byte) error { return err } u.finalityBranch = b - u.p.FinalityBranch = branch - return nil } +func (u *updateDeneb) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version()) +} + func (u *updateDeneb) SyncAggregate() *pb.SyncAggregate { return u.p.SyncAggregate } @@ -572,7 +551,7 @@ type updateElectra struct { attestedHeader interfaces.LightClientHeader nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranchElectra finalizedHeader interfaces.LightClientHeader - finalityBranch interfaces.LightClientFinalityBranch + finalityBranch interfaces.LightClientFinalityBranchElectra } var _ interfaces.LightClientUpdate = &updateElectra{} @@ -581,14 +560,15 @@ func NewWrappedUpdateElectra(p *pb.LightClientUpdateElectra) (interfaces.LightCl if p == nil { return nil, consensustypes.ErrNilObjectWrapped } - attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader) + + attestedHeader, err := NewWrappedHeader(p.AttestedHeader) if err != nil { return nil, err } var finalizedHeader interfaces.LightClientHeader if p.FinalizedHeader != nil { - finalizedHeader, err = NewWrappedHeaderDeneb(p.FinalizedHeader) + finalizedHeader, err = NewWrappedHeader(p.FinalizedHeader) if err != nil { return nil, err } @@ -602,10 +582,11 @@ func NewWrappedUpdateElectra(p *pb.LightClientUpdateElectra) (interfaces.LightCl if err != nil { return nil, err } - finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch]( + + finalityBranch, err := createBranch[interfaces.LightClientFinalityBranchElectra]( "finality", p.FinalityBranch, - fieldparams.FinalityBranchDepth, + fieldparams.FinalityBranchDepthElectra, ) if err != nil { return nil, err @@ -645,17 +626,12 @@ func (u *updateElectra) AttestedHeader() interfaces.LightClientHeader { } func (u *updateElectra) SetAttestedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Electra { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Electra)) - } - u.attestedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderDeneb) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderDeneb{}) } u.p.AttestedHeader = proto - + u.attestedHeader = header return nil } @@ -696,36 +672,33 @@ func (u *updateElectra) FinalizedHeader() interfaces.LightClientHeader { } func (u *updateElectra) SetFinalizedHeader(header interfaces.LightClientHeader) error { - if header.Version() != version.Electra { - return fmt.Errorf("header version %s is not %s", version.String(header.Version()), version.String(version.Electra)) - } - u.finalizedHeader = header - proto, ok := header.Proto().(*pb.LightClientHeaderDeneb) if !ok { return fmt.Errorf("header type %T is not %T", proto, &pb.LightClientHeaderDeneb{}) } u.p.FinalizedHeader = proto - + u.finalizedHeader = header return nil } -func (u *updateElectra) FinalityBranch() interfaces.LightClientFinalityBranch { - return u.finalityBranch +func (u *updateElectra) FinalityBranch() (interfaces.LightClientFinalityBranch, error) { + return interfaces.LightClientFinalityBranch{}, consensustypes.ErrNotSupported("FinalityBranch", u.Version()) } func (u *updateElectra) SetFinalityBranch(branch [][]byte) error { - b, err := createBranch[interfaces.LightClientFinalityBranch]("finality", branch, fieldparams.FinalityBranchDepth) + b, err := createBranch[interfaces.LightClientFinalityBranchElectra]("finality", branch, fieldparams.FinalityBranchDepthElectra) if err != nil { return err } u.finalityBranch = b - u.p.FinalityBranch = branch - return nil } +func (u *updateElectra) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) { + return u.finalityBranch, nil +} + func (u *updateElectra) SyncAggregate() *pb.SyncAggregate { return u.p.SyncAggregate } diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index e79cd785673..51ec7d96164 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -81,11 +81,11 @@ ssz_altair_objs = [ "BeaconBlockBodyAltair", "BeaconStateAltair", "ContributionAndProof", + "LightClientHeaderAltair", "LightClientBootstrapAltair", + "LightClientUpdateAltair", "LightClientFinalityUpdateAltair", - "LightClientHeaderAltair", "LightClientOptimisticUpdateAltair", - "LightClientUpdateAltair", "SignedBeaconBlockAltair", "SignedContributionAndProof", "SyncAggregate", @@ -115,11 +115,11 @@ ssz_capella_objs = [ "BlindedBeaconBlockCapella", "BuilderBidCapella", "HistoricalSummary", + "LightClientHeaderCapella", "LightClientBootstrapCapella", + "LightClientUpdateCapella", "LightClientFinalityUpdateCapella", - "LightClientHeaderCapella", "LightClientOptimisticUpdateCapella", - "LightClientUpdateCapella", "SignedBLSToExecutionChange", "SignedBeaconBlockCapella", "SignedBlindedBeaconBlockCapella", @@ -137,11 +137,11 @@ ssz_deneb_objs = [ "BlobSidecar", "BlobSidecars", "BuilderBidDeneb", + "LightClientHeaderDeneb", "LightClientBootstrapDeneb", + "LightClientUpdateDeneb", "LightClientFinalityUpdateDeneb", - "LightClientHeaderDeneb", "LightClientOptimisticUpdateDeneb", - "LightClientUpdateDeneb", "SignedBeaconBlockContentsDeneb", "SignedBeaconBlockDeneb", "SignedBlindedBeaconBlockDeneb", @@ -151,16 +151,18 @@ ssz_electra_objs = [ "AggregateAttestationAndProofElectra", "AttestationElectra", "AttesterSlashingElectra", + "BeaconBlockElectra", "BeaconBlockBodyElectra", "BeaconBlockContentsElectra", - "BeaconBlockElectra", "BeaconStateElectra", "BlindedBeaconBlockBodyElectra", "BlindedBeaconBlockElectra", "Consolidation", "IndexedAttestationElectra", + "LightClientHeaderElectra", "LightClientBootstrapElectra", "LightClientUpdateElectra", + "LightClientFinalityUpdateElectra", "PendingDeposit", "PendingDeposits", "PendingConsolidation", diff --git a/proto/prysm/v1alpha1/light_client.proto b/proto/prysm/v1alpha1/light_client.proto index 52b5e967c53..57a12aa0d82 100644 --- a/proto/prysm/v1alpha1/light_client.proto +++ b/proto/prysm/v1alpha1/light_client.proto @@ -102,7 +102,7 @@ message LightClientUpdateElectra { SyncCommittee next_sync_committee = 2; repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"]; LightClientHeaderDeneb finalized_header = 4; - repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"]; + repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "7,32"]; SyncAggregate sync_aggregate = 6; uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; } @@ -131,6 +131,14 @@ message LightClientFinalityUpdateDeneb { uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"]; } +message LightClientFinalityUpdateElectra { + LightClientHeaderDeneb attested_header = 1; + LightClientHeaderDeneb finalized_header = 2; + repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_max) = "7,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; From c34d89e0d08af5538961e7c2972ad39ebd24615b Mon Sep 17 00:00:00 2001 From: rkapka Date: Thu, 31 Oct 2024 22:07:15 +0700 Subject: [PATCH 2/4] generate code --- proto/prysm/v1alpha1/electra.ssz.go | 274 ++++++++++++++++-- proto/prysm/v1alpha1/light_client.pb.go | 365 ++++++++++++++++-------- 2 files changed, 502 insertions(+), 137 deletions(-) diff --git a/proto/prysm/v1alpha1/electra.ssz.go b/proto/prysm/v1alpha1/electra.ssz.go index 772aec1ecb9..95a8c2fe87e 100644 --- a/proto/prysm/v1alpha1/electra.ssz.go +++ b/proto/prysm/v1alpha1/electra.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 5ca1c2c4e61b47b1f8185b3e9c477ae280f82e1483b88d4e11fa214452da5117 +// Hash: 734bb55036e8fc3dc75bec7202483b74acd4f33b48e3e9956ffd5cd8de0a07f1 package eth import ( @@ -4410,7 +4410,7 @@ func (l *LightClientUpdateElectra) MarshalSSZ() ([]byte, error) { // MarshalSSZTo ssz marshals the LightClientUpdateElectra object to a target array func (l *LightClientUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf - offset := int(25184) + offset := int(25216) // Offset (0) 'AttestedHeader' dst = ssz.WriteOffset(dst, offset) @@ -4448,11 +4448,11 @@ func (l *LightClientUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, err err offset += l.FinalizedHeader.SizeSSZ() // Field (4) 'FinalityBranch' - if size := len(l.FinalityBranch); size != 6 { - err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6) + if size := len(l.FinalityBranch); size != 7 { + err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 7) return } - for ii := 0; ii < 6; ii++ { + for ii := 0; ii < 7; ii++ { if size := len(l.FinalityBranch[ii]); size != 32 { err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32) return @@ -4488,7 +4488,7 @@ func (l *LightClientUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, err err func (l *LightClientUpdateElectra) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) - if size < 25184 { + if size < 25216 { return ssz.ErrSize } @@ -4500,7 +4500,7 @@ func (l *LightClientUpdateElectra) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 != 25184 { + if o0 != 25216 { return ssz.ErrInvalidVariableOffset } @@ -4527,24 +4527,24 @@ func (l *LightClientUpdateElectra) UnmarshalSSZ(buf []byte) error { } // Field (4) 'FinalityBranch' - l.FinalityBranch = make([][]byte, 6) - for ii := 0; ii < 6; ii++ { + l.FinalityBranch = make([][]byte, 7) + for ii := 0; ii < 7; ii++ { if cap(l.FinalityBranch[ii]) == 0 { - l.FinalityBranch[ii] = make([]byte, 0, len(buf[24824:25016][ii*32:(ii+1)*32])) + l.FinalityBranch[ii] = make([]byte, 0, len(buf[24824:25048][ii*32:(ii+1)*32])) } - l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[24824:25016][ii*32:(ii+1)*32]...) + l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[24824:25048][ii*32:(ii+1)*32]...) } // Field (5) 'SyncAggregate' if l.SyncAggregate == nil { l.SyncAggregate = new(SyncAggregate) } - if err = l.SyncAggregate.UnmarshalSSZ(buf[25016:25176]); err != nil { + if err = l.SyncAggregate.UnmarshalSSZ(buf[25048:25208]); err != nil { return err } // Field (6) 'SignatureSlot' - l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25176:25184])) + l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25208:25216])) // Field (0) 'AttestedHeader' { @@ -4572,7 +4572,7 @@ func (l *LightClientUpdateElectra) UnmarshalSSZ(buf []byte) error { // SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateElectra object func (l *LightClientUpdateElectra) SizeSSZ() (size int) { - size = 25184 + size = 25216 // Field (0) 'AttestedHeader' if l.AttestedHeader == nil { @@ -4632,8 +4632,8 @@ func (l *LightClientUpdateElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) // Field (4) 'FinalityBranch' { - if size := len(l.FinalityBranch); size != 6 { - err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6) + if size := len(l.FinalityBranch); size != 7 { + err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 7) return } subIndx := hh.Index() @@ -4658,3 +4658,245 @@ func (l *LightClientUpdateElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) hh.Merkleize(indx) return } + +// MarshalSSZ ssz marshals the LightClientFinalityUpdateElectra object +func (l *LightClientFinalityUpdateElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(l) +} + +// MarshalSSZTo ssz marshals the LightClientFinalityUpdateElectra object to a target array +func (l *LightClientFinalityUpdateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(180) + + // 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() + + // Offset (2) 'FinalityBranch' + dst = ssz.WriteOffset(dst, offset) + for ii := 0; ii < len(l.FinalityBranch); ii++ { + offset += 4 + offset += len(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 + } + + // Field (2) 'FinalityBranch' + if size := len(l.FinalityBranch); size > 7 { + err = ssz.ErrListTooBigFn("--.FinalityBranch", size, 7) + return + } + { + offset = 4 * len(l.FinalityBranch) + for ii := 0; ii < len(l.FinalityBranch); ii++ { + dst = ssz.WriteOffset(dst, offset) + offset += len(l.FinalityBranch[ii]) + } + } + for ii := 0; ii < len(l.FinalityBranch); ii++ { + if size := len(l.FinalityBranch[ii]); size > 32 { + err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32) + return + } + dst = append(dst, l.FinalityBranch[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateElectra object +func (l *LightClientFinalityUpdateElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 180 { + return ssz.ErrSize + } + + tail := buf + var o0, o1, o2 uint64 + + // Offset (0) 'AttestedHeader' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 180 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'FinalizedHeader' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Offset (2) 'FinalityBranch' + if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { + return ssz.ErrOffset + } + + // Field (3) 'SyncAggregate' + if l.SyncAggregate == nil { + l.SyncAggregate = new(SyncAggregate) + } + if err = l.SyncAggregate.UnmarshalSSZ(buf[12:172]); err != nil { + return err + } + + // Field (4) 'SignatureSlot' + l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[172:180])) + + // 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:o2] + if l.FinalizedHeader == nil { + l.FinalizedHeader = new(LightClientHeaderDeneb) + } + if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (2) 'FinalityBranch' + { + buf = tail[o2:] + num, err := ssz.DecodeDynamicLength(buf, 7) + if err != nil { + return err + } + l.FinalityBranch = make([][]byte, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if len(buf) > 32 { + return ssz.ErrBytesLength + } + if cap(l.FinalityBranch[indx]) == 0 { + l.FinalityBranch[indx] = make([]byte, 0, len(buf)) + } + l.FinalityBranch[indx] = append(l.FinalityBranch[indx], buf...) + return nil + }) + if err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateElectra object +func (l *LightClientFinalityUpdateElectra) SizeSSZ() (size int) { + size = 180 + + // 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() + + // Field (2) 'FinalityBranch' + for ii := 0; ii < len(l.FinalityBranch); ii++ { + size += 4 + size += len(l.FinalityBranch[ii]) + } + + return +} + +// HashTreeRoot ssz hashes the LightClientFinalityUpdateElectra object +func (l *LightClientFinalityUpdateElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(l) +} + +// HashTreeRootWith ssz hashes the LightClientFinalityUpdateElectra object with a hasher +func (l *LightClientFinalityUpdateElectra) 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' + { + subIndx := hh.Index() + num := uint64(len(l.FinalityBranch)) + if num > 7 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range l.FinalityBranch { + { + elemIndx := hh.Index() + byteLen := uint64(len(elem)) + if byteLen > 32 { + err = ssz.ErrIncorrectListSize + return + } + hh.AppendBytes32(elem) + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) + } + } + hh.MerkleizeWithMixin(subIndx, num, 7) + } + + // Field (3) 'SyncAggregate' + if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'SignatureSlot' + hh.PutUint64(uint64(l.SignatureSlot)) + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/light_client.pb.go b/proto/prysm/v1alpha1/light_client.pb.go index 34992141bc7..28747e52776 100755 --- a/proto/prysm/v1alpha1/light_client.pb.go +++ b/proto/prysm/v1alpha1/light_client.pb.go @@ -743,7 +743,7 @@ type LightClientUpdateElectra struct { NextSyncCommittee *SyncCommittee `protobuf:"bytes,2,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"` NextSyncCommitteeBranch [][]byte `protobuf:"bytes,3,rep,name=next_sync_committee_branch,json=nextSyncCommitteeBranch,proto3" json:"next_sync_committee_branch,omitempty" ssz-size:"6,32"` FinalizedHeader *LightClientHeaderDeneb `protobuf:"bytes,4,opt,name=finalized_header,json=finalizedHeader,proto3" json:"finalized_header,omitempty"` - FinalityBranch [][]byte `protobuf:"bytes,5,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-size:"6,32"` + FinalityBranch [][]byte `protobuf:"bytes,5,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-size:"7,32"` SyncAggregate *SyncAggregate `protobuf:"bytes,6,opt,name=sync_aggregate,json=syncAggregate,proto3" json:"sync_aggregate,omitempty"` SignatureSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,7,opt,name=signature_slot,json=signatureSlot,proto3" json:"signature_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` } @@ -1066,6 +1066,85 @@ func (x *LightClientFinalityUpdateDeneb) GetSignatureSlot() github_com_prysmatic return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(0) } +type LightClientFinalityUpdateElectra struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AttestedHeader *LightClientHeaderDeneb `protobuf:"bytes,1,opt,name=attested_header,json=attestedHeader,proto3" json:"attested_header,omitempty"` + FinalizedHeader *LightClientHeaderDeneb `protobuf:"bytes,2,opt,name=finalized_header,json=finalizedHeader,proto3" json:"finalized_header,omitempty"` + FinalityBranch [][]byte `protobuf:"bytes,3,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-max:"7,32"` + SyncAggregate *SyncAggregate `protobuf:"bytes,4,opt,name=sync_aggregate,json=syncAggregate,proto3" json:"sync_aggregate,omitempty"` + SignatureSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,5,opt,name=signature_slot,json=signatureSlot,proto3" json:"signature_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` +} + +func (x *LightClientFinalityUpdateElectra) Reset() { + *x = LightClientFinalityUpdateElectra{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LightClientFinalityUpdateElectra) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LightClientFinalityUpdateElectra) ProtoMessage() {} + +func (x *LightClientFinalityUpdateElectra) ProtoReflect() protoreflect.Message { + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LightClientFinalityUpdateElectra.ProtoReflect.Descriptor instead. +func (*LightClientFinalityUpdateElectra) Descriptor() ([]byte, []int) { + return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{14} +} + +func (x *LightClientFinalityUpdateElectra) GetAttestedHeader() *LightClientHeaderDeneb { + if x != nil { + return x.AttestedHeader + } + return nil +} + +func (x *LightClientFinalityUpdateElectra) GetFinalizedHeader() *LightClientHeaderDeneb { + if x != nil { + return x.FinalizedHeader + } + return nil +} + +func (x *LightClientFinalityUpdateElectra) GetFinalityBranch() [][]byte { + if x != nil { + return x.FinalityBranch + } + return nil +} + +func (x *LightClientFinalityUpdateElectra) GetSyncAggregate() *SyncAggregate { + if x != nil { + return x.SyncAggregate + } + return nil +} + +func (x *LightClientFinalityUpdateElectra) GetSignatureSlot() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot { + if x != nil { + return x.SignatureSlot + } + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(0) +} + type LightClientOptimisticUpdateAltair struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1079,7 +1158,7 @@ type LightClientOptimisticUpdateAltair struct { func (x *LightClientOptimisticUpdateAltair) Reset() { *x = LightClientOptimisticUpdateAltair{} if protoimpl.UnsafeEnabled { - mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[14] + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1092,7 +1171,7 @@ func (x *LightClientOptimisticUpdateAltair) String() string { func (*LightClientOptimisticUpdateAltair) ProtoMessage() {} func (x *LightClientOptimisticUpdateAltair) ProtoReflect() protoreflect.Message { - mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[14] + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1105,7 +1184,7 @@ func (x *LightClientOptimisticUpdateAltair) ProtoReflect() protoreflect.Message // Deprecated: Use LightClientOptimisticUpdateAltair.ProtoReflect.Descriptor instead. func (*LightClientOptimisticUpdateAltair) Descriptor() ([]byte, []int) { - return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{14} + return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{15} } func (x *LightClientOptimisticUpdateAltair) GetAttestedHeader() *LightClientHeaderAltair { @@ -1142,7 +1221,7 @@ type LightClientOptimisticUpdateCapella struct { func (x *LightClientOptimisticUpdateCapella) Reset() { *x = LightClientOptimisticUpdateCapella{} if protoimpl.UnsafeEnabled { - mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[15] + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1155,7 +1234,7 @@ func (x *LightClientOptimisticUpdateCapella) String() string { func (*LightClientOptimisticUpdateCapella) ProtoMessage() {} func (x *LightClientOptimisticUpdateCapella) ProtoReflect() protoreflect.Message { - mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[15] + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1168,7 +1247,7 @@ func (x *LightClientOptimisticUpdateCapella) ProtoReflect() protoreflect.Message // Deprecated: Use LightClientOptimisticUpdateCapella.ProtoReflect.Descriptor instead. func (*LightClientOptimisticUpdateCapella) Descriptor() ([]byte, []int) { - return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{15} + return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{16} } func (x *LightClientOptimisticUpdateCapella) GetAttestedHeader() *LightClientHeaderCapella { @@ -1205,7 +1284,7 @@ type LightClientOptimisticUpdateDeneb struct { func (x *LightClientOptimisticUpdateDeneb) Reset() { *x = LightClientOptimisticUpdateDeneb{} if protoimpl.UnsafeEnabled { - mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[16] + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1218,7 +1297,7 @@ func (x *LightClientOptimisticUpdateDeneb) String() string { func (*LightClientOptimisticUpdateDeneb) ProtoMessage() {} func (x *LightClientOptimisticUpdateDeneb) ProtoReflect() protoreflect.Message { - mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[16] + mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1231,7 +1310,7 @@ func (x *LightClientOptimisticUpdateDeneb) ProtoReflect() protoreflect.Message { // Deprecated: Use LightClientOptimisticUpdateDeneb.ProtoReflect.Descriptor instead. func (*LightClientOptimisticUpdateDeneb) Descriptor() ([]byte, []int) { - return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{16} + return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{17} } func (x *LightClientOptimisticUpdateDeneb) GetAttestedHeader() *LightClientHeaderDeneb { @@ -1511,7 +1590,7 @@ var file_proto_prysm_v1alpha1_light_client_proto_rawDesc = []byte{ 0x72, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x52, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0c, - 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x36, 0x2c, 0x33, 0x32, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, + 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x37, 0x2c, 0x33, 0x32, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, @@ -1609,76 +1688,104 @@ var file_proto_prysm_v1alpha1_light_client_proto_rawDesc = []byte{ 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0xb7, 0x02, 0x0a, 0x21, 0x4c, 0x69, 0x67, 0x68, - 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, - 0x63, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x74, 0x61, 0x69, 0x72, 0x12, 0x57, 0x0a, - 0x0f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, - 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x41, 0x6c, 0x74, 0x61, 0x69, 0x72, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x75, 0x72, 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0xc2, 0x03, 0x0a, 0x20, 0x4c, 0x69, 0x67, 0x68, + 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x12, 0x56, 0x0a, 0x0f, + 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, + 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, + 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x44, + 0x65, 0x6e, 0x65, 0x62, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x10, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, + 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x12, 0x6c, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, - 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, - 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, - 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, - 0x6f, 0x74, 0x52, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x6c, 0x6f, - 0x74, 0x22, 0xb9, 0x02, 0x0a, 0x22, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x43, 0x61, 0x70, 0x65, 0x6c, 0x6c, 0x61, 0x12, 0x58, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x65, - 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x61, 0x70, 0x65, 0x6c, - 0x6c, 0x61, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, - 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, - 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, - 0x6c, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6c, 0x6f, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, - 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, - 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, - 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0d, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0xb5, 0x02, - 0x0a, 0x20, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4f, 0x70, 0x74, - 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x6e, - 0x65, 0x62, 0x12, 0x56, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x74, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x52, 0x0f, 0x66, + 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, + 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, + 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x92, 0xb5, 0x18, 0x04, 0x37, 0x2c, 0x33, + 0x32, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, + 0x68, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, + 0x0d, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x6c, + 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6c, 0x6f, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, + 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, + 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, + 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0d, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0xb7, 0x02, 0x0a, + 0x21, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4f, 0x70, 0x74, 0x69, + 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x74, 0x61, + 0x69, 0x72, 0x12, 0x57, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x65, - 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, - 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, - 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x6c, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, - 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, - 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, - 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, - 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x42, 0x99, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x42, 0x10, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, - 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, - 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, - 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, - 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x41, 0x6c, 0x74, 0x61, 0x69, 0x72, 0x52, 0x0e, 0x61, 0x74, 0x74, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0e, 0x73, + 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, + 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, + 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x63, 0x41, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x6c, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, + 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, + 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, + 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x22, 0xb9, 0x02, 0x0a, 0x22, 0x4c, 0x69, 0x67, 0x68, 0x74, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x70, 0x65, 0x6c, 0x6c, 0x61, 0x12, 0x58, 0x0a, + 0x0f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x43, 0x61, 0x70, 0x65, 0x6c, 0x6c, 0x61, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, + 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x12, 0x6c, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, + 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, + 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, + 0x6c, 0x6f, 0x74, 0x52, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x6c, + 0x6f, 0x74, 0x22, 0xb5, 0x02, 0x0a, 0x20, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x73, 0x74, 0x69, 0x63, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x12, 0x56, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x65, 0x73, + 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x52, + 0x0e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x4b, 0x0a, 0x0e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x53, 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, + 0x79, 0x6e, 0x63, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x12, 0x6c, 0x0a, 0x0e, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, + 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, + 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, + 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0d, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x6c, 0x6f, 0x74, 0x42, 0x99, 0x01, 0x0a, 0x19, 0x6f, + 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, + 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, + 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1693,7 +1800,7 @@ func file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP() []byte { return file_proto_prysm_v1alpha1_light_client_proto_rawDescData } -var file_proto_prysm_v1alpha1_light_client_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_proto_prysm_v1alpha1_light_client_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_proto_prysm_v1alpha1_light_client_proto_goTypes = []interface{}{ (*LightClientHeaderAltair)(nil), // 0: ethereum.eth.v1alpha1.LightClientHeaderAltair (*LightClientHeaderCapella)(nil), // 1: ethereum.eth.v1alpha1.LightClientHeaderCapella @@ -1709,65 +1816,69 @@ var file_proto_prysm_v1alpha1_light_client_proto_goTypes = []interface{}{ (*LightClientFinalityUpdateAltair)(nil), // 11: ethereum.eth.v1alpha1.LightClientFinalityUpdateAltair (*LightClientFinalityUpdateCapella)(nil), // 12: ethereum.eth.v1alpha1.LightClientFinalityUpdateCapella (*LightClientFinalityUpdateDeneb)(nil), // 13: ethereum.eth.v1alpha1.LightClientFinalityUpdateDeneb - (*LightClientOptimisticUpdateAltair)(nil), // 14: ethereum.eth.v1alpha1.LightClientOptimisticUpdateAltair - (*LightClientOptimisticUpdateCapella)(nil), // 15: ethereum.eth.v1alpha1.LightClientOptimisticUpdateCapella - (*LightClientOptimisticUpdateDeneb)(nil), // 16: ethereum.eth.v1alpha1.LightClientOptimisticUpdateDeneb - (*BeaconBlockHeader)(nil), // 17: ethereum.eth.v1alpha1.BeaconBlockHeader - (*v1.ExecutionPayloadHeaderCapella)(nil), // 18: ethereum.engine.v1.ExecutionPayloadHeaderCapella - (*v1.ExecutionPayloadHeaderDeneb)(nil), // 19: ethereum.engine.v1.ExecutionPayloadHeaderDeneb - (*SyncCommittee)(nil), // 20: ethereum.eth.v1alpha1.SyncCommittee - (*SyncAggregate)(nil), // 21: ethereum.eth.v1alpha1.SyncAggregate + (*LightClientFinalityUpdateElectra)(nil), // 14: ethereum.eth.v1alpha1.LightClientFinalityUpdateElectra + (*LightClientOptimisticUpdateAltair)(nil), // 15: ethereum.eth.v1alpha1.LightClientOptimisticUpdateAltair + (*LightClientOptimisticUpdateCapella)(nil), // 16: ethereum.eth.v1alpha1.LightClientOptimisticUpdateCapella + (*LightClientOptimisticUpdateDeneb)(nil), // 17: ethereum.eth.v1alpha1.LightClientOptimisticUpdateDeneb + (*BeaconBlockHeader)(nil), // 18: ethereum.eth.v1alpha1.BeaconBlockHeader + (*v1.ExecutionPayloadHeaderCapella)(nil), // 19: ethereum.engine.v1.ExecutionPayloadHeaderCapella + (*v1.ExecutionPayloadHeaderDeneb)(nil), // 20: ethereum.engine.v1.ExecutionPayloadHeaderDeneb + (*SyncCommittee)(nil), // 21: ethereum.eth.v1alpha1.SyncCommittee + (*SyncAggregate)(nil), // 22: ethereum.eth.v1alpha1.SyncAggregate } var file_proto_prysm_v1alpha1_light_client_proto_depIdxs = []int32{ - 17, // 0: ethereum.eth.v1alpha1.LightClientHeaderAltair.beacon:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader - 17, // 1: ethereum.eth.v1alpha1.LightClientHeaderCapella.beacon:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader - 18, // 2: ethereum.eth.v1alpha1.LightClientHeaderCapella.execution:type_name -> ethereum.engine.v1.ExecutionPayloadHeaderCapella - 17, // 3: ethereum.eth.v1alpha1.LightClientHeaderDeneb.beacon:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader - 19, // 4: ethereum.eth.v1alpha1.LightClientHeaderDeneb.execution:type_name -> ethereum.engine.v1.ExecutionPayloadHeaderDeneb + 18, // 0: ethereum.eth.v1alpha1.LightClientHeaderAltair.beacon:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader + 18, // 1: ethereum.eth.v1alpha1.LightClientHeaderCapella.beacon:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader + 19, // 2: ethereum.eth.v1alpha1.LightClientHeaderCapella.execution:type_name -> ethereum.engine.v1.ExecutionPayloadHeaderCapella + 18, // 3: ethereum.eth.v1alpha1.LightClientHeaderDeneb.beacon:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader + 20, // 4: ethereum.eth.v1alpha1.LightClientHeaderDeneb.execution:type_name -> ethereum.engine.v1.ExecutionPayloadHeaderDeneb 0, // 5: ethereum.eth.v1alpha1.LightClientBootstrapAltair.header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair - 20, // 6: ethereum.eth.v1alpha1.LightClientBootstrapAltair.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 6: ethereum.eth.v1alpha1.LightClientBootstrapAltair.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 1, // 7: ethereum.eth.v1alpha1.LightClientBootstrapCapella.header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella - 20, // 8: ethereum.eth.v1alpha1.LightClientBootstrapCapella.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 8: ethereum.eth.v1alpha1.LightClientBootstrapCapella.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 2, // 9: ethereum.eth.v1alpha1.LightClientBootstrapDeneb.header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 20, // 10: ethereum.eth.v1alpha1.LightClientBootstrapDeneb.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 10: ethereum.eth.v1alpha1.LightClientBootstrapDeneb.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 2, // 11: ethereum.eth.v1alpha1.LightClientBootstrapElectra.header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 20, // 12: ethereum.eth.v1alpha1.LightClientBootstrapElectra.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 12: ethereum.eth.v1alpha1.LightClientBootstrapElectra.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 0, // 13: ethereum.eth.v1alpha1.LightClientUpdateAltair.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair - 20, // 14: ethereum.eth.v1alpha1.LightClientUpdateAltair.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 14: ethereum.eth.v1alpha1.LightClientUpdateAltair.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 0, // 15: ethereum.eth.v1alpha1.LightClientUpdateAltair.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair - 21, // 16: ethereum.eth.v1alpha1.LightClientUpdateAltair.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 22, // 16: ethereum.eth.v1alpha1.LightClientUpdateAltair.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate 1, // 17: ethereum.eth.v1alpha1.LightClientUpdateCapella.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella - 20, // 18: ethereum.eth.v1alpha1.LightClientUpdateCapella.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 18: ethereum.eth.v1alpha1.LightClientUpdateCapella.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 1, // 19: ethereum.eth.v1alpha1.LightClientUpdateCapella.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella - 21, // 20: ethereum.eth.v1alpha1.LightClientUpdateCapella.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 22, // 20: ethereum.eth.v1alpha1.LightClientUpdateCapella.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate 2, // 21: ethereum.eth.v1alpha1.LightClientUpdateDeneb.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 20, // 22: ethereum.eth.v1alpha1.LightClientUpdateDeneb.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 22: ethereum.eth.v1alpha1.LightClientUpdateDeneb.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 2, // 23: ethereum.eth.v1alpha1.LightClientUpdateDeneb.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 21, // 24: ethereum.eth.v1alpha1.LightClientUpdateDeneb.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 22, // 24: ethereum.eth.v1alpha1.LightClientUpdateDeneb.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate 2, // 25: ethereum.eth.v1alpha1.LightClientUpdateElectra.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 20, // 26: ethereum.eth.v1alpha1.LightClientUpdateElectra.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee + 21, // 26: ethereum.eth.v1alpha1.LightClientUpdateElectra.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee 2, // 27: ethereum.eth.v1alpha1.LightClientUpdateElectra.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 21, // 28: ethereum.eth.v1alpha1.LightClientUpdateElectra.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 22, // 28: ethereum.eth.v1alpha1.LightClientUpdateElectra.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate 0, // 29: ethereum.eth.v1alpha1.LightClientFinalityUpdateAltair.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair 0, // 30: ethereum.eth.v1alpha1.LightClientFinalityUpdateAltair.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair - 21, // 31: ethereum.eth.v1alpha1.LightClientFinalityUpdateAltair.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 22, // 31: ethereum.eth.v1alpha1.LightClientFinalityUpdateAltair.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate 1, // 32: ethereum.eth.v1alpha1.LightClientFinalityUpdateCapella.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella 1, // 33: ethereum.eth.v1alpha1.LightClientFinalityUpdateCapella.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella - 21, // 34: ethereum.eth.v1alpha1.LightClientFinalityUpdateCapella.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 22, // 34: ethereum.eth.v1alpha1.LightClientFinalityUpdateCapella.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate 2, // 35: ethereum.eth.v1alpha1.LightClientFinalityUpdateDeneb.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb 2, // 36: ethereum.eth.v1alpha1.LightClientFinalityUpdateDeneb.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 21, // 37: ethereum.eth.v1alpha1.LightClientFinalityUpdateDeneb.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate - 0, // 38: ethereum.eth.v1alpha1.LightClientOptimisticUpdateAltair.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair - 21, // 39: ethereum.eth.v1alpha1.LightClientOptimisticUpdateAltair.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate - 1, // 40: ethereum.eth.v1alpha1.LightClientOptimisticUpdateCapella.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella - 21, // 41: ethereum.eth.v1alpha1.LightClientOptimisticUpdateCapella.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate - 2, // 42: ethereum.eth.v1alpha1.LightClientOptimisticUpdateDeneb.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb - 21, // 43: ethereum.eth.v1alpha1.LightClientOptimisticUpdateDeneb.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate - 44, // [44:44] is the sub-list for method output_type - 44, // [44:44] is the sub-list for method input_type - 44, // [44:44] is the sub-list for extension type_name - 44, // [44:44] is the sub-list for extension extendee - 0, // [0:44] is the sub-list for field type_name + 22, // 37: ethereum.eth.v1alpha1.LightClientFinalityUpdateDeneb.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 2, // 38: ethereum.eth.v1alpha1.LightClientFinalityUpdateElectra.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb + 2, // 39: ethereum.eth.v1alpha1.LightClientFinalityUpdateElectra.finalized_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb + 22, // 40: ethereum.eth.v1alpha1.LightClientFinalityUpdateElectra.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 0, // 41: ethereum.eth.v1alpha1.LightClientOptimisticUpdateAltair.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderAltair + 22, // 42: ethereum.eth.v1alpha1.LightClientOptimisticUpdateAltair.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 1, // 43: ethereum.eth.v1alpha1.LightClientOptimisticUpdateCapella.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderCapella + 22, // 44: ethereum.eth.v1alpha1.LightClientOptimisticUpdateCapella.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 2, // 45: ethereum.eth.v1alpha1.LightClientOptimisticUpdateDeneb.attested_header:type_name -> ethereum.eth.v1alpha1.LightClientHeaderDeneb + 22, // 46: ethereum.eth.v1alpha1.LightClientOptimisticUpdateDeneb.sync_aggregate:type_name -> ethereum.eth.v1alpha1.SyncAggregate + 47, // [47:47] is the sub-list for method output_type + 47, // [47:47] is the sub-list for method input_type + 47, // [47:47] is the sub-list for extension type_name + 47, // [47:47] is the sub-list for extension extendee + 0, // [0:47] is the sub-list for field type_name } func init() { file_proto_prysm_v1alpha1_light_client_proto_init() } @@ -1947,7 +2058,7 @@ func file_proto_prysm_v1alpha1_light_client_proto_init() { } } file_proto_prysm_v1alpha1_light_client_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LightClientOptimisticUpdateAltair); i { + switch v := v.(*LightClientFinalityUpdateElectra); i { case 0: return &v.state case 1: @@ -1959,7 +2070,7 @@ func file_proto_prysm_v1alpha1_light_client_proto_init() { } } file_proto_prysm_v1alpha1_light_client_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LightClientOptimisticUpdateCapella); i { + switch v := v.(*LightClientOptimisticUpdateAltair); i { case 0: return &v.state case 1: @@ -1971,6 +2082,18 @@ func file_proto_prysm_v1alpha1_light_client_proto_init() { } } file_proto_prysm_v1alpha1_light_client_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LightClientOptimisticUpdateCapella); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_prysm_v1alpha1_light_client_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LightClientOptimisticUpdateDeneb); i { case 0: return &v.state @@ -1989,7 +2112,7 @@ func file_proto_prysm_v1alpha1_light_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_prysm_v1alpha1_light_client_proto_rawDesc, NumEnums: 0, - NumMessages: 17, + NumMessages: 18, NumExtensions: 0, NumServices: 0, }, From 3aa75e2ba5214f123c44bbe714a3c11f707c7f45 Mon Sep 17 00:00:00 2001 From: rkapka Date: Fri, 1 Nov 2024 17:19:10 +0700 Subject: [PATCH 3/4] trixy's review --- api/server/structs/conversions_lightclient.go | 4 +- beacon-chain/core/light-client/lightclient.go | 8 +-- beacon-chain/db/kv/lightclient_test.go | 56 ++++++++++++++----- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/api/server/structs/conversions_lightclient.go b/api/server/structs/conversions_lightclient.go index 48d0a5167a1..2fc3d70e0c2 100644 --- a/api/server/structs/conversions_lightclient.go +++ b/api/server/structs/conversions_lightclient.go @@ -35,11 +35,11 @@ func LightClientUpdateFromConsensus(update interfaces.LightClientUpdate) (*Light } finalityBranch = fb[:] } else { - b, err := update.NextSyncCommitteeBranch() + scb, err := update.NextSyncCommitteeBranch() if err != nil { return nil, err } - scBranch = b[:] + scBranch = scb[:] fb, err := update.FinalityBranch() if err != nil { return nil, err diff --git a/beacon-chain/core/light-client/lightclient.go b/beacon-chain/core/light-client/lightclient.go index d59c86a1cc1..c009fc5a5a9 100644 --- a/beacon-chain/core/light-client/lightclient.go +++ b/beacon-chain/core/light-client/lightclient.go @@ -155,7 +155,7 @@ func NewLightClientUpdateFromBeaconState( updateAttestedPeriod := slots.SyncCommitteePeriod(slots.ToEpoch(attestedBlock.Block().Slot())) // update = LightClientUpdate() - result, err := CreateDefaultLightClientUpdate(currentSlot, attestedBlock) + result, err := CreateDefaultLightClientUpdate(currentSlot, attestedState) if err != nil { return nil, errors.Wrap(err, "could not create default light client update") } @@ -239,7 +239,7 @@ func NewLightClientUpdateFromBeaconState( return result, nil } -func CreateDefaultLightClientUpdate(currentSlot primitives.Slot, attestedBlock interfaces.ReadOnlySignedBeaconBlock) (interfaces.LightClientUpdate, error) { +func CreateDefaultLightClientUpdate(currentSlot primitives.Slot, attestedState state.BeaconState) (interfaces.LightClientUpdate, error) { currentEpoch := slots.ToEpoch(currentSlot) syncCommitteeSize := params.BeaconConfig().SyncCommitteeSize @@ -268,7 +268,7 @@ func CreateDefaultLightClientUpdate(currentSlot primitives.Slot, attestedBlock i } var finalityBranch [][]byte - if attestedBlock.Version() >= version.Electra { + if attestedState.Version() >= version.Electra { finalityBranch = make([][]byte, fieldparams.FinalityBranchDepthElectra) } else { finalityBranch = make([][]byte, fieldparams.FinalityBranchDepth) @@ -310,7 +310,7 @@ func CreateDefaultLightClientUpdate(currentSlot primitives.Slot, attestedBlock i FinalityBranch: finalityBranch, } } else { - if attestedBlock.Version() >= version.Electra { + if attestedState.Version() >= version.Electra { m = &pb.LightClientUpdateElectra{ AttestedHeader: &pb.LightClientHeaderDeneb{ Beacon: &pb.BeaconBlockHeader{}, diff --git a/beacon-chain/db/kv/lightclient_test.go b/beacon-chain/db/kv/lightclient_test.go index fc20d8c27a0..6ba5a5cd8b2 100644 --- a/beacon-chain/db/kv/lightclient_test.go +++ b/beacon-chain/db/kv/lightclient_test.go @@ -6,6 +6,7 @@ import ( "math/rand" "testing" + "github.com/prysmaticlabs/prysm/v5/beacon-chain/state" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" @@ -15,6 +16,7 @@ import ( pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/testing/require" + "github.com/prysmaticlabs/prysm/v5/testing/util" "github.com/prysmaticlabs/prysm/v5/time/slots" "google.golang.org/protobuf/proto" ) @@ -23,6 +25,7 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { config := params.BeaconConfig() var slot primitives.Slot var header interfaces.LightClientHeader + var st state.BeaconState var err error sampleRoot := make([]byte, 32) @@ -51,6 +54,8 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { }, }) require.NoError(t, err) + st, err = util.NewBeaconState() + require.NoError(t, err) case version.Capella: slot = primitives.Slot(config.CapellaForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) header, err = light_client.NewWrappedHeader(&pb.LightClientHeaderCapella{ @@ -77,6 +82,8 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { ExecutionBranch: sampleExecutionBranch, }) require.NoError(t, err) + st, err = util.NewBeaconStateCapella() + require.NoError(t, err) case version.Deneb: slot = primitives.Slot(config.DenebForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) header, err = light_client.NewWrappedHeader(&pb.LightClientHeaderDeneb{ @@ -103,6 +110,8 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { ExecutionBranch: sampleExecutionBranch, }) require.NoError(t, err) + st, err = util.NewBeaconStateDeneb() + require.NoError(t, err) case version.Electra: slot = primitives.Slot(config.ElectraForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) header, err = light_client.NewWrappedHeader(&pb.LightClientHeaderDeneb{ @@ -129,11 +138,13 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { ExecutionBranch: sampleExecutionBranch, }) require.NoError(t, err) + st, err = util.NewBeaconStateElectra() + require.NoError(t, err) default: return nil, fmt.Errorf("unsupported version %s", version.String(v)) } - update, err := createDefaultLightClientUpdate(slot) + update, err := createDefaultLightClientUpdate(slot, st) require.NoError(t, err) update.SetSignatureSlot(slot - 1) syncCommitteeBits := make([]byte, 64) @@ -430,7 +441,7 @@ func TestStore_LightClientUpdate_RetrieveMissingPeriodDistributed(t *testing.T) require.DeepEqual(t, updates[4], retrievedUpdates[uint64(5)], "retrieved update does not match saved update") } -func createDefaultLightClientUpdate(currentSlot primitives.Slot) (interfaces.LightClientUpdate, error) { +func createDefaultLightClientUpdate(currentSlot primitives.Slot, attestedState state.BeaconState) (interfaces.LightClientUpdate, error) { currentEpoch := slots.ToEpoch(currentSlot) syncCommitteeSize := params.BeaconConfig().SyncCommitteeSize @@ -457,8 +468,14 @@ func createDefaultLightClientUpdate(currentSlot primitives.Slot) (interfaces.Lig for i := 0; i < fieldparams.ExecutionBranchDepth; i++ { executionBranch[i] = make([]byte, 32) } - finalityBranch := make([][]byte, fieldparams.FinalityBranchDepth) - for i := 0; i < fieldparams.FinalityBranchDepth; i++ { + + var finalityBranch [][]byte + if attestedState.Version() >= version.Electra { + finalityBranch = make([][]byte, fieldparams.FinalityBranchDepthElectra) + } else { + finalityBranch = make([][]byte, fieldparams.FinalityBranchDepth) + } + for i := 0; i < len(finalityBranch); i++ { finalityBranch[i] = make([]byte, 32) } @@ -493,15 +510,28 @@ func createDefaultLightClientUpdate(currentSlot primitives.Slot) (interfaces.Lig FinalityBranch: finalityBranch, } } else { - m = &pb.LightClientUpdateElectra{ - AttestedHeader: &pb.LightClientHeaderDeneb{ - Beacon: &pb.BeaconBlockHeader{}, - Execution: &enginev1.ExecutionPayloadHeaderDeneb{}, - ExecutionBranch: executionBranch, - }, - NextSyncCommittee: nextSyncCommittee, - NextSyncCommitteeBranch: nextSyncCommitteeBranch, - FinalityBranch: finalityBranch, + if attestedState.Version() >= version.Electra { + m = &pb.LightClientUpdateElectra{ + AttestedHeader: &pb.LightClientHeaderDeneb{ + Beacon: &pb.BeaconBlockHeader{}, + Execution: &enginev1.ExecutionPayloadHeaderDeneb{}, + ExecutionBranch: executionBranch, + }, + NextSyncCommittee: nextSyncCommittee, + NextSyncCommitteeBranch: nextSyncCommitteeBranch, + FinalityBranch: finalityBranch, + } + } else { + m = &pb.LightClientUpdateDeneb{ + AttestedHeader: &pb.LightClientHeaderDeneb{ + Beacon: &pb.BeaconBlockHeader{}, + Execution: &enginev1.ExecutionPayloadHeaderDeneb{}, + ExecutionBranch: executionBranch, + }, + NextSyncCommittee: nextSyncCommittee, + NextSyncCommitteeBranch: nextSyncCommitteeBranch, + FinalityBranch: finalityBranch, + } } } From 8248f668510b6dbf42df2b865f2e78daa8966126 Mon Sep 17 00:00:00 2001 From: rkapka Date: Sat, 2 Nov 2024 18:51:47 +0700 Subject: [PATCH 4/4] test fixes --- .../core/light-client/lightclient_test.go | 46 +++++---- beacon-chain/db/kv/lightclient_test.go | 96 ++++++++++--------- .../rpc/eth/light-client/handlers_test.go | 11 ++- .../rpc/eth/light-client/helpers_test.go | 69 ++++++------- config/fieldparams/minimal.go | 1 + 5 files changed, 121 insertions(+), 102 deletions(-) diff --git a/beacon-chain/core/light-client/lightclient_test.go b/beacon-chain/core/light-client/lightclient_test.go index 7d787b1cb52..e26a4d2f7da 100644 --- a/beacon-chain/core/light-client/lightclient_test.go +++ b/beacon-chain/core/light-client/lightclient_test.go @@ -82,12 +82,12 @@ func TestLightClient_NewLightClientFinalityUpdateFromBeaconState(t *testing.T) { require.DeepSSZEqual(t, finalizedBlockHeader.Header.ParentRoot, updateFinalizedHeaderBeacon.ParentRoot, "Finalized header parent root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.StateRoot, updateFinalizedHeaderBeacon.StateRoot, "Finalized header state root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.BodyRoot, updateFinalizedHeaderBeacon.BodyRoot, "Finalized header body root is not equal") - require.Equal(t, lightClient.FinalityBranchNumOfLeaves, len(update.FinalityBranch()), "Invalid finality branch leaves") - - finalityBranch, err := l.AttestedState.FinalizedRootProof(l.Ctx) + fb, err := update.FinalityBranch() + require.NoError(t, err) + proof, err := l.AttestedState.FinalizedRootProof(l.Ctx) require.NoError(t, err) - for i, leaf := range update.FinalityBranch() { - require.DeepSSZEqual(t, finalityBranch[i], leaf[:], "Leaf is not equal") + for i, leaf := range fb { + require.DeepSSZEqual(t, proof[i], leaf[:], "Leaf is not equal") } }) }) @@ -115,11 +115,12 @@ func TestLightClient_NewLightClientFinalityUpdateFromBeaconState(t *testing.T) { require.DeepSSZEqual(t, finalizedBlockHeader.Header.ParentRoot, updateFinalizedHeaderBeacon.ParentRoot, "Finalized header parent root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.StateRoot, updateFinalizedHeaderBeacon.StateRoot, "Finalized header state root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.BodyRoot, updateFinalizedHeaderBeacon.BodyRoot, "Finalized header body root is not equal") - require.Equal(t, lightClient.FinalityBranchNumOfLeaves, len(update.FinalityBranch()), "Invalid finality branch leaves") - finalityBranch, err := l.AttestedState.FinalizedRootProof(l.Ctx) + fb, err := update.FinalityBranch() + require.NoError(t, err) + proof, err := l.AttestedState.FinalizedRootProof(l.Ctx) require.NoError(t, err) - for i, leaf := range update.FinalityBranch() { - require.DeepSSZEqual(t, finalityBranch[i], leaf[:], "Leaf is not equal") + for i, leaf := range fb { + require.DeepSSZEqual(t, proof[i], leaf[:], "Leaf is not equal") } // Check Execution BlockHash @@ -188,11 +189,12 @@ func TestLightClient_NewLightClientFinalityUpdateFromBeaconState(t *testing.T) { require.DeepSSZEqual(t, finalizedBlockHeader.Header.ParentRoot, updateFinalizedHeaderBeacon.ParentRoot, "Finalized header parent root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.StateRoot, updateFinalizedHeaderBeacon.StateRoot, "Finalized header state root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.BodyRoot, updateFinalizedHeaderBeacon.BodyRoot, "Finalized header body root is not equal") - require.Equal(t, lightClient.FinalityBranchNumOfLeaves, len(update.FinalityBranch()), "Invalid finality branch leaves") - finalityBranch, err := l.AttestedState.FinalizedRootProof(l.Ctx) + fb, err := update.FinalityBranch() require.NoError(t, err) - for i, leaf := range update.FinalityBranch() { - require.DeepSSZEqual(t, finalityBranch[i], leaf[:], "Leaf is not equal") + proof, err := l.AttestedState.FinalizedRootProof(l.Ctx) + require.NoError(t, err) + for i, leaf := range fb { + require.DeepSSZEqual(t, proof[i], leaf[:], "Leaf is not equal") } }) }) @@ -221,11 +223,12 @@ func TestLightClient_NewLightClientFinalityUpdateFromBeaconState(t *testing.T) { require.DeepSSZEqual(t, finalizedBlockHeader.Header.ParentRoot, updateFinalizedHeaderBeacon.ParentRoot, "Finalized header parent root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.StateRoot, updateFinalizedHeaderBeacon.StateRoot, "Finalized header state root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.BodyRoot, updateFinalizedHeaderBeacon.BodyRoot, "Finalized header body root is not equal") - require.Equal(t, lightClient.FinalityBranchNumOfLeaves, len(update.FinalityBranch()), "Invalid finality branch leaves") - finalityBranch, err := l.AttestedState.FinalizedRootProof(l.Ctx) + fb, err := update.FinalityBranch() + require.NoError(t, err) + proof, err := l.AttestedState.FinalizedRootProof(l.Ctx) require.NoError(t, err) - for i, leaf := range update.FinalityBranch() { - require.DeepSSZEqual(t, finalityBranch[i], leaf[:], "Leaf is not equal") + for i, leaf := range fb { + require.DeepSSZEqual(t, proof[i], leaf[:], "Leaf is not equal") } // Check Execution BlockHash @@ -295,11 +298,12 @@ func TestLightClient_NewLightClientFinalityUpdateFromBeaconState(t *testing.T) { require.DeepSSZEqual(t, finalizedBlockHeader.Header.ParentRoot, updateFinalizedHeaderBeacon.ParentRoot, "Finalized header parent root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.StateRoot, updateFinalizedHeaderBeacon.StateRoot, "Finalized header state root is not equal") require.DeepSSZEqual(t, finalizedBlockHeader.Header.BodyRoot, updateFinalizedHeaderBeacon.BodyRoot, "Finalized header body root is not equal") - require.Equal(t, lightClient.FinalityBranchNumOfLeaves, len(update.FinalityBranch()), "Invalid finality branch leaves") - finalityBranch, err := l.AttestedState.FinalizedRootProof(l.Ctx) + fb, err := update.FinalityBranch() + require.NoError(t, err) + proof, err := l.AttestedState.FinalizedRootProof(l.Ctx) require.NoError(t, err) - for i, leaf := range update.FinalityBranch() { - require.DeepSSZEqual(t, finalityBranch[i], leaf[:], "Leaf is not equal") + for i, leaf := range fb { + require.DeepSSZEqual(t, proof[i], leaf[:], "Leaf is not equal") } // Check Execution BlockHash diff --git a/beacon-chain/db/kv/lightclient_test.go b/beacon-chain/db/kv/lightclient_test.go index 6ba5a5cd8b2..fc7b6cbeef2 100644 --- a/beacon-chain/db/kv/lightclient_test.go +++ b/beacon-chain/db/kv/lightclient_test.go @@ -160,61 +160,63 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { return update, nil } -func TestStore_LightClientUpdate_CanSaveRetrieveAltair(t *testing.T) { - db := setupDB(t) - ctx := context.Background() - update, err := createUpdate(t, version.Altair) - require.NoError(t, err) - period := uint64(1) +func TestStore_LightClientUpdate_CanSaveRetrieve(t *testing.T) { + params.SetupTestConfigCleanup(t) + cfg := params.BeaconConfig() + cfg.AltairForkEpoch = 0 + cfg.CapellaForkEpoch = 1 + cfg.DenebForkEpoch = 2 + cfg.ElectraForkEpoch = 3 + params.OverrideBeaconConfig(cfg) - err = db.SaveLightClientUpdate(ctx, period, update) - require.NoError(t, err) - - retrievedUpdate, err := db.LightClientUpdate(ctx, period) - require.NoError(t, err) - require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") -} - -func TestStore_LightClientUpdate_CanSaveRetrieveCapella(t *testing.T) { db := setupDB(t) ctx := context.Background() - update, err := createUpdate(t, version.Capella) - require.NoError(t, err) - period := uint64(1) - err = db.SaveLightClientUpdate(ctx, period, update) - require.NoError(t, err) - retrievedUpdate, err := db.LightClientUpdate(ctx, period) - require.NoError(t, err) - require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") -} + t.Run("Altair", func(t *testing.T) { + update, err := createUpdate(t, version.Altair) + require.NoError(t, err) + period := uint64(1) -func TestStore_LightClientUpdate_CanSaveRetrieveDeneb(t *testing.T) { - db := setupDB(t) - ctx := context.Background() - update, err := createUpdate(t, version.Deneb) - require.NoError(t, err) - period := uint64(1) - err = db.SaveLightClientUpdate(ctx, period, update) - require.NoError(t, err) + err = db.SaveLightClientUpdate(ctx, period, update) + require.NoError(t, err) - retrievedUpdate, err := db.LightClientUpdate(ctx, period) - require.NoError(t, err) - require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") -} + retrievedUpdate, err := db.LightClientUpdate(ctx, period) + require.NoError(t, err) + require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") + }) + t.Run("Capella", func(t *testing.T) { + update, err := createUpdate(t, version.Capella) + require.NoError(t, err) + period := uint64(1) + err = db.SaveLightClientUpdate(ctx, period, update) + require.NoError(t, err) -func TestStore_LightClientUpdate_CanSaveRetrieveElectra(t *testing.T) { - db := setupDB(t) - ctx := context.Background() - update, err := createUpdate(t, version.Electra) - require.NoError(t, err) - period := uint64(1) - err = db.SaveLightClientUpdate(ctx, period, update) - require.NoError(t, err) + retrievedUpdate, err := db.LightClientUpdate(ctx, period) + require.NoError(t, err) + require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") + }) + t.Run("Deneb", func(t *testing.T) { + update, err := createUpdate(t, version.Deneb) + require.NoError(t, err) + period := uint64(1) + err = db.SaveLightClientUpdate(ctx, period, update) + require.NoError(t, err) - retrievedUpdate, err := db.LightClientUpdate(ctx, period) - require.NoError(t, err) - require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") + retrievedUpdate, err := db.LightClientUpdate(ctx, period) + require.NoError(t, err) + require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") + }) + t.Run("Electra", func(t *testing.T) { + update, err := createUpdate(t, version.Electra) + require.NoError(t, err) + period := uint64(1) + err = db.SaveLightClientUpdate(ctx, period, update) + require.NoError(t, err) + + retrievedUpdate, err := db.LightClientUpdate(ctx, period) + require.NoError(t, err) + require.DeepEqual(t, update, retrievedUpdate, "retrieved update does not match saved update") + }) } func TestStore_LightClientUpdates_canRetrieveRange(t *testing.T) { diff --git a/beacon-chain/rpc/eth/light-client/handlers_test.go b/beacon-chain/rpc/eth/light-client/handlers_test.go index 449daa20ec9..0e91f38e403 100644 --- a/beacon-chain/rpc/eth/light-client/handlers_test.go +++ b/beacon-chain/rpc/eth/light-client/handlers_test.go @@ -1881,6 +1881,7 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { config := params.BeaconConfig() var slot primitives.Slot var header interfaces.LightClientHeader + var st state.BeaconState var err error sampleRoot := make([]byte, 32) @@ -1909,6 +1910,8 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { }, }) require.NoError(t, err) + st, err = util.NewBeaconStateAltair() + require.NoError(t, err) case version.Capella: slot = primitives.Slot(config.CapellaForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) header, err = light_client.NewWrappedHeader(&pb.LightClientHeaderCapella{ @@ -1935,6 +1938,8 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { ExecutionBranch: sampleExecutionBranch, }) require.NoError(t, err) + st, err = util.NewBeaconStateCapella() + require.NoError(t, err) case version.Deneb: slot = primitives.Slot(config.DenebForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) header, err = light_client.NewWrappedHeader(&pb.LightClientHeaderDeneb{ @@ -1961,6 +1966,8 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { ExecutionBranch: sampleExecutionBranch, }) require.NoError(t, err) + st, err = util.NewBeaconStateDeneb() + require.NoError(t, err) case version.Electra: slot = primitives.Slot(config.ElectraForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1) header, err = light_client.NewWrappedHeader(&pb.LightClientHeaderDeneb{ @@ -1987,11 +1994,13 @@ func createUpdate(t *testing.T, v int) (interfaces.LightClientUpdate, error) { ExecutionBranch: sampleExecutionBranch, }) require.NoError(t, err) + st, err = util.NewBeaconStateElectra() + require.NoError(t, err) default: return nil, fmt.Errorf("unsupported version %s", version.String(v)) } - update, err := lightclient.CreateDefaultLightClientUpdate(slot) + update, err := lightclient.CreateDefaultLightClientUpdate(slot, st) require.NoError(t, err) update.SetSignatureSlot(slot - 1) syncCommitteeBits := make([]byte, 64) diff --git a/beacon-chain/rpc/eth/light-client/helpers_test.go b/beacon-chain/rpc/eth/light-client/helpers_test.go index 62594af80c3..e5ac6e11ce6 100644 --- a/beacon-chain/rpc/eth/light-client/helpers_test.go +++ b/beacon-chain/rpc/eth/light-client/helpers_test.go @@ -11,6 +11,8 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v5/testing/assert" + "github.com/prysmaticlabs/prysm/v5/testing/require" + "github.com/prysmaticlabs/prysm/v5/testing/util" ) // When the update has relevant sync committee @@ -34,13 +36,14 @@ func createNonEmptyFinalityBranch() [][]byte { } func TestIsBetterUpdate(t *testing.T) { - config := params.BeaconConfig() + st, err := util.NewBeaconStateAltair() + require.NoError(t, err) t.Run("new has supermajority but old doesn't", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -56,9 +59,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("old has supermajority but new doesn't", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -74,9 +77,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new doesn't have supermajority and newNumActiveParticipants is greater than oldNumActiveParticipants", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -92,9 +95,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new doesn't have supermajority and newNumActiveParticipants is lesser than oldNumActiveParticipants", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -110,9 +113,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new has relevant sync committee but old doesn't", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -149,9 +152,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("old has relevant sync committee but new doesn't", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -188,9 +191,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new has finality but old doesn't", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -231,9 +234,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("old has finality but new doesn't", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -274,9 +277,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new has finality and sync committee finality both but old doesn't have sync committee finality", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -335,9 +338,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new has finality but doesn't have sync committee finality and old has sync committee finality", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -396,9 +399,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new has more active participants than old", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -414,9 +417,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new has less active participants than old", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -432,9 +435,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new's attested header's slot is lesser than old's attested header's slot", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -493,9 +496,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("new's attested header's slot is greater than old's attested header's slot", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -554,9 +557,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("none of the above conditions are met and new signature's slot is less than old signature's slot", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ @@ -615,9 +618,9 @@ func TestIsBetterUpdate(t *testing.T) { }) t.Run("none of the above conditions are met and new signature's slot is greater than old signature's slot", func(t *testing.T) { - oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(1)) + oldUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(1), st) assert.NoError(t, err) - newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch * primitives.Epoch(config.SlotsPerEpoch)).Add(2)) + newUpdate, err := lightclient.CreateDefaultLightClientUpdate(primitives.Slot(config.AltairForkEpoch*primitives.Epoch(config.SlotsPerEpoch)).Add(2), st) assert.NoError(t, err) oldUpdate.SetSyncAggregate(&pb.SyncAggregate{ diff --git a/config/fieldparams/minimal.go b/config/fieldparams/minimal.go index db99c2dd91b..eb9d1af88f7 100644 --- a/config/fieldparams/minimal.go +++ b/config/fieldparams/minimal.go @@ -37,6 +37,7 @@ const ( SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee. SyncCommitteeBranchDepthElectra = 6 // SyncCommitteeBranchDepthElectra 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. + FinalityBranchDepthElectra = 7 // FinalityBranchDepthElectra defines the number of leaves in a merkle proof of the finalized checkpoint root. PendingDepositsLimit = 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.