block

package
v0.7.0-beta-qa Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllSignatures

func GetAllSignatures(batch *database.Batch, transaction *database.Transaction, status *protocol.TransactionStatus, txnInitHash []byte) ([]protocol.Signature, error)

func GetSignaturesForSigner

func GetSignaturesForSigner(batch *database.Batch, transaction *database.Transaction, signer protocol.Signer) ([]protocol.Signature, error)

Types

type Block

type Block struct {
	BlockMeta
	State BlockState
	Batch *database.Batch
}

type BlockMeta

type BlockMeta struct {
	IsLeader   bool
	Index      uint64
	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) AuthorityIsSatisfied added in v1.0.0

func (x *Executor) AuthorityIsSatisfied(batch *database.Batch, transaction *protocol.Transaction, status *protocol.TransactionStatus, authUrl *url.URL) (bool, error)

func (*Executor) BeginBlock

func (x *Executor) BeginBlock(block *Block) (err error)

BeginBlock implements ./Chain

func (*Executor) EndBlock

func (m *Executor) EndBlock(block *Block) error

EndBlock implements ./Chain

func (*Executor) ExecuteEnvelope added in v0.6.0

func (x *Executor) ExecuteEnvelope(block *Block, delivery *chain.Delivery) (*protocol.TransactionStatus, error)

func (*Executor) Genesis

func (m *Executor) Genesis(block *Block, exec chain.TransactionExecutor) error

func (*Executor) GetAccountAuthoritySet added in v1.0.0

func (*Executor) GetAccountAuthoritySet(batch *database.Batch, account protocol.Account) (*protocol.AccountAuth, error)

func (*Executor) InitFromGenesis

func (m *Executor) InitFromGenesis(batch *database.Batch, data []byte) error

func (*Executor) InitFromSnapshot

func (m *Executor) InitFromSnapshot(batch *database.Batch, file ioutil2.SectionReader) error

func (*Executor) LoadStateRoot added in v1.0.0

func (m *Executor) LoadStateRoot(batch *database.Batch) ([]byte, error)

func (*Executor) ProcessRemoteSignatures added in v0.6.0

func (x *Executor) ProcessRemoteSignatures(block *Block, delivery *chain.Delivery) error

func (*Executor) ProcessSignature

func (x *Executor) ProcessSignature(batch *database.Batch, delivery *chain.Delivery, signature protocol.Signature) (*ProcessSignatureState, error)

func (*Executor) ProcessTransaction

func (x *Executor) ProcessTransaction(batch *database.Batch, delivery *chain.Delivery) (*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) Query

func (m *Executor) Query(batch *database.Batch, q query.Request, _ int64, prove bool) (k, v []byte, _ *protocol.Error)

func (*Executor) SaveSnapshot

func (m *Executor) SaveSnapshot(batch *database.Batch, file io.WriteSeeker) error

func (*Executor) SignerIsAuthorized added in v1.0.0

func (x *Executor) SignerIsAuthorized(batch *database.Batch, transaction *protocol.Transaction, signer protocol.Signer, checkAuthz bool) error

SignerIsAuthorized verifies that the signer is allowed to sign the transaction

func (*Executor) SignerIsSatisfied added in v1.0.0

func (x *Executor) SignerIsSatisfied(batch *database.Batch, transaction *protocol.Transaction, status *protocol.TransactionStatus, signer protocol.Signer) (bool, 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 ExecutorOptions struct {
	Logger  log.Logger
	Key     ed25519.PrivateKey
	Router  routing.Router
	Network config.Network
	// contains filtered or unexported fields
}

type ProcessSignatureState

type ProcessSignatureState struct {
}

func (*ProcessSignatureState) Merge

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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