Documentation ¶
Index ¶
- Constants
- type ClientHandler
- func (c *ClientHandler) Call(ctx context.Context, data []byte, from common.Address, height uint64) ([]byte, error)
- func (c *ClientHandler) EstimateGas(ctx context.Context, data []byte, from common.Address, height uint64) (uint64, error)
- func (c *ClientHandler) GetBalance(ctx context.Context, address common.Address, height uint64) (*big.Int, error)
- func (c *ClientHandler) GetCode(ctx context.Context, address common.Address, height uint64) ([]byte, error)
- func (c *ClientHandler) GetLatestEVMHeight(ctx context.Context) (uint64, error)
- func (c *ClientHandler) GetNonce(ctx context.Context, address common.Address, height uint64) (uint64, error)
- func (c *ClientHandler) GetStorageAt(ctx context.Context, address common.Address, hash common.Hash, height uint64) (common.Hash, error)
- func (c *ClientHandler) SendRawTransaction(ctx context.Context, data []byte) (common.Hash, error)
- type CrossSporkClient
- func (c *CrossSporkClient) ExecuteScriptAtBlockHeight(ctx context.Context, height uint64, script []byte, arguments []cadence.Value) (cadence.Value, error)
- func (c *CrossSporkClient) GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flow.BlockHeader, error)
- func (c *CrossSporkClient) GetLatestHeightForSpork(ctx context.Context, height uint64) (uint64, error)
- func (c *CrossSporkClient) IsPastSpork(height uint64) bool
- func (c *CrossSporkClient) SubscribeEventsByBlockHeight(ctx context.Context, startHeight uint64, filter flow.EventFilter, ...) (<-chan flow.BlockEvents, <-chan error, error)
- type EVMClient
- type KMSKeyRotationSigner
- type KeyRotationSigner
- type LocalClient
- func (l *LocalClient) Call(ctx context.Context, data []byte, from common.Address, evmHeight uint64) ([]byte, error)
- func (l *LocalClient) EstimateGas(ctx context.Context, data []byte, from common.Address, evmHeight uint64) (uint64, error)
- func (l *LocalClient) GetBalance(ctx context.Context, address common.Address, evmHeight uint64) (*big.Int, error)
- func (l *LocalClient) GetCode(ctx context.Context, address common.Address, height uint64) ([]byte, error)
- func (l *LocalClient) GetLatestEVMHeight(ctx context.Context) (uint64, error)
- func (l *LocalClient) GetNonce(ctx context.Context, address common.Address, evmHeight uint64) (uint64, error)
- func (l *LocalClient) GetStorageAt(ctx context.Context, address common.Address, hash common.Hash, ...) (common.Hash, error)
- func (l *LocalClient) SendRawTransaction(ctx context.Context, data []byte) (common.Hash, error)
- type RemoteClient
- func (e *RemoteClient) Call(ctx context.Context, data []byte, from common.Address, evmHeight uint64) ([]byte, error)
- func (e *RemoteClient) EstimateGas(ctx context.Context, data []byte, from common.Address, evmHeight uint64) (uint64, error)
- func (e *RemoteClient) GetBalance(ctx context.Context, address common.Address, evmHeight uint64) (*big.Int, error)
- func (e *RemoteClient) GetCode(ctx context.Context, address common.Address, height uint64) ([]byte, error)
- func (e *RemoteClient) GetLatestEVMHeight(ctx context.Context) (uint64, error)
- func (e *RemoteClient) GetNonce(ctx context.Context, address common.Address, evmHeight uint64) (uint64, error)
- func (e *RemoteClient) GetStorageAt(ctx context.Context, address common.Address, hash common.Hash, ...) (common.Hash, error)
- func (e *RemoteClient) SendRawTransaction(ctx context.Context, data []byte) (common.Hash, error)
- type TxPool
Constants ¶
const LatestBlockHeight uint64 = math.MaxUint64 - 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientHandler ¶
type ClientHandler struct {
// contains filtered or unexported fields
}
ClientHandler handles remote and local client for executing EVM operations. The handler contains logic that can switch between using local or remote client and implements error handling logic that can prefer either remote result or local result.
func NewClientHandler ¶
func NewClientHandler( config *config.Config, store *pebble.Storage, txPool *TxPool, signer crypto.Signer, client *CrossSporkClient, blocks storage.BlockIndexer, receipts storage.ReceiptIndexer, logger zerolog.Logger, collector metrics.Collector, ) (*ClientHandler, error)
func (*ClientHandler) EstimateGas ¶
func (*ClientHandler) GetBalance ¶
func (*ClientHandler) GetLatestEVMHeight ¶
func (c *ClientHandler) GetLatestEVMHeight(ctx context.Context) (uint64, error)
func (*ClientHandler) GetStorageAt ¶
func (*ClientHandler) SendRawTransaction ¶
type CrossSporkClient ¶ added in v0.12.0
CrossSporkClient is a wrapper around the Flow AN client that can access different AN APIs based on the height boundaries of the sporks.
Each spork is defined with the last height included in that spork, based on the list we know which AN client to use when requesting the data.
Any API that supports cross-spork access must have a defined function that shadows the original access Client function.
func NewCrossSporkClient ¶ added in v0.12.0
func NewCrossSporkClient( currentSpork access.Client, pastSporks []access.Client, logger zerolog.Logger, chainID flowGo.ChainID, ) (*CrossSporkClient, error)
NewCrossSporkClient creates a new instance of the multi-spork client. It requires the current spork client and a slice of past spork clients.
func (*CrossSporkClient) ExecuteScriptAtBlockHeight ¶ added in v0.12.0
func (*CrossSporkClient) GetBlockHeaderByHeight ¶ added in v0.12.0
func (c *CrossSporkClient) GetBlockHeaderByHeight( ctx context.Context, height uint64, ) (*flow.BlockHeader, error)
func (*CrossSporkClient) GetLatestHeightForSpork ¶ added in v0.12.0
func (c *CrossSporkClient) GetLatestHeightForSpork(ctx context.Context, height uint64) (uint64, error)
GetLatestHeightForSpork will determine the spork client in which the provided height is contained and then find the latest height in that spork.
func (*CrossSporkClient) IsPastSpork ¶ added in v0.12.0
func (c *CrossSporkClient) IsPastSpork(height uint64) bool
IsPastSpork will check if the provided height is contained in the previous sporks.
func (*CrossSporkClient) SubscribeEventsByBlockHeight ¶ added in v0.12.0
func (c *CrossSporkClient) SubscribeEventsByBlockHeight( ctx context.Context, startHeight uint64, filter flow.EventFilter, opts ...access.SubscribeOption, ) (<-chan flow.BlockEvents, <-chan error, error)
type EVMClient ¶
type EVMClient interface { // SendRawTransaction will submit signed transaction data to the network. // The submitted EVM transaction hash is returned. SendRawTransaction(ctx context.Context, data []byte) (common.Hash, error) // GetBalance returns the amount of wei for the given address in the state of the // given EVM block height. GetBalance(ctx context.Context, address common.Address, height uint64) (*big.Int, error) // Call executes the given signed transaction data on the state for the given EVM block height. // Note, this function doesn't make and changes in the state/blockchain and is // useful to execute and retrieve values. Call(ctx context.Context, data []byte, from common.Address, height uint64) ([]byte, error) // EstimateGas executes the given signed transaction data on the state for the given EVM block height. // Note, this function doesn't make any changes in the state/blockchain and is // useful to executed and retrieve the gas consumption and possible failures. EstimateGas(ctx context.Context, data []byte, from common.Address, height uint64) (uint64, error) // GetNonce gets nonce from the network at the given EVM block height. GetNonce(ctx context.Context, address common.Address, height uint64) (uint64, error) // GetCode returns the code stored at the given address in // the state for the given EVM block height. GetCode(ctx context.Context, address common.Address, height uint64) ([]byte, error) // GetLatestEVMHeight returns the latest EVM height of the network. GetLatestEVMHeight(ctx context.Context) (uint64, error) // GetStorageAt returns the storage from the state at the given address, key and block number. GetStorageAt(ctx context.Context, address common.Address, hash common.Hash, height uint64) (common.Hash, error) }
type KMSKeyRotationSigner ¶ added in v0.18.0
type KMSKeyRotationSigner struct {
// contains filtered or unexported fields
}
KMSKeyRotationSigner is a crypto signer that contains a pool of `crypto.Signer`[1] objects, each of which is tied to a Cloud KMS asymmetric signing key. It keeps track of the signer/key combination that should be used for the next incoming signing request. This allows for faster submission of transactions to the network, due to a sequence number not being reused between different keys used. It also contains logic to queue up signature requests and in case there are more transactions pending than the keys in the pool it will wait for transactions to get executed so the new sequence key can be obtained. The signer is concurrency-safe.
[1](https://github.com/onflow/flow-go-sdk/blob/master/crypto/cloudkms/signer.go#L37)
func NewKMSKeyRotationSigner ¶ added in v0.18.0
func NewKMSKeyRotationSigner( ctx context.Context, keys []cloudkms.Key, logger zerolog.Logger, ) (*KMSKeyRotationSigner, error)
NewKMSKeyRotationSigner returns a new KMSKeyRotationSigner, for the given slice of Cloud KMS keys.
func (*KMSKeyRotationSigner) PublicKey ¶ added in v0.18.0
func (s *KMSKeyRotationSigner) PublicKey() crypto.PublicKey
PublicKey returns the current public key which is available for signing.
type KeyRotationSigner ¶
type KeyRotationSigner struct {
// contains filtered or unexported fields
}
KeyRotationSigner is a crypto signer that contains a pool of key pairs to sign with, and it rotates the key used for each signing request. This allows for faster submission of transactions to the network, due to a sequence number not being reused between different keys used. It also contains logic to queue up signature requests and in case there are more transactions pending than the keys in the pool it will wait for transactions to get executed so the new sequence key can be obtained. The signer is concurrency-safe.
func NewKeyRotationSigner ¶
func NewKeyRotationSigner(keys []crypto.PrivateKey, hashAlgo crypto.HashAlgorithm) (*KeyRotationSigner, error)
func (*KeyRotationSigner) PublicKey ¶
func (k *KeyRotationSigner) PublicKey() crypto.PublicKey
PublicKey returns the current public key which is available for signing.
type LocalClient ¶
type LocalClient struct {
// contains filtered or unexported fields
}
LocalClient preforms read-only queries on the local state. The client is created with the state instance which is initialized using a evm height so all the methods that take evm height as parameter can ignore it since the state is already initialized with it.
func NewLocalClient ¶
func NewLocalClient(state *state.BlockState, blocks storage.BlockIndexer) *LocalClient
func (*LocalClient) EstimateGas ¶
func (*LocalClient) GetBalance ¶
func (*LocalClient) GetLatestEVMHeight ¶
func (l *LocalClient) GetLatestEVMHeight(ctx context.Context) (uint64, error)
func (*LocalClient) GetStorageAt ¶
func (*LocalClient) SendRawTransaction ¶
type RemoteClient ¶
type RemoteClient struct {
// contains filtered or unexported fields
}
func NewRemote ¶
func NewRemote( client *CrossSporkClient, config *config.Config, signer crypto.Signer, logger zerolog.Logger, blocks storage.BlockIndexer, txPool *TxPool, collector metrics.Collector, ) (*RemoteClient, error)
func (*RemoteClient) EstimateGas ¶
func (*RemoteClient) GetBalance ¶
func (*RemoteClient) GetLatestEVMHeight ¶
func (e *RemoteClient) GetLatestEVMHeight(ctx context.Context) (uint64, error)
func (*RemoteClient) GetStorageAt ¶
func (*RemoteClient) SendRawTransaction ¶
type TxPool ¶ added in v0.21.0
type TxPool struct {
// contains filtered or unexported fields
}
func (*TxPool) Send ¶ added in v0.21.0
func (t *TxPool) Send( ctx context.Context, flowTx *flow.Transaction, evmTx *gethTypes.Transaction, ) error
Send flow transaction that executes EVM run function which takes in the encoded EVM transaction. The flow transaction status is awaited and an error is returned in case of a failure in submission, or an EVM validation error. Until the flow transaction is sealed the transaction will stay in the transaction pool marked as pending.