Documentation ¶
Index ¶
- Constants
- func CalculateMeanGas(ctx context.Context, rpcAddress, msgType string, fromHeight int64, ...) (float64, int64, error)
- func CalculateMeanGasFromRecentBlocks(ctx context.Context, rpcAddress, msgType string, blocks int64) (float64, int64, error)
- func DecodeBlockData(data types.Data) ([]sdk.Tx, error)
- func DefaultAppConfig() *srvconfig.Config
- func DefaultConsensusParams() *tmproto.ConsensusParams
- func DefaultTendermintConfig() *tmconfig.Config
- func FundKeyringAccounts(accounts ...string) (keyring.Keyring, []banktypes.Balance, []authtypes.GenesisAccount)
- func GenerateAccounts(count int) []string
- func NewCometNode(baseDir string, cfg *UniversalTestingConfig) (*node.Node, srvtypes.Application, error)
- func NewKeyring(accounts ...string) (keyring.Keyring, []sdk.AccAddress)
- func NewOfflineSigner() (*user.Signer, error)
- func NewSignerFromContext(ctx Context, acc string) (*user.Signer, error)
- func NewSingleSignerFromContext(ctx Context) (*user.Signer, error)
- func QueryTx(clientCtx client.Context, hashHexStr string, prove bool) (*rpctypes.ResultTx, error)
- func QueryWithoutProof(clientCtx client.Context, hashHexStr string) (*rpctypes.ResultTx, error)
- func RandomAccounts(n int) (accounts []string)
- func RandomAddress() sdk.Address
- func ReadBlockHeights(ctx context.Context, rpcAddress string, fromHeight, toHeight int64) ([]*types.Block, error)
- func ReadBlockchain(ctx context.Context, rpcAddress string) ([]*types.Block, error)
- func ReadRecentBlocks(ctx context.Context, rpcAddress string, blocks int64) ([]*types.Block, error)
- func StartAPIServer(app srvtypes.Application, appCfg srvconfig.Config, cctx Context) (*api.Server, error)
- func TestAddress() sdk.AccAddress
- type Config
- func (c *Config) WithAppConfig(conf *srvconfig.Config) *Config
- func (c *Config) WithAppCreator(creator srvtypes.AppCreator) *Config
- func (c *Config) WithAppOptions(opts *KVAppOptions) *Config
- func (c *Config) WithChainID(id string) *Config
- func (c *Config) WithConsensusParams(params *tmproto.ConsensusParams) *Config
- func (c *Config) WithFundedAccounts(accounts ...string) *Config
- func (c *Config) WithGenesis(g *genesis.Genesis) *Config
- func (c *Config) WithGenesisTime(t time.Time) *Config
- func (c *Config) WithModifiers(ops ...genesis.Modifier) *Config
- func (c *Config) WithSuppressLogs(sl bool) *Config
- func (c *Config) WithTendermintConfig(conf *tmconfig.Config) *Config
- func (c *Config) WithTimeoutCommit(d time.Duration) *Config
- type Context
- func NewContext(goCtx context.Context, kr keyring.Keyring, tmCfg *tmconfig.Config, ...) Context
- func NewNetwork(t testing.TB, cfg *Config) (cctx Context, rpcAddr, grpcAddr string)
- func StartGRPCServer(app srvtypes.Application, appCfg *srvconfig.Config, cctx Context) (Context, func() error, error)
- func StartNode(tmNode *node.Node, cctx Context) (Context, func() error, error)
- func (c *Context) APIAddress() string
- func (c *Context) FillBlock(squareSize int, account string, broadcastMode string) (*sdk.TxResponse, error)
- func (c *Context) GenesisTime() (time.Time, error)
- func (c *Context) GoContext() context.Context
- func (c *Context) HeightForTimestamp(timestamp time.Time) (int64, error)
- func (c *Context) LatestHeight() (int64, error)
- func (c *Context) LatestTimestamp() (time.Time, error)
- func (c *Context) PostData(account, broadcastMode string, ns appns.Namespace, blobData []byte) (*sdk.TxResponse, error)
- func (c *Context) WaitForBlocks(n int64) error
- func (c *Context) WaitForHeight(h int64) (int64, error)
- func (c *Context) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, error)
- func (c *Context) WaitForNextBlock() error
- func (c *Context) WaitForTimestamp(t time.Time) (time.Time, error)
- func (c *Context) WaitForTimestampWithTimeout(t time.Time, d time.Duration) (time.Time, error)
- func (c *Context) WaitForTx(hashHexStr string, blocks int) (*rpctypes.ResultTx, error)
- type KVAppOptions
- type UniversalTestingConfig
Constants ¶
const ( DefaultValidatorAccountName = "validator" DefaultInitialBalance = genesis.DefaultInitialBalance )
const (
DefaultTimeout = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func CalculateMeanGas ¶
func DefaultAppConfig ¶
DefaultAppConfig wraps the default config described in the server
func DefaultConsensusParams ¶
func DefaultConsensusParams() *tmproto.ConsensusParams
func DefaultTendermintConfig ¶
func FundKeyringAccounts ¶
func GenerateAccounts ¶
func NewCometNode ¶
func NewCometNode(baseDir string, cfg *UniversalTestingConfig) (*node.Node, srvtypes.Application, error)
NewCometNode creates a ready to use comet node that operates a single validator celestia-app network. It expects that all configuration files are already initialized and saved to the baseDir.
func NewKeyring ¶
func NewKeyring(accounts ...string) (keyring.Keyring, []sdk.AccAddress)
func NewOfflineSigner ¶
func NewSignerFromContext ¶
func QueryWithoutProof ¶
func RandomAccounts ¶
RandomAccounts returns a list of n random accounts
func RandomAddress ¶
func ReadBlockHeights ¶
func ReadBlockchain ¶
func ReadRecentBlocks ¶
func StartAPIServer ¶
func TestAddress ¶
func TestAddress() sdk.AccAddress
Types ¶
type Config ¶
type Config struct { Genesis *genesis.Genesis UniversalTestingConfig }
Config is the configuration of a test node.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration of a test node.
func (*Config) WithAppConfig ¶
WithAppConfig sets the AppConfig and returns the Config.
func (*Config) WithAppCreator ¶
func (c *Config) WithAppCreator(creator srvtypes.AppCreator) *Config
WithAppCreator sets the AppCreator and returns the Config.
func (*Config) WithAppOptions ¶
func (c *Config) WithAppOptions(opts *KVAppOptions) *Config
WithAppOptions sets the AppOptions and returns the Config.
func (*Config) WithChainID ¶
WithChainID sets the chain ID and returns the Config.
func (*Config) WithConsensusParams ¶
func (c *Config) WithConsensusParams(params *tmproto.ConsensusParams) *Config
WithConsensusParams sets the consensus params and returns the Config.
func (*Config) WithFundedAccounts ¶
WithFundedAccounts sets the genesis accounts and returns the Config.
func (*Config) WithGenesisTime ¶
WithGenesisTime sets the genesis time and returns the Config.
func (*Config) WithModifiers ¶
WithModifiers sets the genesis options and returns the Config.
func (*Config) WithSuppressLogs ¶
WithSuppressLogs sets the SuppressLogs and returns the Config.
func (*Config) WithTendermintConfig ¶
WithTendermintConfig sets the TmConfig and returns the *Config.
type Context ¶
func NewContext ¶
func NewNetwork ¶
NewNetwork starts a single validator celestia-app network using the provided configurations. Configured accounts will be funded and their keys can be accessed in keyring returned client.Context. All rpc, p2p, and grpc addresses in the provided configs are overwritten to use open ports. The node can be accessed via the returned client.Context or via the returned rpc and grpc addresses. Configured genesis options will be applied after all accounts have been initialized.
func StartGRPCServer ¶
func StartGRPCServer(app srvtypes.Application, appCfg *srvconfig.Config, cctx Context) (Context, func() error, error)
StartGRPCServer starts the grpc server using the provided application and config. A grpc client connection to that server is also added to the client context. The returned function should be used to shutdown the server.
func StartNode ¶
StartNode starts the tendermint node along with a local core rpc client. The rpc is returned via the client.Context. The function returned should be called during cleanup to teardown the node, core client, along with canceling the internal context.Context in the returned Context.
func (*Context) APIAddress ¶
func (*Context) FillBlock ¶
func (c *Context) FillBlock(squareSize int, account string, broadcastMode string) (*sdk.TxResponse, error)
FillBlock creates and submits a single transaction that is large enough to create a square of the desired size. broadcast mode indicates if the tx should be submitted async, sync, or block. (see flags.BroadcastModeSync). If broadcast mode is the string zero value, then it will be set to block.
func (*Context) GenesisTime ¶
GenesisTime returns the genesis block time.
func (*Context) HeightForTimestamp ¶
HeightForTimestamp returns the block height for the first block after a given timestamp.
func (*Context) LatestHeight ¶
LatestHeight returns the latest height of the network or an error if the query fails.
func (*Context) LatestTimestamp ¶
LatestTimestamp returns the latest timestamp of the network or an error if the query fails.
func (*Context) PostData ¶
func (c *Context) PostData(account, broadcastMode string, ns appns.Namespace, blobData []byte) (*sdk.TxResponse, error)
PostData will create and submit PFB transaction containing the namespace and blobData. This function blocks until the PFB has been included in a block and returns an error if the transaction is invalid or is rejected by the mempool.
func (*Context) WaitForBlocks ¶
WaitForBlocks waits until n blocks have been committed, returning an error upon failure.
func (*Context) WaitForHeight ¶
WaitForHeight performs a blocking check where it waits for a block to be committed after a given block. If that height is not reached within a timeout, an error is returned. Regardless, the latest height queried is returned.
func (*Context) WaitForHeightWithTimeout ¶
WaitForHeightWithTimeout is the same as WaitForHeight except the caller can provide a custom timeout.
func (*Context) WaitForNextBlock ¶
WaitForNextBlock waits for the next block to be committed, returning an error upon failure.
func (*Context) WaitForTimestamp ¶
WaitForTimestamp performs a blocking check where it waits for a block to be committed after a given timestamp. If that height is not reached within a timeout, an error is returned. Regardless, the latest timestamp queried is returned.
func (*Context) WaitForTimestampWithTimeout ¶
WaitForTimestampWithTimeout waits for a block with a timestamp greater than t.
type KVAppOptions ¶
type KVAppOptions struct {
// contains filtered or unexported fields
}
func DefaultAppOptions ¶
func DefaultAppOptions() *KVAppOptions
DefaultAppOptions returns the default application options.
func (*KVAppOptions) Get ¶
func (ao *KVAppOptions) Get(option string) interface{}
Get returns the option value for the given option key.
func (*KVAppOptions) Set ¶
func (ao *KVAppOptions) Set(option string, value interface{})
Set sets a key-value app option.
type UniversalTestingConfig ¶
type UniversalTestingConfig struct { // TmConfig is the Tendermint configuration used for the network. TmConfig *tmconfig.Config // AppConfig is the application configuration of the test node. AppConfig *srvconfig.Config // AppOptions are the application options of the test node. AppOptions *KVAppOptions // AppCreator is used to create the application for the testnode. AppCreator srvtypes.AppCreator // SuppressLogs in testnode. This should be set to true when running // testground tests. SuppressLogs bool }