mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
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:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user