stub

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const EVMRPCEnabled = "MockEVMRPCEnabled"
View Source
const ErrMsgPaused = "pell core bridge is paused"

Variables

View Source
var TestKeyringPair cryptotypes.PrivKey
View Source
var TestPrivateKey *ecdsa.PrivateKey

Functions

func MockChainParams

func MockChainParams(chainID int64, confirmation uint64) relayertypes.ChainParams

func MockDelegationManager

func MockDelegationManager(chainID int64) *delegationmanager.DelegationManager

func MockPellConnector

func MockPellConnector(chainID int64) *pellconnector.PellConnector

func MockStrategyManager

func MockStrategyManager(chainID int64) *strategymanager.StrategyManager

func NewKeyring

func NewKeyring() ckeys.Keyring

Types

type BTCSigner

type BTCSigner struct {
}

BTCSigner is a mock of bitcoin chain signer for testing

func NewBTCSigner

func NewBTCSigner() *BTCSigner

func (*BTCSigner) GetPellConnectorAddress

func (s *BTCSigner) GetPellConnectorAddress() ethcommon.Address

func (*BTCSigner) SetPellConnectorAddress

func (s *BTCSigner) SetPellConnectorAddress(_ ethcommon.Address)

type EVMClient

type EVMClient struct {
	ChainParams relayertypes.ChainParams
}

EVMClient is a mock of evm chain client for testing

func NewEVMClient

func NewEVMClient(chainParams *relayertypes.ChainParams) *EVMClient

func (*EVMClient) GetChainParams

func (s *EVMClient) GetChainParams() relayertypes.ChainParams

func (*EVMClient) IsOutboundProcessed

func (s *EVMClient) IsOutboundProcessed(_ context.Context, _ *xmsgtypes.Xmsg, _ zerolog.Logger) (bool, bool, error)

func (*EVMClient) OutboundID

func (s *EVMClient) OutboundID(_ uint64) string

func (*EVMClient) SetChainParams

func (s *EVMClient) SetChainParams(chainParams relayertypes.ChainParams)

func (*EVMClient) Start

func (s *EVMClient) Start(ctx context.Context)

func (*EVMClient) Stop

func (s *EVMClient) Stop()

func (*EVMClient) WatchIntxTracker

func (s *EVMClient) WatchIntxTracker(_ context.Context) error

type EVMSigner

type EVMSigner struct {
	Chain                chains.Chain
	PellConnectorAddress ethcommon.Address
}

EVMSigner is a mock of evm chain signer for testing

func NewEVMSigner

func NewEVMSigner(
	chain chains.Chain,
	pellConnectorAddress ethcommon.Address,
) *EVMSigner

func (*EVMSigner) GetPellConnectorAddress

func (s *EVMSigner) GetPellConnectorAddress() ethcommon.Address

func (*EVMSigner) SetPellConnectorAddress

func (s *EVMSigner) SetPellConnectorAddress(address ethcommon.Address)

type Keyring

type Keyring struct {
}

func (Keyring) Backend

func (m Keyring) Backend() string

func (Keyring) Delete

func (m Keyring) Delete(_ string) error

func (Keyring) DeleteByAddress

func (m Keyring) DeleteByAddress(_ sdk.Address) error

func (Keyring) ExportPrivKeyArmor

func (m Keyring) ExportPrivKeyArmor(_, _ string) (armor string, err error)

func (Keyring) ExportPrivKeyArmorByAddress

func (m Keyring) ExportPrivKeyArmorByAddress(_ sdk.Address, _ string) (armor string, err error)

func (Keyring) ExportPubKeyArmor

func (m Keyring) ExportPubKeyArmor(_ string) (string, error)

func (Keyring) ExportPubKeyArmorByAddress

func (m Keyring) ExportPubKeyArmorByAddress(_ sdk.Address) (string, error)

func (Keyring) ImportPrivKey

func (m Keyring) ImportPrivKey(_, _, _ string) error

func (Keyring) ImportPrivKeyHex

func (m Keyring) ImportPrivKeyHex(uid, privKey, algoStr string) error

func (Keyring) ImportPubKey

func (m Keyring) ImportPubKey(_ string, _ string) error

func (Keyring) Key

func (m Keyring) Key(_ string) (*ckeys.Record, error)

func (Keyring) KeyByAddress

func (m Keyring) KeyByAddress(_ sdk.Address) (*ckeys.Record, error)

func (Keyring) List

func (m Keyring) List() ([]*ckeys.Record, error)

func (Keyring) MigrateAll

func (m Keyring) MigrateAll() ([]*ckeys.Record, error)

func (Keyring) NewAccount

func (m Keyring) NewAccount(_, _, _, _ string, _ ckeys.SignatureAlgo) (*ckeys.Record, error)

func (Keyring) NewMnemonic

func (m Keyring) NewMnemonic(_ string, _ ckeys.Language, _, _ string, _ ckeys.SignatureAlgo) (*ckeys.Record, string, error)

func (Keyring) Rename

func (m Keyring) Rename(_ string, _ string) error

func (Keyring) SaveLedgerKey

func (m Keyring) SaveLedgerKey(_ string, _ ckeys.SignatureAlgo, _ string, _, _, _ uint32) (*ckeys.Record, error)

func (Keyring) SaveMultisig

func (m Keyring) SaveMultisig(_ string, _ cryptotypes.PubKey) (*ckeys.Record, error)

func (Keyring) SaveOfflineKey

func (m Keyring) SaveOfflineKey(_ string, _ cryptotypes.PubKey) (*ckeys.Record, error)

func (Keyring) Sign

func (m Keyring) Sign(_ string, _ []byte, _ signing.SignMode) ([]byte, cryptotypes.PubKey, error)

func (Keyring) SignByAddress

func (m Keyring) SignByAddress(_ sdk.Address, _ []byte, _ signing.SignMode) ([]byte, cryptotypes.PubKey, error)

func (Keyring) SupportedAlgorithms

func (m Keyring) SupportedAlgorithms() (ckeys.SigningAlgoList, ckeys.SigningAlgoList)

type MockBTCRPCClient

type MockBTCRPCClient struct {
	Txs []*btcutil.Tx
}

MockBTCRPCClient is a mock implementation of the BTCRPCClient interface

func NewMockBTCRPCClient

func NewMockBTCRPCClient() *MockBTCRPCClient

NewMockBTCRPCClient creates a new mock BTC RPC client

func (*MockBTCRPCClient) CreateWallet

func (*MockBTCRPCClient) EstimateSmartFee

func (*MockBTCRPCClient) GenerateToAddress

func (c *MockBTCRPCClient) GenerateToAddress(_ int64, _ btcutil.Address, _ *int64) ([]*chainhash.Hash, error)

func (*MockBTCRPCClient) GetBalance

func (c *MockBTCRPCClient) GetBalance(_ string) (btcutil.Amount, error)

func (*MockBTCRPCClient) GetBlockCount

func (c *MockBTCRPCClient) GetBlockCount() (int64, error)

func (*MockBTCRPCClient) GetBlockHash

func (c *MockBTCRPCClient) GetBlockHash(_ int64) (*chainhash.Hash, error)

func (*MockBTCRPCClient) GetBlockHeader

func (c *MockBTCRPCClient) GetBlockHeader(_ *chainhash.Hash) (*wire.BlockHeader, error)

func (*MockBTCRPCClient) GetBlockVerbose

func (*MockBTCRPCClient) GetBlockVerboseTx

func (c *MockBTCRPCClient) GetBlockVerboseTx(_ *chainhash.Hash) (*btcjson.GetBlockVerboseTxResult, error)

func (*MockBTCRPCClient) GetNetworkInfo

func (c *MockBTCRPCClient) GetNetworkInfo() (*btcjson.GetNetworkInfoResult, error)

func (*MockBTCRPCClient) GetNewAddress

func (c *MockBTCRPCClient) GetNewAddress(_ string) (btcutil.Address, error)

func (*MockBTCRPCClient) GetRawTransaction

func (c *MockBTCRPCClient) GetRawTransaction(_ *chainhash.Hash) (*btcutil.Tx, error)

GetRawTransaction returns a pre-loaded transaction or nil

func (*MockBTCRPCClient) GetRawTransactionVerbose

func (c *MockBTCRPCClient) GetRawTransactionVerbose(_ *chainhash.Hash) (*btcjson.TxRawResult, error)

func (*MockBTCRPCClient) GetTransaction

func (*MockBTCRPCClient) ListUnspent

func (c *MockBTCRPCClient) ListUnspent() ([]btcjson.ListUnspentResult, error)

func (*MockBTCRPCClient) ListUnspentMinMaxAddresses

func (c *MockBTCRPCClient) ListUnspentMinMaxAddresses(_ int, _ int, _ []btcutil.Address) ([]btcjson.ListUnspentResult, error)

func (*MockBTCRPCClient) Reset

func (c *MockBTCRPCClient) Reset() *MockBTCRPCClient

Reset clears the mock data

func (*MockBTCRPCClient) SendRawTransaction

func (c *MockBTCRPCClient) SendRawTransaction(_ *wire.MsgTx, _ bool) (*chainhash.Hash, error)

func (*MockBTCRPCClient) WithRawTransaction

func (c *MockBTCRPCClient) WithRawTransaction(tx *btcutil.Tx) *MockBTCRPCClient

func (*MockBTCRPCClient) WithRawTransactions

func (c *MockBTCRPCClient) WithRawTransactions(txs []*btcutil.Tx) *MockBTCRPCClient

type MockEvmClient

type MockEvmClient struct {
	Receipts []*ethtypes.Receipt
	// contains filtered or unexported fields
}

func NewMockEvmClient

func NewMockEvmClient() *MockEvmClient

func (*MockEvmClient) BalanceAt

func (e *MockEvmClient) BalanceAt(ctx context.Context, account ethcommon.Address, blockNumber *big.Int) (*big.Int, error)

func (*MockEvmClient) BlockByNumber

func (e *MockEvmClient) BlockByNumber(_ context.Context, _ *big.Int) (*ethtypes.Block, error)

func (*MockEvmClient) BlockNumber

func (e *MockEvmClient) BlockNumber(_ context.Context) (uint64, error)

func (*MockEvmClient) CallContract

func (e *MockEvmClient) CallContract(_ context.Context, _ ethereum.CallMsg, _ *big.Int) ([]byte, error)

func (*MockEvmClient) CodeAt

func (e *MockEvmClient) CodeAt(_ context.Context, _ ethcommon.Address, _ *big.Int) ([]byte, error)

func (*MockEvmClient) EstimateGas

func (e *MockEvmClient) EstimateGas(_ context.Context, _ ethereum.CallMsg) (gas uint64, err error)

func (*MockEvmClient) FilterLogs

func (*MockEvmClient) HeaderByNumber

func (e *MockEvmClient) HeaderByNumber(_ context.Context, _ *big.Int) (*ethtypes.Header, error)

func (*MockEvmClient) PendingCodeAt

func (e *MockEvmClient) PendingCodeAt(_ context.Context, _ ethcommon.Address) ([]byte, error)

func (*MockEvmClient) PendingNonceAt

func (e *MockEvmClient) PendingNonceAt(_ context.Context, _ ethcommon.Address) (uint64, error)

func (*MockEvmClient) Reset

func (e *MockEvmClient) Reset() *MockEvmClient

func (*MockEvmClient) SendTransaction

func (e *MockEvmClient) SendTransaction(_ context.Context, _ *ethtypes.Transaction) error

func (*MockEvmClient) SubscribeFilterLogs

func (e *MockEvmClient) SubscribeFilterLogs(_ context.Context, _ ethereum.FilterQuery, _ chan<- ethtypes.Log) (ethereum.Subscription, error)

func (*MockEvmClient) SuggestGasPrice

func (e *MockEvmClient) SuggestGasPrice(_ context.Context) (*big.Int, error)

func (*MockEvmClient) SuggestGasTipCap

func (e *MockEvmClient) SuggestGasTipCap(_ context.Context) (*big.Int, error)

func (*MockEvmClient) TransactionByHash

func (e *MockEvmClient) TransactionByHash(_ context.Context, _ ethcommon.Hash) (tx *ethtypes.Transaction, isPending bool, err error)

func (*MockEvmClient) TransactionReceipt

func (e *MockEvmClient) TransactionReceipt(_ context.Context, _ ethcommon.Hash) (*ethtypes.Receipt, error)

func (*MockEvmClient) TransactionSender

func (e *MockEvmClient) TransactionSender(_ context.Context, _ *ethtypes.Transaction, _ ethcommon.Hash, _ uint) (ethcommon.Address, error)

func (*MockEvmClient) WithBlockNumber

func (e *MockEvmClient) WithBlockNumber(blockNumber uint64) *MockEvmClient

func (*MockEvmClient) WithError

func (e *MockEvmClient) WithError(err error) *MockEvmClient

func (*MockEvmClient) WithHeader

func (e *MockEvmClient) WithHeader(header *ethtypes.Header) *MockEvmClient

func (*MockEvmClient) WithReceipt

func (e *MockEvmClient) WithReceipt(receipt *ethtypes.Receipt) *MockEvmClient

---------------------------------------------------------------------------- Feed data to the mock evm client for testing ----------------------------------------------------------------------------

func (*MockEvmClient) WithReceipts

func (e *MockEvmClient) WithReceipts(receipts []*ethtypes.Receipt) *MockEvmClient

func (*MockEvmClient) WithSuggestGasPrice

func (e *MockEvmClient) WithSuggestGasPrice(price *big.Int) *MockEvmClient

func (*MockEvmClient) WithSuggestGasTipCap

func (e *MockEvmClient) WithSuggestGasTipCap(price *big.Int) *MockEvmClient

type MockJSONRPCClient

type MockJSONRPCClient struct {
	Blocks       []*ethrpc.Block
	Transactions []*ethrpc.Transaction
}

MockJSONRPCClient is a mock implementation of the EVMJSONRPCClient interface

func NewMockJSONRPCClient

func NewMockJSONRPCClient() *MockJSONRPCClient

NewMockJSONRPCClient creates a new mock JSON RPC client

func (*MockJSONRPCClient) EthGetBalance

func (e *MockJSONRPCClient) EthGetBalance(address, block string) (big.Int, error)

func (*MockJSONRPCClient) EthGetBlockByNumber

func (e *MockJSONRPCClient) EthGetBlockByNumber(_ int, _ bool) (*ethrpc.Block, error)

EthGetBlockByNumber returns a pre-loaded block or nil

func (*MockJSONRPCClient) EthGetTransactionByHash

func (e *MockJSONRPCClient) EthGetTransactionByHash(_ string) (*ethrpc.Transaction, error)

EthGetTransactionByHash returns a pre-loaded transaction or nil

func (*MockJSONRPCClient) Reset

Reset clears the mock data

func (*MockJSONRPCClient) WithBlock

func (e *MockJSONRPCClient) WithBlock(block *ethrpc.Block) *MockJSONRPCClient

---------------------------------------------------------------------------- Feed data to the mock JSON RPC client for testing ----------------------------------------------------------------------------

func (*MockJSONRPCClient) WithBlocks

func (e *MockJSONRPCClient) WithBlocks(blocks []*ethrpc.Block) *MockJSONRPCClient

func (*MockJSONRPCClient) WithTransaction

func (e *MockJSONRPCClient) WithTransaction(tx *ethrpc.Transaction) *MockJSONRPCClient

func (*MockJSONRPCClient) WithTransactions

func (e *MockJSONRPCClient) WithTransactions(txs []*ethrpc.Transaction) *MockJSONRPCClient

type MockPellCoreBridge

type MockPellCoreBridge struct {
	// contains filtered or unexported fields
}

func NewMockPellCoreBridge

func NewMockPellCoreBridge() *MockPellCoreBridge

func (*MockPellCoreBridge) Chain

func (z *MockPellCoreBridge) Chain() chains.Chain

func (*MockPellCoreBridge) GetAllOutTxTrackerByChain

func (z *MockPellCoreBridge) GetAllOutTxTrackerByChain(ctx context.Context, _ int64, _ interfaces.Order) ([]xmsgtypes.OutTxTracker, error)

func (*MockPellCoreBridge) GetBTCTSSAddress

func (z *MockPellCoreBridge) GetBTCTSSAddress(ctx context.Context, _ int64) (string, error)

func (*MockPellCoreBridge) GetBlockHeaderChainState

func (z *MockPellCoreBridge) GetBlockHeaderChainState(ctx context.Context, _ int64) (*lightclienttypes.QueryChainStateResponse, error)

func (*MockPellCoreBridge) GetBlockHeight

func (z *MockPellCoreBridge) GetBlockHeight(ctx context.Context) (int64, error)

func (*MockPellCoreBridge) GetChainIndex

func (z *MockPellCoreBridge) GetChainIndex(ctx context.Context, chainId int64) (*xmsgtypes.ChainIndex, error)

func (*MockPellCoreBridge) GetCrosschainFlags

func (z *MockPellCoreBridge) GetCrosschainFlags(ctx context.Context) (relayertypes.CrosschainFlags, error)

func (*MockPellCoreBridge) GetGasRechargeOperationIndex

func (z *MockPellCoreBridge) GetGasRechargeOperationIndex(ctx context.Context, chainId int64) (*xmsgtypes.GasRechargeOperationIndex, error)

func (*MockPellCoreBridge) GetInboundTrackersForChain

func (z *MockPellCoreBridge) GetInboundTrackersForChain(ctx context.Context, _ int64) ([]xmsgtypes.InTxTracker, error)

func (*MockPellCoreBridge) GetKeyGen

func (*MockPellCoreBridge) GetKeys

func (*MockPellCoreBridge) GetLastBlockHeightByChain

func (z *MockPellCoreBridge) GetLastBlockHeightByChain(ctx context.Context, _ chains.Chain) (*xmsgtypes.LastBlockHeight, error)

func (*MockPellCoreBridge) GetLogger

func (z *MockPellCoreBridge) GetLogger() *zerolog.Logger

func (*MockPellCoreBridge) GetObserverList

func (z *MockPellCoreBridge) GetObserverList(ctx context.Context) ([]string, error)

func (*MockPellCoreBridge) GetOutTxTracker

func (z *MockPellCoreBridge) GetOutTxTracker(ctx context.Context, _ chains.Chain, _ uint64) (*xmsgtypes.OutTxTracker, error)

func (*MockPellCoreBridge) GetPellBlockHeight

func (z *MockPellCoreBridge) GetPellBlockHeight(ctx context.Context) (int64, error)

func (*MockPellCoreBridge) GetPellHotKeyBalance

func (z *MockPellCoreBridge) GetPellHotKeyBalance(ctx context.Context) (math.Int, error)

func (*MockPellCoreBridge) GetPellRechargeOperationIndex

func (z *MockPellCoreBridge) GetPellRechargeOperationIndex(ctx context.Context, chainId int64) (*xmsgtypes.PellRechargeOperationIndex, error)

func (*MockPellCoreBridge) GetPendingNoncesByChain

func (z *MockPellCoreBridge) GetPendingNoncesByChain(ctx context.Context, _ int64) (relayertypes.PendingNonces, error)

func (*MockPellCoreBridge) GetRateLimiterFlags

func (z *MockPellCoreBridge) GetRateLimiterFlags(ctx context.Context) (xmsgtypes.RateLimiterFlags, error)

func (*MockPellCoreBridge) GetRateLimiterInput

func (z *MockPellCoreBridge) GetRateLimiterInput(ctx context.Context, window int64) (*xmsgtypes.QueryRateLimiterInputResponse, error)

func (*MockPellCoreBridge) GetXmsgByNonce

func (z *MockPellCoreBridge) GetXmsgByNonce(ctx context.Context, _ int64, _ uint64) (*xmsgtypes.Xmsg, error)

func (*MockPellCoreBridge) ListPendingXmsg

func (z *MockPellCoreBridge) ListPendingXmsg(ctx context.Context, _ int64) ([]*xmsgtypes.Xmsg, uint64, error)

func (*MockPellCoreBridge) ListPendingXmsgWithinRatelimit

func (*MockPellCoreBridge) OnBeforeStop

func (z *MockPellCoreBridge) OnBeforeStop(callback func())

func (*MockPellCoreBridge) PostAddTxHashToOutTxTracker

func (z *MockPellCoreBridge) PostAddTxHashToOutTxTracker(ctx context.Context, _ int64, _ uint64, _ string, _ *proofs.Proof, _ string, _ int64) (string, error)

func (*MockPellCoreBridge) PostBlameData

func (z *MockPellCoreBridge) PostBlameData(ctx context.Context, _ *blame.Blame, _ int64, _ string) (string, error)

func (*MockPellCoreBridge) PostGasPrice

func (z *MockPellCoreBridge) PostGasPrice(ctx context.Context, _ chains.Chain, _ uint64, _ string, _ uint64) (string, error)

func (*MockPellCoreBridge) PostVoteBlockHeader

func (z *MockPellCoreBridge) PostVoteBlockHeader(ctx context.Context, _ int64, _ []byte, _ int64, _ proofs.HeaderData) (string, error)

func (*MockPellCoreBridge) PostVoteInboundBlock

func (z *MockPellCoreBridge) PostVoteInboundBlock(
	ctx context.Context,
	gasLimit, retryLimit uint64,
	block *xmsgtypes.MsgVoteInboundBlock,
	events []*xmsgtypes.MsgVoteOnObservedInboundTx,
) ([]string, []string, error)

func (*MockPellCoreBridge) PostVoteInboundEvents

func (z *MockPellCoreBridge) PostVoteInboundEvents(ctx context.Context, _, _ uint64, _ []*xmsgtypes.MsgVoteOnObservedInboundTx) (string, string, error)

func (*MockPellCoreBridge) PostVoteOnGasRecharge

func (z *MockPellCoreBridge) PostVoteOnGasRecharge(ctx context.Context, chain chains.Chain, voteIndex uint64) (string, error)

func (*MockPellCoreBridge) PostVoteOnPellRecharge

func (z *MockPellCoreBridge) PostVoteOnPellRecharge(ctx context.Context, chain chains.Chain, voteIndex uint64) (string, error)

func (*MockPellCoreBridge) PostVoteOutbound

func (z *MockPellCoreBridge) PostVoteOutbound(ctx context.Context, _ string, _ string, _ uint64, _ uint64, _ *big.Int, _ uint64, _ chains.ReceiveStatus, _ string, _ chains.Chain, _ uint64) (string, string, error)

func (*MockPellCoreBridge) Stop

func (z *MockPellCoreBridge) Stop()

type SDKClient

type SDKClient struct {
	mock.Client
	// contains filtered or unexported fields
}

func NewSDKClientWithErr

func NewSDKClientWithErr(err error, code uint32) *SDKClient

func (SDKClient) Block

func (SDKClient) BroadcastTxAsync

func (c SDKClient) BroadcastTxAsync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error)

func (SDKClient) BroadcastTxCommit

func (c SDKClient) BroadcastTxCommit(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTxCommit, error)

func (SDKClient) BroadcastTxSync

func (c SDKClient) BroadcastTxSync(_ context.Context, _ tmtypes.Tx) (*coretypes.ResultBroadcastTx, error)

func (SDKClient) Tx

func (c SDKClient) Tx(_ context.Context, _ []byte, _ bool) (*coretypes.ResultTx, error)

type TSS

type TSS struct {
	// contains filtered or unexported fields
}

TSS is a mock of TSS signer for testing

func NewMockTSS

func NewMockTSS(chain chains.Chain, evmAddress string) *TSS

func NewTSSIgnite3

func NewTSSIgnite3() *TSS

func NewTSSMainnet

func NewTSSMainnet() *TSS

func (*TSS) EVMAddress

func (s *TSS) EVMAddress() ethcommon.Address

func (*TSS) PubKeyCompressedBytes

func (s *TSS) PubKeyCompressedBytes() []byte

func (*TSS) Pubkey

func (s *TSS) Pubkey() []byte

Pubkey uses the hardcoded private test key to generate the public key in bytes

func (*TSS) Sign

func (s *TSS) Sign(ctx context.Context, data []byte, _ uint64, _ uint64, _ *chains.Chain, _ string) ([65]byte, error)

Sign uses test key unrelated to any tss key in production

Jump to

Keyboard shortcuts

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