Documentation ¶
Index ¶
- Constants
- func GetEthClientLatestBlockTimestamp(ec eth.IExecutionClient) (uint64, error)
- func IsSyncWithinThreshold(ec eth.IExecutionClient) (bool, time.Time, error)
- type BeaconClientManager
- func (m *BeaconClientManager) ChangeWithdrawalCredentials(ctx context.Context, validatorIndex string, ...) error
- func (m *BeaconClientManager) CheckStatus(ctx context.Context, checkChainIDs bool) *types.ClientManagerStatus
- func (m *BeaconClientManager) Close(ctx context.Context) error
- func (m *BeaconClientManager) ExitValidator(ctx context.Context, validatorIndex string, epoch uint64, ...) error
- func (m *BeaconClientManager) GetAttestations(ctx context.Context, blockId string) ([]beacon.AttestationInfo, bool, error)
- func (m *BeaconClientManager) GetBeaconBlock(ctx context.Context, blockId string) (beacon.BeaconBlock, bool, error)
- func (m *BeaconClientManager) GetBeaconBlockHeader(ctx context.Context, blockId string) (beacon.BeaconBlockHeader, bool, error)
- func (m *BeaconClientManager) GetBeaconHead(ctx context.Context) (beacon.BeaconHead, error)
- func (m *BeaconClientManager) GetClientTypeName() string
- func (m *BeaconClientManager) GetCommitteesForEpoch(ctx context.Context, epoch *uint64) (beacon.Committees, error)
- func (m *BeaconClientManager) GetDomainData(ctx context.Context, domainType []byte, epoch uint64, useGenesisFork bool) ([]byte, error)
- func (m *BeaconClientManager) GetEth1DataForEth2Block(ctx context.Context, blockId string) (beacon.Eth1Data, bool, error)
- func (m *BeaconClientManager) GetEth2Config(ctx context.Context) (beacon.Eth2Config, error)
- func (m *BeaconClientManager) GetEth2DepositContract(ctx context.Context) (beacon.Eth2DepositContract, error)
- func (m *BeaconClientManager) GetFallbackClient() beacon.IBeaconClient
- func (m *BeaconClientManager) GetPrimaryClient() beacon.IBeaconClient
- func (m *BeaconClientManager) GetSyncStatus(ctx context.Context) (beacon.SyncStatus, error)
- func (m *BeaconClientManager) GetValidatorIndex(ctx context.Context, pubkey beacon.ValidatorPubkey) (string, error)
- func (m *BeaconClientManager) GetValidatorProposerDuties(ctx context.Context, indices []string, epoch uint64) (map[string]uint64, error)
- func (m *BeaconClientManager) GetValidatorStatus(ctx context.Context, pubkey beacon.ValidatorPubkey, ...) (beacon.ValidatorStatus, error)
- func (m *BeaconClientManager) GetValidatorStatusByIndex(ctx context.Context, index string, opts *beacon.ValidatorStatusOptions) (beacon.ValidatorStatus, error)
- func (m *BeaconClientManager) GetValidatorStatuses(ctx context.Context, pubkeys []beacon.ValidatorPubkey, ...) (map[beacon.ValidatorPubkey]beacon.ValidatorStatus, error)
- func (m *BeaconClientManager) GetValidatorSyncDuties(ctx context.Context, indices []string, epoch uint64) (map[string]bool, error)
- func (m *BeaconClientManager) IsFallbackEnabled() bool
- func (m *BeaconClientManager) IsFallbackReady() bool
- func (m *BeaconClientManager) IsPrimaryReady() bool
- func (m *BeaconClientManager) SetFallbackReady(ready bool)
- func (m *BeaconClientManager) SetPrimaryReady(ready bool)
- type ExecutionClientManager
- func (m *ExecutionClientManager) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (m *ExecutionClientManager) BlockNumber(ctx context.Context) (uint64, error)
- func (m *ExecutionClientManager) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (m *ExecutionClientManager) ChainID(ctx context.Context) (*big.Int, error)
- func (m *ExecutionClientManager) CheckStatus(ctx context.Context, checkChainIDs bool) *apitypes.ClientManagerStatus
- func (m *ExecutionClientManager) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
- func (m *ExecutionClientManager) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
- func (m *ExecutionClientManager) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
- func (m *ExecutionClientManager) GetClientTypeName() string
- func (m *ExecutionClientManager) GetFallbackClient() eth.IExecutionClient
- func (m *ExecutionClientManager) GetPrimaryClient() eth.IExecutionClient
- func (m *ExecutionClientManager) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (m *ExecutionClientManager) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (m *ExecutionClientManager) IsFallbackEnabled() bool
- func (m *ExecutionClientManager) IsFallbackReady() bool
- func (m *ExecutionClientManager) IsPrimaryReady() bool
- func (m *ExecutionClientManager) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (m *ExecutionClientManager) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (m *ExecutionClientManager) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (m *ExecutionClientManager) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (m *ExecutionClientManager) SetFallbackReady(ready bool)
- func (m *ExecutionClientManager) SetPrimaryReady(ready bool)
- func (m *ExecutionClientManager) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (m *ExecutionClientManager) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (m *ExecutionClientManager) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (m *ExecutionClientManager) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (m *ExecutionClientManager) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)
- func (m *ExecutionClientManager) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type IClientManager
- type ServiceProvider
- func (p *ServiceProvider) CancelContextOnShutdown()
- func (p *ServiceProvider) Close()
- func (p *ServiceProvider) GetApiLogger() *log.Logger
- func (p *ServiceProvider) GetBaseContext() context.Context
- func (p *ServiceProvider) GetBeaconClient() *BeaconClientManager
- func (p *ServiceProvider) GetConfig() config.IConfig
- func (p *ServiceProvider) GetDocker() dclient.APIClient
- func (p *ServiceProvider) GetEthClient() *ExecutionClientManager
- func (p *ServiceProvider) GetNetworkResources() *config.NetworkResources
- func (p *ServiceProvider) GetQueryManager() *eth.QueryManager
- func (p *ServiceProvider) GetTasksLogger() *log.Logger
- func (p *ServiceProvider) GetTransactionManager() *eth.TransactionManager
- func (p *ServiceProvider) GetWallet() *wallet.Wallet
Constants ¶
const (
DockerApiVersion string = "1.40"
)
Variables ¶
This section is empty.
Functions ¶
func GetEthClientLatestBlockTimestamp ¶
func GetEthClientLatestBlockTimestamp(ec eth.IExecutionClient) (uint64, error)
func IsSyncWithinThreshold ¶
Confirm the EC's latest block is within the threshold of the current system clock
Types ¶
type BeaconClientManager ¶
type BeaconClientManager struct {
// contains filtered or unexported fields
}
This is a proxy for multiple Beacon clients, providing natural fallback support if one of them fails.
func NewBeaconClientManager ¶
func NewBeaconClientManager(primaryBc beacon.IBeaconClient, chainID uint, clientTimeout time.Duration) *BeaconClientManager
Creates a new BeaconClientManager instance
func NewBeaconClientManagerWithFallback ¶ added in v0.4.0
func NewBeaconClientManagerWithFallback(primaryBc beacon.IBeaconClient, fallbackBc beacon.IBeaconClient, chainID uint, clientTimeout time.Duration) *BeaconClientManager
Creates a new BeaconClientManager instance with a fallback client
func (*BeaconClientManager) ChangeWithdrawalCredentials ¶
func (m *BeaconClientManager) ChangeWithdrawalCredentials(ctx context.Context, validatorIndex string, fromBlsPubkey beacon.ValidatorPubkey, toExecutionAddress common.Address, signature beacon.ValidatorSignature) error
Change the withdrawal credentials for a validator
func (*BeaconClientManager) CheckStatus ¶
func (m *BeaconClientManager) CheckStatus(ctx context.Context, checkChainIDs bool) *types.ClientManagerStatus
Get the status of the primary and fallback clients
func (*BeaconClientManager) Close ¶
func (m *BeaconClientManager) Close(ctx context.Context) error
Close the connection to the Beacon client
func (*BeaconClientManager) ExitValidator ¶
func (m *BeaconClientManager) ExitValidator(ctx context.Context, validatorIndex string, epoch uint64, signature beacon.ValidatorSignature) error
Voluntarily exit a validator
func (*BeaconClientManager) GetAttestations ¶
func (m *BeaconClientManager) GetAttestations(ctx context.Context, blockId string) ([]beacon.AttestationInfo, bool, error)
Get the attestations in a Beacon chain block
func (*BeaconClientManager) GetBeaconBlock ¶
func (m *BeaconClientManager) GetBeaconBlock(ctx context.Context, blockId string) (beacon.BeaconBlock, bool, error)
Get a Beacon chain block
func (*BeaconClientManager) GetBeaconBlockHeader ¶ added in v0.2.0
func (m *BeaconClientManager) GetBeaconBlockHeader(ctx context.Context, blockId string) (beacon.BeaconBlockHeader, bool, error)
Get the header of a Beacon chain block
func (*BeaconClientManager) GetBeaconHead ¶
func (m *BeaconClientManager) GetBeaconHead(ctx context.Context) (beacon.BeaconHead, error)
Get the Beacon chain's head information
func (*BeaconClientManager) GetClientTypeName ¶ added in v0.2.0
func (m *BeaconClientManager) GetClientTypeName() string
func (*BeaconClientManager) GetCommitteesForEpoch ¶ added in v0.2.0
func (m *BeaconClientManager) GetCommitteesForEpoch(ctx context.Context, epoch *uint64) (beacon.Committees, error)
Get the attestation committees for an epoch
func (*BeaconClientManager) GetDomainData ¶
func (m *BeaconClientManager) GetDomainData(ctx context.Context, domainType []byte, epoch uint64, useGenesisFork bool) ([]byte, error)
Get the Beacon chain's domain data
func (*BeaconClientManager) GetEth1DataForEth2Block ¶
func (m *BeaconClientManager) GetEth1DataForEth2Block(ctx context.Context, blockId string) (beacon.Eth1Data, bool, error)
Get the EL data for a CL block
func (*BeaconClientManager) GetEth2Config ¶
func (m *BeaconClientManager) GetEth2Config(ctx context.Context) (beacon.Eth2Config, error)
Get the Beacon configuration
func (*BeaconClientManager) GetEth2DepositContract ¶
func (m *BeaconClientManager) GetEth2DepositContract(ctx context.Context) (beacon.Eth2DepositContract, error)
Get the Beacon configuration
func (*BeaconClientManager) GetFallbackClient ¶ added in v0.2.0
func (m *BeaconClientManager) GetFallbackClient() beacon.IBeaconClient
func (*BeaconClientManager) GetPrimaryClient ¶ added in v0.2.0
func (m *BeaconClientManager) GetPrimaryClient() beacon.IBeaconClient
func (*BeaconClientManager) GetSyncStatus ¶
func (m *BeaconClientManager) GetSyncStatus(ctx context.Context) (beacon.SyncStatus, error)
Get the client's sync status
func (*BeaconClientManager) GetValidatorIndex ¶
func (m *BeaconClientManager) GetValidatorIndex(ctx context.Context, pubkey beacon.ValidatorPubkey) (string, error)
Get a validator's index
func (*BeaconClientManager) GetValidatorProposerDuties ¶
func (m *BeaconClientManager) GetValidatorProposerDuties(ctx context.Context, indices []string, epoch uint64) (map[string]uint64, error)
Get a validator's proposer duties
func (*BeaconClientManager) GetValidatorStatus ¶
func (m *BeaconClientManager) GetValidatorStatus(ctx context.Context, pubkey beacon.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (beacon.ValidatorStatus, error)
Get a validator's status by its pubkey
func (*BeaconClientManager) GetValidatorStatusByIndex ¶
func (m *BeaconClientManager) GetValidatorStatusByIndex(ctx context.Context, index string, opts *beacon.ValidatorStatusOptions) (beacon.ValidatorStatus, error)
Get a validator's status by its index
func (*BeaconClientManager) GetValidatorStatuses ¶
func (m *BeaconClientManager) GetValidatorStatuses(ctx context.Context, pubkeys []beacon.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (map[beacon.ValidatorPubkey]beacon.ValidatorStatus, error)
Get the statuses of multiple validators by their pubkeys
func (*BeaconClientManager) GetValidatorSyncDuties ¶
func (m *BeaconClientManager) GetValidatorSyncDuties(ctx context.Context, indices []string, epoch uint64) (map[string]bool, error)
Get a validator's sync duties
func (*BeaconClientManager) IsFallbackEnabled ¶ added in v0.2.0
func (m *BeaconClientManager) IsFallbackEnabled() bool
func (*BeaconClientManager) IsFallbackReady ¶
func (m *BeaconClientManager) IsFallbackReady() bool
func (*BeaconClientManager) IsPrimaryReady ¶
func (m *BeaconClientManager) IsPrimaryReady() bool
func (*BeaconClientManager) SetFallbackReady ¶ added in v0.3.1
func (m *BeaconClientManager) SetFallbackReady(ready bool)
func (*BeaconClientManager) SetPrimaryReady ¶ added in v0.3.1
func (m *BeaconClientManager) SetPrimaryReady(ready bool)
type ExecutionClientManager ¶
type ExecutionClientManager struct {
// contains filtered or unexported fields
}
This is a proxy for multiple ETH clients, providing natural fallback support if one of them fails.
func NewExecutionClientManager ¶
func NewExecutionClientManager(primaryEc eth.IExecutionClient, chainID uint, clientTimeout time.Duration) *ExecutionClientManager
Creates a new ExecutionClientManager instance
func NewExecutionClientManagerWithFallback ¶ added in v0.4.0
func NewExecutionClientManagerWithFallback(primaryEc eth.IExecutionClient, fallbackEc eth.IExecutionClient, chainID uint, clientTimeout time.Duration) *ExecutionClientManager
Creates a new ExecutionClientManager instance that includes a fallback client
func (*ExecutionClientManager) BalanceAt ¶
func (m *ExecutionClientManager) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt returns the wei balance of the given account. The block number can be nil, in which case the balance is taken from the latest known block.
func (*ExecutionClientManager) BlockNumber ¶
func (m *ExecutionClientManager) BlockNumber(ctx context.Context) (uint64, error)
BlockNumber returns the most recent block number
func (*ExecutionClientManager) CallContract ¶
func (m *ExecutionClientManager) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract executes an Ethereum contract call with the specified data as the input.
func (*ExecutionClientManager) CheckStatus ¶
func (m *ExecutionClientManager) CheckStatus(ctx context.Context, checkChainIDs bool) *apitypes.ClientManagerStatus
Get the status of the primary and fallback clients
func (*ExecutionClientManager) CodeAt ¶
func (m *ExecutionClientManager) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt returns the code of the given account. This is needed to differentiate between contract internal errors and the local chain being out of sync.
func (*ExecutionClientManager) EstimateGas ¶
func (m *ExecutionClientManager) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the backend blockchain. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.
func (*ExecutionClientManager) FilterLogs ¶
func (m *ExecutionClientManager) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
FilterLogs executes a log filter operation, blocking during execution and returning all the results in one batch.
TODO(karalabe): Deprecate when the subscription one can return past data too.
func (*ExecutionClientManager) GetClientTypeName ¶ added in v0.2.0
func (m *ExecutionClientManager) GetClientTypeName() string
func (*ExecutionClientManager) GetFallbackClient ¶ added in v0.2.0
func (m *ExecutionClientManager) GetFallbackClient() eth.IExecutionClient
func (*ExecutionClientManager) GetPrimaryClient ¶ added in v0.2.0
func (m *ExecutionClientManager) GetPrimaryClient() eth.IExecutionClient
func (*ExecutionClientManager) HeaderByHash ¶
func (m *ExecutionClientManager) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
HeaderByHash returns the block header with the given hash.
func (*ExecutionClientManager) HeaderByNumber ¶
func (m *ExecutionClientManager) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*ExecutionClientManager) IsFallbackEnabled ¶ added in v0.2.0
func (m *ExecutionClientManager) IsFallbackEnabled() bool
func (*ExecutionClientManager) IsFallbackReady ¶
func (m *ExecutionClientManager) IsFallbackReady() bool
func (*ExecutionClientManager) IsPrimaryReady ¶
func (m *ExecutionClientManager) IsPrimaryReady() bool
func (*ExecutionClientManager) NonceAt ¶
func (m *ExecutionClientManager) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.
func (*ExecutionClientManager) PendingCodeAt ¶
func (m *ExecutionClientManager) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
PendingCodeAt returns the code of the given account in the pending state.
func (*ExecutionClientManager) PendingNonceAt ¶
func (m *ExecutionClientManager) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
PendingNonceAt retrieves the current pending nonce associated with an account.
func (*ExecutionClientManager) SendTransaction ¶
func (m *ExecutionClientManager) SendTransaction(ctx context.Context, tx *types.Transaction) error
SendTransaction injects the transaction into the pending pool for execution.
func (*ExecutionClientManager) SetFallbackReady ¶ added in v0.3.1
func (m *ExecutionClientManager) SetFallbackReady(ready bool)
func (*ExecutionClientManager) SetPrimaryReady ¶ added in v0.3.1
func (m *ExecutionClientManager) SetPrimaryReady(ready bool)
func (*ExecutionClientManager) SubscribeFilterLogs ¶
func (m *ExecutionClientManager) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
SubscribeFilterLogs creates a background log filtering operation, returning a subscription immediately, which can be used to stream the found events.
func (*ExecutionClientManager) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*ExecutionClientManager) SuggestGasTipCap ¶
SuggestGasTipCap retrieves the currently suggested 1559 priority fee to allow a timely execution of a transaction.
func (*ExecutionClientManager) SyncProgress ¶
func (m *ExecutionClientManager) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
SyncProgress retrieves the current progress of the sync algorithm. If there's no sync currently running, it returns nil.
func (*ExecutionClientManager) TransactionByHash ¶
func (m *ExecutionClientManager) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)
TransactionByHash returns the transaction with the given hash.
func (*ExecutionClientManager) TransactionReceipt ¶
func (m *ExecutionClientManager) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.
type IClientManager ¶ added in v0.2.0
type ServiceProvider ¶
type ServiceProvider struct {
// contains filtered or unexported fields
}
A container for all of the various services used by the node service
func NewServiceProvider ¶
Creates a new ServiceProvider instance based on the given config
func NewServiceProviderWithCustomServices ¶ added in v0.4.0
func NewServiceProviderWithCustomServices(cfg config.IConfig, resources *config.NetworkResources, ecManager *ExecutionClientManager, bcManager *BeaconClientManager, dockerClient dclient.APIClient) (*ServiceProvider, error)
Creates a new ServiceProvider instance with custom services instead of creating them from the config
func (*ServiceProvider) CancelContextOnShutdown ¶ added in v0.2.0
func (p *ServiceProvider) CancelContextOnShutdown()
func (*ServiceProvider) Close ¶ added in v0.2.0
func (p *ServiceProvider) Close()
Closes the service provider and its underlying services
func (*ServiceProvider) GetApiLogger ¶
func (p *ServiceProvider) GetApiLogger() *log.Logger
func (*ServiceProvider) GetBaseContext ¶ added in v0.2.0
func (p *ServiceProvider) GetBaseContext() context.Context
func (*ServiceProvider) GetBeaconClient ¶
func (p *ServiceProvider) GetBeaconClient() *BeaconClientManager
func (*ServiceProvider) GetConfig ¶
func (p *ServiceProvider) GetConfig() config.IConfig
func (*ServiceProvider) GetDocker ¶
func (p *ServiceProvider) GetDocker() dclient.APIClient
func (*ServiceProvider) GetEthClient ¶
func (p *ServiceProvider) GetEthClient() *ExecutionClientManager
func (*ServiceProvider) GetNetworkResources ¶
func (p *ServiceProvider) GetNetworkResources() *config.NetworkResources
func (*ServiceProvider) GetQueryManager ¶
func (p *ServiceProvider) GetQueryManager() *eth.QueryManager
func (*ServiceProvider) GetTasksLogger ¶ added in v0.2.0
func (p *ServiceProvider) GetTasksLogger() *log.Logger
func (*ServiceProvider) GetTransactionManager ¶
func (p *ServiceProvider) GetTransactionManager() *eth.TransactionManager
func (*ServiceProvider) GetWallet ¶
func (p *ServiceProvider) GetWallet() *wallet.Wallet