Documentation ¶
Index ¶
- Constants
- Variables
- type ForkValidator
- func (fv *ForkValidator) ClearWithUnwind(accumulator *shards.Accumulator, c shards.StateChangeConsumer)
- func (fv *ForkValidator) ExtendingForkHeadHash() libcommon.Hash
- func (fv *ForkValidator) FlushExtendingFork(tx kv.RwTx, accumulator *shards.Accumulator) error
- func (fv *ForkValidator) NotifyCurrentHeight(currentHeight uint64)
- func (fv *ForkValidator) ValidatePayload(tx kv.Tx, header *types.Header, body *types.RawBody, extendCanonical bool) (status engine_types.EngineStatus, latestValidHash libcommon.Hash, ...)
Constants ¶
const MaxBuilders = 128
Variables ¶
var InvalidForkchoiceStateErr = rpc.CustomError{Code: -38002, Message: "Invalid forkchoice state"}
var InvalidPayloadAttributesErr = rpc.CustomError{Code: -38003, Message: "Invalid payload attributes"}
var TooLargeRequestErr = rpc.CustomError{Code: -38004, Message: "Too large request"}
var UnknownPayloadErr = rpc.CustomError{Code: -38001, Message: "Unknown payload"}
Functions ¶
This section is empty.
Types ¶
type ForkValidator ¶
type ForkValidator struct {
// contains filtered or unexported fields
}
func NewForkValidator ¶
func NewForkValidator(ctx context.Context, currentHeight uint64, validatePayload validatePayloadFunc, tmpDir string, blockReader services.FullBlockReader) *ForkValidator
func NewForkValidatorMock ¶
func NewForkValidatorMock(currentHeight uint64) *ForkValidator
func (*ForkValidator) ClearWithUnwind ¶
func (fv *ForkValidator) ClearWithUnwind(accumulator *shards.Accumulator, c shards.StateChangeConsumer)
Clear wipes out current extending fork data.
func (*ForkValidator) ExtendingForkHeadHash ¶
func (fv *ForkValidator) ExtendingForkHeadHash() libcommon.Hash
ExtendingForkHeadHash return the fork head hash of the fork that extends the canonical chain.
func (*ForkValidator) FlushExtendingFork ¶
func (fv *ForkValidator) FlushExtendingFork(tx kv.RwTx, accumulator *shards.Accumulator) error
FlushExtendingFork flush the current extending fork if fcu chooses its head hash as the its forkchoice.
func (*ForkValidator) NotifyCurrentHeight ¶
func (fv *ForkValidator) NotifyCurrentHeight(currentHeight uint64)
NotifyCurrentHeight is to be called at the end of the stage cycle and represent the last processed block.
func (*ForkValidator) ValidatePayload ¶
func (fv *ForkValidator) ValidatePayload(tx kv.Tx, header *types.Header, body *types.RawBody, extendCanonical bool) (status engine_types.EngineStatus, latestValidHash libcommon.Hash, validationError error, criticalError error)
ValidatePayload returns whether a payload is valid or invalid, or if cannot be determined, it will be accepted. if the payload extends the canonical chain, then we stack it in extendingFork without any unwind. if the payload is a fork then we unwind to the point where the fork meets the canonical chain, and there we check whether it is valid. if for any reason none of the actions above can be performed due to lack of information, we accept the payload and avoid validation.