erigon-pulse/cl/transition/impl/eth2/statechange/resets.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

29 lines
800 B
Go

package statechange
import (
"github.com/ledgerwatch/erigon/cl/abstract"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
)
func ProcessEth1DataReset(s abstract.BeaconState) {
nextEpoch := state.Epoch(s) + 1
if nextEpoch%s.BeaconConfig().EpochsPerEth1VotingPeriod == 0 {
s.ResetEth1DataVotes()
}
}
func ProcessSlashingsReset(s abstract.BeaconState) {
s.SetSlashingSegmentAt(int(state.Epoch(s)+1)%int(s.BeaconConfig().EpochsPerSlashingsVector), 0)
}
func ProcessRandaoMixesReset(s abstract.BeaconState) {
currentEpoch := state.Epoch(s)
nextEpoch := state.Epoch(s) + 1
s.SetRandaoMixAt(int(nextEpoch%s.BeaconConfig().EpochsPerHistoricalVector), s.GetRandaoMixes(currentEpoch))
}
func ProcessParticipationFlagUpdates(state abstract.BeaconState) {
state.ResetEpochParticipation()
}