2023-08-29 14:47:16 +00:00
|
|
|
package forkchoice
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common"
|
2023-11-18 02:08:19 +00:00
|
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
2023-08-29 14:47:16 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/cltypes"
|
|
|
|
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
|
2023-12-04 23:13:52 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
|
2023-08-29 14:47:16 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/phase1/execution_client"
|
2023-12-30 19:51:28 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/transition/impl/eth2"
|
2023-08-29 14:47:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ForkChoiceStorage interface {
|
|
|
|
ForkChoiceStorageWriter
|
|
|
|
ForkChoiceStorageReader
|
|
|
|
}
|
|
|
|
|
|
|
|
type ForkChoiceStorageReader interface {
|
|
|
|
Ancestor(root common.Hash, slot uint64) common.Hash
|
|
|
|
AnchorSlot() uint64
|
|
|
|
Engine() execution_client.ExecutionEngine
|
|
|
|
FinalizedCheckpoint() solid.Checkpoint
|
|
|
|
FinalizedSlot() uint64
|
2024-01-01 21:18:11 +00:00
|
|
|
LowestAvaiableSlot() uint64
|
2023-08-29 14:47:16 +00:00
|
|
|
GetEth1Hash(eth2Root common.Hash) common.Hash
|
|
|
|
GetHead() (common.Hash, uint64, error)
|
|
|
|
HighestSeen() uint64
|
|
|
|
JustifiedCheckpoint() solid.Checkpoint
|
2023-12-04 23:13:52 +00:00
|
|
|
JustifiedSlot() uint64
|
2023-08-29 14:47:16 +00:00
|
|
|
ProposerBoostRoot() common.Hash
|
2023-12-04 23:13:52 +00:00
|
|
|
GetStateAtBlockRoot(blockRoot libcommon.Hash, alwaysCopy bool) (*state.CachingBeaconState, error)
|
2023-12-15 01:27:27 +00:00
|
|
|
GetFinalityCheckpoints(blockRoot libcommon.Hash) (bool, solid.Checkpoint, solid.Checkpoint, solid.Checkpoint)
|
2023-12-18 12:54:15 +00:00
|
|
|
GetSyncCommittees(blockRoot libcommon.Hash) (*solid.SyncCommittee, *solid.SyncCommittee, bool)
|
2023-08-29 14:47:16 +00:00
|
|
|
Slot() uint64
|
|
|
|
Time() uint64
|
2024-01-01 21:18:11 +00:00
|
|
|
Partecipation(epoch uint64) (*solid.BitList, bool)
|
|
|
|
RandaoMixes(blockRoot libcommon.Hash, out solid.HashListSSZ) bool
|
2023-12-30 19:51:28 +00:00
|
|
|
BlockRewards(root libcommon.Hash) (*eth2.BlockRewardsCollector, bool)
|
|
|
|
TotalActiveBalance(root libcommon.Hash) (uint64, bool)
|
2023-12-04 23:13:52 +00:00
|
|
|
|
|
|
|
GetStateAtSlot(slot uint64, alwaysCopy bool) (*state.CachingBeaconState, error)
|
|
|
|
GetStateAtStateRoot(root libcommon.Hash, alwaysCopy bool) (*state.CachingBeaconState, error)
|
2024-01-06 20:49:23 +00:00
|
|
|
ForkNodes() []ForkNode
|
2023-08-29 14:47:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ForkChoiceStorageWriter interface {
|
|
|
|
OnAttestation(attestation *solid.Attestation, fromBlock bool) error
|
2023-09-29 21:42:07 +00:00
|
|
|
OnAttesterSlashing(attesterSlashing *cltypes.AttesterSlashing, test bool) error
|
2024-01-03 22:26:56 +00:00
|
|
|
OnVoluntaryExit(signedVoluntaryExit *cltypes.SignedVoluntaryExit, test bool) error
|
|
|
|
OnProposerSlashing(proposerSlashing *cltypes.ProposerSlashing, test bool) error
|
|
|
|
OnBlsToExecutionChange(signedChange *cltypes.SignedBLSToExecutionChange, test bool) error
|
2023-08-29 14:47:16 +00:00
|
|
|
OnBlock(block *cltypes.SignedBeaconBlock, newPayload bool, fullValidation bool) error
|
|
|
|
OnTick(time uint64)
|
|
|
|
}
|