Documentation ¶
Overview ¶
Package txexec implements all transaction executors.
Package txexec implements all transaction executors.
Package txexec implements all transaction executors.
Package txexec implements all transaction executors.
Index ¶
- Variables
- func CacheTxSender(txs types.Transactions, signer types.Signer, threadNum int)
- func CallWasmContract(codePointer unsafe.Pointer, codeLength int, actionPointer unsafe.Pointer, ...) int
- func CanTransfer(db *state.StateDB, addr common.Address, amount *big.Int, round uint64) bool
- func IntrinsicGas(data []byte, contractCreation bool) (uint64, error)
- func Pointer2Address(pointer unsafe.Pointer) (common.Address, error)
- func Pointer2Slice(pointer unsafe.Pointer, length int) ([]byte, error)
- func SimpleApplyMessage(prevStateDb *state.StateDB, statedb *state.StateDB, round uint64, msg Message, ...) ([]byte, uint64, error)
- func Transfer(db *state.StateDB, sender, recipient common.Address, amount *big.Int)
- func WasmApplyMessage(prevStateDb *state.StateDB, statedb *state.StateDB, round uint64, msg Message, ...) ([]byte, uint64, bool, error)
- type Message
- type SimpleExecutor
- func (e *SimpleExecutor) ApplyTransaction(prevStateDb *state.StateDB, state *state.StateDB, tx *types.Transaction, ...) (*types.Receipt, uint64, common.Address, error)
- func (e *SimpleExecutor) ExecuteTransaction(prevStateDb *state.StateDB, state *state.StateDB, tx *types.Transaction, ...) (*types.Receipt, common.Address, error)
- func (e *SimpleExecutor) ExecuteTransactions(txs types.Transactions, prevStateDb *state.StateDB, state *state.StateDB, ...) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
- func (e *SimpleExecutor) ExecuteTxPackage(txPackageIndex uint32, txPackage *types.TxPackage, prevStateDb *state.StateDB, ...) ([]*types.TxWithIndex, []*types.Log, types.Receipts, bool)
- func (e *SimpleExecutor) ExecuteTxPackages(txpkgs types.TxPackages, prevStateDb *state.StateDB, state *state.StateDB, ...) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
- type StateTransition
- type TxExecResult
- type TxExecutor
- type WasmExecutor
- func (e *WasmExecutor) ApplyTransaction(prevStateDb *state.StateDB, state *state.StateDB, tx *types.Transaction, ...) (*types.Receipt, uint64, common.Address, error)
- func (e *WasmExecutor) ExecuteTransaction(prevStateDb *state.StateDB, state *state.StateDB, tx *types.Transaction, ...) (*types.Receipt, common.Address, error)
- func (e *WasmExecutor) ExecuteTransactions(txs types.Transactions, prevStateDb *state.StateDB, state *state.StateDB, ...) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
- func (e *WasmExecutor) ExecuteTxPackage(txPackageIndex uint32, txPackage *types.TxPackage, prevStateDb *state.StateDB, ...) ([]*types.TxWithIndex, []*types.Log, types.Receipts, bool)
- func (e *WasmExecutor) ExecuteTxPackages(txpkgs types.TxPackages, prevStateDb *state.StateDB, state *state.StateDB, ...) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNonceNotAllowed = errors.New("nonce not allowed") ErrNonceNotAllowedTooNew = errors.New("nonce not allowed(too new)") ErrNonceNotAllowedContained = errors.New("nonce not allowed(contained)") ErrNonceNotAllowedTooOld = errors.New("nonce not allowed(too old)") ErrNonceSetNotFound = errors.New("nonceSet not found") ErrInsufficientBalance = errors.New("insufficient balance") ErrSimpleTxHasNoTarget = errors.New("simple transaction has no target") ErrInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas") ErrOutOfGas = errors.New("out of gas") ErrCodeStoreOutOfGas = errors.New("contract creation code storage out of gas") ErrWasmExec = errors.New("wasm exec return error") ErrTransferIsNotAllowed = errors.New("transfer is not allowed") )
Functions ¶
func CacheTxSender ¶
func CacheTxSender(txs types.Transactions, signer types.Signer, threadNum int)
func CallWasmContract ¶
func CanTransfer ¶
CanTransfer checks whether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.
func IntrinsicGas ¶
IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
func SimpleApplyMessage ¶
Types ¶
type Message ¶
type Message interface { From() common.Address To() *common.Address GasPrice() *big.Int Gas() uint64 Value() *big.Int Nonce() uint64 CheckNonce() bool Data() []byte }
Message represents a message sent to a contract.
type SimpleExecutor ¶
type SimpleExecutor struct {
// contains filtered or unexported fields
}
func (*SimpleExecutor) ApplyTransaction ¶
func (e *SimpleExecutor) ApplyTransaction(prevStateDb *state.StateDB, state *state.StateDB, tx *types.Transaction, block *types.Block, gp *types.GasPool, usedGas *uint64, callbackParamKey uint64) (*types.Receipt, uint64, common.Address, error)
ApplyTransaction attempts to apply a transaction to the given state database and uses the input parameters for its environment. It returns the receipt for the transaction, gas used and an error if the transaction failed, indicating the block was invalid.
func (*SimpleExecutor) ExecuteTransaction ¶
func (*SimpleExecutor) ExecuteTransactions ¶
func (e *SimpleExecutor) ExecuteTransactions(txs types.Transactions, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, txPackageIndex uint32, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
func (*SimpleExecutor) ExecuteTxPackage ¶
func (e *SimpleExecutor) ExecuteTxPackage(txPackageIndex uint32, txPackage *types.TxPackage, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, bool)
func (*SimpleExecutor) ExecuteTxPackages ¶
func (e *SimpleExecutor) ExecuteTxPackages(txpkgs types.TxPackages, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
type StateTransition ¶
type StateTransition struct {
// contains filtered or unexported fields
}
The State Transitioning Model
A state transition is a change made when a transaction is applied to the current world state The state transitioning model does all the necessary work to work out a valid new state root.
1) Nonce handling 2) Pre pay gas 3) Create a new state object if the recipient is \0*32 4) Value transfer == If contract creation ==
4a) Attempt to run transaction data 4b) If valid, use result as code for the new state object
== end ==
func NewStateTransition ¶
func NewStateTransition(prevStateDb *state.StateDB, statedb *state.StateDB, round uint64, msg Message, gp *types.GasPool, nonceSet *nonces.NonceSet, maxBitLength uint64, callbackParamKey uint64) *StateTransition
NewStateTransition initialises and returns a new state transition object.
func (*StateTransition) SimpleTransitionDb ¶
func (*StateTransition) WasmTransitionDb ¶
type TxExecutor ¶
type TxExecutor interface { ExecuteTxPackages(txpkgs types.TxPackages, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int) ExecuteTransactions(txs types.Transactions, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, txPackageIndex uint32, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int) }
func NewExecutor ¶
func NewExecutor(exeType string, maxBitLength uint64, signer types.Signer) TxExecutor
func NewSimpleExecutor ¶
func NewSimpleExecutor(signer types.Signer, maxBitLength uint64) TxExecutor
func NewWasmExecutor ¶
func NewWasmExecutor(signer types.Signer, maxBitLength uint64) TxExecutor
type WasmExecutor ¶
type WasmExecutor struct {
// contains filtered or unexported fields
}
func (*WasmExecutor) ApplyTransaction ¶
func (e *WasmExecutor) ApplyTransaction(prevStateDb *state.StateDB, state *state.StateDB, tx *types.Transaction, block *types.Block, gp *types.GasPool, usedGas *uint64, maxBitLength uint64, callbackParamKey uint64) (*types.Receipt, uint64, common.Address, error)
ApplyTransaction attempts to apply a transaction to the given state database and uses the input parameters for its environment. It returns the receipt for the transaction, gas used and an error if the transaction failed, indicating the block was invalid.
func (*WasmExecutor) ExecuteTransaction ¶
func (*WasmExecutor) ExecuteTransactions ¶
func (e *WasmExecutor) ExecuteTransactions(txs types.Transactions, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, txPackageIndex uint32, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)
func (*WasmExecutor) ExecuteTxPackage ¶
func (e *WasmExecutor) ExecuteTxPackage(txPackageIndex uint32, txPackage *types.TxPackage, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, bool)
func (*WasmExecutor) ExecuteTxPackages ¶
func (e *WasmExecutor) ExecuteTxPackages(txpkgs types.TxPackages, prevStateDb *state.StateDB, state *state.StateDB, receipts types.Receipts, block *types.Block, executedTxs []*types.TxWithIndex, usedGas *uint64, allLogs []*types.Log, gasPool *types.GasPool, callbackParamKey uint64) ([]*types.TxWithIndex, []*types.Log, types.Receipts, int)