Documentation ¶
Index ¶
- Constants
- Variables
- type BlockCache
- type BlockSyncService
- func (bSyncService *BlockSyncService) BlockStore() *goheaderstore.Store[*types.Block]
- func (bSyncService *BlockSyncService) Start() error
- func (bSyncService *BlockSyncService) StartSyncer() error
- func (bSyncService *BlockSyncService) Stop() error
- func (bSyncService *BlockSyncService) WriteToBlockStoreAndBroadcast(ctx context.Context, block *types.Block) error
- type HeaderSyncService
- func (hSyncService *HeaderSyncService) HeaderStore() *goheaderstore.Store[*types.SignedHeader]
- func (hSyncService *HeaderSyncService) Start() error
- func (hSyncService *HeaderSyncService) StartSyncer() error
- func (hSyncService *HeaderSyncService) Stop() error
- func (hSyncService *HeaderSyncService) WriteToHeaderStoreAndBroadcast(ctx context.Context, signedHeader *types.SignedHeader) error
- type Manager
- func (m *Manager) AggregationLoop(ctx context.Context, lazy bool)
- func (m *Manager) BlockStoreRetrieveLoop(ctx context.Context)
- func (m *Manager) BlockSubmissionLoop(ctx context.Context)
- func (m *Manager) GetBlockInCh() chan NewBlockEvent
- func (m *Manager) GetStoreHeight() uint64
- func (m *Manager) IsBlockHashSeen(blockHash string) bool
- func (m *Manager) IsDAIncluded(hash types.Hash) bool
- func (m *Manager) RetrieveLoop(ctx context.Context)
- func (m *Manager) SetDALC(dalc *da.DAClient)
- func (m *Manager) SetLastState(state types.State)
- func (m *Manager) SyncLoop(ctx context.Context, cancel context.CancelFunc)
- type Metrics
- type NewBlockEvent
- type PendingBlocks
- type SyncerStatus
Constants ¶
const LastSubmittedHeightKey = "last submitted"
LastSubmittedHeightKey is the key used for persisting the last submitted height in store.
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "sequencer" )
Variables ¶
var ( // ErrNoValidatorsInGenesis is used when no validators/proposers are found in genesis state ErrNoValidatorsInGenesis = errors.New("no validators found in genesis") // ErrNotProposer is used when the manager is not a proposer ErrNotProposer = errors.New("not a proposer") )
Functions ¶
This section is empty.
Types ¶
type BlockCache ¶ added in v0.10.2
type BlockCache struct {
// contains filtered or unexported fields
}
BlockCache maintains blocks that are seen and hard confirmed
func NewBlockCache ¶ added in v0.10.2
func NewBlockCache() *BlockCache
NewBlockCache returns a new BlockCache struct
type BlockSyncService ¶ added in v0.10.5
type BlockSyncService struct {
// contains filtered or unexported fields
}
BlockSyncService is the P2P Sync Service for block that implements the go-header interface. Contains a block store where synced blocks are stored. Uses the go-header library for handling all P2P logic.
func NewBlockSyncService ¶ added in v0.10.5
func NewBlockSyncService(ctx context.Context, store ds.TxnDatastore, conf config.NodeConfig, genesis *cmtypes.GenesisDoc, p2p *p2p.Client, logger log.Logger) (*BlockSyncService, error)
NewBlockSyncService returns a new BlockSyncService.
func (*BlockSyncService) BlockStore ¶ added in v0.10.5
func (bSyncService *BlockSyncService) BlockStore() *goheaderstore.Store[*types.Block]
BlockStore returns the blockstore of the BlockSyncService
func (*BlockSyncService) Start ¶ added in v0.10.5
func (bSyncService *BlockSyncService) Start() error
Start is a part of Service interface.
func (*BlockSyncService) StartSyncer ¶ added in v0.10.5
func (bSyncService *BlockSyncService) StartSyncer() error
StartSyncer starts the BlockSyncService's syncer
func (*BlockSyncService) Stop ¶ added in v0.10.5
func (bSyncService *BlockSyncService) Stop() error
Stop is a part of Service interface.
`blockStore` is closed last because it's used by other services.
func (*BlockSyncService) WriteToBlockStoreAndBroadcast ¶ added in v0.10.5
func (bSyncService *BlockSyncService) WriteToBlockStoreAndBroadcast(ctx context.Context, block *types.Block) error
WriteToBlockStoreAndBroadcast initializes block store if needed and broadcasts provided block. Note: Only returns an error in case block store can't be initialized. Logs error if there's one while broadcasting.
type HeaderSyncService ¶ added in v0.10.7
type HeaderSyncService struct {
// contains filtered or unexported fields
}
HeaderSyncService is the P2P Sync Service for header that implements the go-header interface. Contains a header store where synced headers are stored. Uses the go-header library for handling all P2P logic.
func NewHeaderSyncService ¶ added in v0.10.7
func NewHeaderSyncService(ctx context.Context, store ds.TxnDatastore, conf config.NodeConfig, genesis *cmtypes.GenesisDoc, p2p *p2p.Client, logger log.Logger) (*HeaderSyncService, error)
NewHeaderSyncService returns a new HeaderSyncService.
func (*HeaderSyncService) HeaderStore ¶ added in v0.10.7
func (hSyncService *HeaderSyncService) HeaderStore() *goheaderstore.Store[*types.SignedHeader]
HeaderStore returns the headerstore of the HeaderSynceService
func (*HeaderSyncService) Start ¶ added in v0.10.7
func (hSyncService *HeaderSyncService) Start() error
Start is a part of Service interface.
func (*HeaderSyncService) StartSyncer ¶ added in v0.10.7
func (hSyncService *HeaderSyncService) StartSyncer() error
StartSyncer starts the HeaderSyncService's syncer
func (*HeaderSyncService) Stop ¶ added in v0.10.7
func (hSyncService *HeaderSyncService) Stop() error
Stop is a part of Service interface.
`headerStore` is closed last because it's used by other services.
func (*HeaderSyncService) WriteToHeaderStoreAndBroadcast ¶ added in v0.10.7
func (hSyncService *HeaderSyncService) WriteToHeaderStoreAndBroadcast(ctx context.Context, signedHeader *types.SignedHeader) error
WriteToHeaderStoreAndBroadcast initializes header store if needed and broadcasts provided header. Note: Only returns an error in case header store can't be initialized. Logs error if there's one while broadcasting.
type Manager ¶
type Manager struct { HeaderCh chan *types.SignedHeader BlockCh chan *types.Block // contains filtered or unexported fields }
Manager is responsible for aggregating transactions into blocks.
func NewManager ¶
func NewManager( proposerKey crypto.PrivKey, conf config.BlockManagerConfig, genesis *cmtypes.GenesisDoc, store store.Store, mempool mempool.Mempool, proxyApp proxy.AppConnConsensus, dalc *da.DAClient, eventBus *cmtypes.EventBus, logger log.Logger, blockStore *goheaderstore.Store[*types.Block], seqMetrics *Metrics, execMetrics *state.Metrics, ) (*Manager, error)
NewManager creates new block Manager.
func (*Manager) AggregationLoop ¶
AggregationLoop is responsible for aggregating transactions into rollup-blocks.
func (*Manager) BlockStoreRetrieveLoop ¶ added in v0.10.2
BlockStoreRetrieveLoop is responsible for retrieving blocks from the Block Store.
func (*Manager) BlockSubmissionLoop ¶ added in v0.10.2
BlockSubmissionLoop is responsible for submitting blocks to the DA layer.
func (*Manager) GetBlockInCh ¶ added in v0.11.8
func (m *Manager) GetBlockInCh() chan NewBlockEvent
GetBlockInCh returns the manager's blockInCh
func (*Manager) GetStoreHeight ¶ added in v0.10.2
GetStoreHeight returns the manager's store height
func (*Manager) IsBlockHashSeen ¶ added in v0.11.8
IsBlockHashSeen returns true if the block with the given hash has been seen.
func (*Manager) IsDAIncluded ¶ added in v0.10.7
IsDAIncluded returns true if the block with the given hash has been seen on DA.
func (*Manager) RetrieveLoop ¶
RetrieveLoop is responsible for interacting with DA layer.
func (*Manager) SetLastState ¶ added in v0.11.8
SetLastState is used to set lastState used by Manager.
type Metrics ¶ added in v0.11.19
type Metrics struct { // Height of the chain. Height metrics.Gauge // Number of transactions. NumTxs metrics.Gauge // Size of the block. BlockSizeBytes metrics.Gauge // Total number of transactions. TotalTxs metrics.Gauge // The latest block height. CommittedHeight metrics.Gauge `metrics_name:"latest_block_height"` }
Metrics contains metrics exposed by this package.
func PrometheusMetrics ¶ added in v0.11.19
PrometheusMetrics returns Metrics build using Prometheus client library. Optionally, labels can be provided along with their values ("foo", "fooValue").
type NewBlockEvent ¶ added in v0.11.8
NewBlockEvent is used to pass block and DA height to blockInCh
type PendingBlocks ¶ added in v0.10.3
type PendingBlocks struct {
// contains filtered or unexported fields
}
PendingBlocks maintains blocks that need to be published to DA layer
Important assertions: - blocks are safely stored in database before submission to DA - blocks are always pushed to DA in order (by height) - DA submission of multiple blocks is atomic - it's impossible to submit only part of a batch
lastSubmittedHeight is updated only after receiving confirmation from DA. Worst case scenario is when blocks was successfully submitted to DA, but confirmation was not received (e.g. node was restarted, networking issue occurred). In this case blocks are re-submitted to DA (it's extra cost). rollkit is able to skip duplicate blocks so this shouldn't affect full nodes. TODO(tzdybal): we shouldn't try to push all pending blocks at once; this should depend on max blob size
func NewPendingBlocks ¶ added in v0.10.3
NewPendingBlocks returns a new PendingBlocks struct
type SyncerStatus ¶ added in v0.10.5
type SyncerStatus struct {
// contains filtered or unexported fields
}
SyncerStatus is used by header and block exchange service for keeping track of the status of the syncer in them.