beacon_changeset

package
v0.0.0-...-92d349b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet struct {

	// Lists and arrays changesets
	BlockRootsChanges      *ListChangeSet[libcommon.Hash]
	StateRootsChanges      *ListChangeSet[libcommon.Hash]
	HistoricalRootsChanges *ListChangeSet[libcommon.Hash]

	BalancesChanges                   *ListChangeSet[uint64]
	RandaoMixesChanges                *ListChangeSet[libcommon.Hash]
	SlashingsChanges                  *ListChangeSet[uint64]
	PreviousEpochParticipationChanges *ListChangeSet[cltypes.ParticipationFlags]
	CurrentEpochParticipationChanges  *ListChangeSet[cltypes.ParticipationFlags]
	InactivityScoresChanges           *ListChangeSet[uint64]

	// Validator fields.
	PublicKeyChanges                 *ListChangeSet[[48]byte]
	WithdrawalCredentialsChange      *ListChangeSet[libcommon.Hash]
	EffectiveBalanceChange           *ListChangeSet[uint64]
	SlashedChange                    *ListChangeSet[bool]
	ActivationEligibilityEpochChange *ListChangeSet[uint64]
	ActivationEpochChange            *ListChangeSet[uint64]
	ExitEpochChange                  *ListChangeSet[uint64]
	WithdrawalEpochChange            *ListChangeSet[uint64]
	// contains filtered or unexported fields
}

This type of changeset is the diff beetwen next state and input state and is used to reverse/forward beacon state.

func New

func New(validatorSetSize, blockRootsLength, stateRootsLength, slashingsLength, historicalSummariesLength, historicalRootsLength, votesLength, randaoMixesLength int, inverseChangeset bool) *ChangeSet

func (*ChangeSet) AddHistoricalSummary

func (r *ChangeSet) AddHistoricalSummary(summary cltypes.HistoricalSummary)

func (*ChangeSet) AddVote

func (r *ChangeSet) AddVote(vote cltypes.Eth1Data)

func (*ChangeSet) ApplyCurrentJustifiedCheckpointChange

func (r *ChangeSet) ApplyCurrentJustifiedCheckpointChange(c *cltypes.Checkpoint) (*cltypes.Checkpoint, bool)

func (*ChangeSet) ApplyCurrentSyncCommitteeChange

func (r *ChangeSet) ApplyCurrentSyncCommitteeChange(committee *cltypes.SyncCommittee) (*cltypes.SyncCommittee, bool)

func (*ChangeSet) ApplyEpochParticipationChanges

func (r *ChangeSet) ApplyEpochParticipationChanges(
	previousEpochParticipation cltypes.ParticipationFlagsList,
	currentEpochParticipation cltypes.ParticipationFlagsList) (newPreviousEpochParticipation cltypes.ParticipationFlagsList, newCurrentEpochParticipation cltypes.ParticipationFlagsList,
	previousParticipationChanged bool, currentParticipationChanged bool)

func (*ChangeSet) ApplyEth1DataChange

func (r *ChangeSet) ApplyEth1DataChange(data *cltypes.Eth1Data) (*cltypes.Eth1Data, bool)

func (*ChangeSet) ApplyEth1DataVotesChanges

func (r *ChangeSet) ApplyEth1DataVotesChanges(initialVotes []*cltypes.Eth1Data) (output []*cltypes.Eth1Data, changed bool)

func (*ChangeSet) ApplyEth1DepositIndexChange

func (r *ChangeSet) ApplyEth1DepositIndexChange(depositIndex uint64) (uint64, bool)

func (*ChangeSet) ApplyFinalizedCheckpointChange

func (r *ChangeSet) ApplyFinalizedCheckpointChange(c *cltypes.Checkpoint) (*cltypes.Checkpoint, bool)

func (*ChangeSet) ApplyForkChange

func (r *ChangeSet) ApplyForkChange(fork *cltypes.Fork) (*cltypes.Fork, bool)

func (*ChangeSet) ApplyHistoricalSummaryChanges

func (r *ChangeSet) ApplyHistoricalSummaryChanges(input []*cltypes.HistoricalSummary) (output []*cltypes.HistoricalSummary, changed bool)

func (*ChangeSet) ApplyJustificationBitsChange

func (r *ChangeSet) ApplyJustificationBitsChange(bits cltypes.JustificationBits) (cltypes.JustificationBits, bool)

func (*ChangeSet) ApplyLatestBlockHeader

func (r *ChangeSet) ApplyLatestBlockHeader(header *cltypes.BeaconBlockHeader) (*cltypes.BeaconBlockHeader, bool)

func (*ChangeSet) ApplyLatestExecutionPayloadHeaderChange

func (r *ChangeSet) ApplyLatestExecutionPayloadHeaderChange(eth1Header *cltypes.Eth1Header) (*cltypes.Eth1Header, bool)

func (*ChangeSet) ApplyNextSyncCommitteeChange

func (r *ChangeSet) ApplyNextSyncCommitteeChange(committee *cltypes.SyncCommittee) (*cltypes.SyncCommittee, bool)

func (*ChangeSet) ApplyNextValidatorWithdrawalIndexChange

func (r *ChangeSet) ApplyNextValidatorWithdrawalIndexChange(index uint64) (uint64, bool)

func (*ChangeSet) ApplyNextWithdrawalIndexChange

func (r *ChangeSet) ApplyNextWithdrawalIndexChange(index uint64) (uint64, bool)

func (*ChangeSet) ApplyPreviousJustifiedCheckpointChange

func (r *ChangeSet) ApplyPreviousJustifiedCheckpointChange(c *cltypes.Checkpoint) (*cltypes.Checkpoint, bool)

func (*ChangeSet) ApplySlotChange

func (r *ChangeSet) ApplySlotChange(prevSlot uint64) (uint64, bool)

func (*ChangeSet) ApplyVersionChange

func (r *ChangeSet) ApplyVersionChange(version clparams.StateVersion) (clparams.StateVersion, bool)

func (*ChangeSet) CompactChanges

func (r *ChangeSet) CompactChanges()

func (*ChangeSet) HasValidatorSetNotChanged

func (r *ChangeSet) HasValidatorSetNotChanged(validatorSetLength int) bool

func (*ChangeSet) OnCurrentJustifiedCheckpointChange

func (r *ChangeSet) OnCurrentJustifiedCheckpointChange(c *cltypes.Checkpoint)

func (*ChangeSet) OnCurrentSyncCommitteeChange

func (r *ChangeSet) OnCurrentSyncCommitteeChange(c *cltypes.SyncCommittee)

func (*ChangeSet) OnEth1DataChange

func (r *ChangeSet) OnEth1DataChange(e *cltypes.Eth1Data)

func (*ChangeSet) OnEth1DepositIndexChange

func (r *ChangeSet) OnEth1DepositIndexChange(e uint64)

func (*ChangeSet) OnEth1Header

func (r *ChangeSet) OnEth1Header(e *cltypes.Eth1Header)

func (*ChangeSet) OnFinalizedCheckpointChange

func (r *ChangeSet) OnFinalizedCheckpointChange(c *cltypes.Checkpoint)

func (*ChangeSet) OnForkChange

func (r *ChangeSet) OnForkChange(fork *cltypes.Fork)

func (*ChangeSet) OnJustificationBitsChange

func (r *ChangeSet) OnJustificationBitsChange(j cltypes.JustificationBits)

func (*ChangeSet) OnLatestHeaderChange

func (r *ChangeSet) OnLatestHeaderChange(h *cltypes.BeaconBlockHeader)

func (*ChangeSet) OnNewValidator

func (r *ChangeSet) OnNewValidator(validator *cltypes.Validator)

func (*ChangeSet) OnNextSyncCommitteeChange

func (r *ChangeSet) OnNextSyncCommitteeChange(c *cltypes.SyncCommittee)

func (*ChangeSet) OnNextWithdrawalIndexChange

func (r *ChangeSet) OnNextWithdrawalIndexChange(index uint64)

func (*ChangeSet) OnNextWithdrawalValidatorIndexChange

func (r *ChangeSet) OnNextWithdrawalValidatorIndexChange(index uint64)

func (*ChangeSet) OnPreviousJustifiedCheckpointChange

func (r *ChangeSet) OnPreviousJustifiedCheckpointChange(c *cltypes.Checkpoint)

func (*ChangeSet) OnSlotChange

func (r *ChangeSet) OnSlotChange(prevSlot uint64)

func (*ChangeSet) OnVersionChange

func (r *ChangeSet) OnVersionChange(v clparams.StateVersion)

func (*ChangeSet) ReportEpochParticipationReset

func (r *ChangeSet) ReportEpochParticipationReset(prevParticipation, currParticpation cltypes.ParticipationFlagsList)

func (*ChangeSet) ReportVotesReset

func (r *ChangeSet) ReportVotesReset(votes []*cltypes.Eth1Data)

type ListChangeSet

type ListChangeSet[T any] struct {
	// contains filtered or unexported fields
}

func NewListChangeSet

func NewListChangeSet[T any](length int) *ListChangeSet[T]

NewListChangeSet creates new list with given length.

func (*ListChangeSet[T]) AddChange

func (l *ListChangeSet[T]) AddChange(index int, elem T)

AddChange appens to a new change to the changeset of the list.

func (*ListChangeSet[T]) ApplyChanges

func (l *ListChangeSet[T]) ApplyChanges(input []T) (output []T, changed bool)

ApplyChanges Apply changes without any mercy. if it is reverse, you need to call CompactChangesReverse before.

func (*ListChangeSet[T]) ChangesWithHandler

func (l *ListChangeSet[T]) ChangesWithHandler(fn func(value T, index int))

ChangesWithHandler uses custom handler to handle changes.

func (*ListChangeSet[T]) Clear

func (l *ListChangeSet[T]) Clear(newLength int)

Clear clears the changesets and re-adjust length.

func (*ListChangeSet[T]) CompactChanges

func (l *ListChangeSet[T]) CompactChanges(reverse bool)

CompactChanges removes duplicates from a list using QuickSort and linear scan. duplicates may appear if one state parameter is changed more than once.

func (*ListChangeSet[T]) Empty

func (l *ListChangeSet[T]) Empty() bool

Empty return whether current list diff is empty

func (*ListChangeSet[T]) ListLength

func (l *ListChangeSet[T]) ListLength() int

ListLength return full list length

func (*ListChangeSet[T]) OnAddNewElement

func (l *ListChangeSet[T]) OnAddNewElement(elem T)

OnAddNewElement handles addition of new element to list set of changes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL