Documentation ¶
Index ¶
- Constants
- Variables
- func SubscribeNewHeadByPolling(ctx context.Context, client ethClient, headCh chan<- *types.Header, ...) event.Subscription
- type BlockTag
- type EthClient
- type EthState
- func (s *EthState) Finalized() types.BlockID
- func (s *EthState) Head() types.BlockID
- func (s *EthState) OnFinalized(_ context.Context, header *ethTypes.Header) error
- func (s *EthState) OnLatest(_ context.Context, header *ethTypes.Header) error
- func (s *EthState) OnSafe(_ context.Context, header *ethTypes.Header) error
- func (s *EthState) Safe() types.BlockID
- func (s *EthState) Tips() (types.BlockID, types.BlockID, types.BlockID)
- type EthSyncer
- type LazyEthClient
- type OnNewHandler
Constants ¶
View Source
const ( EthSlotInterval = 12 * time.Second EthEpochInterval = 6*time.Minute + 24*time.Second )
TODO: move to config
Variables ¶
Functions ¶
Types ¶
type BlockTag ¶
type BlockTag string
const ( // - L1: The most recent block in the canonical chain observed by the client, // this block may be re-orged out of the canonical chain even under healthy/normal conditions // - L2: Local chain head (unconfirmed on L1) Latest BlockTag = "latest" // - L1: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions // - L2: Derived chain tip from (not-necessarily safe) L1 data Safe BlockTag = "safe" // - L1: The most recent crypto-economically secure block, // cannot be re-orged outside of manual intervention driven by community coordination // - L2: Derived chain tip from finalized L1 data Finalized BlockTag = "finalized" )
Block tags (used both for L1 and L2) https://ethereum.github.io/execution-apis/api-documentation/
type EthClient ¶
func DialWithRetry ¶
func NewEthClient ¶
func (*EthClient) HeaderByTag ¶
func (*EthClient) SuggestGasTipCap ¶
type EthState ¶
type EthState struct {
// contains filtered or unexported fields
}
Thread-safe. Tracks the latest, last safe and last finalized L1 headers received.
func NewEthState ¶
func NewEthState() *EthState
func (*EthState) OnFinalized ¶
type EthSyncer ¶
type EthSyncer struct { OnNewHandler LatestHeaderBroker *utils.Broker[*types.Header] SafeHeaderBroker *utils.Broker[*types.Header] FinalizedHeaderBroker *utils.Broker[*types.Header] // contains filtered or unexported fields }
func NewEthSyncer ¶
func NewEthSyncer(handler OnNewHandler) *EthSyncer
type LazyEthClient ¶
type LazyEthClient struct { *EthClient // contains filtered or unexported fields }
func NewLazilyDialedEthClient ¶
func NewLazilyDialedEthClient(endpoint string, retryOpts ...retry.Option) *LazyEthClient
func (*LazyEthClient) EnsureDialed ¶
func (c *LazyEthClient) EnsureDialed(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.