Documentation
¶
Index ¶
- type ExecuteFunc
- type ExecutionContext
- type ExecutionType
- type FeeBalanceValidator
- type FeeCalculation
- type FeeCreditModule
- type FeeTxVerifier
- type GenericExecuteFunc
- type GenericTargetUnitsFunc
- type GenericValidateFunc
- type Module
- type StateInfo
- type TxExecutionContext
- func (ec *TxExecutionContext) CalculateCost() uint64
- func (ec *TxExecutionContext) CommittedUC() *types.UnicityCertificate
- func (ec *TxExecutionContext) CurrentRound() uint64
- func (ec *TxExecutionContext) ExecutionType() ExecutionType
- func (ec *TxExecutionContext) ExtraArgument() ([]byte, error)
- func (ec *TxExecutionContext) GasAvailable() uint64
- func (ec *TxExecutionContext) GetData() []byte
- func (ec *TxExecutionContext) GetUnit(id types.UnitID, committed bool) (state.Unit, error)
- func (ec *TxExecutionContext) SetData(data []byte)
- func (ec *TxExecutionContext) SetExecutionType(exeType ExecutionType)
- func (ec *TxExecutionContext) SpendGas(gas uint64) error
- func (ec *TxExecutionContext) TrustBase(epoch uint64) (types.RootTrustBase, error)
- func (ec *TxExecutionContext) WithExArg(f func() ([]byte, error)) ExecutionContext
- type TxExecutor
- type TxExecutors
- func (h TxExecutors) Add(src TxExecutors) error
- func (h TxExecutors) Execute(txo *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
- func (h TxExecutors) ExecuteWithAttr(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) (*types.ServerMetadata, error)
- func (h TxExecutors) UnmarshalTx(tx *types.TransactionOrder, exeCtx ExecutionContext) (any, any, []types.UnitID, error)
- func (h TxExecutors) Validate(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) error
- func (h TxExecutors) ValidateAndExecute(txo *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
- type TxHandler
- func (t *TxHandler[A, P]) ExecuteTx(txo *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
- func (t *TxHandler[A, P]) ExecuteTxWithAttr(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) (*types.ServerMetadata, error)
- func (t *TxHandler[A, P]) UnmarshalTx(txo *types.TransactionOrder, exeCtx ExecutionContext) (any, any, []types.UnitID, error)
- func (t *TxHandler[A, P]) ValidateTx(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) error
- type TxHandlerOption
- type ValidateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecuteFunc ¶
type ExecuteFunc func(*types.TransactionOrder, ExecutionContext) (*types.ServerMetadata, error)
type ExecutionContext ¶
type ExecutionContext interface {
predicates.TxContext
GetData() []byte // read data added by the GetData function
SetData(data []byte) // add arbitrary data to the execution context
WithExArg(func() ([]byte, error)) ExecutionContext
ExecutionType() ExecutionType
SetExecutionType(exeType ExecutionType)
}
ExecutionContext - provides additional context and info for tx validation and execution
type ExecutionType ¶
type ExecutionType uint
const ( ExecutionTypeUnconditional ExecutionType = iota // normal execution ExecutionTypeConditional // creating dummy units and placing tx "on hold" ExecutionTypeCommit // converting dummy units to normal units and executing "on hold" tx ExecutionTypeRollback // deleting dummy units? )
transaction execution types
type FeeBalanceValidator ¶
type FeeBalanceValidator interface {
IsCredible(exeCtx ExecutionContext, tx *types.TransactionOrder) error
}
type FeeCalculation ¶
type FeeCreditModule ¶
type FeeCreditModule interface {
Module
FeeCalculation
FeeBalanceValidator
FeeTxVerifier
IsPermissionedMode() bool
IsFeelessMode() bool
FeeCreditRecordUnitType() uint32
}
type FeeTxVerifier ¶
type FeeTxVerifier interface {
IsFeeCreditTx(tx *types.TransactionOrder) bool
}
type GenericExecuteFunc ¶
type GenericExecuteFunc[A, P any] func(tx *types.TransactionOrder, attributes *A, authProof *P, exeCtx ExecutionContext) (*types.ServerMetadata, error)
type GenericTargetUnitsFunc ¶
type GenericValidateFunc ¶
type GenericValidateFunc[A, P any] func(tx *types.TransactionOrder, attributes *A, authProof *P, exeCtx ExecutionContext) error
type TxExecutionContext ¶
type TxExecutionContext struct {
// contains filtered or unexported fields
}
TxExecutionContext - implementation of ExecutionContext interface for generic tx handler
func NewExecutionContext ¶
func NewExecutionContext(txSys StateInfo, f FeeCalculation, tb types.RootTrustBase, maxCost uint64) *TxExecutionContext
func (*TxExecutionContext) CalculateCost ¶
func (ec *TxExecutionContext) CalculateCost() uint64
func (*TxExecutionContext) CommittedUC ¶
func (ec *TxExecutionContext) CommittedUC() *types.UnicityCertificate
func (*TxExecutionContext) CurrentRound ¶
func (ec *TxExecutionContext) CurrentRound() uint64
func (*TxExecutionContext) ExecutionType ¶
func (ec *TxExecutionContext) ExecutionType() ExecutionType
func (*TxExecutionContext) ExtraArgument ¶
func (ec *TxExecutionContext) ExtraArgument() ([]byte, error)
ExtraArgument calls the function set using WithExArg method.
This can be used to provide "extra argument" for the predicate, currently used ie by the P2PKH predicate to receive the signature bytes it should verify.
func (*TxExecutionContext) GasAvailable ¶
func (ec *TxExecutionContext) GasAvailable() uint64
func (*TxExecutionContext) GetData ¶
func (ec *TxExecutionContext) GetData() []byte
func (*TxExecutionContext) SetData ¶
func (ec *TxExecutionContext) SetData(data []byte)
func (*TxExecutionContext) SetExecutionType ¶
func (ec *TxExecutionContext) SetExecutionType(exeType ExecutionType)
func (*TxExecutionContext) SpendGas ¶
func (ec *TxExecutionContext) SpendGas(gas uint64) error
func (*TxExecutionContext) TrustBase ¶
func (ec *TxExecutionContext) TrustBase(epoch uint64) (types.RootTrustBase, error)
func (*TxExecutionContext) WithExArg ¶
func (ec *TxExecutionContext) WithExArg(f func() ([]byte, error)) ExecutionContext
WithExArg sets the "extra argument" callback which is used by the ExtraArgument method.
type TxExecutor ¶
type TxExecutor interface {
UnmarshalTx(txo *types.TransactionOrder, ctx ExecutionContext) (any, any, []types.UnitID, error)
ValidateTx(tx *types.TransactionOrder, attributes any, authProof any, exeCtx ExecutionContext) error
ExecuteTxWithAttr(tx *types.TransactionOrder, attributes any, authProof any, exeCtx ExecutionContext) (*types.ServerMetadata, error)
ExecuteTx(tx *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
}
type TxExecutors ¶
type TxExecutors map[uint16]TxExecutor
func (TxExecutors) Execute ¶
func (h TxExecutors) Execute(txo *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
func (TxExecutors) ExecuteWithAttr ¶
func (h TxExecutors) ExecuteWithAttr(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) (*types.ServerMetadata, error)
func (TxExecutors) UnmarshalTx ¶
func (TxExecutors) Validate ¶
func (h TxExecutors) Validate(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) error
func (TxExecutors) ValidateAndExecute ¶
func (h TxExecutors) ValidateAndExecute(txo *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
type TxHandler ¶
type TxHandler[A any, P any] struct { Execute func(tx *types.TransactionOrder, attributes *A, authProof *P, exeCtx ExecutionContext) (*types.ServerMetadata, error) Validate func(tx *types.TransactionOrder, attributes *A, authProof *P, exeCtx ExecutionContext) error TargetUnits func(tx *types.TransactionOrder, attributes *A, authProof *P, exeCtx ExecutionContext) ([]types.UnitID, error) }
func NewTxHandler ¶
func (*TxHandler[A, P]) ExecuteTx ¶
func (t *TxHandler[A, P]) ExecuteTx(txo *types.TransactionOrder, exeCtx ExecutionContext) (*types.ServerMetadata, error)
func (*TxHandler[A, P]) ExecuteTxWithAttr ¶
func (t *TxHandler[A, P]) ExecuteTxWithAttr(txo *types.TransactionOrder, attr any, authProof any, exeCtx ExecutionContext) (*types.ServerMetadata, error)
func (*TxHandler[A, P]) UnmarshalTx ¶
func (*TxHandler[A, P]) ValidateTx ¶
type TxHandlerOption ¶
func WithTargetUnitsFn ¶
func WithTargetUnitsFn[A, P any](u GenericTargetUnitsFunc[A, P]) TxHandlerOption[A, P]
type ValidateFunc ¶
type ValidateFunc func(*types.TransactionOrder, ExecutionContext) error
Click to show internal directories.
Click to hide internal directories.