Documentation ¶
Index ¶
- Constants
- func InjectCounter(disassembly []disasm.Instr, module *wasm.Module, rule Gas) []disasm.Instr
- type BlockEntry
- type BlockEntrys
- type Counter
- type Gas
- type GasCounter
- func (gas GasCounter) AdjustedCharge(amount uint64)
- func (gas GasCounter) Charge(amount uint64)
- func (gas GasCounter) ChargeGas(amount uint64) bool
- func (gas GasCounter) GasAssert()
- func (gas GasCounter) GasCall(address common.Address, value, gasLimit, blockNumber *big.Int, ...) uint64
- func (gas GasCounter) GasConcat(size uint64)
- func (gas GasCounter) GasEqual()
- func (gas GasCounter) GasFastestStep()
- func (gas GasCounter) GasFromI64()
- func (gas GasCounter) GasFromU64()
- func (gas GasCounter) GasGetBalanceFromAddress()
- func (gas GasCounter) GasGetBlockHash()
- func (gas GasCounter) GasGetBlockNumber()
- func (gas GasCounter) GasGetBlockProduser()
- func (gas GasCounter) GasGetContractAddress()
- func (gas GasCounter) GasGetGas()
- func (gas GasCounter) GasGetGasLimit()
- func (gas GasCounter) GasGetOrigin()
- func (gas GasCounter) GasGetSender()
- func (gas GasCounter) GasGetTimestamp()
- func (gas GasCounter) GasGetValue()
- func (gas GasCounter) GasInitialMemory(initial uint64)
- func (gas GasCounter) GasLoad()
- func (gas GasCounter) GasLog(size uint64, topics uint64)
- func (gas GasCounter) GasMemoryCost(size uint64)
- func (gas GasCounter) GasPow(exponent *big.Int)
- func (gas GasCounter) GasQuickStep()
- func (gas GasCounter) GasReturnAddress()
- func (gas GasCounter) GasReturnHash()
- func (gas GasCounter) GasReturnPointer(size uint64)
- func (gas GasCounter) GasReturnU256()
- func (gas GasCounter) GasRevert()
- func (gas GasCounter) GasSHA3(size uint64)
- func (gas GasCounter) GasSendFromContract()
- func (gas GasCounter) GasStore(stateDb *state.StateDB, contractAddr common.Address, loc common.Hash, ...)
- func (gas GasCounter) GasToI64()
- func (gas GasCounter) GasToU64()
- type GasValue
- type InstructionType
- type Metering
Constants ¶
View Source
const ( WasmCostsRegular = 1 WasmCostsDiv = 16 WasmCostsMul = 4 WasmCostsMem = 2 WasmCostsStaticU256 = 64 WasmCostsStaticHash = 64 WasmCostsStaticAddress = 40 /// Memory stipend. Amount of free memory (in 64kb pages) each contract can use for stack. WasmCostsInitialMem = 4096 /// Grow memory cost, per page (64kb) WasmCostsGrowMem = 8192 WasmCostsMemcpy = 1 WasmCostsMaxStackHeight = 64 * 1024 WasmCostsOpcodesMul = 3 WasmCostsOpcodesDiv = 8 )
View Source
const ErrorDisableFloatingPoint = "Wasm contract error: disabled floating point"
View Source
const ErrorGasLimit = "Invocation resulted in gas limit violated"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockEntry ¶
type BlockEntry struct {
// contains filtered or unexported fields
}
type BlockEntrys ¶
type BlockEntrys []*BlockEntry
func (BlockEntrys) Len ¶
func (block BlockEntrys) Len() int
func (BlockEntrys) Less ¶
func (block BlockEntrys) Less(i, j int) bool
func (BlockEntrys) Swap ¶
func (block BlockEntrys) Swap(i, j int)
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter() *Counter
type Gas ¶
type Gas struct { Ops map[byte]InstructionType Rules map[InstructionType]GasValue }
type GasCounter ¶
type GasCounter struct { Contract *contract.WASMContract GasTable params.GasTable }
func NewGasCounter ¶
func NewGasCounter(contract *contract.WASMContract, gasTable params.GasTable) GasCounter
func (GasCounter) AdjustedCharge ¶
func (gas GasCounter) AdjustedCharge(amount uint64)
func (GasCounter) Charge ¶
func (gas GasCounter) Charge(amount uint64)
func (GasCounter) ChargeGas ¶
func (gas GasCounter) ChargeGas(amount uint64) bool
func (GasCounter) GasAssert ¶
func (gas GasCounter) GasAssert()
func (GasCounter) GasCall ¶
func (gas GasCounter) GasCall(address common.Address, value, gasLimit, blockNumber *big.Int, chainConfig *params.ChainConfig, statedb *state.StateDB) uint64
func (GasCounter) GasConcat ¶
func (gas GasCounter) GasConcat(size uint64)
func (GasCounter) GasEqual ¶
func (gas GasCounter) GasEqual()
func (GasCounter) GasFastestStep ¶
func (gas GasCounter) GasFastestStep()
func (GasCounter) GasFromI64 ¶
func (gas GasCounter) GasFromI64()
func (GasCounter) GasFromU64 ¶
func (gas GasCounter) GasFromU64()
func (GasCounter) GasGetBalanceFromAddress ¶
func (gas GasCounter) GasGetBalanceFromAddress()
func (GasCounter) GasGetBlockHash ¶
func (gas GasCounter) GasGetBlockHash()
func (GasCounter) GasGetBlockNumber ¶
func (gas GasCounter) GasGetBlockNumber()
func (GasCounter) GasGetBlockProduser ¶
func (gas GasCounter) GasGetBlockProduser()
func (GasCounter) GasGetContractAddress ¶
func (gas GasCounter) GasGetContractAddress()
func (GasCounter) GasGetGas ¶
func (gas GasCounter) GasGetGas()
func (GasCounter) GasGetGasLimit ¶
func (gas GasCounter) GasGetGasLimit()
func (GasCounter) GasGetOrigin ¶
func (gas GasCounter) GasGetOrigin()
func (GasCounter) GasGetSender ¶
func (gas GasCounter) GasGetSender()
func (GasCounter) GasGetTimestamp ¶
func (gas GasCounter) GasGetTimestamp()
func (GasCounter) GasGetValue ¶
func (gas GasCounter) GasGetValue()
func (GasCounter) GasInitialMemory ¶
func (gas GasCounter) GasInitialMemory(initial uint64)
func (GasCounter) GasLoad ¶
func (gas GasCounter) GasLoad()
func (GasCounter) GasLog ¶
func (gas GasCounter) GasLog(size uint64, topics uint64)
func (GasCounter) GasMemoryCost ¶
func (gas GasCounter) GasMemoryCost(size uint64)
func (GasCounter) GasPow ¶
func (gas GasCounter) GasPow(exponent *big.Int)
func (GasCounter) GasQuickStep ¶
func (gas GasCounter) GasQuickStep()
func (GasCounter) GasReturnAddress ¶
func (gas GasCounter) GasReturnAddress()
func (GasCounter) GasReturnHash ¶
func (gas GasCounter) GasReturnHash()
func (GasCounter) GasReturnPointer ¶
func (gas GasCounter) GasReturnPointer(size uint64)
func (GasCounter) GasReturnU256 ¶
func (gas GasCounter) GasReturnU256()
func (GasCounter) GasRevert ¶
func (gas GasCounter) GasRevert()
func (GasCounter) GasSendFromContract ¶
func (gas GasCounter) GasSendFromContract()
func (GasCounter) GasToI64 ¶
func (gas GasCounter) GasToI64()
func (GasCounter) GasToU64 ¶
func (gas GasCounter) GasToU64()
type InstructionType ¶
type InstructionType int
const ( InstructionTypeBit InstructionType = iota InstructionTypeAdd InstructionTypeMul InstructionTypeDiv InstructionTypeLoad InstructionTypeStore InstructionTypeConst InstructionTypeFloatConst InstructionTypeLocal InstructionTypeGlobal InstructionTypeControlFlow InstructionTypeIntegerComparsion InstructionTypeFloatComparsion InstructionTypeFloat InstructionTypeConversion InstructionTypeFloatConversion InstructionTypeReinterpretation InstructionTypeUnreachable InstructionTypeNop InstructionTypeCurrentMemory InstructionTypeGrowMemory )
Click to show internal directories.
Click to hide internal directories.