config

package
v1.2.65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const GasValueForTests = 1

Variables

View Source
var AsyncCallbackGasLockForTests = uint64(100_000)

Functions

func FillGasMap_BaseOperationCosts

func FillGasMap_BaseOperationCosts(value uint64) map[string]uint64

func FillGasMap_BaseOpsAPICosts added in v1.2.50

func FillGasMap_BaseOpsAPICosts(value, asyncCallbackGasLock uint64) map[string]uint64

func FillGasMap_BigIntAPICosts

func FillGasMap_BigIntAPICosts(value uint64) map[string]uint64

func FillGasMap_BuiltInCosts

func FillGasMap_BuiltInCosts(value uint64) map[string]uint64

func FillGasMap_CryptoAPICosts

func FillGasMap_CryptoAPICosts(value uint64) map[string]uint64

func FillGasMap_EthereumAPICosts

func FillGasMap_EthereumAPICosts(value uint64) map[string]uint64

func FillGasMap_WASMOpcodeValues

func FillGasMap_WASMOpcodeValues(value uint64) map[string]uint64

Types

type BaseOperationCost

type BaseOperationCost struct {
	StorePerByte      uint64
	ReleasePerByte    uint64
	DataCopyPerByte   uint64
	PersistPerByte    uint64
	CompilePerByte    uint64
	AoTPreparePerByte uint64
	GetCode           uint64
}

type BaseOpsAPICost added in v1.2.50

type BaseOpsAPICost struct {
	GetSCAddress         uint64
	GetOwnerAddress      uint64
	IsSmartContract      uint64
	GetShardOfAddress    uint64
	GetExternalBalance   uint64
	GetBlockHash         uint64
	TransferValue        uint64
	GetArgument          uint64
	GetFunction          uint64
	GetNumArguments      uint64
	StorageStore         uint64
	StorageLoad          uint64
	GetCaller            uint64
	GetCallValue         uint64
	Log                  uint64
	Finish               uint64
	SignalError          uint64
	GetBlockTimeStamp    uint64
	GetGasLeft           uint64
	Int64GetArgument     uint64
	Int64StorageStore    uint64
	Int64StorageLoad     uint64
	Int64Finish          uint64
	GetStateRootHash     uint64
	GetBlockNonce        uint64
	GetBlockEpoch        uint64
	GetBlockRound        uint64
	GetBlockRandomSeed   uint64
	ExecuteOnSameContext uint64
	ExecuteOnDestContext uint64
	DelegateExecution    uint64
	ExecuteReadOnly      uint64
	AsyncCallStep        uint64
	AsyncCallbackGasLock uint64
	CreateContract       uint64
	GetReturnData        uint64
	GetNumReturnData     uint64
	GetReturnDataSize    uint64
}

type BigIntAPICost

type BigIntAPICost struct {
	BigIntNew                  uint64
	BigIntUnsignedByteLength   uint64
	BigIntSignedByteLength     uint64
	BigIntGetUnsignedBytes     uint64
	BigIntGetSignedBytes       uint64
	BigIntSetUnsignedBytes     uint64
	BigIntSetSignedBytes       uint64
	BigIntIsInt64              uint64
	BigIntGetInt64             uint64
	BigIntSetInt64             uint64
	BigIntAdd                  uint64
	BigIntSub                  uint64
	BigIntMul                  uint64
	BigIntTDiv                 uint64
	BigIntTMod                 uint64
	BigIntEDiv                 uint64
	BigIntEMod                 uint64
	BigIntAbs                  uint64
	BigIntNeg                  uint64
	BigIntSign                 uint64
	BigIntCmp                  uint64
	BigIntNot                  uint64
	BigIntAnd                  uint64
	BigIntOr                   uint64
	BigIntXor                  uint64
	BigIntShr                  uint64
	BigIntShl                  uint64
	BigIntFinishUnsigned       uint64
	BigIntFinishSigned         uint64
	BigIntStorageLoadUnsigned  uint64
	BigIntStorageStoreUnsigned uint64
	BigIntGetUnsignedArgument  uint64
	BigIntGetSignedArgument    uint64
	BigIntGetCallValue         uint64
	BigIntGetExternalBalance   uint64
}

type CryptoAPICost

type CryptoAPICost struct {
	SHA256          uint64
	Keccak256       uint64
	Ripemd160       uint64
	VerifyBLS       uint64
	VerifyEd25519   uint64
	VerifySecp256k1 uint64
}

type EthAPICost

type EthAPICost struct {
	UseGas              uint64
	GetAddress          uint64
	GetExternalBalance  uint64
	GetBlockHash        uint64
	Call                uint64
	CallDataCopy        uint64
	GetCallDataSize     uint64
	CallCode            uint64
	CallDelegate        uint64
	CallStatic          uint64
	StorageStore        uint64
	StorageLoad         uint64
	GetCaller           uint64
	GetCallValue        uint64
	CodeCopy            uint64
	GetCodeSize         uint64
	GetBlockCoinbase    uint64
	Create              uint64
	GetBlockDifficulty  uint64
	ExternalCodeCopy    uint64
	GetExternalCodeSize uint64
	GetGasLeft          uint64
	GetBlockGasLimit    uint64
	GetTxGasPrice       uint64
	Log                 uint64
	GetBlockNumber      uint64
	GetTxOrigin         uint64
	Finish              uint64
	Revert              uint64
	GetReturnDataSize   uint64
	ReturnDataCopy      uint64
	SelfDestruct        uint64
	GetBlockTimeStamp   uint64
}

type GasCost

type GasCost struct {
	BaseOperationCost BaseOperationCost
	BigIntAPICost     BigIntAPICost
	EthAPICost        EthAPICost
	BaseOpsAPICost    BaseOpsAPICost
	CryptoAPICost     CryptoAPICost
	WASMOpcodeCost    WASMOpcodeCost
}

func CreateGasConfig

func CreateGasConfig(gasMap GasScheduleMap) (*GasCost, error)

type GasScheduleMap

type GasScheduleMap = map[string]map[string]uint64

GasScheduleMap (alias) is the map for gas schedule

func FillGasMap

func FillGasMap(gasMap GasScheduleMap, value, asyncCallbackGasLock uint64) GasScheduleMap

func MakeGasMap

func MakeGasMap(value, asyncCallbackGasLock uint64) GasScheduleMap

func MakeGasMapForTests

func MakeGasMapForTests() GasScheduleMap

type WASMOpcodeCost

type WASMOpcodeCost struct {
	Unreachable            uint32
	Nop                    uint32
	Block                  uint32
	Loop                   uint32
	If                     uint32
	Else                   uint32
	End                    uint32
	Br                     uint32
	BrIf                   uint32
	BrTable                uint32
	Return                 uint32
	Call                   uint32
	CallIndirect           uint32
	Drop                   uint32
	Select                 uint32
	TypedSelect            uint32
	LocalGet               uint32
	LocalSet               uint32
	LocalTee               uint32
	GlobalGet              uint32
	GlobalSet              uint32
	I32Load                uint32
	I64Load                uint32
	F32Load                uint32
	F64Load                uint32
	I32Load8S              uint32
	I32Load8U              uint32
	I32Load16S             uint32
	I32Load16U             uint32
	I64Load8S              uint32
	I64Load8U              uint32
	I64Load16S             uint32
	I64Load16U             uint32
	I64Load32S             uint32
	I64Load32U             uint32
	I32Store               uint32
	I64Store               uint32
	F32Store               uint32
	F64Store               uint32
	I32Store8              uint32
	I32Store16             uint32
	I64Store8              uint32
	I64Store16             uint32
	I64Store32             uint32
	MemorySize             uint32
	MemoryGrow             uint32
	I32Const               uint32
	I64Const               uint32
	F32Const               uint32
	F64Const               uint32
	RefNull                uint32
	RefIsNull              uint32
	RefFunc                uint32
	I32Eqz                 uint32
	I32Eq                  uint32
	I32Ne                  uint32
	I32LtS                 uint32
	I32LtU                 uint32
	I32GtS                 uint32
	I32GtU                 uint32
	I32LeS                 uint32
	I32LeU                 uint32
	I32GeS                 uint32
	I32GeU                 uint32
	I64Eqz                 uint32
	I64Eq                  uint32
	I64Ne                  uint32
	I64LtS                 uint32
	I64LtU                 uint32
	I64GtS                 uint32
	I64GtU                 uint32
	I64LeS                 uint32
	I64LeU                 uint32
	I64GeS                 uint32
	I64GeU                 uint32
	F32Eq                  uint32
	F32Ne                  uint32
	F32Lt                  uint32
	F32Gt                  uint32
	F32Le                  uint32
	F32Ge                  uint32
	F64Eq                  uint32
	F64Ne                  uint32
	F64Lt                  uint32
	F64Gt                  uint32
	F64Le                  uint32
	F64Ge                  uint32
	I32Clz                 uint32
	I32Ctz                 uint32
	I32Popcnt              uint32
	I32Add                 uint32
	I32Sub                 uint32
	I32Mul                 uint32
	I32DivS                uint32
	I32DivU                uint32
	I32RemS                uint32
	I32RemU                uint32
	I32And                 uint32
	I32Or                  uint32
	I32Xor                 uint32
	I32Shl                 uint32
	I32ShrS                uint32
	I32ShrU                uint32
	I32Rotl                uint32
	I32Rotr                uint32
	I64Clz                 uint32
	I64Ctz                 uint32
	I64Popcnt              uint32
	I64Add                 uint32
	I64Sub                 uint32
	I64Mul                 uint32
	I64DivS                uint32
	I64DivU                uint32
	I64RemS                uint32
	I64RemU                uint32
	I64And                 uint32
	I64Or                  uint32
	I64Xor                 uint32
	I64Shl                 uint32
	I64ShrS                uint32
	I64ShrU                uint32
	I64Rotl                uint32
	I64Rotr                uint32
	F32Abs                 uint32
	F32Neg                 uint32
	F32Ceil                uint32
	F32Floor               uint32
	F32Trunc               uint32
	F32Nearest             uint32
	F32Sqrt                uint32
	F32Add                 uint32
	F32Sub                 uint32
	F32Mul                 uint32
	F32Div                 uint32
	F32Min                 uint32
	F32Max                 uint32
	F32Copysign            uint32
	F64Abs                 uint32
	F64Neg                 uint32
	F64Ceil                uint32
	F64Floor               uint32
	F64Trunc               uint32
	F64Nearest             uint32
	F64Sqrt                uint32
	F64Add                 uint32
	F64Sub                 uint32
	F64Mul                 uint32
	F64Div                 uint32
	F64Min                 uint32
	F64Max                 uint32
	F64Copysign            uint32
	I32WrapI64             uint32
	I32TruncF32S           uint32
	I32TruncF32U           uint32
	I32TruncF64S           uint32
	I32TruncF64U           uint32
	I64ExtendI32S          uint32
	I64ExtendI32U          uint32
	I64TruncF32S           uint32
	I64TruncF32U           uint32
	I64TruncF64S           uint32
	I64TruncF64U           uint32
	F32ConvertI32S         uint32
	F32ConvertI32U         uint32
	F32ConvertI64S         uint32
	F32ConvertI64U         uint32
	F32DemoteF64           uint32
	F64ConvertI32S         uint32
	F64ConvertI32U         uint32
	F64ConvertI64S         uint32
	F64ConvertI64U         uint32
	F64PromoteF32          uint32
	I32ReinterpretF32      uint32
	I64ReinterpretF64      uint32
	F32ReinterpretI32      uint32
	F64ReinterpretI64      uint32
	I32Extend8S            uint32
	I32Extend16S           uint32
	I64Extend8S            uint32
	I64Extend16S           uint32
	I64Extend32S           uint32
	I32TruncSatF32S        uint32
	I32TruncSatF32U        uint32
	I32TruncSatF64S        uint32
	I32TruncSatF64U        uint32
	I64TruncSatF32S        uint32
	I64TruncSatF32U        uint32
	I64TruncSatF64S        uint32
	I64TruncSatF64U        uint32
	MemoryInit             uint32
	DataDrop               uint32
	MemoryCopy             uint32
	MemoryFill             uint32
	TableInit              uint32
	ElemDrop               uint32
	TableCopy              uint32
	TableFill              uint32
	TableGet               uint32
	TableSet               uint32
	TableGrow              uint32
	TableSize              uint32
	AtomicNotify           uint32
	I32AtomicWait          uint32
	I64AtomicWait          uint32
	AtomicFence            uint32
	I32AtomicLoad          uint32
	I64AtomicLoad          uint32
	I32AtomicLoad8U        uint32
	I32AtomicLoad16U       uint32
	I64AtomicLoad8U        uint32
	I64AtomicLoad16U       uint32
	I64AtomicLoad32U       uint32
	I32AtomicStore         uint32
	I64AtomicStore         uint32
	I32AtomicStore8        uint32
	I32AtomicStore16       uint32
	I64AtomicStore8        uint32
	I64AtomicStore16       uint32
	I64AtomicStore32       uint32
	I32AtomicRmwAdd        uint32
	I64AtomicRmwAdd        uint32
	I32AtomicRmw8AddU      uint32
	I32AtomicRmw16AddU     uint32
	I64AtomicRmw8AddU      uint32
	I64AtomicRmw16AddU     uint32
	I64AtomicRmw32AddU     uint32
	I32AtomicRmwSub        uint32
	I64AtomicRmwSub        uint32
	I32AtomicRmw8SubU      uint32
	I32AtomicRmw16SubU     uint32
	I64AtomicRmw8SubU      uint32
	I64AtomicRmw16SubU     uint32
	I64AtomicRmw32SubU     uint32
	I32AtomicRmwAnd        uint32
	I64AtomicRmwAnd        uint32
	I32AtomicRmw8AndU      uint32
	I32AtomicRmw16AndU     uint32
	I64AtomicRmw8AndU      uint32
	I64AtomicRmw16AndU     uint32
	I64AtomicRmw32AndU     uint32
	I32AtomicRmwOr         uint32
	I64AtomicRmwOr         uint32
	I32AtomicRmw8OrU       uint32
	I32AtomicRmw16OrU      uint32
	I64AtomicRmw8OrU       uint32
	I64AtomicRmw16OrU      uint32
	I64AtomicRmw32OrU      uint32
	I32AtomicRmwXor        uint32
	I64AtomicRmwXor        uint32
	I32AtomicRmw8XorU      uint32
	I32AtomicRmw16XorU     uint32
	I64AtomicRmw8XorU      uint32
	I64AtomicRmw16XorU     uint32
	I64AtomicRmw32XorU     uint32
	I32AtomicRmwXchg       uint32
	I64AtomicRmwXchg       uint32
	I32AtomicRmw8XchgU     uint32
	I32AtomicRmw16XchgU    uint32
	I64AtomicRmw8XchgU     uint32
	I64AtomicRmw16XchgU    uint32
	I64AtomicRmw32XchgU    uint32
	I32AtomicRmwCmpxchg    uint32
	I64AtomicRmwCmpxchg    uint32
	I32AtomicRmw8CmpxchgU  uint32
	I32AtomicRmw16CmpxchgU uint32
	I64AtomicRmw8CmpxchgU  uint32
	I64AtomicRmw16CmpxchgU uint32
	I64AtomicRmw32CmpxchgU uint32
	V128Load               uint32
	V128Store              uint32
	V128Const              uint32
	I8x16Splat             uint32
	I8x16ExtractLaneS      uint32
	I8x16ExtractLaneU      uint32
	I8x16ReplaceLane       uint32
	I16x8Splat             uint32
	I16x8ExtractLaneS      uint32
	I16x8ExtractLaneU      uint32
	I16x8ReplaceLane       uint32
	I32x4Splat             uint32
	I32x4ExtractLane       uint32
	I32x4ReplaceLane       uint32
	I64x2Splat             uint32
	I64x2ExtractLane       uint32
	I64x2ReplaceLane       uint32
	F32x4Splat             uint32
	F32x4ExtractLane       uint32
	F32x4ReplaceLane       uint32
	F64x2Splat             uint32
	F64x2ExtractLane       uint32
	F64x2ReplaceLane       uint32
	I8x16Eq                uint32
	I8x16Ne                uint32
	I8x16LtS               uint32
	I8x16LtU               uint32
	I8x16GtS               uint32
	I8x16GtU               uint32
	I8x16LeS               uint32
	I8x16LeU               uint32
	I8x16GeS               uint32
	I8x16GeU               uint32
	I16x8Eq                uint32
	I16x8Ne                uint32
	I16x8LtS               uint32
	I16x8LtU               uint32
	I16x8GtS               uint32
	I16x8GtU               uint32
	I16x8LeS               uint32
	I16x8LeU               uint32
	I16x8GeS               uint32
	I16x8GeU               uint32
	I32x4Eq                uint32
	I32x4Ne                uint32
	I32x4LtS               uint32
	I32x4LtU               uint32
	I32x4GtS               uint32
	I32x4GtU               uint32
	I32x4LeS               uint32
	I32x4LeU               uint32
	I32x4GeS               uint32
	I32x4GeU               uint32
	F32x4Eq                uint32
	F32x4Ne                uint32
	F32x4Lt                uint32
	F32x4Gt                uint32
	F32x4Le                uint32
	F32x4Ge                uint32
	F64x2Eq                uint32
	F64x2Ne                uint32
	F64x2Lt                uint32
	F64x2Gt                uint32
	F64x2Le                uint32
	F64x2Ge                uint32
	V128Not                uint32
	V128And                uint32
	V128AndNot             uint32
	V128Or                 uint32
	V128Xor                uint32
	V128Bitselect          uint32
	I8x16Neg               uint32
	I8x16AnyTrue           uint32
	I8x16AllTrue           uint32
	I8x16Shl               uint32
	I8x16ShrS              uint32
	I8x16ShrU              uint32
	I8x16Add               uint32
	I8x16AddSaturateS      uint32
	I8x16AddSaturateU      uint32
	I8x16Sub               uint32
	I8x16SubSaturateS      uint32
	I8x16SubSaturateU      uint32
	I8x16MinS              uint32
	I8x16MinU              uint32
	I8x16MaxS              uint32
	I8x16MaxU              uint32
	I8x16Mul               uint32
	I16x8Neg               uint32
	I16x8AnyTrue           uint32
	I16x8AllTrue           uint32
	I16x8Shl               uint32
	I16x8ShrS              uint32
	I16x8ShrU              uint32
	I16x8Add               uint32
	I16x8AddSaturateS      uint32
	I16x8AddSaturateU      uint32
	I16x8Sub               uint32
	I16x8SubSaturateS      uint32
	I16x8SubSaturateU      uint32
	I16x8Mul               uint32
	I16x8MinS              uint32
	I16x8MinU              uint32
	I16x8MaxS              uint32
	I16x8MaxU              uint32
	I32x4Neg               uint32
	I32x4AnyTrue           uint32
	I32x4AllTrue           uint32
	I32x4Shl               uint32
	I32x4ShrS              uint32
	I32x4ShrU              uint32
	I32x4Add               uint32
	I32x4Sub               uint32
	I32x4Mul               uint32
	I32x4MinS              uint32
	I32x4MinU              uint32
	I32x4MaxS              uint32
	I32x4MaxU              uint32
	I64x2Neg               uint32
	I64x2AnyTrue           uint32
	I64x2AllTrue           uint32
	I64x2Shl               uint32
	I64x2ShrS              uint32
	I64x2ShrU              uint32
	I64x2Add               uint32
	I64x2Sub               uint32
	I64x2Mul               uint32
	F32x4Abs               uint32
	F32x4Neg               uint32
	F32x4Sqrt              uint32
	F32x4Add               uint32
	F32x4Sub               uint32
	F32x4Mul               uint32
	F32x4Div               uint32
	F32x4Min               uint32
	F32x4Max               uint32
	F64x2Abs               uint32
	F64x2Neg               uint32
	F64x2Sqrt              uint32
	F64x2Add               uint32
	F64x2Sub               uint32
	F64x2Mul               uint32
	F64x2Div               uint32
	F64x2Min               uint32
	F64x2Max               uint32
	I32x4TruncSatF32x4S    uint32
	I32x4TruncSatF32x4U    uint32
	I64x2TruncSatF64x2S    uint32
	I64x2TruncSatF64x2U    uint32
	F32x4ConvertI32x4S     uint32
	F32x4ConvertI32x4U     uint32
	F64x2ConvertI64x2S     uint32
	F64x2ConvertI64x2U     uint32
	V8x16Swizzle           uint32
	V8x16Shuffle           uint32
	V8x16LoadSplat         uint32
	V16x8LoadSplat         uint32
	V32x4LoadSplat         uint32
	V64x2LoadSplat         uint32
	I8x16NarrowI16x8S      uint32
	I8x16NarrowI16x8U      uint32
	I16x8NarrowI32x4S      uint32
	I16x8NarrowI32x4U      uint32
	I16x8WidenLowI8x16S    uint32
	I16x8WidenHighI8x16S   uint32
	I16x8WidenLowI8x16U    uint32
	I16x8WidenHighI8x16U   uint32
	I32x4WidenLowI16x8S    uint32
	I32x4WidenHighI16x8S   uint32
	I32x4WidenLowI16x8U    uint32
	I32x4WidenHighI16x8U   uint32
	I16x8Load8x8S          uint32
	I16x8Load8x8U          uint32
	I32x4Load16x4S         uint32
	I32x4Load16x4U         uint32
	I64x2Load32x2S         uint32
	I64x2Load32x2U         uint32
	I8x16RoundingAverageU  uint32
	I16x8RoundingAverageU  uint32
	LocalAllocate          uint32
	LocalsUnmetered        uint32
}

func (*WASMOpcodeCost) ToOpcodeCostsArray

func (opcode_costs_struct *WASMOpcodeCost) ToOpcodeCostsArray() [wasmer.OPCODE_COUNT]uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL