erigon-pulse/cl/transition/impl/eth2/statechange/process_epoch.go
a 4d35e776da
[caplin] abstract transition (#7661)
start of abstracting the transition layer. 

incremental movements.
2023-06-11 23:50:02 +02:00

50 lines
1.2 KiB
Go

package statechange
import (
"github.com/ledgerwatch/erigon/cl/clparams"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
)
// ProcessEpoch process epoch transition.
func ProcessEpoch(state *state.BeaconState) error {
if err := ProcessJustificationBitsAndFinality(state); err != nil {
return err
}
if state.Version() >= clparams.AltairVersion {
if err := ProcessInactivityScores(state); err != nil {
return err
}
}
if err := ProcessRewardsAndPenalties(state); err != nil {
return err
}
if err := ProcessRegistryUpdates(state); err != nil {
return err
}
if err := ProcessSlashings(state); err != nil {
return err
}
ProcessEth1DataReset(state)
if err := ProcessEffectiveBalanceUpdates(state); err != nil {
return err
}
ProcessSlashingsReset(state)
ProcessRandaoMixesReset(state)
if err := ProcessHistoricalRootsUpdate(state); err != nil {
return err
}
if state.Version() == clparams.Phase0Version {
if err := ProcessParticipationRecordUpdates(state); err != nil {
return err
}
}
if state.Version() >= clparams.AltairVersion {
ProcessParticipationFlagUpdates(state)
if err := ProcessSyncCommitteeUpdate(state); err != nil {
return err
}
}
return nil
}