Documentation
¶
Index ¶
- Variables
- func LimitRPC(c client.RPC, concurrentRequests int) client.RPC
- type HeaderInfo
- func (info *HeaderInfo) BaseFee() *big.Int
- func (info *HeaderInfo) BlockRef() eth.L1BlockRef
- func (info *HeaderInfo) Hash() common.Hash
- func (info *HeaderInfo) ID() eth.BlockID
- func (info *HeaderInfo) MixDigest() common.Hash
- func (info *HeaderInfo) NumberU64() uint64
- func (info *HeaderInfo) ParentHash() common.Hash
- func (info *HeaderInfo) ReceiptHash() common.Hash
- func (info *HeaderInfo) Root() common.Hash
- func (info *HeaderInfo) Time() uint64
- type Source
- func (s *Source) Close()
- func (s *Source) Fetch(ctx context.Context, blockHash common.Hash) (eth.L1Info, types.Transactions, types.Receipts, error)
- func (s *Source) FetchAllTransactions(ctx context.Context, window []eth.BlockID) ([]types.Transactions, error)
- func (s *Source) InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.L1Info, types.Transactions, error)
- func (s *Source) InfoAndTxsByNumber(ctx context.Context, number uint64) (eth.L1Info, types.Transactions, error)
- func (s *Source) InfoAndTxsHead(ctx context.Context) (eth.L1Info, types.Transactions, error)
- func (s *Source) InfoByHash(ctx context.Context, hash common.Hash) (eth.L1Info, error)
- func (s *Source) InfoByNumber(ctx context.Context, number uint64) (eth.L1Info, error)
- func (s *Source) InfoHead(ctx context.Context) (eth.L1Info, error)
- func (s *Source) L1BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L1BlockRef, error)
- func (s *Source) L1BlockRefByNumber(ctx context.Context, l1Num uint64) (eth.L1BlockRef, error)
- func (s *Source) L1HeadBlockRef(ctx context.Context) (eth.L1BlockRef, error)
- func (s *Source) L1Range(ctx context.Context, begin eth.BlockID, max uint64) ([]eth.BlockID, error)
- func (s *Source) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- type SourceConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
TooManyRetries = errors.New("too many retries")
)
Functions ¶
Types ¶
type HeaderInfo ¶
type HeaderInfo struct {
// contains filtered or unexported fields
}
func (*HeaderInfo) BaseFee ¶
func (info *HeaderInfo) BaseFee() *big.Int
func (*HeaderInfo) BlockRef ¶
func (info *HeaderInfo) BlockRef() eth.L1BlockRef
func (*HeaderInfo) Hash ¶
func (info *HeaderInfo) Hash() common.Hash
func (*HeaderInfo) ID ¶
func (info *HeaderInfo) ID() eth.BlockID
func (*HeaderInfo) MixDigest ¶
func (info *HeaderInfo) MixDigest() common.Hash
func (*HeaderInfo) NumberU64 ¶
func (info *HeaderInfo) NumberU64() uint64
func (*HeaderInfo) ParentHash ¶
func (info *HeaderInfo) ParentHash() common.Hash
func (*HeaderInfo) ReceiptHash ¶
func (info *HeaderInfo) ReceiptHash() common.Hash
func (*HeaderInfo) Root ¶
func (info *HeaderInfo) Root() common.Hash
func (*HeaderInfo) Time ¶
func (info *HeaderInfo) Time() uint64
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source to retrieve L1 data from with optimized batch requests, cached results, and flag to not trust the RPC.
func NewSource ¶
func NewSource(client client.RPC, log log.Logger, metrics caching.Metrics, config *SourceConfig) (*Source, error)
NewSource wraps a RPC with bindings to fetch L1 data, while logging errors, tracking metrics (optional), and caching.
func (*Source) FetchAllTransactions ¶
func (s *Source) FetchAllTransactions(ctx context.Context, window []eth.BlockID) ([]types.Transactions, error)
FetchAllTransactions fetches transaction lists of a window of blocks, and caches each block and the transactions
func (*Source) InfoAndTxsByHash ¶
func (*Source) InfoAndTxsByNumber ¶
func (*Source) InfoAndTxsHead ¶
func (*Source) InfoByHash ¶
func (*Source) InfoByNumber ¶
func (*Source) L1BlockRefByHash ¶
func (*Source) L1BlockRefByNumber ¶
func (*Source) L1HeadBlockRef ¶
type SourceConfig ¶
type SourceConfig struct { // batching parameters MaxParallelBatching int MaxBatchRetry int MaxRequestsPerBatch int // limit concurrent requests, applies to the source as a whole MaxConcurrentRequests int // Number of blocks worth of receipts to cache ReceiptsCacheSize int // Number of blocks worth of transactions to cache TransactionsCacheSize int // Number of block headers to cache HeadersCacheSize int // If the RPC is untrusted, then we should not use cached information from responses, // and instead verify against the block-hash. // Of real L1 blocks no deposits can be missed/faked, no batches can be missed/faked, // only the wrong L1 blocks can be retrieved. TrustRPC bool }
func DefaultConfig ¶
func DefaultConfig(config *rollup.Config, trustRPC bool) *SourceConfig
func (*SourceConfig) Check ¶
func (c *SourceConfig) Check() error
Click to show internal directories.
Click to hide internal directories.