block

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 34 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonRecoverable = errors.New("non recoverable")
	ErrRecoverable    = errors.New("recoverable")
	ErrWrongDA        = errors.New("wrong DA")
)

Functions

This section is empty.

Types

type CachedBlock added in v1.1.0

type CachedBlock struct {
	Block  *types.Block
	Commit *types.Commit
}

type Executor added in v1.1.0

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

Executor creates and applies blocks and maintains state.

func NewExecutor added in v1.1.0

func NewExecutor(proposerAddress []byte, namespaceID string, chainID string, mempool mempool.Mempool, proxyApp proxy.AppConns, eventBus *tmtypes.EventBus, logger types.Logger) (*Executor, error)

NewExecutor creates new instance of BlockExecutor. Proposer address and namespace ID will be used in all newly created blocks.

func (*Executor) Commit added in v1.1.0

func (e *Executor) Commit(state *types.State, block *types.Block, resp *tmstate.ABCIResponses) (int64, error)

Commit commits the block

func (*Executor) CreateBlock added in v1.1.0

func (e *Executor) CreateBlock(height uint64, lastCommit *types.Commit, lastHeaderHash [32]byte, state types.State) *types.Block

CreateBlock reaps transactions from mempool and builds a block.

func (*Executor) ExecuteBlock added in v1.1.0

func (e *Executor) ExecuteBlock(state types.State, block *types.Block) (*tmstate.ABCIResponses, error)

ExecuteBlock executes the block and returns the ABCIResponses. Block should be valid (passed validation checks).

func (*Executor) GetAppInfo added in v1.1.0

func (e *Executor) GetAppInfo() (*abci.ResponseInfo, error)

GetAppInfo returns the latest AppInfo from the proxyApp.

func (*Executor) InitChain added in v1.1.0

func (e *Executor) InitChain(genesis *tmtypes.GenesisDoc, validators []*tmtypes.Validator) (*abci.ResponseInitChain, error)

InitChain calls InitChainSync using consensus connection to app.

func (*Executor) UpdateMempoolAfterInitChain added in v1.1.0

func (e *Executor) UpdateMempoolAfterInitChain(s *types.State)

func (*Executor) UpdateStateAfterInitChain added in v1.1.0

func (e *Executor) UpdateStateAfterInitChain(s *types.State, res *abci.ResponseInitChain, validators []*tmtypes.Validator)

func (*Executor) UpdateStateFromResponses added in v1.1.0

func (e *Executor) UpdateStateFromResponses(resp *tmstate.ABCIResponses, state types.State, block *types.Block) (types.State, error)

UpdateStateFromResponses updates state based on the ABCIResponses.

type Manager

type Manager struct {
	// Configuration
	Conf        config.BlockManagerConfig
	Genesis     *tmtypes.GenesisDoc
	ProposerKey crypto.PrivKey

	// Store and execution
	Store     store.Store
	LastState types.State
	Executor  *Executor

	// Clients and servers
	Pubsub *pubsub.Server

	DAClient da.DataAvailabilityLayerClient
	SLClient settlement.LayerI

	// Data retrieval
	Retriever da.BatchRetriever

	SyncTargetDiode diodes.Diode
	SyncTarget      atomic.Uint64
	// contains filtered or unexported fields
}

Manager is responsible for aggregating transactions into blocks.

func NewManager

func NewManager(
	proposerKey crypto.PrivKey,
	conf config.BlockManagerConfig,
	genesis *tmtypes.GenesisDoc,
	store store.Store,
	mempool mempool.Mempool,
	proxyApp proxy.AppConns,
	dalc da.DataAvailabilityLayerClient,
	settlementClient settlement.LayerI,
	eventBus *tmtypes.EventBus,
	pubsub *pubsub.Server,
	p2pClient *p2p.Client,
	logger types.Logger,
) (*Manager, error)

NewManager creates new block Manager.

func (*Manager) CreateNextDABatch added in v1.1.0

func (m *Manager) CreateNextDABatch(startHeight uint64, endHeight uint64) (*types.Batch, error)

func (*Manager) HandleSubmissionTrigger added in v1.1.0

func (m *Manager) HandleSubmissionTrigger(ctx context.Context) error

HandleSubmissionTrigger processes the submission trigger event. It checks if there are new blocks produced since the last submission. If there are, it attempts to submit a batch of blocks. It then attempts to produce an empty block to ensure IBC messages pass through during the batch submission process due to proofs requires for ibc messages only exist on the next block. Finally, it submits the next batch of blocks and updates the sync target to the height of the last block in the submitted batch.

func (*Manager) ProcessNextDABatch added in v1.1.0

func (m *Manager) ProcessNextDABatch(daMetaData *da.DASubmitMetaData) error

func (*Manager) ProduceAndGossipBlock added in v1.1.0

func (m *Manager) ProduceAndGossipBlock(ctx context.Context, allowEmpty bool) error

func (*Manager) ProduceBlockLoop

func (m *Manager) ProduceBlockLoop(ctx context.Context)

ProduceBlockLoop is calling publishBlock in a loop as long as we're synced.

func (*Manager) RetrieveLoop added in v1.1.0

func (m *Manager) RetrieveLoop(ctx context.Context)

RetrieveLoop listens for new sync messages written to a ring buffer and in turn runs syncUntilTarget on the latest message in the ring buffer.

func (*Manager) RunInitChain added in v1.1.0

func (m *Manager) RunInitChain(ctx context.Context) error

func (*Manager) Start added in v1.1.0

func (m *Manager) Start(ctx context.Context, isAggregator bool) error

Start starts the block manager.

func (*Manager) SubmitLoop added in v1.1.0

func (m *Manager) SubmitLoop(ctx context.Context)

func (*Manager) SyncTargetLoop

func (m *Manager) SyncTargetLoop(ctx context.Context)

SyncTargetLoop is responsible for getting real time updates about batches submission. for non aggregator: updating the sync target which will be used by retrieveLoop to sync until this target.

func (*Manager) UpdateStateFromApp added in v1.1.0

func (m *Manager) UpdateStateFromApp() error

UpdateStateFromApp is responsible for aligning the state of the store from the abci app

func (*Manager) UpdateSyncParams added in v1.1.0

func (m *Manager) UpdateSyncParams(endHeight uint64)

UpdateSyncParams updates the sync target and state index if necessary

func (*Manager) ValidateBatch added in v1.1.0

func (m *Manager) ValidateBatch(batch *types.Batch) error

type PendingBatch added in v1.1.0

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

Jump to

Keyboard shortcuts

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