Documentation
¶
Index ¶
- Variables
- func NewStateSummary(rootHash []byte, summary []byte) stateSummary
- type GenericTxSystem
- func (m *GenericTxSystem) BeginBlock(roundNo uint64) error
- func (m *GenericTxSystem) Commit(uc *types.UnicityCertificate) error
- func (m *GenericTxSystem) CommittedUC() *types.UnicityCertificate
- func (m *GenericTxSystem) CurrentRound() uint64
- func (m *GenericTxSystem) EndBlock() (StateSummary, error)
- func (m *GenericTxSystem) Execute(tx *types.TransactionOrder) (*types.TransactionRecord, error)
- func (m *GenericTxSystem) GetUnit(id types.UnitID, committed bool) (*state.Unit, error)
- func (m *GenericTxSystem) IsFeelessMode() bool
- func (m *GenericTxSystem) IsPermissionedMode() bool
- func (m *GenericTxSystem) Revert()
- func (m *GenericTxSystem) SerializeState(writer io.Writer, committed bool) error
- func (m *GenericTxSystem) State() StateReader
- func (m *GenericTxSystem) StateSize() (uint64, error)
- func (m *GenericTxSystem) StateSummary() (StateSummary, error)
- func (m *GenericTxSystem) TypeID() types.PartitionTypeID
- type Observability
- type Option
- func WithBeginBlockFunctions(funcs ...func(blockNumber uint64) error) Option
- func WithEndBlockFunctions(funcs ...func(blockNumber uint64) error) Option
- func WithFeeCredits(f txtypes.FeeCreditModule) Option
- func WithHashAlgorithm(hashAlgorithm crypto.Hash) Option
- func WithState(s *state.State) Option
- type Options
- type StateReader
- type StateSummary
- type StateUnlockProof
- type StateUnlockProofKind
- type TransactionExecutor
- type TransactionSystem
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewStateSummary ¶
Types ¶
type GenericTxSystem ¶
type GenericTxSystem struct {
// contains filtered or unexported fields
}
func NewGenericTxSystem ¶
func NewGenericTxSystem(pdr types.PartitionDescriptionRecord, shardID types.ShardID, trustBase types.RootTrustBase, modules []txtypes.Module, observe Observability, opts ...Option) (*GenericTxSystem, error)
func (*GenericTxSystem) BeginBlock ¶
func (m *GenericTxSystem) BeginBlock(roundNo uint64) error
func (*GenericTxSystem) Commit ¶
func (m *GenericTxSystem) Commit(uc *types.UnicityCertificate) error
func (*GenericTxSystem) CommittedUC ¶
func (m *GenericTxSystem) CommittedUC() *types.UnicityCertificate
func (*GenericTxSystem) CurrentRound ¶ added in v1.0.0
func (m *GenericTxSystem) CurrentRound() uint64
func (*GenericTxSystem) EndBlock ¶
func (m *GenericTxSystem) EndBlock() (StateSummary, error)
func (*GenericTxSystem) Execute ¶
func (m *GenericTxSystem) Execute(tx *types.TransactionOrder) (*types.TransactionRecord, error)
func (*GenericTxSystem) IsFeelessMode ¶ added in v1.0.0
func (m *GenericTxSystem) IsFeelessMode() bool
func (*GenericTxSystem) IsPermissionedMode ¶ added in v1.0.0
func (m *GenericTxSystem) IsPermissionedMode() bool
func (*GenericTxSystem) Revert ¶
func (m *GenericTxSystem) Revert()
func (*GenericTxSystem) SerializeState ¶
func (m *GenericTxSystem) SerializeState(writer io.Writer, committed bool) error
func (*GenericTxSystem) State ¶
func (m *GenericTxSystem) State() StateReader
func (*GenericTxSystem) StateSize ¶ added in v1.0.0
func (m *GenericTxSystem) StateSize() (uint64, error)
func (*GenericTxSystem) StateSummary ¶
func (m *GenericTxSystem) StateSummary() (StateSummary, error)
func (*GenericTxSystem) TypeID ¶ added in v1.0.0
func (m *GenericTxSystem) TypeID() types.PartitionTypeID
type Observability ¶
type Option ¶
type Option func(*Options)
func WithBeginBlockFunctions ¶
func WithEndBlockFunctions ¶
func WithFeeCredits ¶ added in v1.0.0
func WithFeeCredits(f txtypes.FeeCreditModule) Option
func WithHashAlgorithm ¶
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options
type StateReader ¶ added in v0.4.0
type StateReader interface {
GetUnit(id types.UnitID, committed bool) (*state.Unit, error)
CreateUnitStateProof(id types.UnitID, logIndex int) (*types.UnitStateProof, error)
CreateIndex(state.KeyExtractor[string]) (state.Index[string], error)
// Serialize writes the serialized state to the given writer.
Serialize(writer io.Writer, committed bool) error
}
type StateSummary ¶
type StateSummary interface {
// Root returns the root hash of the TransactionSystem.
Root() []byte
// Summary returns the summary value of the state.
Summary() []byte
}
StateSummary represents the root hash and summary value of the transaction system.
type StateUnlockProof ¶ added in v1.0.0
type StateUnlockProof struct {
Kind StateUnlockProofKind
Proof []byte
}
type StateUnlockProofKind ¶ added in v1.0.0
type StateUnlockProofKind byte
const ( StateUnlockRollback StateUnlockProofKind = iota StateUnlockExecute )
type TransactionExecutor ¶ added in v1.0.0
type TransactionExecutor interface {
// Execute method executes the transaction order. An error must be returned if the transaction order execution
// was not successful.
Execute(order *types.TransactionOrder) (*types.TransactionRecord, error)
}
type TransactionSystem ¶
type TransactionSystem interface {
TransactionExecutor
// StateSummary returns the summary of the current state of the transaction system or an ErrStateContainsUncommittedChanges if
// current state contains uncommitted changes.
StateSummary() (StateSummary, error)
StateSize() (uint64, error)
// BeginBlock signals the start of a new block and is invoked before any Execute method calls.
BeginBlock(uint64) error
// EndBlock signals the end of the block and is called after all transactions have been delivered to the
// transaction system.
EndBlock() (StateSummary, error)
// Revert signals the unsuccessful consensus round. When called the transaction system must revert all the changes
// made during the BeginBlock, EndBlock, and Execute method calls.
Revert()
// Commit signals the successful consensus round. Called after the block was approved by the root chain. When called
// the transaction system must commit all the changes made during the BeginBlock,
// EndBlock, and Execute method calls.
Commit(uc *types.UnicityCertificate) error
// CommittedUC returns the unicity certificate of the latest commit.
CommittedUC() *types.UnicityCertificate
// State returns clone of transaction system state
State() StateReader
// IsPermissionedMode returns true if permissioned mode is enabled and only transactions from approved parties
// are executed.
IsPermissionedMode() bool
// IsFeelessMode returns true if feeless mode is enabled and the cost of executing transactions is 0.
IsFeelessMode() bool
// TypeID returns the type identifier of the transaction system.
TypeID() types.PartitionTypeID
}
TransactionSystem is a set of rules and logic for defining units and performing transactions with them. The following sequence of methods is executed for each block: BeginBlock, Execute (called once for each transaction in the block), EndBlock, and Commit (consensus round was successful) or Revert (consensus round was unsuccessful).
Source Files
¶
Click to show internal directories.
Click to hide internal directories.