Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultELSyncPolicy ¶
func DefaultELSyncPolicy() eth.ELSyncPolicy
Types ¶
type WindowSyncPolicy ¶
type WindowSyncPolicy struct {
// contains filtered or unexported fields
}
WindowSyncPolicy implements eth.ELSyncPolicy by maintaining a sliding window of recently observed payload numbers (block heights) and determining when the execution layer (EL) should be considered fully synced.
Conceptually, the policy tracks the most recent payload numbers in a sorted, duplicate-free cache. When a new payload number is reported, it is inserted into the cache while removing any entries greater than or equal to it - simulating a reorg or an out-of-order unsafe payload insertion. The cache size is capped by maxSize.
The EL is considered SYNCING until the following conditions are met:
- At least cnt payload numbers have been observed, and
- The last cnt numbers in the cache form a consecutive sequence ending exactly at the most recent number.
Once both conditions hold, ELSyncStatus(num) returns ExecutionValid. Otherwise, it returns ExecutionSyncing.
Example:
With cnt=3 and maxSize=5, the policy reports SYNCING until it has seen three consecutive payloads (for example 10, 11, 12). After that, it reports VALID for subsequent payloads unless a reorg or out-of-order insertion causes the cache to break the consecutive sequence.
func NewWindowSyncPolicy ¶
func NewWindowSyncPolicy(cnt, maxSize uint64) *WindowSyncPolicy
func (*WindowSyncPolicy) ELSyncStatus ¶
func (e *WindowSyncPolicy) ELSyncStatus(num uint64) eth.ExecutePayloadStatus