gas

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// function list gas price
	GetArgsGasPrice               uint64 = 1  // GetArgsGasPrice
	GetStateGasPrice              uint64 = 1  // GetStateGasPrice
	GetBatchStateGasPrice         uint64 = 1  // GetBatchStateGasPrice
	PutStateGasPrice              uint64 = 10 // PutStateGasPrice
	DelStateGasPrice              uint64 = 10 // DelStateGasPrice
	GetCreatorOrgIdGasPrice       uint64 = 1  // GetCreatorOrgIdGasPrice
	GetCreatorRoleGasPrice        uint64 = 1  // GetCreatorRoleGasPrice
	GetCreatorPkGasPrice          uint64 = 1  // GetCreatorPkGasPrice
	GetSenderOrgIdGasPrice        uint64 = 1  //GetSenderOrgIdGasPrice
	GetSenderRoleGasPrice         uint64 = 1  //GetSenderRoleGasPrice
	GetSenderPkGasPrice           uint64 = 1  //GetSenderPkGasPrice
	GetBlockHeightGasPrice        uint64 = 1  //GetBlockHeightGasPrice
	GetTxIdGasPrice               uint64 = 1  //GetTxIdGasPrice
	GetTimeStampPrice             uint64 = 1  //GetTimeStampPrice
	EmitEventGasPrice             uint64 = 5  //EmitEventGasPrice
	LogGasPrice                   uint64 = 5  //LogGasPrice
	KvIteratorCreateGasPrice      uint64 = 1  //KvIteratorCreateGasPrice
	KvPreIteratorCreateGasPrice   uint64 = 1  //KvPreIteratorCreateGasPrice
	KvIteratorHasNextGasPrice     uint64 = 1  //KvIteratorHasNextGasPrice
	KvIteratorNextGasPrice        uint64 = 1  //KvIteratorNextGasPrice
	KvIteratorCloseGasPrice       uint64 = 1  //KvIteratorCloseGasPrice
	KeyHistoryIterCreateGasPrice  uint64 = 1  //KeyHistoryIterCreateGasPrice
	KeyHistoryIterHasNextGasPrice uint64 = 1  //KeyHistoryIterHasNextGasPrice
	KeyHistoryIterNextGasPrice    uint64 = 1  //KeyHistoryIterNextGasPrice
	KeyHistoryIterCloseGasPrice   uint64 = 1  //KeyHistoryIterCloseGasPrice
	GetSenderAddressGasPrice      uint64 = 1  //GetSenderAddressGasPrice

	// special parameters passed to contract
	ContractParamCreatorOrgId = "__creator_org_id__" //ContractParamCreatorOrgId
	ContractParamCreatorRole  = "__creator_role__"   //ContractParamCreatorRole
	ContractParamCreatorPk    = "__creator_pk__"     //ContractParamCreatorPk
	ContractParamSenderOrgId  = "__sender_org_id__"  //ContractParamSenderOrgId
	ContractParamSenderRole   = "__sender_role__"    //ContractParamSenderRole
	ContractParamSenderPk     = "__sender_pk__"      //ContractParamSenderPk
	ContractParamBlockHeight  = "__block_height__"   //ContractParamBlockHeight
	ContractParamTxId         = "__tx_id__"          //ContractParamTxId
	ContractParamTxTimeStamp  = "__tx_time_stamp__"  //ContractParamTxTimeStamp

)

nolint: revive

Variables

This section is empty.

Functions

func CallContractGasUsed added in v3.0.1

func CallContractGasUsed(blockVersion uint32, gasConfig *gasutils.GasConfig, gasUsed uint64,
	contractName string, contractMethod string, parameters map[string][]byte,
	txId string, log protocol.Logger) (uint64, error)

CallContractGasUsed return call contract gas used

func CallContractGasUsed2312 added in v3.0.1

func CallContractGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64,
	contractName string, contractMethod string, parameters map[string][]byte,
	txId string, log protocol.Logger) (uint64, error)

CallContractGasUsed2312 calculate gas for calling contract

func CheckGasLimit

func CheckGasLimit(gasUsed uint64) bool

CheckGasLimit judge gas limit enough

func ConsumeKeyHistoryIterGasUsed

func ConsumeKeyHistoryIterGasUsed(blockVersion uint32, gasConfig *gasutils.GasConfig, gasUsed uint64) (uint64, error)

ConsumeKeyHistoryIterGasUsed returns consume key history iter gas used

func ConsumeKeyHistoryIterGasUsed2312 added in v3.0.1

func ConsumeKeyHistoryIterGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64) (uint64, error)

ConsumeKeyHistoryIterGasUsed2312 calculate gas for key history iterator `HasNext/Close` operation

func ConsumeKeyHistoryIterGasUsedLt2312 added in v3.0.1

func ConsumeKeyHistoryIterGasUsedLt2312(gasUsed uint64) (uint64, error)

ConsumeKeyHistoryIterGasUsedLt2312 returns consume key history iter gas used

func ConsumeKeyHistoryIterNextGasUsed2312 added in v3.0.1

func ConsumeKeyHistoryIterNextGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64,
	value []byte) (uint64, error)

ConsumeKeyHistoryIterNextGasUsed2312 calculate gas for key-value iterator `Next` operation

func ConsumeKvIteratorGasUsed

func ConsumeKvIteratorGasUsed(blockVersion uint32, gasConfig *gasutils.GasConfig, gasUsed uint64) (uint64, error)

ConsumeKvIteratorGasUsed returns kv iter gas used

func ConsumeKvIteratorGasUsed2312 added in v3.0.1

func ConsumeKvIteratorGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64) (uint64, error)

ConsumeKvIteratorGasUsed2312 calculate gas for key-value iterator `HasNext/Close` operation

func ConsumeKvIteratorGasUsedLt2312 added in v3.0.1

func ConsumeKvIteratorGasUsedLt2312(gasUsed uint64) (uint64, error)

ConsumeKvIteratorGasUsedLt2312 returns kv iter gas used

func ConsumeKvIteratorNextGasUsed2312 added in v3.0.1

func ConsumeKvIteratorNextGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64,
	key string, field string, value []byte) (uint64, error)

ConsumeKvIteratorNextGasUsed2312 calculate gas for key-value iterator `Next` operation

func ContractGasUsed

func ContractGasUsed(gasUsed uint64, method string, contractName string, byteCode []byte) (uint64, error)

ContractGasUsed returns contract gas used

func CreateKeyHistoryIterGasUsed

func CreateKeyHistoryIterGasUsed(blockVersion uint32, gasConfig *gasutils.GasConfig,
	params map[string][]byte, gasUsed uint64, txId string, log protocol.Logger) (uint64, error)

CreateKeyHistoryIterGasUsed returns create key history iter gas used

func CreateKeyHistoryIterGasUsed2312 added in v3.0.1

func CreateKeyHistoryIterGasUsed2312(gasConfig *gasutils.GasConfig,
	params map[string][]byte, gasUsed uint64, txId string, log protocol.Logger) (uint64, error)

CreateKeyHistoryIterGasUsed2312 calculate gas for key history iterator `Create` operation

func CreateKeyHistoryIterGasUsedLt2312 added in v3.0.1

func CreateKeyHistoryIterGasUsedLt2312(gasUsed uint64) (uint64, error)

CreateKeyHistoryIterGasUsedLt2312 returns create key history iter gas used

func CreateKvIteratorGasUsed

func CreateKvIteratorGasUsed(blockVersion uint32, gasConfig *gasutils.GasConfig,
	params map[string][]byte, gasUsed uint64, txId string, log protocol.Logger) (uint64, error)

CreateKvIteratorGasUsed create kv iter gas used

func CreateKvIteratorGasUsed2312 added in v3.0.1

func CreateKvIteratorGasUsed2312(gasConfig *gasutils.GasConfig,
	params map[string][]byte, gasUsed uint64,
	txId string, log protocol.Logger) (uint64, error)

CreateKvIteratorGasUsed2312 calculate gas for key-value iterator `Create` operation

func CreateKvIteratorGasUsedLt2312 added in v3.0.1

func CreateKvIteratorGasUsedLt2312(gasUsed uint64) (uint64, error)

CreateKvIteratorGasUsedLt2312 create kv iter gas used

func EmitEventGasUsed

func EmitEventGasUsed(
	blockVersion uint32, gasConfig *gasutils.GasConfig,
	gasUsed uint64, contractEvent *common.ContractEvent) (uint64, error)

EmitEventGasUsed returns emit event gas used

func EmitEventGasUsed2312 added in v3.0.1

func EmitEventGasUsed2312(gasConfig *gasutils.GasConfig,
	gasUsed uint64, contractEvent *common.ContractEvent) (uint64, error)

EmitEventGasUsed2312 returns emit event gas used

func EmitEventGasUsedLt2312 added in v3.0.1

func EmitEventGasUsedLt2312(gasUsed uint64, contractEvent *common.ContractEvent) (uint64, error)

EmitEventGasUsedLt2312 returns emit event gas used

func GetBatchStateGasUsed

func GetBatchStateGasUsed(
	blockVersion uint32, gasConfig *gasutils.GasConfig,
	gasUsed uint64, payload []byte) (uint64, error)

GetBatchStateGasUsed returns get batch state gas used

func GetBatchStateGasUsed2312 added in v3.0.1

func GetBatchStateGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64, payload []byte) (uint64, error)

GetBatchStateGasUsed2312 returns get batch state gas used

func GetBatchStateGasUsedLt2312 added in v3.0.1

func GetBatchStateGasUsedLt2312(gasUsed uint64, payload []byte) (uint64, error)

GetBatchStateGasUsedLt2312 returns get batch state gas used

func GetSenderAddressGasUsed

func GetSenderAddressGasUsed(gasUsed uint64) (uint64, error)

GetSenderAddressGasUsed returns get sender address gas used

func GetStateGasUsed

func GetStateGasUsed(
	blockVersion uint32, gasConfig *gasutils.GasConfig, gasUsed uint64,
	contractName, key, field string, value []byte) (uint64, error)

GetStateGasUsed returns put state gas used

func GetStateGasUsed2312 added in v3.0.1

func GetStateGasUsed2312(gasConfig *gasutils.GasConfig, gasUsed uint64,
	contractName, key, field string, value []byte) (uint64, error)

GetStateGasUsed2312 returns get state gas used

func GetStateGasUsedLt2312 added in v3.0.1

func GetStateGasUsedLt2312(gasUsed uint64, value []byte) (uint64, error)

GetStateGasUsedLt2312 returns get state gas used

func InitFuncGasUsedLt2312 added in v3.0.1

func InitFuncGasUsedLt2312(gasUsed, configDefaultGas uint64) (uint64, error)

InitFuncGasUsedLt2312 returns init func gas used

func PutStateGasUsed

func PutStateGasUsed(
	blockVersion uint32, gasConfig *gasutils.GasConfig,
	gasUsed uint64, contractName, key, field string, value []byte) (uint64, error)

PutStateGasUsed returns put state gas used

func PutStateGasUsed2312 added in v3.0.1

func PutStateGasUsed2312(gasConfig *gasutils.GasConfig,
	gasUsed uint64, contractName, key, field string, value []byte) (uint64, error)

PutStateGasUsed2312 returns put state gas used

func PutStateGasUsedLt2312 added in v3.0.1

func PutStateGasUsedLt2312(gasUsed uint64, contractName, key, field string, value []byte) (uint64, error)

PutStateGasUsedLt2312 returns put state gas used

Types

This section is empty.

Jump to

Keyboard shortcuts

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