mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
save light client updates (diff) (#14683)
* update diff * deps * add tests for `SaveLightClientUpdate` * cleanup imports * lint * changelog * fix incorrect arithmetic * check for lightclient feature flag * fix tests * fix `saveLightClientBootstrap` and `saveLightClientUpdate` * replace and with or * move feature check to `postBlockProcess` --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -240,23 +240,13 @@ func PayloadProof(ctx context.Context, block interfaces.ReadOnlyBeaconBlock) ([]
|
||||
return nil, errors.New("failed to cast block body")
|
||||
}
|
||||
|
||||
blockBodyFieldRoots, err := ComputeBlockBodyFieldRoots(ctx, blockBody)
|
||||
fieldRoots, err := ComputeBlockBodyFieldRoots(ctx, blockBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
blockBodyFieldRootsTrie := stateutil.Merkleize(blockBodyFieldRoots)
|
||||
blockBodyProof := trie.ProofFromMerkleLayers(blockBodyFieldRootsTrie, payloadFieldIndex)
|
||||
fieldRootsTrie := stateutil.Merkleize(fieldRoots)
|
||||
proof := trie.ProofFromMerkleLayers(fieldRootsTrie, payloadFieldIndex)
|
||||
|
||||
beaconBlockFieldRoots, err := ComputeBlockFieldRoots(ctx, block)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
beaconBlockFieldRootsTrie := stateutil.Merkleize(beaconBlockFieldRoots)
|
||||
beaconBlockProof := trie.ProofFromMerkleLayers(beaconBlockFieldRootsTrie, bodyFieldIndex)
|
||||
|
||||
finalProof := append(blockBodyProof, beaconBlockProof...)
|
||||
|
||||
return finalProof, nil
|
||||
return proof, nil
|
||||
}
|
||||
|
||||
@@ -27,9 +27,12 @@ type LightClientBootstrap interface {
|
||||
ssz.Marshaler
|
||||
Version() int
|
||||
Header() LightClientHeader
|
||||
SetHeader(header LightClientHeader) error
|
||||
CurrentSyncCommittee() *pb.SyncCommittee
|
||||
SetCurrentSyncCommittee(sc *pb.SyncCommittee) error
|
||||
CurrentSyncCommitteeBranch() (LightClientSyncCommitteeBranch, error)
|
||||
CurrentSyncCommitteeBranchElectra() (LightClientSyncCommitteeBranchElectra, error)
|
||||
SetCurrentSyncCommitteeBranch(branch [][]byte) error
|
||||
}
|
||||
|
||||
type LightClientUpdate interface {
|
||||
@@ -56,6 +59,7 @@ type LightClientUpdate interface {
|
||||
|
||||
type LightClientFinalityUpdate interface {
|
||||
ssz.Marshaler
|
||||
ssz.Unmarshaler
|
||||
Proto() proto.Message
|
||||
Version() int
|
||||
AttestedHeader() LightClientHeader
|
||||
@@ -68,6 +72,7 @@ type LightClientFinalityUpdate interface {
|
||||
|
||||
type LightClientOptimisticUpdate interface {
|
||||
ssz.Marshaler
|
||||
ssz.Unmarshaler
|
||||
Proto() proto.Message
|
||||
Version() int
|
||||
AttestedHeader() LightClientHeader
|
||||
|
||||
@@ -41,10 +41,16 @@ func NewWrappedBootstrapAltair(p *pb.LightClientBootstrapAltair) (interfaces.Lig
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
var header interfaces.LightClientHeader
|
||||
var err error
|
||||
if p.Header != nil {
|
||||
header, err = NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
@@ -81,14 +87,42 @@ func (h *bootstrapAltair) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) SetHeader(header interfaces.LightClientHeader) error {
|
||||
p, ok := (header.Proto()).(*pb.LightClientHeaderAltair)
|
||||
if !ok {
|
||||
return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderAltair{})
|
||||
}
|
||||
h.p.Header = p
|
||||
h.header = header
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error {
|
||||
h.p.CurrentSyncCommittee = sc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) {
|
||||
return h.currentSyncCommitteeBranch, nil
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) SetCurrentSyncCommitteeBranch(branch [][]byte) error {
|
||||
if len(branch) != fieldparams.SyncCommitteeBranchDepth {
|
||||
return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepth)
|
||||
}
|
||||
newBranch := [fieldparams.SyncCommitteeBranchDepth][32]byte{}
|
||||
for i, root := range branch {
|
||||
copy(newBranch[i][:], root)
|
||||
}
|
||||
h.currentSyncCommitteeBranch = newBranch
|
||||
h.p.CurrentSyncCommitteeBranch = branch
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) {
|
||||
return [6][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranchElectra", version.Altair)
|
||||
}
|
||||
@@ -105,10 +139,16 @@ func NewWrappedBootstrapCapella(p *pb.LightClientBootstrapCapella) (interfaces.L
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
var header interfaces.LightClientHeader
|
||||
var err error
|
||||
if p.Header != nil {
|
||||
header, err = NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
@@ -145,14 +185,42 @@ func (h *bootstrapCapella) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) SetHeader(header interfaces.LightClientHeader) error {
|
||||
p, ok := (header.Proto()).(*pb.LightClientHeaderCapella)
|
||||
if !ok {
|
||||
return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderCapella{})
|
||||
}
|
||||
h.p.Header = p
|
||||
h.header = header
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error {
|
||||
h.p.CurrentSyncCommittee = sc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) {
|
||||
return h.currentSyncCommitteeBranch, nil
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) SetCurrentSyncCommitteeBranch(branch [][]byte) error {
|
||||
if len(branch) != fieldparams.SyncCommitteeBranchDepth {
|
||||
return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepth)
|
||||
}
|
||||
newBranch := [fieldparams.SyncCommitteeBranchDepth][32]byte{}
|
||||
for i, root := range branch {
|
||||
copy(newBranch[i][:], root)
|
||||
}
|
||||
h.currentSyncCommitteeBranch = newBranch
|
||||
h.p.CurrentSyncCommitteeBranch = branch
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) {
|
||||
return [6][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranchElectra", version.Capella)
|
||||
}
|
||||
@@ -169,10 +237,16 @@ func NewWrappedBootstrapDeneb(p *pb.LightClientBootstrapDeneb) (interfaces.Light
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
var header interfaces.LightClientHeader
|
||||
var err error
|
||||
if p.Header != nil {
|
||||
header, err = NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
@@ -209,14 +283,42 @@ func (h *bootstrapDeneb) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) SetHeader(header interfaces.LightClientHeader) error {
|
||||
p, ok := (header.Proto()).(*pb.LightClientHeaderDeneb)
|
||||
if !ok {
|
||||
return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderDeneb{})
|
||||
}
|
||||
h.p.Header = p
|
||||
h.header = header
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error {
|
||||
h.p.CurrentSyncCommittee = sc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) {
|
||||
return h.currentSyncCommitteeBranch, nil
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) SetCurrentSyncCommitteeBranch(branch [][]byte) error {
|
||||
if len(branch) != fieldparams.SyncCommitteeBranchDepth {
|
||||
return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepth)
|
||||
}
|
||||
newBranch := [fieldparams.SyncCommitteeBranchDepth][32]byte{}
|
||||
for i, root := range branch {
|
||||
copy(newBranch[i][:], root)
|
||||
}
|
||||
h.currentSyncCommitteeBranch = newBranch
|
||||
h.p.CurrentSyncCommitteeBranch = branch
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) {
|
||||
return [6][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranchElectra", version.Deneb)
|
||||
}
|
||||
@@ -233,10 +335,16 @@ func NewWrappedBootstrapElectra(p *pb.LightClientBootstrapElectra) (interfaces.L
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
var header interfaces.LightClientHeader
|
||||
var err error
|
||||
if p.Header != nil {
|
||||
header, err = NewWrappedHeader(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranchElectra](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
@@ -273,14 +381,42 @@ func (h *bootstrapElectra) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapElectra) SetHeader(header interfaces.LightClientHeader) error {
|
||||
p, ok := (header.Proto()).(*pb.LightClientHeaderDeneb)
|
||||
if !ok {
|
||||
return fmt.Errorf("header type %T is not %T", p, &pb.LightClientHeaderDeneb{})
|
||||
}
|
||||
h.p.Header = p
|
||||
h.header = header
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapElectra) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapElectra) SetCurrentSyncCommittee(sc *pb.SyncCommittee) error {
|
||||
h.p.CurrentSyncCommittee = sc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapElectra) CurrentSyncCommitteeBranch() (interfaces.LightClientSyncCommitteeBranch, error) {
|
||||
return [5][32]byte{}, consensustypes.ErrNotSupported("CurrentSyncCommitteeBranch", version.Electra)
|
||||
}
|
||||
|
||||
func (h *bootstrapElectra) SetCurrentSyncCommitteeBranch(branch [][]byte) error {
|
||||
if len(branch) != fieldparams.SyncCommitteeBranchDepthElectra {
|
||||
return fmt.Errorf("branch length %d is not %d", len(branch), fieldparams.SyncCommitteeBranchDepthElectra)
|
||||
}
|
||||
newBranch := [fieldparams.SyncCommitteeBranchDepthElectra][32]byte{}
|
||||
for i, root := range branch {
|
||||
copy(newBranch[i][:], root)
|
||||
}
|
||||
h.currentSyncCommitteeBranch = newBranch
|
||||
h.p.CurrentSyncCommitteeBranch = branch
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *bootstrapElectra) CurrentSyncCommitteeBranchElectra() (interfaces.LightClientSyncCommitteeBranchElectra, error) {
|
||||
return h.currentSyncCommitteeBranch, nil
|
||||
}
|
||||
|
||||
@@ -139,6 +139,23 @@ func (u *finalityUpdateAltair) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientFinalityUpdateAltair{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedFinalityUpdateAltair(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*finalityUpdateAltair)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
@@ -221,6 +238,23 @@ func (u *finalityUpdateCapella) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientFinalityUpdateCapella{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedFinalityUpdateCapella(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*finalityUpdateCapella)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
@@ -303,6 +337,23 @@ func (u *finalityUpdateDeneb) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientFinalityUpdateDeneb{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedFinalityUpdateDeneb(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*finalityUpdateDeneb)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
@@ -386,6 +437,23 @@ func (u *finalityUpdateElectra) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateElectra) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientFinalityUpdateElectra{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedFinalityUpdateElectra(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*finalityUpdateElectra)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateElectra) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
|
||||
@@ -104,6 +104,23 @@ func (u *optimisticUpdateAltair) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *optimisticUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientOptimisticUpdateAltair{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedOptimisticUpdateAltair(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*optimisticUpdateAltair)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *optimisticUpdateAltair) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
@@ -158,6 +175,23 @@ func (u *optimisticUpdateCapella) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *optimisticUpdateCapella) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientOptimisticUpdateCapella{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedOptimisticUpdateCapella(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*optimisticUpdateCapella)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *optimisticUpdateCapella) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
@@ -212,6 +246,23 @@ func (u *optimisticUpdateDeneb) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *optimisticUpdateDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
p := &pb.LightClientOptimisticUpdateDeneb{}
|
||||
if err := p.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
updateInterface, err := NewWrappedOptimisticUpdateDeneb(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
update, ok := updateInterface.(*optimisticUpdateDeneb)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected update type %T", updateInterface)
|
||||
}
|
||||
*u = *update
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *optimisticUpdateDeneb) Proto() proto.Message {
|
||||
return u.p
|
||||
}
|
||||
|
||||
@@ -168,6 +168,10 @@ func (u *updateAltair) FinalityBranch() (interfaces.LightClientFinalityBranch, e
|
||||
return u.finalityBranch, nil
|
||||
}
|
||||
|
||||
func (u *updateAltair) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) {
|
||||
return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", version.Altair)
|
||||
}
|
||||
|
||||
func (u *updateAltair) SetFinalityBranch(branch [][]byte) error {
|
||||
b, err := createBranch[interfaces.LightClientFinalityBranch]("finality", branch, fieldparams.FinalityBranchDepth)
|
||||
if err != nil {
|
||||
@@ -178,10 +182,6 @@ func (u *updateAltair) SetFinalityBranch(branch [][]byte) error {
|
||||
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
|
||||
}
|
||||
@@ -335,6 +335,10 @@ func (u *updateCapella) FinalityBranch() (interfaces.LightClientFinalityBranch,
|
||||
return u.finalityBranch, nil
|
||||
}
|
||||
|
||||
func (u *updateCapella) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) {
|
||||
return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version())
|
||||
}
|
||||
|
||||
func (u *updateCapella) SetFinalityBranch(branch [][]byte) error {
|
||||
b, err := createBranch[interfaces.LightClientFinalityBranch]("finality", branch, fieldparams.FinalityBranchDepth)
|
||||
if err != nil {
|
||||
@@ -345,10 +349,6 @@ func (u *updateCapella) SetFinalityBranch(branch [][]byte) error {
|
||||
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
|
||||
}
|
||||
@@ -502,6 +502,10 @@ func (u *updateDeneb) FinalityBranch() (interfaces.LightClientFinalityBranch, er
|
||||
return u.finalityBranch, nil
|
||||
}
|
||||
|
||||
func (u *updateDeneb) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) {
|
||||
return interfaces.LightClientFinalityBranchElectra{}, consensustypes.ErrNotSupported("FinalityBranchElectra", u.Version())
|
||||
}
|
||||
|
||||
func (u *updateDeneb) SetFinalityBranch(branch [][]byte) error {
|
||||
b, err := createBranch[interfaces.LightClientFinalityBranch]("finality", branch, fieldparams.FinalityBranchDepth)
|
||||
if err != nil {
|
||||
@@ -512,10 +516,6 @@ func (u *updateDeneb) SetFinalityBranch(branch [][]byte) error {
|
||||
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
|
||||
}
|
||||
@@ -670,6 +670,10 @@ func (u *updateElectra) FinalityBranch() (interfaces.LightClientFinalityBranch,
|
||||
return interfaces.LightClientFinalityBranch{}, consensustypes.ErrNotSupported("FinalityBranch", u.Version())
|
||||
}
|
||||
|
||||
func (u *updateElectra) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) {
|
||||
return u.finalityBranch, nil
|
||||
}
|
||||
|
||||
func (u *updateElectra) SetFinalityBranch(branch [][]byte) error {
|
||||
b, err := createBranch[interfaces.LightClientFinalityBranchElectra]("finality", branch, fieldparams.FinalityBranchDepthElectra)
|
||||
if err != nil {
|
||||
@@ -680,10 +684,6 @@ func (u *updateElectra) SetFinalityBranch(branch [][]byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *updateElectra) FinalityBranchElectra() (interfaces.LightClientFinalityBranchElectra, error) {
|
||||
return u.finalityBranch, nil
|
||||
}
|
||||
|
||||
func (u *updateElectra) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user