Documentation ¶
Overview ¶
The block header feeder package enables automated lookback and blockhash filling beyond the EVM 256 block lookback window to catch missed block hashes.
Index ¶
- func CheckFromAddressesExist(ctx context.Context, jb job.Job, gethks keystore.Eth) (err error)
- func ValidatedSpec(tomlString string) (job.Job, error)
- type BatchBHS
- type BlockHeaderFeeder
- type BlockHeaderProvider
- type Client
- type Delegate
- func (d *Delegate) AfterJobCreated(spec job.Job)
- func (d *Delegate) BeforeJobCreated(spec job.Job)
- func (d *Delegate) BeforeJobDeleted(spec job.Job)
- func (d *Delegate) JobType() job.Type
- func (d *Delegate) OnDeleteJob(ctx context.Context, spec job.Job, q pg.Queryer) error
- func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) ([]job.ServiceCtx, error)
- type GethBlockHeaderProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFromAddressesExist ¶
CheckFromAddressesExist returns an error if and only if one of the addresses in the BlockHeaderFeeder spec's fromAddresses field does not exist in the keystore.
Types ¶
type BatchBHS ¶
type BatchBHS interface { // GetBlockhashes returns blockhashes for given blockNumbers GetBlockhashes(ctx context.Context, blockNumbers []*big.Int) ([][32]byte, error) // StoreVerifyHeader stores blockhashes on-chain by using block headers StoreVerifyHeader(ctx context.Context, blockNumbers []*big.Int, blockHeaders [][]byte, fromAddress common.Address) error }
BatchBHS defines an interface for interacting with a BatchBlockhashStore contract.
type BlockHeaderFeeder ¶
type BlockHeaderFeeder struct {
// contains filtered or unexported fields
}
BlockHeaderFeeder checks recent VRF coordinator events and stores any blockhashes for blocks within waitBlocks and lookbackBlocks that have unfulfilled requests.
func NewBlockHeaderFeeder ¶
func NewBlockHeaderFeeder( logger logger.Logger, coordinator blockhashstore.Coordinator, bhs blockhashstore.BHS, batchBHS BatchBHS, blockHeaderProvider BlockHeaderProvider, waitBlocks int, lookbackBlocks int, latestBlock func(ctx context.Context) (uint64, error), gethks keystore.Eth, getBlockhashesBatchSize uint16, storeBlockhashesBatchSize uint16, fromAddresses []types.EIP55Address, chainID *big.Int, ) *BlockHeaderFeeder
NewBlockHeaderFeeder creates a new BlockHeaderFeeder instance.
type BlockHeaderProvider ¶
type Delegate ¶
type Delegate struct {
// contains filtered or unexported fields
}
func NewDelegate ¶
func (*Delegate) AfterJobCreated ¶
AfterJobCreated satisfies the job.Delegate interface.
func (*Delegate) BeforeJobCreated ¶
func (*Delegate) BeforeJobDeleted ¶
BeforeJobDeleted satisfies the job.Delegate interface.
func (*Delegate) OnDeleteJob ¶
OnDeleteJob satisfies the job.Delegate interface.
func (*Delegate) ServicesForSpec ¶
ServicesForSpec satisfies the job.Delegate interface.
type GethBlockHeaderProvider ¶
type GethBlockHeaderProvider struct {
// contains filtered or unexported fields
}
func NewGethBlockHeaderProvider ¶
func NewGethBlockHeaderProvider(client Client) *GethBlockHeaderProvider
func (*GethBlockHeaderProvider) RlpHeadersBatch ¶
func (p *GethBlockHeaderProvider) RlpHeadersBatch(ctx context.Context, blockRange []*big.Int) ([][]byte, error)
RlpHeadersBatch retrieves RLP-encoded block headers this function is not supported for Avax because Avalanche block header format is different from go-ethereum types.Header. validation for invalid chain ID is done upstream in blockheaderfeeder.validate.go