stateless

package
v0.2509.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Overview

Package stateless implements a stateless CometBFT consensus node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(address string, cert *tls.Certificate) (*consensusAPI.Client, error)

NewProvider creates a new consensus provider for the stateless client.

Types

type CompositeProvider

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

CompositeProvider routes consensus requests to the most suitable provider based on dynamic scoring.

func NewCompositeProvider

func NewCompositeProvider(providers []consensusAPI.Backend) *CompositeProvider

NewCompositeProvider creates a new composite consensus provider for the stateless client.

func (*CompositeProvider) EstimateGas

EstimateGas implements consensusAPI.Backend.

func (*CompositeProvider) GetBlock

func (p *CompositeProvider) GetBlock(ctx context.Context, height int64) (*consensusAPI.Block, error)

GetBlock implements consensusAPI.Backend.

func (*CompositeProvider) GetBlockResults

func (p *CompositeProvider) GetBlockResults(ctx context.Context, height int64) (*consensusAPI.BlockResults, error)

GetBlockResults implements consensusAPI.Backend.

func (*CompositeProvider) GetChainContext

func (p *CompositeProvider) GetChainContext(ctx context.Context) (string, error)

GetChainContext implements consensusAPI.Backend.

func (*CompositeProvider) GetGenesisDocument

func (p *CompositeProvider) GetGenesisDocument(ctx context.Context) (*genesis.Document, error)

GetGenesisDocument implements consensusAPI.Backend.

func (*CompositeProvider) GetLastRetainedHeight

func (p *CompositeProvider) GetLastRetainedHeight(ctx context.Context) (int64, error)

GetLastRetainedHeight implements consensusAPI.Backend.

func (*CompositeProvider) GetLatestHeight

func (p *CompositeProvider) GetLatestHeight(ctx context.Context) (int64, error)

GetLatestHeight implements consensusAPI.Backend.

func (*CompositeProvider) GetLightBlock

func (p *CompositeProvider) GetLightBlock(ctx context.Context, height int64) (*consensusAPI.LightBlock, error)

GetLightBlock implements consensusAPI.Backend.

func (*CompositeProvider) GetNextBlockState

func (p *CompositeProvider) GetNextBlockState(ctx context.Context) (*consensusAPI.NextBlockState, error)

GetNextBlockState implements consensusAPI.Backend.

func (*CompositeProvider) GetParameters

func (p *CompositeProvider) GetParameters(ctx context.Context, height int64) (*consensusAPI.Parameters, error)

GetParameters implements consensusAPI.Backend.

func (*CompositeProvider) GetSignerNonce

GetSignerNonce implements consensusAPI.Backend.

func (*CompositeProvider) GetStatus

GetStatus implements consensusAPI.Backend.

func (*CompositeProvider) GetTransactions

func (p *CompositeProvider) GetTransactions(ctx context.Context, height int64) ([][]byte, error)

GetTransactions implements consensusAPI.Backend.

func (*CompositeProvider) GetTransactionsWithProofs

func (p *CompositeProvider) GetTransactionsWithProofs(ctx context.Context, height int64) (*consensusAPI.TransactionsWithProofs, error)

GetTransactionsWithProofs implements consensusAPI.Backend.

func (*CompositeProvider) GetTransactionsWithResults

func (p *CompositeProvider) GetTransactionsWithResults(ctx context.Context, height int64) (*consensusAPI.TransactionsWithResults, error)

GetTransactionsWithResults implements consensusAPI.Backend.

func (*CompositeProvider) GetUnconfirmedTransactions

func (p *CompositeProvider) GetUnconfirmedTransactions(ctx context.Context) ([][]byte, error)

GetUnconfirmedTransactions implements consensusAPI.Backend.

func (*CompositeProvider) GetValidators added in v0.2508.0

func (p *CompositeProvider) GetValidators(ctx context.Context, height int64) (*consensusAPI.Validators, error)

GetValidators implements consensusAPI.Backend.

func (*CompositeProvider) MinGasPrice

func (p *CompositeProvider) MinGasPrice(ctx context.Context) (*quantity.Quantity, error)

MinGasPrice implements consensusAPI.Backend.

func (*CompositeProvider) State

func (p *CompositeProvider) State() syncer.ReadSyncer

State implements consensusAPI.Backend.

func (*CompositeProvider) StateToGenesis

func (p *CompositeProvider) StateToGenesis(ctx context.Context, height int64) (*genesis.Document, error)

StateToGenesis implements consensusAPI.Backend.

func (*CompositeProvider) SubmitEvidence

func (p *CompositeProvider) SubmitEvidence(ctx context.Context, evidence *consensusAPI.Evidence) error

SubmitEvidence implements consensusAPI.Backend.

func (*CompositeProvider) SubmitTx

SubmitTx implements consensusAPI.Backend.

func (*CompositeProvider) SubmitTxNoWait

SubmitTxNoWait implements consensusAPI.Backend.

func (*CompositeProvider) SubmitTxWithProof

SubmitTxWithProof implements consensusAPI.Backend.

func (*CompositeProvider) SyncGet

SyncGet implements syncer.ReadSyncer.

func (*CompositeProvider) SyncGetPrefixes

SyncGetPrefixes implements syncer.ReadSyncer.

func (*CompositeProvider) SyncIterate

SyncIterate implements syncer.ReadSyncer.

func (*CompositeProvider) WatchBlocks

WatchBlocks implements consensusAPI.Backend.

type Config

type Config struct {
	// ChainID is the unique identifier of the chain.
	ChainID string
	// ChainContext is the chain's domain separation context.
	ChainContext string
	// Genesis provides access to the genesis document.
	Genesis genesisAPI.Provider
	// GenesisDoc is the CometBFT genesis document.
	GenesisDoc *cmttypes.GenesisDoc
	// GenesisHeight is the block height at which the genesis document
	// was generated.
	GenesisHeight int64
	// BaseEpoch is the starting epoch.
	BaseEpoch beaconAPI.EpochTime
	// BaseHeight is the starting height.
	BaseHeight int64
}

Config contains configuration parameters for the stateless services.

type Core

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

Core is a stateless implementation of consensus backend.

func NewCore

func NewCore(provider consensusAPI.Backend, lightClient *light.Client, cfg Config) *Core

NewCore creates a new stateless consensus backend.

After construction, queriers must be set before using the instance.

func (*Core) EstimateGas

func (c *Core) EstimateGas(ctx context.Context, req *consensusAPI.EstimateGasRequest) (transaction.Gas, error)

EstimateGas implements api.Backend.

func (*Core) GetBlock

func (c *Core) GetBlock(ctx context.Context, height int64) (*consensusAPI.Block, error)

GetBlock implements api.Backend.

func (*Core) GetBlockResults

func (c *Core) GetBlockResults(ctx context.Context, height int64) (*consensusAPI.BlockResults, error)

GetBlockResults implements api.Backend.

func (*Core) GetChainContext

func (c *Core) GetChainContext(context.Context) (string, error)

GetChainContext implements api.Backend.

func (*Core) GetGenesisDocument

func (c *Core) GetGenesisDocument(context.Context) (*genesisAPI.Document, error)

GetGenesisDocument implements api.Backend.

func (*Core) GetLastRetainedHeight

func (c *Core) GetLastRetainedHeight(ctx context.Context) (int64, error)

GetLastRetainedHeight implements api.Backend.

func (*Core) GetLatestHeight

func (c *Core) GetLatestHeight(ctx context.Context) (int64, error)

GetLatestHeight implements api.Backend.

func (*Core) GetLightBlock

func (c *Core) GetLightBlock(ctx context.Context, height int64) (*consensusAPI.LightBlock, error)

GetLightBlock implements api.Backend.

func (*Core) GetNextBlockState

func (c *Core) GetNextBlockState(ctx context.Context) (*consensusAPI.NextBlockState, error)

GetNextBlockState implements api.Backend.

func (*Core) GetParameters

func (c *Core) GetParameters(ctx context.Context, height int64) (*consensusAPI.Parameters, error)

GetParameters implements api.Backend.

func (*Core) GetSignerNonce

GetSignerNonce implements api.Backend.

func (*Core) GetStatus

func (c *Core) GetStatus(ctx context.Context) (*consensusAPI.Status, error)

GetStatus implements api.Backend.

func (*Core) GetTransactions

func (c *Core) GetTransactions(ctx context.Context, height int64) ([][]byte, error)

GetTransactions implements api.Backend.

func (*Core) GetTransactionsWithProofs

func (c *Core) GetTransactionsWithProofs(ctx context.Context, height int64) (*consensusAPI.TransactionsWithProofs, error)

GetTransactionsWithProofs implements api.Backend.

func (*Core) GetTransactionsWithResults

func (c *Core) GetTransactionsWithResults(ctx context.Context, height int64) (*consensusAPI.TransactionsWithResults, error)

GetTransactionsWithResults implements api.Backend.

func (*Core) GetUnconfirmedTransactions

func (c *Core) GetUnconfirmedTransactions(ctx context.Context) ([][]byte, error)

GetUnconfirmedTransactions implements api.Backend.

func (*Core) GetValidators added in v0.2508.0

func (c *Core) GetValidators(ctx context.Context, height int64) (*consensusAPI.Validators, error)

GetValidators implements api.Backend.

func (*Core) MinGasPrice

func (c *Core) MinGasPrice(ctx context.Context) (*quantity.Quantity, error)

MinGasPrice implements api.Backend.

func (*Core) Serve

func (c *Core) Serve(ctx context.Context) error

Serve listens for new blocks and notifies subscribers when requested.

func (*Core) SetQueriers

func (c *Core) SetQueriers(beaconQuerier beacon.QueryFactory, consensusQuerier consensus.QueryFactory, registryQuerier registry.QueryFactory)

SetQueriers sets consensus and registry queriers.

func (*Core) State

func (c *Core) State() syncer.ReadSyncer

State implements api.Backend.

func (*Core) StateRoot

func (c *Core) StateRoot(ctx context.Context, height int64) (mkvsNode.Root, error)

StateRoot implements StateRooter.

func (*Core) StateToGenesis

func (c *Core) StateToGenesis(context.Context, int64) (*genesisAPI.Document, error)

StateToGenesis implements api.Backend.

func (*Core) SubmitEvidence

func (c *Core) SubmitEvidence(ctx context.Context, evidence *consensusAPI.Evidence) error

SubmitEvidence implements api.Backend.

func (*Core) SubmitTx

func (c *Core) SubmitTx(ctx context.Context, tx *transaction.SignedTransaction) error

SubmitTx implements api.Backend.

func (*Core) SubmitTxNoWait

func (c *Core) SubmitTxNoWait(ctx context.Context, tx *transaction.SignedTransaction) error

SubmitTxNoWait implements api.Backend.

func (*Core) SubmitTxWithProof

func (c *Core) SubmitTxWithProof(ctx context.Context, tx *transaction.SignedTransaction) (*transaction.Proof, error)

SubmitTxWithProof implements api.Backend.

func (*Core) WatchBlocks

func (c *Core) WatchBlocks(context.Context) (<-chan *consensusAPI.Block, pubsub.ClosableSubscription, error)

WatchBlocks implements api.Backend.

type Service

type Service struct {
	*Services
	// contains filtered or unexported fields
}

Service is a stateless CometBFT service.

func NewService

func NewService(services *Services, submitter consensusAPI.SubmissionManager) (*Service, error)

NewService creates a new stateless CometBFT service.

func (*Service) Checkpointer

func (s *Service) Checkpointer() checkpoint.Checkpointer

Checkpointer implements consensusAPI.Service.

func (*Service) Cleanup

func (s *Service) Cleanup()

Cleanup implements consensusAPI.Service.

func (*Service) GetAddresses

func (s *Service) GetAddresses() ([]node.ConsensusAddress, error)

GetAddresses implements consensusAPI.Service.

func (*Service) Name

func (s *Service) Name() string

Name implements consensusAPI.Service.

func (*Service) Pruner

func (s *Service) Pruner() consensusAPI.StatePruner

Pruner implements consensusAPI.Service.

func (*Service) Quit

func (s *Service) Quit() <-chan struct{}

Quit implements consensusAPI.Service.

func (*Service) Serve

func (s *Service) Serve(ctx context.Context) error

Serve starts the service.

func (*Service) Start

func (s *Service) Start() error

Start implements consensusAPI.Service.

func (*Service) Stop

func (s *Service) Stop()

Stop implements consensusAPI.Service.

func (*Service) SubmissionManager

func (s *Service) SubmissionManager() consensusAPI.SubmissionManager

SubmissionManager implements consensusAPI.Service.

func (*Service) SupportedFeatures

func (s *Service) SupportedFeatures() consensusAPI.FeatureMask

SupportedFeatures implements consensusAPI.Service.

func (*Service) Synced

func (s *Service) Synced() <-chan struct{}

Synced implements consensusAPI.Service.

type Services

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

Services is a stateless implementation of CometBFT services.

func NewServices

func NewServices(provider consensusAPI.Backend, lightClient *light.Client, cfg Config) (*Services, error)

NewServices creates new stateless CometBFT services.

Stateless services retrieve untrusted data from the specified remote provider and verify it using the provided light client.

func (*Services) Beacon

func (s *Services) Beacon() beaconAPI.Backend

Beacon implements consensusAPI.Services.

func (*Services) Core

func (s *Services) Core() consensusAPI.Backend

Core implements consensusAPI.Services.

func (*Services) Governance

func (s *Services) Governance() governanceAPI.Backend

Governance implements consensusAPI.Services.

func (*Services) KeyManager

func (s *Services) KeyManager() keymanagerAPI.Backend

KeyManager implements consensusAPI.Services.

func (*Services) Registry

func (s *Services) Registry() registryAPI.Backend

Registry implements consensusAPI.Services.

func (*Services) RootHash

func (s *Services) RootHash() roothashAPI.Backend

RootHash implements consensusAPI.Services.

func (*Services) Scheduler

func (s *Services) Scheduler() schedulerAPI.Backend

Scheduler implements consensusAPI.Services.

func (*Services) Serve

func (s *Services) Serve(ctx context.Context) error

Serve listens for blocks and notifies service clients about new blocks and related events.

func (*Services) Staking

func (s *Services) Staking() stakingAPI.Backend

Staking implements consensusAPI.Services.

func (*Services) Synced

func (s *Services) Synced() <-chan struct{}

Synced returns a channel that is closed once synchronization is complete.

func (*Services) Vault

func (s *Services) Vault() vaultAPI.Backend

Vault implements consensusAPI.Services.

Jump to

Keyboard shortcuts

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