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-11-18 02:08:19 +00:00
|
|
|
state2 "github.com/ledgerwatch/erigon/cl/phase1/core/state"
|
2023-08-29 14:47:16 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/phase1/execution_client"
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
GetEth1Hash(eth2Root common.Hash) common.Hash
|
|
|
|
GetHead() (common.Hash, uint64, error)
|
|
|
|
HighestSeen() uint64
|
|
|
|
JustifiedCheckpoint() solid.Checkpoint
|
|
|
|
ProposerBoostRoot() common.Hash
|
2023-11-18 18:03:56 +00:00
|
|
|
GetFullState(libcommon.Hash, bool) (*state2.CachingBeaconState, error)
|
2023-08-29 14:47:16 +00:00
|
|
|
Slot() uint64
|
|
|
|
Time() uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2023-08-29 14:47:16 +00:00
|
|
|
OnBlock(block *cltypes.SignedBeaconBlock, newPayload bool, fullValidation bool) error
|
|
|
|
OnTick(time uint64)
|
|
|
|
}
|