Add Fulu fork boilerplate (#14771)

* Prepare for future fork boilerplate.

* Implement the Fulu fork boilerplate.

* `Upgraded state to <fork> log`: Move from debug to info.

Rationale:
This log is the only one notifying the user a new fork happened.
A new fork is always a little bit stressful for a node operator.
Having at least one log indicating the client switched fork is something useful.

* Update testing/util/helpers.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Fix Radek's comment.

* Fix Radek's comment.

* Update beacon-chain/state/state-native/state_trie.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/state/state-native/state_trie.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Fix Radek's comment.

* Fix Radek's comment.

* Fix Radek's comment.

* Remove Electra struct type aliasing.

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
Manu NALEPA
2025-01-07 21:09:12 +01:00
committed by GitHub
parent a21f544219
commit c48d40907c
99 changed files with 10951 additions and 1507 deletions

View File

@@ -86,6 +86,8 @@ func ToEpoch(slot primitives.Slot) primitives.Epoch {
func ToForkVersion(slot primitives.Slot) int {
epoch := ToEpoch(slot)
switch {
case epoch >= params.BeaconConfig().FuluForkEpoch:
return version.Fulu
case epoch >= params.BeaconConfig().ElectraForkEpoch:
return version.Electra
case epoch >= params.BeaconConfig().DenebForkEpoch:

View File

@@ -635,6 +635,19 @@ func TestSecondsUntilNextEpochStart(t *testing.T) {
}
func TestToForkVersion(t *testing.T) {
t.Run("Fulu fork version", func(t *testing.T) {
params.SetupTestConfigCleanup(t)
config := params.BeaconConfig()
config.FuluForkEpoch = 100
params.OverrideBeaconConfig(config)
slot, err := EpochStart(params.BeaconConfig().FuluForkEpoch)
require.NoError(t, err)
result := ToForkVersion(slot)
require.Equal(t, version.Fulu, result)
})
t.Run("Electra fork version", func(t *testing.T) {
params.SetupTestConfigCleanup(t)
config := params.BeaconConfig()