mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 03:51:20 +00:00
4d35e776da
start of abstracting the transition layer. incremental movements.
50 lines
1.2 KiB
Go
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
|
|
}
|