Fix LC versioning bug (#15400)

* fix versioning

* changelog

* fix blockchain tests

* fix linter issue

* fix spec tests

* fix default lc update version

* fix lc header version

* gzl

* clean up the code

* Update testing/spectest/shared/common/light_client/update_ranking.go

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>

* add fulu set up in update ranking

* pass att block to createDefaultLCUpdate

* address comments

* linter

* Update lightclient.go

* sort imports

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
This commit is contained in:
Bastin
2025-07-01 23:40:18 +02:00
committed by GitHub
parent bc7664321b
commit bddcc158e4
18 changed files with 744 additions and 500 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
pb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
"github.com/OffchainLabs/prysm/v6/runtime/version"
"github.com/OffchainLabs/prysm/v6/time/slots"
"google.golang.org/protobuf/proto"
)
@@ -83,7 +84,7 @@ func (h *bootstrapAltair) SizeSSZ() int {
}
func (h *bootstrapAltair) Version() int {
return version.Altair
return slots.ToForkVersion(h.header.Beacon().Slot)
}
func (h *bootstrapAltair) Proto() proto.Message {
@@ -188,7 +189,7 @@ func (h *bootstrapCapella) SizeSSZ() int {
}
func (h *bootstrapCapella) Version() int {
return version.Capella
return slots.ToForkVersion(h.header.Beacon().Slot)
}
func (h *bootstrapCapella) Proto() proto.Message {
@@ -293,7 +294,7 @@ func (h *bootstrapDeneb) SizeSSZ() int {
}
func (h *bootstrapDeneb) Version() int {
return version.Deneb
return slots.ToForkVersion(h.header.Beacon().Slot)
}
func (h *bootstrapDeneb) Proto() proto.Message {
@@ -398,7 +399,7 @@ func (h *bootstrapElectra) SizeSSZ() int {
}
func (h *bootstrapElectra) Version() int {
return version.Electra
return slots.ToForkVersion(h.header.Beacon().Slot)
}
func (h *bootstrapElectra) Proto() proto.Message {

View File

@@ -8,7 +8,7 @@ import (
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
pb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
"github.com/OffchainLabs/prysm/v6/runtime/version"
"github.com/OffchainLabs/prysm/v6/time/slots"
"google.golang.org/protobuf/proto"
)
@@ -174,7 +174,7 @@ func (u *finalityUpdateAltair) Proto() proto.Message {
}
func (u *finalityUpdateAltair) Version() int {
return version.Altair
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *finalityUpdateAltair) AttestedHeader() interfaces.LightClientHeader {
@@ -286,7 +286,7 @@ func (u *finalityUpdateCapella) Proto() proto.Message {
}
func (u *finalityUpdateCapella) Version() int {
return version.Capella
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *finalityUpdateCapella) AttestedHeader() interfaces.LightClientHeader {
@@ -398,7 +398,7 @@ func (u *finalityUpdateDeneb) Proto() proto.Message {
}
func (u *finalityUpdateDeneb) Version() int {
return version.Deneb
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *finalityUpdateDeneb) AttestedHeader() interfaces.LightClientHeader {
@@ -511,7 +511,7 @@ func (u *finalityUpdateElectra) Proto() proto.Message {
}
func (u *finalityUpdateElectra) Version() int {
return version.Electra
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *finalityUpdateElectra) AttestedHeader() interfaces.LightClientHeader {

View File

@@ -7,7 +7,7 @@ import (
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
pb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
"github.com/OffchainLabs/prysm/v6/runtime/version"
"github.com/OffchainLabs/prysm/v6/time/slots"
"google.golang.org/protobuf/proto"
)
@@ -139,7 +139,7 @@ func (u *optimisticUpdateAltair) Proto() proto.Message {
}
func (u *optimisticUpdateAltair) Version() int {
return version.Altair
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *optimisticUpdateAltair) AttestedHeader() interfaces.LightClientHeader {
@@ -223,7 +223,7 @@ func (u *optimisticUpdateCapella) Proto() proto.Message {
}
func (u *optimisticUpdateCapella) Version() int {
return version.Capella
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *optimisticUpdateCapella) AttestedHeader() interfaces.LightClientHeader {
@@ -307,7 +307,7 @@ func (u *optimisticUpdateDeneb) Proto() proto.Message {
}
func (u *optimisticUpdateDeneb) Version() int {
return version.Deneb
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *optimisticUpdateDeneb) AttestedHeader() interfaces.LightClientHeader {

View File

@@ -9,6 +9,7 @@ import (
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
pb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
"github.com/OffchainLabs/prysm/v6/runtime/version"
"github.com/OffchainLabs/prysm/v6/time/slots"
"google.golang.org/protobuf/proto"
)
@@ -105,7 +106,7 @@ func (u *updateAltair) Proto() proto.Message {
}
func (u *updateAltair) Version() int {
return version.Altair
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *updateAltair) AttestedHeader() interfaces.LightClientHeader {
@@ -272,7 +273,7 @@ func (u *updateCapella) Proto() proto.Message {
}
func (u *updateCapella) Version() int {
return version.Capella
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *updateCapella) AttestedHeader() interfaces.LightClientHeader {
@@ -439,7 +440,7 @@ func (u *updateDeneb) Proto() proto.Message {
}
func (u *updateDeneb) Version() int {
return version.Deneb
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *updateDeneb) AttestedHeader() interfaces.LightClientHeader {
@@ -607,7 +608,7 @@ func (u *updateElectra) Proto() proto.Message {
}
func (u *updateElectra) Version() int {
return version.Electra
return slots.ToForkVersion(u.attestedHeader.Beacon().Slot)
}
func (u *updateElectra) AttestedHeader() interfaces.LightClientHeader {