ethereum

package
v0.0.0-...-2eef473 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: LGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTrie

func CreateTrie(list types.DerivableList, trie *trie.Trie) *trie.Trie

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

func MakeMessageFromEvent(event *etypes.Log, receiptsTrie *etrie.Trie) (*parachain.Message, error)

func MakeTrie

func MakeTrie(items types.Receipts) (*trie.Trie, error)

func ResolvePrivateKey

func ResolvePrivateKey(privateKey, privateKeyFile string) (*secp256k1.Keypair, error)

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)

func (*BlockCache) Insert

func (bc *BlockCache) Insert(block *gethTypes.Block, receiptTrie *gethTrie.Trie)

type BlockLoader

type BlockLoader interface {
	GetBlock(ctx context.Context, hash gethCommon.Hash) (*gethTypes.Block, error)
	GetAllReceipts(ctx context.Context, block *gethTypes.Block) (gethTypes.Receipts, error)
}

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) Connect

func (co *Connection) Connect(ctx context.Context) error

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 (d *DefaultBlockLoader) GetAllReceipts(ctx context.Context, block *gethTypes.Block) (gethTypes.Receipts, error)

func (*DefaultBlockLoader) GetBlock

type Header struct {
	Fields headerSCALE
	// contains filtered or unexported fields
}

func MakeHeaderData

func MakeHeaderData(gethheader *etypes.Header) (*Header, error)

func (*Header) Decode

func (h *Header) Decode(decoder scale.Decoder) error

func (Header) Encode

func (h Header) Encode(encoder scale.Encoder) error

func (*Header) ID

func (h *Header) ID() HeaderID

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.

type HeaderID

type HeaderID struct {
	Number types.U64
	Hash   types.H256
}

type JsonError

type JsonError interface {
	Error() string
	ErrorCode() int
	ErrorData() interface{}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL