erigon-pulse/cmd/erigon-cl/core/transition/resets.go
Giulio rebuffo 628f52dd6c
Added reverse beacon changeset for beacon state rewind (#7185)
Added changesets for beacon chain to implement memory efficient fork
choice
2023-03-26 22:25:08 +00:00

28 lines
786 B
Go

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