erigon-pulse/cl/transition/impl/eth2/statechange/process_epoch.go
a 3ab373787e
[caplin] extracting beacon state interface (#7910)
we need to extract this interface from the struct. 

i need to also break down the interface more, to better show what parts
the caching is used, move some functions from the cache state to the
underlying.


don't merge
2023-07-20 00:20:33 +02:00

50 lines
1.2 KiB
Go

package statechange
import (
"github.com/ledgerwatch/erigon/cl/abstract"
"github.com/ledgerwatch/erigon/cl/clparams"
)
// ProcessEpoch process epoch transition.
func ProcessEpoch(state abstract.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
}