2023-06-11 21:50:02 +00:00
|
|
|
package statechange
|
2023-05-13 21:44:07 +00:00
|
|
|
|
|
|
|
import (
|
2023-07-19 22:20:33 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/abstract"
|
|
|
|
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
|
2023-05-13 21:44:07 +00:00
|
|
|
)
|
|
|
|
|
2023-07-19 22:20:33 +00:00
|
|
|
func ProcessEth1DataReset(s abstract.BeaconState) {
|
|
|
|
nextEpoch := state.Epoch(s) + 1
|
2023-05-13 21:44:07 +00:00
|
|
|
if nextEpoch%s.BeaconConfig().EpochsPerEth1VotingPeriod == 0 {
|
|
|
|
s.ResetEth1DataVotes()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-19 22:20:33 +00:00
|
|
|
func ProcessSlashingsReset(s abstract.BeaconState) {
|
|
|
|
s.SetSlashingSegmentAt(int(state.Epoch(s)+1)%int(s.BeaconConfig().EpochsPerSlashingsVector), 0)
|
2023-05-13 21:44:07 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-07-19 22:20:33 +00:00
|
|
|
func ProcessRandaoMixesReset(s abstract.BeaconState) {
|
|
|
|
currentEpoch := state.Epoch(s)
|
|
|
|
nextEpoch := state.Epoch(s) + 1
|
2023-05-13 21:44:07 +00:00
|
|
|
s.SetRandaoMixAt(int(nextEpoch%s.BeaconConfig().EpochsPerHistoricalVector), s.GetRandaoMixes(currentEpoch))
|
|
|
|
}
|
|
|
|
|
2023-07-19 22:20:33 +00:00
|
|
|
func ProcessParticipationFlagUpdates(state abstract.BeaconState) {
|
2023-05-13 21:44:07 +00:00
|
|
|
state.ResetEpochParticipation()
|
|
|
|
}
|