Documentation ¶
Index ¶
- type Block
- type BlockMeta
- type BlockState
- type Executor
- func (x *Executor) BeginBlock(block *Block) (err error)
- func (m *Executor) EndBlock(block *Block) error
- func (x *Executor) ExecuteEnvelope(block *Block, delivery *chain.Delivery) (*protocol.TransactionStatus, error)
- func (m *Executor) Genesis(block *Block, callback func(st *chain.StateManager) error) error
- func (m *Executor) InitChain(block *Block, data []byte) ([]byte, error)
- func (x *Executor) ProcessRemoteSignatures(block *Block, delivery *chain.Delivery) error
- func (x *Executor) ProcessSignature(batch *database.Batch, delivery *chain.Delivery, signature protocol.Signature) (*ProcessSignatureState, error)
- func (x *Executor) ProcessTransaction(batch *database.Batch, transaction *protocol.Transaction) (*protocol.TransactionStatus, *chain.ProcessTransactionState, error)
- func (x *Executor) ProduceSynthetic(batch *database.Batch, from *protocol.Transaction, ...) error
- func (m *Executor) Query(batch *database.Batch, q *query.Query, _ int64, prove bool) (k, v []byte, err *protocol.Error)
- func (x *Executor) TransactionIsReady(batch *database.Batch, transaction *protocol.Transaction, ...) (bool, error)
- func (x *Executor) ValidateEnvelope(batch *database.Batch, delivery *chain.Delivery) (protocol.TransactionResult, error)
- type ExecutorOptions
- type PrincipalValidator
- type ProcessSignatureState
- type SignatureValidator
- type TransactionExecutor
- type TransactionExecutorCleanup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockMeta ¶
type BlockMeta struct { IsLeader bool Index int64 Time time.Time CommitInfo *types.LastCommitInfo Evidence []types.Evidence }
BlockMeta is metadata about a block.
type BlockState ¶
type BlockState struct { Delivered uint64 Signed uint64 SynthSigned uint64 SynthSent uint64 ValidatorsUpdates []chain.ValidatorUpdate ProducedTxns []*protocol.Transaction ChainUpdates chain.ChainUpdates }
BlockState tracks various metrics of a block of transactions as they are executed.
func (*BlockState) Empty ¶
func (s *BlockState) Empty() bool
Empty returns true if nothing happened during the block.
func (*BlockState) MergeSignature ¶
func (s *BlockState) MergeSignature(r *ProcessSignatureState)
func (*BlockState) MergeTransaction ¶
func (s *BlockState) MergeTransaction(r *chain.ProcessTransactionState)
type Executor ¶
type Executor struct { ExecutorOptions // contains filtered or unexported fields }
func NewGenesisExecutor ¶
func NewGenesisExecutor(db *database.Database, logger log.Logger, network config.Network, router routing.Router) (*Executor, error)
NewGenesisExecutor creates a transaction executor that can be used to set up the genesis state.
func NewNodeExecutor ¶
func NewNodeExecutor(opts ExecutorOptions, db *database.Database) (*Executor, error)
NewNodeExecutor creates a new Executor for a node.
func (*Executor) BeginBlock ¶
BeginBlock implements ./Chain
func (*Executor) ExecuteEnvelope ¶ added in v0.6.0
func (*Executor) ProcessRemoteSignatures ¶ added in v0.6.0
func (*Executor) ProcessSignature ¶
func (*Executor) ProcessTransaction ¶
func (x *Executor) ProcessTransaction(batch *database.Batch, transaction *protocol.Transaction) (*protocol.TransactionStatus, *chain.ProcessTransactionState, error)
ProcessTransaction processes a transaction. It will not return an error if the transaction fails - in that case the status code will be non zero. It only returns an error in cases like a database failure.
func (*Executor) ProduceSynthetic ¶
func (x *Executor) ProduceSynthetic(batch *database.Batch, from *protocol.Transaction, produced []*protocol.Transaction) error
func (*Executor) TransactionIsReady ¶ added in v0.6.0
func (x *Executor) TransactionIsReady(batch *database.Batch, transaction *protocol.Transaction, status *protocol.TransactionStatus) (bool, error)
func (*Executor) ValidateEnvelope ¶
func (x *Executor) ValidateEnvelope(batch *database.Batch, delivery *chain.Delivery) (protocol.TransactionResult, error)
ValidateEnvelope verifies that the envelope is valid. It checks the basics, like the envelope has signatures and a hash and/or a transaction. It validates signatures, ensuring they match the transaction hash, reference a signator, etc. And more.
ValidateEnvelope should not modify anything. Right now it updates signer timestamps and credits, but that will be moved to ProcessSignature.
type ExecutorOptions ¶
type PrincipalValidator ¶ added in v0.6.0
type PrincipalValidator interface { TransactionExecutor AllowMissingPrincipal(*protocol.Transaction) (allow, fallback bool) }
PrincipalValidator validates the principal for a specific type of transaction.
type ProcessSignatureState ¶
func (*ProcessSignatureState) Merge ¶
func (s *ProcessSignatureState) Merge(r *ProcessSignatureState)
type SignatureValidator ¶ added in v0.6.0
type SignatureValidator interface { TransactionExecutor // SignerIsAuthorized checks if the signature is authorized for the // transaction. SignerIsAuthorized(*database.Batch, *protocol.Transaction, protocol.Signer) (fallback bool, err error) // TransactionIsReady checks if the transaction is ready to be executed. TransactionIsReady(*database.Batch, *protocol.Transaction, *protocol.TransactionStatus) (ready, fallback bool, err error) }
SignatureValidator validates signatures for a specific type of transaction.
type TransactionExecutor ¶
type TransactionExecutor interface { // Type is the transaction type the executor can execute. Type() protocol.TransactionType // Validate validates the transaction for acceptance. Validate(*StateManager, *Delivery) (protocol.TransactionResult, error) // Execute fully validates and executes the transaction. Execute(*StateManager, *Delivery) (protocol.TransactionResult, error) }
TransactionExecutor executes a specific type of transaction.
type TransactionExecutorCleanup ¶ added in v0.6.0
type TransactionExecutorCleanup interface { // DidFail is called if the transaction failed. DidFail(*ProcessTransactionState, *protocol.Transaction) error }
TransactionExecutorCleanup cleans up after a failed transaction.