node

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 52 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConsensusStateNotAvailable is returned because Rollkit doesn't use Tendermint consensus.
	ErrConsensusStateNotAvailable = errors.New("consensus state not available in Rollkit")
)

Functions

This section is empty.

Types

type FullClient

type FullClient struct {
	*tmtypes.EventBus
	// contains filtered or unexported fields
}

FullClient implements tendermint RPC client interface.

This is the type that is used in communication between cosmos-sdk app and Rollkit.

func NewFullClient

func NewFullClient(node *FullNode) *FullClient

NewFullClient returns Client working with given node.

func (*FullClient) ABCIInfo

func (c *FullClient) ABCIInfo(ctx context.Context) (*ctypes.ResultABCIInfo, error)

ABCIInfo returns basic information about application state.

func (*FullClient) ABCIQuery

func (c *FullClient) ABCIQuery(ctx context.Context, path string, data tmbytes.HexBytes) (*ctypes.ResultABCIQuery, error)

ABCIQuery queries for data from application.

func (*FullClient) ABCIQueryWithOptions

func (c *FullClient) ABCIQueryWithOptions(ctx context.Context, path string, data tmbytes.HexBytes, opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

ABCIQueryWithOptions queries for data from application.

func (*FullClient) Block

func (c *FullClient) Block(ctx context.Context, height *int64) (*ctypes.ResultBlock, error)

Block method returns BlockID and block itself for given height.

If height is nil, it returns information about last known block.

func (*FullClient) BlockByHash

func (c *FullClient) BlockByHash(ctx context.Context, hash []byte) (*ctypes.ResultBlock, error)

BlockByHash returns BlockID and block itself for given hash.

func (*FullClient) BlockResults

func (c *FullClient) BlockResults(ctx context.Context, height *int64) (*ctypes.ResultBlockResults, error)

BlockResults returns information about transactions, events and updates of validator set and consensus params.

func (*FullClient) BlockSearch

func (c *FullClient) BlockSearch(ctx context.Context, query string, page, perPage *int, orderBy string) (*ctypes.ResultBlockSearch, error)

BlockSearch defines a method to search for a paginated set of blocks by BeginBlock and EndBlock event search criteria.

func (*FullClient) BlockchainInfo

func (c *FullClient) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

BlockchainInfo returns ABCI block meta information for given height range.

func (*FullClient) BroadcastEvidence

func (c *FullClient) BroadcastEvidence(ctx context.Context, evidence tmtypes.Evidence) (*ctypes.ResultBroadcastEvidence, error)

BroadcastEvidence is not yet implemented.

func (*FullClient) BroadcastTxAsync

func (c *FullClient) BroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultBroadcastTx, error)

BroadcastTxAsync returns right away, with no response. Does not wait for CheckTx nor DeliverTx results. More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async

func (*FullClient) BroadcastTxCommit

func (c *FullClient) BroadcastTxCommit(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultBroadcastTxCommit, error)

BroadcastTxCommit returns with the responses from CheckTx and DeliverTx. More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit

func (*FullClient) BroadcastTxSync

func (c *FullClient) BroadcastTxSync(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultBroadcastTx, error)

BroadcastTxSync returns with the response from CheckTx. Does not wait for DeliverTx result. More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync

func (*FullClient) CheckTx

func (c *FullClient) CheckTx(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultCheckTx, error)

CheckTx executes a new transaction against the application to determine its validity.

If valid, the tx is automatically added to the mempool.

func (*FullClient) Commit

func (c *FullClient) Commit(ctx context.Context, height *int64) (*ctypes.ResultCommit, error)

Commit returns signed header (aka commit) at given height.

func (*FullClient) ConsensusParams

func (c *FullClient) ConsensusParams(ctx context.Context, height *int64) (*ctypes.ResultConsensusParams, error)

ConsensusParams returns consensus params at given height.

Currently, consensus params changes are not supported and this method returns params as defined in genesis.

func (*FullClient) ConsensusState

func (c *FullClient) ConsensusState(ctx context.Context) (*ctypes.ResultConsensusState, error)

ConsensusState always returns error as there is no consensus state in Rollkit.

func (*FullClient) DumpConsensusState

func (c *FullClient) DumpConsensusState(ctx context.Context) (*ctypes.ResultDumpConsensusState, error)

DumpConsensusState always returns error as there is no consensus state in Rollkit.

func (*FullClient) Genesis

func (c *FullClient) Genesis(_ context.Context) (*ctypes.ResultGenesis, error)

Genesis returns entire genesis.

func (*FullClient) GenesisChunked

func (c *FullClient) GenesisChunked(context context.Context, id uint) (*ctypes.ResultGenesisChunk, error)

GenesisChunked returns given chunk of genesis.

func (*FullClient) Health

func (c *FullClient) Health(ctx context.Context) (*ctypes.ResultHealth, error)

Health endpoint returns empty value. It can be used to monitor service availability.

func (*FullClient) NetInfo

func (c *FullClient) NetInfo(ctx context.Context) (*ctypes.ResultNetInfo, error)

NetInfo returns basic information about client P2P connections.

func (*FullClient) NumUnconfirmedTxs

func (c *FullClient) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUnconfirmedTxs, error)

NumUnconfirmedTxs returns information about transactions in mempool.

func (*FullClient) Status

func (c *FullClient) Status(ctx context.Context) (*ctypes.ResultStatus, error)

Status returns detailed information about current status of the node.

func (*FullClient) Subscribe

func (c *FullClient) Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)

Subscribe subscribe given subscriber to a query.

func (*FullClient) Tx

func (c *FullClient) Tx(ctx context.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)

Tx returns detailed information about transaction identified by its hash.

func (*FullClient) TxSearch

func (c *FullClient) TxSearch(ctx context.Context, query string, prove bool, pagePtr, perPagePtr *int, orderBy string) (*ctypes.ResultTxSearch, error)

TxSearch returns detailed information about transactions matching query.

func (*FullClient) UnconfirmedTxs

func (c *FullClient) UnconfirmedTxs(ctx context.Context, limitPtr *int) (*ctypes.ResultUnconfirmedTxs, error)

UnconfirmedTxs returns transactions in mempool.

func (*FullClient) Unsubscribe

func (c *FullClient) Unsubscribe(ctx context.Context, subscriber, query string) error

Unsubscribe unsubscribes given subscriber from a query.

func (*FullClient) Validators

func (c *FullClient) Validators(ctx context.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*ctypes.ResultValidators, error)

Validators returns paginated list of validators at given height.

type FullNode

type FullNode struct {
	service.BaseService

	P2P *p2p.Client

	// TODO(tzdybal): consider extracting "mempool reactor"
	Mempool mempool.Mempool

	Store store.Store

	TxIndexer      txindex.TxIndexer
	BlockIndexer   indexer.BlockIndexer
	IndexerService *txindex.IndexerService

	// For use in Lazy Aggregator
	DoneBuildingBlock chan struct{}
	// contains filtered or unexported fields
}

FullNode represents a client node in Rollkit network. It connects all the components and orchestrates their work.

func (*FullNode) AppClient

func (n *FullNode) AppClient() abciclient.Client

AppClient returns ABCI proxy connections to communicate with application.

func (*FullNode) EventBus

func (n *FullNode) EventBus() *tmtypes.EventBus

EventBus gives access to Node's event bus.

func (*FullNode) GetClient

func (n *FullNode) GetClient() rpcclient.Client

func (*FullNode) GetGenesis

func (n *FullNode) GetGenesis() *tmtypes.GenesisDoc

GetGenesis returns entire genesis doc.

func (*FullNode) GetGenesisChunks

func (n *FullNode) GetGenesisChunks() ([]string, error)

GetGenesisChunks returns chunked version of genesis.

func (*FullNode) GetLogger

func (n *FullNode) GetLogger() log.Logger

GetLogger returns logger.

func (*FullNode) OnReset

func (n *FullNode) OnReset() error

OnReset is a part of Service interface.

func (*FullNode) OnStart

func (n *FullNode) OnStart() error

OnStart is a part of Service interface.

func (*FullNode) OnStop

func (n *FullNode) OnStop()

OnStop is a part of Service interface.

func (*FullNode) SetLogger

func (n *FullNode) SetLogger(logger log.Logger)

SetLogger sets the logger used by node.

type HeaderExchangeService added in v0.7.0

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

func NewHeaderExchangeService added in v0.7.0

func NewHeaderExchangeService(ctx context.Context, store ds.TxnDatastore, conf config.NodeConfig, genesis *tmtypes.GenesisDoc, p2p *p2p.Client, logger log.Logger) (*HeaderExchangeService, error)

func (*HeaderExchangeService) Start added in v0.7.0

func (hExService *HeaderExchangeService) Start() error

OnStart is a part of Service interface.

func (*HeaderExchangeService) Stop added in v0.7.0

func (hExService *HeaderExchangeService) Stop() error

OnStop is a part of Service interface.

type LightClient

type LightClient struct {
	types.EventBus
	// contains filtered or unexported fields
}

func NewLightClient

func NewLightClient(node *LightNode) *LightClient

func (*LightClient) ABCIInfo

func (c *LightClient) ABCIInfo(ctx context.Context) (*ctypes.ResultABCIInfo, error)

ABCIInfo returns basic information about application state.

func (*LightClient) ABCIQuery

func (c *LightClient) ABCIQuery(ctx context.Context, path string, data tmbytes.HexBytes) (*ctypes.ResultABCIQuery, error)

ABCIQuery queries for data from application.

func (*LightClient) ABCIQueryWithOptions

func (c *LightClient) ABCIQueryWithOptions(ctx context.Context, path string, data tmbytes.HexBytes, opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

ABCIQueryWithOptions queries for data from application.

func (*LightClient) Block

func (c *LightClient) Block(ctx context.Context, height *int64) (*ctypes.ResultBlock, error)

Block method returns BlockID and block itself for given height.

If height is nil, it returns information about last known block.

func (*LightClient) BlockByHash

func (c *LightClient) BlockByHash(ctx context.Context, hash []byte) (*ctypes.ResultBlock, error)

BlockByHash returns BlockID and block itself for given hash.

func (*LightClient) BlockResults

func (c *LightClient) BlockResults(ctx context.Context, height *int64) (*ctypes.ResultBlockResults, error)

BlockResults returns information about transactions, events and updates of validator set and consensus params.

func (*LightClient) BlockSearch

func (c *LightClient) BlockSearch(ctx context.Context, query string, page, perPage *int, orderBy string) (*ctypes.ResultBlockSearch, error)

BlockSearch defines a method to search for a paginated set of blocks by BeginBlock and EndBlock event search criteria.

func (*LightClient) BlockchainInfo

func (c *LightClient) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

BlockchainInfo returns ABCI block meta information for given height range.

func (*LightClient) BroadcastEvidence

func (c *LightClient) BroadcastEvidence(ctx context.Context, evidence types.Evidence) (*ctypes.ResultBroadcastEvidence, error)

BroadcastEvidence is not yet implemented.

func (*LightClient) BroadcastTxAsync

func (c *LightClient) BroadcastTxAsync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

BroadcastTxAsync returns right away, with no response. Does not wait for CheckTx nor DeliverTx results. More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async

func (*LightClient) BroadcastTxCommit

func (c *LightClient) BroadcastTxCommit(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

BroadcastTxCommit returns with the responses from CheckTx and DeliverTx. More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit

func (*LightClient) BroadcastTxSync

func (c *LightClient) BroadcastTxSync(ctx context.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

BroadcastTxSync returns with the response from CheckTx. Does not wait for DeliverTx result. More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync

func (*LightClient) CheckTx

func (c *LightClient) CheckTx(ctx context.Context, tx types.Tx) (*ctypes.ResultCheckTx, error)

CheckTx executes a new transaction against the application to determine its validity.

If valid, the tx is automatically added to the mempool.

func (*LightClient) Commit

func (c *LightClient) Commit(ctx context.Context, height *int64) (*ctypes.ResultCommit, error)

Commit returns signed header (aka commit) at given height.

func (*LightClient) ConsensusParams

func (c *LightClient) ConsensusParams(ctx context.Context, height *int64) (*ctypes.ResultConsensusParams, error)

ConsensusParams returns consensus params at given height.

Currently, consensus params changes are not supported and this method returns params as defined in genesis.

func (*LightClient) ConsensusState

func (c *LightClient) ConsensusState(ctx context.Context) (*ctypes.ResultConsensusState, error)

ConsensusState always returns error as there is no consensus state in Rollkit.

func (*LightClient) DumpConsensusState

func (c *LightClient) DumpConsensusState(ctx context.Context) (*ctypes.ResultDumpConsensusState, error)

DumpConsensusState always returns error as there is no consensus state in Rollkit.

func (*LightClient) Genesis

Genesis returns entire genesis.

func (*LightClient) GenesisChunked

func (c *LightClient) GenesisChunked(context context.Context, id uint) (*ctypes.ResultGenesisChunk, error)

GenesisChunked returns given chunk of genesis.

func (*LightClient) Health

func (c *LightClient) Health(ctx context.Context) (*ctypes.ResultHealth, error)

Health endpoint returns empty value. It can be used to monitor service availability.

func (*LightClient) NetInfo

func (c *LightClient) NetInfo(ctx context.Context) (*ctypes.ResultNetInfo, error)

NetInfo returns basic information about client P2P connections.

func (*LightClient) NumUnconfirmedTxs

func (c *LightClient) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUnconfirmedTxs, error)

NumUnconfirmedTxs returns information about transactions in mempool.

func (*LightClient) Status

func (c *LightClient) Status(ctx context.Context) (*ctypes.ResultStatus, error)

Status returns detailed information about current status of the node.

func (*LightClient) Subscribe

func (c *LightClient) Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)

Subscribe subscribe given subscriber to a query.

func (*LightClient) Tx

func (c *LightClient) Tx(ctx context.Context, hash []byte, prove bool) (*ctypes.ResultTx, error)

Tx returns detailed information about transaction identified by its hash.

func (*LightClient) TxSearch

func (c *LightClient) TxSearch(ctx context.Context, query string, prove bool, pagePtr, perPagePtr *int, orderBy string) (*ctypes.ResultTxSearch, error)

TxSearch returns detailed information about transactions matching query.

func (*LightClient) UnconfirmedTxs

func (c *LightClient) UnconfirmedTxs(ctx context.Context, limitPtr *int) (*ctypes.ResultUnconfirmedTxs, error)

UnconfirmedTxs returns transactions in mempool.

func (*LightClient) Unsubscribe

func (c *LightClient) Unsubscribe(ctx context.Context, subscriber, query string) error

Unsubscribe unsubscribes given subscriber from a query.

func (*LightClient) Validators

func (c *LightClient) Validators(ctx context.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*ctypes.ResultValidators, error)

Validators returns paginated list of validators at given height.

type LightNode

type LightNode struct {
	service.BaseService

	P2P *p2p.Client
	// contains filtered or unexported fields
}

func (*LightNode) GetClient

func (ln *LightNode) GetClient() rpcclient.Client

func (*LightNode) OnStart added in v0.7.0

func (ln *LightNode) OnStart() error

func (*LightNode) OnStop added in v0.7.0

func (ln *LightNode) OnStop()

type Node

type Node interface {
	Start() error
	GetClient() rpcclient.Client
	Stop() error
	IsRunning() bool
}

func NewNode

func NewNode(
	ctx context.Context,
	conf config.NodeConfig,
	p2pKey crypto.PrivKey,
	signingKey crypto.PrivKey,
	appClient abciclient.Client,
	genesis *tmtypes.GenesisDoc,
	logger log.Logger,
) (Node, error)

Jump to

Keyboard shortcuts

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