Documentation
¶
Index ¶
- func DefaultTestConfig() *testnode.Config
- func StartTestNode(t *testing.T) testnode.Context
- func StartTestNodeWithConfig(t *testing.T, cfg *testnode.Config) testnode.Context
- func StartTestNodeWithConfigAndClient(t *testing.T) (testnode.Context, *cmthttp.HTTP)
- type BlockFetcher
- func (f *BlockFetcher) Commit(ctx context.Context, height int64) (*types.Commit, error)
- func (f *BlockFetcher) GetBlock(ctx context.Context, height int64) (*SignedBlock, 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) (*SignedBlock, error)
- func (f *BlockFetcher) IsSyncing(ctx context.Context) (bool, error)
- func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (chan SignedBlock, error)
- func (f *BlockFetcher) ValidatorSet(ctx context.Context, height int64) (*types.ValidatorSet, error)
- 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, opts ...libhead.HeadOption[*header.ExtendedHeader]) (*header.ExtendedHeader, error)
- type Listener
- type Network
- type Option
- type RoutingExchange
- func (h *RoutingExchange) Get(ctx context.Context, hash libhead.Hash) (*header.ExtendedHeader, error)
- func (h *RoutingExchange) GetByHeight(ctx context.Context, height uint64) (*header.ExtendedHeader, error)
- func (h *RoutingExchange) GetRangeByHeight(ctx context.Context, from *header.ExtendedHeader, to uint64) ([]*header.ExtendedHeader, error)
- func (h *RoutingExchange) Head(ctx context.Context, opts ...libhead.HeadOption[*header.ExtendedHeader]) (*header.ExtendedHeader, error)
- type SignedBlock
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 StartTestNode ¶ added in v0.3.0
StartTestNode simply starts Tendermint and Celestia App tandem with default testing configuration.
func StartTestNodeWithConfig ¶ added in v0.6.2
StartTestNodeWithConfig starts Tendermint and Celestia App tandem with custom configuration.
Types ¶
type BlockFetcher ¶
type BlockFetcher struct {
// contains filtered or unexported fields
}
func NewBlockFetcher ¶
func NewBlockFetcher(conn *grpc.ClientConn) (*BlockFetcher, error)
NewBlockFetcher returns a new `BlockFetcher`.
func (*BlockFetcher) Commit ¶
Commit queries Core for a `Commit` from the block at the given height. If the height is nil, use the latest height.
func (*BlockFetcher) GetBlock ¶
func (f *BlockFetcher) GetBlock(ctx context.Context, height int64) (*SignedBlock, error)
GetBlock queries Core for a `Block` at the given height. if the height is nil, use the latest 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) (*SignedBlock, error)
GetSignedBlock queries Core for a `Block` at the given height. if the height is nil, use the latest 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 SignedBlock, error)
SubscribeNewBlockEvent subscribes to new block events from Core, returning a new block event channel.
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. If the height is nil, use the latest 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 *store.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, opts ...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 *store.Store, blocktime time.Duration, opts ...Option, ) (*Listener, error)
type Network ¶ added in v0.21.9
Network wraps `testnode.Context` allowing to manually stop all underlying connections. TODO @vgonkivs: remove after https://github.com/celestiaorg/celestia-app/issues/4304 is done.
type Option ¶ added in v0.12.1
type Option func(*params)
func WithArchivalMode ¶ added in v0.21.5
func WithArchivalMode() Option
func WithAvailabilityWindow ¶ added in v0.14.0
func WithChainID ¶ added in v0.13.0
func WithMetrics ¶ added in v0.12.1
func WithMetrics() Option
WithMetrics is a functional option that enables metrics inside the core package.
func WithP2PExchange ¶
func WithP2PExchange(ex libhead.Exchange[*header.ExtendedHeader]) Option
WithP2PExchange sets the P2P exchange for fallback when core doesn't have blocks. When core is unavailable, only headers will be fetched via P2P. The EDS data will be downloaded later by the DASer component.
type RoutingExchange ¶
type RoutingExchange struct {
// contains filtered or unexported fields
}
RoutingExchange combines core and P2P exchanges to optimize header syncing for Bridge nodes. It routes requests based on whether headers fall within the availability window:
- Inside window: uses core exchange (fetches full blocks from consensus)
- Outside window: uses P2P exchange (fetches headers only from network)
func NewRoutingExchange ¶
func NewRoutingExchange( coreEx libhead.Exchange[*header.ExtendedHeader], p2pEx libhead.Exchange[*header.ExtendedHeader], window time.Duration, blockTime time.Duration, ) (*RoutingExchange, error)
NewRoutingExchange creates a new RoutingExchange that wraps core and P2P exchanges.
func (*RoutingExchange) Get ¶
func (h *RoutingExchange) Get(ctx context.Context, hash libhead.Hash) (*header.ExtendedHeader, error)
Get retrieves a header by hash.
func (*RoutingExchange) GetByHeight ¶
func (h *RoutingExchange) GetByHeight(ctx context.Context, height uint64) (*header.ExtendedHeader, error)
GetByHeight retrieves a header by height. Uses the availability window to determine which exchange to use.
func (*RoutingExchange) GetRangeByHeight ¶
func (h *RoutingExchange) GetRangeByHeight( ctx context.Context, from *header.ExtendedHeader, to uint64, ) ([]*header.ExtendedHeader, error)
GetRangeByHeight retrieves a range of headers. Splits the range based on the availability window cutoff.
func (*RoutingExchange) Head ¶
func (h *RoutingExchange) Head( ctx context.Context, opts ...libhead.HeadOption[*header.ExtendedHeader], ) (*header.ExtendedHeader, error)
Head returns the latest header from the core exchange. We always use core for Head() to get the authoritative latest block. Also updates the cached cutoff height for routing decisions.