Documentation ¶
Index ¶
- Constants
- Variables
- func ScriptEngineCheck(d []byte) bool
- type Output
- type ResolvedTransaction
- func (r *ResolvedTransaction) BuyGas(state *state.State, blockTime uint64) (baseGasPrice *big.Int, gasPrice *big.Int, payer meter.Address, ...)
- func (r *ResolvedTransaction) CommonTo() *meter.Address
- func (r *ResolvedTransaction) ToContext(gasPrice *big.Int, blockNumber uint32, getID func(uint32) meter.Bytes32) *xenv.TransactionContext
- type Runtime
- func (rt *Runtime) Context() *xenv.BlockContext
- func (rt *Runtime) EnforceTelsaFork1_1Corrections()
- func (rt *Runtime) EnforceTeslaFork5_Corrections()
- func (rt *Runtime) ExecuteClause(clause *tx.Clause, clauseIndex uint32, gas uint64, ...) *Output
- func (rt *Runtime) ExecuteTransaction(tx *tx.Transaction) (receipt *tx.Receipt, err error)
- func (rt *Runtime) FromNativeContract(caller meter.Address) bool
- func (rt *Runtime) LoadERC20NativeCotract()
- func (rt *Runtime) PrepareClause(clause *tx.Clause, clauseIndex uint32, gas uint64, ...) (exec func() (output *Output, interrupted bool), interrupt func())
- func (rt *Runtime) PrepareTransaction(tx *tx.Transaction) (*TransactionExecutor, error)
- func (rt *Runtime) ScriptEngineCheck(d []byte) bool
- func (rt *Runtime) Seeker() *chain.Seeker
- func (rt *Runtime) SetVMConfig(config vm.Config) *Runtime
- func (rt *Runtime) State() *state.State
- type TransactionExecutor
Constants ¶
const (
MTRGSysContractByteCodeHex = "" /* 9352-byte string literal not displayed */
)
Variables ¶
var ( MinScriptEngDataLen int = 16 //script engine data min size EmptyRuntimeBytecode = []byte{0x60, 0x60, 0x60, 0x40, 0x52, 0x60, 0x02, 0x56} )
Functions ¶
func ScriptEngineCheck ¶ added in v1.2.0
Types ¶
type Output ¶
type Output struct { Data []byte Events tx.Events Transfers tx.Transfers LeftOverGas uint64 RefundGas uint64 VMErr error // VMErr identify the execution result of the contract function, not evm function's err. ContractAddress *meter.Address // if create a new contract, or is nil. }
Output output of clause execution.
type ResolvedTransaction ¶
type ResolvedTransaction struct { Origin meter.Address IntrinsicGas uint64 Clauses []*tx.Clause // contains filtered or unexported fields }
ResolvedTransaction resolve the transaction according to given state.
func ResolveTransaction ¶
func ResolveTransaction(tx *tx.Transaction) (*ResolvedTransaction, error)
ResolveTransaction resolves the transaction and performs basic validation.
func (*ResolvedTransaction) BuyGas ¶
func (r *ResolvedTransaction) BuyGas(state *state.State, blockTime uint64) ( baseGasPrice *big.Int, gasPrice *big.Int, payer meter.Address, returnGas func(uint64), err error)
BuyGas consumes energy to buy gas, to prepare for execution.
func (*ResolvedTransaction) CommonTo ¶
func (r *ResolvedTransaction) CommonTo() *meter.Address
CommonTo returns common 'To' field of clauses if any. Nil returned if no common 'To'.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime bases on EVM and Meter builtins.
func (*Runtime) Context ¶
func (rt *Runtime) Context() *xenv.BlockContext
func (*Runtime) EnforceTelsaFork1_1Corrections ¶ added in v1.2.0
func (rt *Runtime) EnforceTelsaFork1_1Corrections()
func (*Runtime) EnforceTeslaFork5_Corrections ¶
func (rt *Runtime) EnforceTeslaFork5_Corrections()
func (*Runtime) ExecuteClause ¶
func (rt *Runtime) ExecuteClause( clause *tx.Clause, clauseIndex uint32, gas uint64, txCtx *xenv.TransactionContext, ) *Output
ExecuteClause executes single clause.
func (*Runtime) ExecuteTransaction ¶
ExecuteTransaction executes a transaction. If some clause failed, receipt.Outputs will be nil and vmOutputs may shorter than clause count.
func (*Runtime) FromNativeContract ¶ added in v1.2.0
func (*Runtime) LoadERC20NativeCotract ¶ added in v1.2.0
func (rt *Runtime) LoadERC20NativeCotract()
func (*Runtime) PrepareClause ¶
func (rt *Runtime) PrepareClause( clause *tx.Clause, clauseIndex uint32, gas uint64, txCtx *xenv.TransactionContext, ) (exec func() (output *Output, interrupted bool), interrupt func())
PrepareClause prepare to execute clause. It allows to interrupt execution.
func (*Runtime) PrepareTransaction ¶
func (rt *Runtime) PrepareTransaction(tx *tx.Transaction) (*TransactionExecutor, error)
PrepareTransaction prepare to execute tx.
func (*Runtime) ScriptEngineCheck ¶
func (*Runtime) SetVMConfig ¶
SetVMConfig config VM. Returns this runtime.