Documentation ¶
Index ¶
- func DefaultTestConfig() *testnode.Config
- func StartGRPCServer(app srvtypes.Application, appCfg *srvconfig.Config, cctx testnode.Context) (testnode.Context, func() error, error)
- func StartTestNode(t *testing.T) testnode.Context
- func StartTestNodeWithConfig(t *testing.T, cfg *testnode.Config) testnode.Context
- type BlockFetcher
- func (f *BlockFetcher) Commit(ctx context.Context, height *int64) (*types.Commit, error)
- func (f *BlockFetcher) GetBlock(ctx context.Context, height *int64) (*types.Block, error)
- func (f *BlockFetcher) GetBlockByHash(ctx context.Context, hash libhead.Hash) (*types.Block, error)
- func (f *BlockFetcher) GetBlockInfo(ctx context.Context, height *int64) (*types.Commit, *types.ValidatorSet, error)
- func (f *BlockFetcher) GetSignedBlock(ctx context.Context, height *int64) (*coretypes.ResultSignedBlock, error)
- func (f *BlockFetcher) IsSyncing(ctx context.Context) (bool, error)
- func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (<-chan types.EventDataSignedBlock, error)
- func (f *BlockFetcher) UnsubscribeNewBlockEvent(ctx context.Context) error
- func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.ValidatorSet, error)
- type Client
- type Exchange
- func (ce *Exchange) Get(ctx context.Context, hash libhead.Hash) (*header.ExtendedHeader, error)
- func (ce *Exchange) GetByHeight(ctx context.Context, height uint64) (*header.ExtendedHeader, error)
- func (ce *Exchange) GetRangeByHeight(ctx context.Context, from *header.ExtendedHeader, to uint64) ([]*header.ExtendedHeader, error)
- func (ce *Exchange) Head(ctx context.Context, _ ...libhead.HeadOption[*header.ExtendedHeader]) (*header.ExtendedHeader, error)
- type Listener
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultTestConfig ¶ added in v0.6.2
DefaultTestConfig returns the default testing configuration for Tendermint + Celestia App tandem.
It fetches free ports from OS and sets them into configs, s.t. user can make use of them(unlike 0 port) and allowing to run multiple tests nodes in parallel.
Additionally, it instructs Tendermint + Celestia App tandem to setup 10 funded accounts.
func StartGRPCServer ¶ added in v0.6.2
func StartGRPCServer( app srvtypes.Application, appCfg *srvconfig.Config, cctx testnode.Context, ) (testnode.Context, func() error, error)
StartGRPCServer is a copy of https://github.com/celestiaorg/celestia-app/blob/e5a679d11b464d583b616d4d686de9dd44bdab2e/testutil/testnode/rpc_client.go#L46 // It's copied as internal Cosmos SDK logic take 5 seconds to run: https://github.com/cosmos/cosmos-sdk/blob/6dfa0c98062d5d8b38d85ca1d2807937f47da4a3/server/grpc/server.go#L80 // FIXME once the fix for https://github.com/cosmos/cosmos-sdk/issues/14429 lands in our fork
func StartTestNode ¶ added in v0.3.0
StartTestNode simply starts Tendermint and Celestia App tandem with default testing configuration.
Types ¶
type BlockFetcher ¶
type BlockFetcher struct {
// contains filtered or unexported fields
}
func NewBlockFetcher ¶
func NewBlockFetcher(client Client) *BlockFetcher
NewBlockFetcher returns a new `BlockFetcher`.
func (*BlockFetcher) Commit ¶
Commit queries Core for a `Commit` from the block at the given height.
func (*BlockFetcher) GetBlockByHash ¶
func (*BlockFetcher) GetBlockInfo ¶ added in v0.2.0
func (f *BlockFetcher) GetBlockInfo(ctx context.Context, height *int64) (*types.Commit, *types.ValidatorSet, error)
GetBlockInfo queries Core for additional block information, like Commit and ValidatorSet.
func (*BlockFetcher) GetSignedBlock ¶ added in v0.7.2
func (f *BlockFetcher) GetSignedBlock(ctx context.Context, height *int64) (*coretypes.ResultSignedBlock, error)
GetSignedBlock queries Core for a `Block` at the given height.
func (*BlockFetcher) IsSyncing ¶ added in v0.3.0
func (f *BlockFetcher) IsSyncing(ctx context.Context) (bool, error)
IsSyncing returns the sync status of the Core connection: true for syncing, and false for already caught up. It can also return an error in the case of a failed status request.
func (*BlockFetcher) SubscribeNewBlockEvent ¶
func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (<-chan types.EventDataSignedBlock, error)
SubscribeNewBlockEvent subscribes to new block events from Core, returning a new block event channel on success.
func (*BlockFetcher) UnsubscribeNewBlockEvent ¶
func (f *BlockFetcher) UnsubscribeNewBlockEvent(ctx context.Context) error
UnsubscribeNewBlockEvent stops the subscription to new block events from Core.
func (*BlockFetcher) ValidatorSet ¶
func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.ValidatorSet, error)
ValidatorSet queries Core for the ValidatorSet from the block at the given height.
type Exchange ¶ added in v0.6.3
type Exchange struct {
// contains filtered or unexported fields
}
func NewExchange ¶ added in v0.6.3
func NewExchange( fetcher *BlockFetcher, store *eds.Store, construct header.ConstructFn, opts ...Option, ) (*Exchange, error)
func (*Exchange) GetByHeight ¶ added in v0.6.3
func (*Exchange) GetRangeByHeight ¶ added in v0.6.3
func (ce *Exchange) GetRangeByHeight( ctx context.Context, from *header.ExtendedHeader, to uint64, ) ([]*header.ExtendedHeader, error)
func (*Exchange) Head ¶ added in v0.6.3
func (ce *Exchange) Head( ctx context.Context, _ ...libhead.HeadOption[*header.ExtendedHeader], ) (*header.ExtendedHeader, error)
type Listener ¶ added in v0.6.3
type Listener struct {
// contains filtered or unexported fields
}
Listener is responsible for listening to Core for new block events and converting new Core blocks into the main data structure used in the Celestia DA network: `ExtendedHeader`. After digesting the Core block, extending it, and generating the `ExtendedHeader`, the Listener broadcasts the new `ExtendedHeader` to the header-sub gossipsub network.
func NewListener ¶ added in v0.6.3
func NewListener( bcast libhead.Broadcaster[*header.ExtendedHeader], fetcher *BlockFetcher, hashBroadcaster shrexsub.BroadcastFn, construct header.ConstructFn, store *eds.Store, blocktime time.Duration, opts ...Option, ) (*Listener, error)
type Option ¶ added in v0.12.1
type Option func(*params)
func WithMetrics ¶ added in v0.12.1
func WithMetrics() Option
WithMetrics is a functional option that enables metrics inside the core package.