Documentation ¶
Index ¶
- func CreateTrie(list types.DerivableList, trie *trie.Trie) *trie.Trie
- func GetAllReceipts(ctx context.Context, conn *Connection, block *etypes.Block) (etypes.Receipts, error)
- func MakeMessageFromEvent(event *etypes.Log, receiptsTrie *etrie.Trie) (*parachain.Message, error)
- func MakeTrie(items types.Receipts) (*trie.Trie, error)
- func ResolvePrivateKey(privateKey, privateKeyFile, privateKeyID string) (*secp256k1.Keypair, error)
- type BlockCache
- type BlockLoader
- type Connection
- func (co *Connection) ChainID() *big.Int
- func (co *Connection) Client() *ethclient.Client
- func (co *Connection) Close()
- func (co *Connection) Connect(ctx context.Context) error
- func (co *Connection) Keypair() *secp256k1.Keypair
- func (co *Connection) MakeTxOpts(ctx context.Context) *bind.TransactOpts
- func (co *Connection) WatchTransaction(ctx context.Context, tx *types.Transaction, confirmations uint64) (*types.Receipt, error)
- type DefaultBlockLoader
- type Header
- type HeaderCache
- type HeaderID
- type JsonError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTrie ¶
CreateTrie creates the tree hashes of transactions and receipts in a block header.
func GetAllReceipts ¶
func GetAllReceipts(ctx context.Context, conn *Connection, block *etypes.Block) (etypes.Receipts, error)
Fetch all receipts for the given block in batches of `receiptFetchBatchSize`
func MakeMessageFromEvent ¶
Types ¶
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
Keeps the blocks and receipts for the latest block heights / numbers in memory (up to `capacity` block numbers)
func NewBlockCache ¶
func NewBlockCache(capacity int) *BlockCache
func (*BlockCache) Get ¶
func (bc *BlockCache) Get(hash gethCommon.Hash) (*gethTypes.Block, *gethTrie.Trie, bool)
type BlockLoader ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(config *config.EthereumConfig, kp *secp256k1.Keypair) *Connection
func (*Connection) ChainID ¶
func (co *Connection) ChainID() *big.Int
func (*Connection) Client ¶
func (co *Connection) Client() *ethclient.Client
func (*Connection) Close ¶
func (co *Connection) Close()
func (*Connection) Keypair ¶
func (co *Connection) Keypair() *secp256k1.Keypair
func (*Connection) MakeTxOpts ¶
func (co *Connection) MakeTxOpts(ctx context.Context) *bind.TransactOpts
func (*Connection) WatchTransaction ¶
func (co *Connection) WatchTransaction(ctx context.Context, tx *types.Transaction, confirmations uint64) (*types.Receipt, error)
type DefaultBlockLoader ¶
type DefaultBlockLoader struct {
Conn *Connection
}
func (*DefaultBlockLoader) GetAllReceipts ¶
func (*DefaultBlockLoader) GetBlock ¶
func (d *DefaultBlockLoader) GetBlock(ctx context.Context, hash gethCommon.Hash) (*gethTypes.Block, error)
type HeaderCache ¶
type HeaderCache struct {
// contains filtered or unexported fields
}
HeaderCache fetches and caches data we need to construct proofs as we move along the Ethereum chain.
func NewHeaderBlockCache ¶
func NewHeaderBlockCache( bl BlockLoader, ) (*HeaderCache, error)
Instantiates a Header Cache with just a block loader and block cache. Used by beacon relayer.
func (*HeaderCache) GetReceiptTrie ¶
func (s *HeaderCache) GetReceiptTrie(ctx context.Context, hash gethCommon.Hash) (*gethTrie.Trie, error)
GetReceiptTrie returns a Merkle Patricia trie constructed from the receipts of the block specified by `hash`. If the trie isn't cached, it will block for multiple seconds to fetch receipts and construct the trie.