Documentation ¶
Index ¶
- type ExecForkActor
- type ExecForkSuppressor
- func (s *ExecForkSuppressor) Add(newSeal *flow.IncorporatedResultSeal) (bool, error)
- func (s *ExecForkSuppressor) All() []*flow.IncorporatedResultSeal
- func (s *ExecForkSuppressor) ByID(identifier flow.Identifier) (*flow.IncorporatedResultSeal, bool)
- func (s *ExecForkSuppressor) Clear()
- func (s *ExecForkSuppressor) Limit() uint
- func (s *ExecForkSuppressor) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)
- func (s *ExecForkSuppressor) Rem(id flow.Identifier) bool
- func (s *ExecForkSuppressor) Size() uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecForkActor ¶
type ExecForkActor func([]*flow.IncorporatedResultSeal)
func LogForkAndCrash ¶
func LogForkAndCrash(log zerolog.Logger) ExecForkActor
type ExecForkSuppressor ¶
type ExecForkSuppressor struct {
// contains filtered or unexported fields
}
ExecForkSuppressor is a wrapper around a conventional mempool.IncorporatedResultSeals mempool. It implements the following mitigation strategy for execution forks:
- In case two conflicting results are considered sealable for the same block, sealing should halt. Specifically, two results are considered conflicting, if they differ in their start or end state.
- Even after a restart, the sealing should not resume.
- We rely on human intervention to resolve the conflict.
The ExecForkSuppressor implements this mitigation strategy as follows:
- For each candidate seal inserted into the mempool, inspect the state transition for the respective block.
- If this is the first seal for a block, store the seal as an archetype for the state transition into the internal map `sealsForBlock`.
- If the mempool already knows about a state transition for a block, and a second seal for the same block is inserted, check whether the seal has the same state transition.
- If conflicting state transitions for the same block are detected, ExecForkSuppressor sets an internal flag and thereafter reports the mempool as empty, which will lead to the respective consensus node not including any more seals.
- Evidence for an execution fork stored in a database (persisted across restarts).
Implementation is concurrency safe.
func NewExecStateForkSuppressor ¶
func NewExecStateForkSuppressor(onExecFork ExecForkActor, seals mempool.IncorporatedResultSeals, db *badger.DB, log zerolog.Logger) (*ExecForkSuppressor, error)
func (*ExecForkSuppressor) Add ¶
func (s *ExecForkSuppressor) Add(newSeal *flow.IncorporatedResultSeal) (bool, error)
Add adds the given seal to the mempool. Return value indicates whether or not seal was added to mempool. Error returns:
- engine.InvalidInputError (sentinel error) In case a seal fails one of the required consistency checks;
func (*ExecForkSuppressor) All ¶
func (s *ExecForkSuppressor) All() []*flow.IncorporatedResultSeal
All returns all the IncorporatedResultSeals in the mempool
func (*ExecForkSuppressor) ByID ¶
func (s *ExecForkSuppressor) ByID(identifier flow.Identifier) (*flow.IncorporatedResultSeal, bool)
ByID returns an IncorporatedResultSeal by its ID
func (*ExecForkSuppressor) Clear ¶
func (s *ExecForkSuppressor) Clear()
Clear removes all entities from the pool. The wrapper clears the internal state as well as its local (additional) state.
func (*ExecForkSuppressor) Limit ¶
func (s *ExecForkSuppressor) Limit() uint
Limit returns the size limit of the mempool
func (*ExecForkSuppressor) RegisterEjectionCallbacks ¶
func (s *ExecForkSuppressor) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)
RegisterEjectionCallbacks adds the provided OnEjection callbacks
func (*ExecForkSuppressor) Rem ¶
func (s *ExecForkSuppressor) Rem(id flow.Identifier) bool
Rem removes the IncorporatedResultSeal with id from the mempool
func (*ExecForkSuppressor) Size ¶
func (s *ExecForkSuppressor) Size() uint
Size returns the number of items in the mempool