observer

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PellMessageFailedEventName = "PellMessageFailed"
)

Variables

View Source
var (
	ConnectorContractABI *abi.ABI
)

Functions

This section is empty.

Types

type ChainClient

type ChainClient struct {
	// base.Observer implements the base chain observer
	base.Observer
	// contains filtered or unexported fields
}

ChainClient represents the chain configuration for an EVM chain Filled with above constants depending on chain

func NewEVMChainClient

func NewEVMChainClient(
	ctx context.Context,
	config config.EVMConfig,
	chainParams relayertypes.ChainParams,
	evmClient interfaces.EVMRPCClient,
	evmJSONRPC interfaces.EVMJSONRPCClient,
	pellcoreClient interfaces.PellCoreBridger,
	tss interfaces.TSSSigner,
	database *db.DB,
	logger clientlogs.Logger,
	ts *metrics.TelemetryServer,
) (*ChainClient, error)

NewEVMChainClient returns a new configuration based on supplied target chain

func (*ChainClient) BlockByNumber

func (ob *ChainClient) BlockByNumber(blockNumber int) (*ethrpc.Block, error)

BlockByNumber query block by number via JSON-RPC

func (*ChainClient) CheckTxInclusion

func (ob *ChainClient) CheckTxInclusion(tx *ethtypes.Transaction, receipt *ethtypes.Receipt) error

CheckTxInclusion returns nil only if tx is included at the position indicated by the receipt ([block, index])

func (*ChainClient) GetBlockByNumberCached

func (ob *ChainClient) GetBlockByNumberCached(blockNumber uint64) (*ethrpc.Block, error)

GetBlockByNumberCached get block by number from cache returns block, ethrpc.Block, isFallback, isSkip, error

func (*ChainClient) GetBlockHeaderCached

func (ob *ChainClient) GetBlockHeaderCached(ctx context.Context, blockNumber uint64) (*ethtypes.Header, error)

func (*ChainClient) GetChainParams

func (ob *ChainClient) GetChainParams() relayertypes.ChainParams

GetChainParams returns the chain params for the chain client

func (*ChainClient) GetEvmReactor

func (ob *ChainClient) GetEvmReactor() interfaces.IEVMEventReactor

GetEvmReactor returns the evm event reactor for the chain client

func (*ChainClient) GetPendingTx

func (ob *ChainClient) GetPendingTx(nonce uint64) *ethtypes.Transaction

GetPendingTx gets the pending transaction from memory

func (*ChainClient) GetTxNReceipt

func (ob *ChainClient) GetTxNReceipt(nonce uint64) (*ethtypes.Receipt, *ethtypes.Transaction)

GetTxNReceipt gets the receipt and transaction from memory

func (*ChainClient) HasEnoughConfirmations

func (ob *ChainClient) HasEnoughConfirmations(receipt *ethtypes.Receipt, lastHeight uint64) bool

HasEnoughConfirmations checks if the given receipt has enough confirmations

func (*ChainClient) IsOutboundProcessed

func (ob *ChainClient) IsOutboundProcessed(ctx context.Context, xmsg *xmsgtypes.Xmsg, logger zerolog.Logger) (bool, bool, error)

IsOutboundProcessed checks outtx status and returns (isIncluded, isConfirmed, error) It also posts vote to pellcore if the tx is confirmed

func (*ChainClient) IsOutboundProcessed_i

func (ob *ChainClient) IsOutboundProcessed_i(ctx context.Context, xmsg *xmsgtypes.Xmsg, logger zerolog.Logger) (bool, bool, error)

IsOutboundProcessed checks outtx status and returns (isIncluded, isConfirmed, error) It also posts vote to pellcore if the tx is confirmed

func (*ChainClient) IsTxConfirmed

func (ob *ChainClient) IsTxConfirmed(nonce uint64) bool

IsTxConfirmed returns true if there is a confirmed tx for 'nonce'

func (*ChainClient) LoadLastBlockScanned

func (ob *ChainClient) LoadLastBlockScanned(ctx context.Context) error

LoadLastBlockScanned loads the last scanned block from the database TODO(revamp): move to a db file

func (*ChainClient) ObserveIntxTrackers

func (ob *ChainClient) ObserveIntxTrackers(ctx context.Context) error

ObserveIntxTrackers observes the inbound trackers for the chain

func (*ChainClient) ObservePellEvents

func (ob *ChainClient) ObservePellEvents(ctx context.Context, startBlock, toBlock uint64) uint64

ObservePellEvents queries logs from registered providers and processes them

func (*ChainClient) PostGasPrice

func (ob *ChainClient) PostGasPrice(ctx context.Context) error

func (*ChainClient) PostGasTokenVote

func (ob *ChainClient) PostGasTokenVote(ctx context.Context, balance *big.Int) error

PostGasTokenVote posts vote for gas token recharge

func (*ChainClient) PostPellTokenVote

func (ob *ChainClient) PostPellTokenVote(ctx context.Context, balance *big.Int) error

func (*ChainClient) PostVoteInboundMsgs

func (ob *ChainClient) PostVoteInboundMsgs(ctx context.Context, msgs []*xmsgtypes.MsgVoteOnObservedInboundTx) (string, error)

PostVoteInboundMsgs posts multiple inbound vote messages to pellcore

func (*ChainClient) PostVoteOutbound

func (ob *ChainClient) PostVoteOutbound(
	ctx context.Context,
	xmsgIndex string,
	receipt *ethtypes.Receipt,
	transaction *ethtypes.Transaction,
	receiveStatus chains.ReceiveStatus,
	nonce uint64,
	logger zerolog.Logger,
)

PostVoteOutbound posts vote to pellcore for the confirmed outtx

func (*ChainClient) ProcessOutboundTrackers

func (ob *ChainClient) ProcessOutboundTrackers(ctx context.Context) error

ProcessOutboundTrackers processes outbound trackers

func (*ChainClient) RemoveCachedBlock

func (ob *ChainClient) RemoveCachedBlock(blockNumber uint64)

RemoveCachedBlock remove block from cache

func (*ChainClient) SetChainParams

func (ob *ChainClient) SetChainParams(params relayertypes.ChainParams)

SetChainParams sets the chain params for the chain client

func (*ChainClient) SetPendingTx

func (ob *ChainClient) SetPendingTx(nonce uint64, transaction *ethtypes.Transaction)

SetPendingTx sets the pending transaction in memory

func (*ChainClient) SetTxNReceipt

func (ob *ChainClient) SetTxNReceipt(nonce uint64, receipt *ethtypes.Receipt, transaction *ethtypes.Transaction)

SetTxNReceipt sets the receipt and transaction in memory

func (*ChainClient) Start

func (ob *ChainClient) Start(ctx context.Context)

Start all observation routines for the evm chain

func (*ChainClient) TransactionByHash

func (ob *ChainClient) TransactionByHash(txHash string) (*ethrpc.Transaction, bool, error)

TransactionByHash query transaction by hash via JSON-RPC

func (*ChainClient) WatchGasPrice

func (ob *ChainClient) WatchGasPrice(ctx context.Context) error

WatchGasPrice watches evm chain for gas prices and post to pellcore TODO(revamp): move inner logic to a separate function

func (*ChainClient) WatchGasToken

func (ob *ChainClient) WatchGasToken(ctx context.Context) error

WatchGasToken watches evm chain for gas token balance and post to pellcore when it below threshold

func (*ChainClient) WatchInTx

func (ob *ChainClient) WatchInTx(ctx context.Context) error

WatchInbound watches evm chain for incoming txs and post votes to pellcore TODO(revamp): move ticker function to a separate file

func (*ChainClient) WatchIntxTracker

func (ob *ChainClient) WatchIntxTracker(ctx context.Context) error

WatchInboundTracker gets a list of Inbound tracker suggestions from pell-core at each tick and tries to check if the in-tx was confirmed. If it was, it tries to broadcast the confirmation vote. If this pell client has previously broadcast the vote, the tx would be rejected TODO(revamp): move inbound tracker function to a separate file

func (*ChainClient) WatchOutTx

func (ob *ChainClient) WatchOutTx(ctx context.Context) error

WatchOutbound watches evm chain for outgoing txs status TODO(revamp): move ticker function to ticker file

func (*ChainClient) WatchPellToken

func (ob *ChainClient) WatchPellToken(ctx context.Context) error

WatchPellToken watches evm chain for pell token balance and post to pellcore when it below threshold

func (*ChainClient) WatchRPCStatus

func (ob *ChainClient) WatchRPCStatus(ctx context.Context) error

WatchRPCStatus watches the RPC status of the EVM chain

func (*ChainClient) WithEvmClient

func (ob *ChainClient) WithEvmClient(client interfaces.EVMRPCClient)

WithEvmClient attaches a new evm client to the chain client

func (*ChainClient) WithEvmJSONRPC

func (ob *ChainClient) WithEvmJSONRPC(client interfaces.EVMJSONRPCClient)

WithEvmJSONRPC attaches a new evm json rpc client to the chain client

type TxHashEnvelope

type TxHashEnvelope struct {
	TxHash string
	Done   chan struct{}
}

Directories

Path Synopsis
staker_delegated.go
staker_delegated.go

Jump to

Keyboard shortcuts

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