gas

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 5 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 CheckGasLimit

func CheckGasLimit(gasUsed uint64) bool

CheckGasLimit judge gas limit enough

func ConsumeKeyHistoryIterGasUsed

func ConsumeKeyHistoryIterGasUsed(gasUsed uint64) (uint64, error)

ConsumeKeyHistoryIterGasUsed returns consume key history iter gas used

func ConsumeKvIteratorGasUsed

func ConsumeKvIteratorGasUsed(gasUsed uint64) (uint64, error)

ConsumeKvIteratorGasUsed returns kv iter gas used

func ContractGasUsed

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

ContractGasUsed returns contract gas used

func CreateKeyHistoryIterGasUsed

func CreateKeyHistoryIterGasUsed(gasUsed uint64) (uint64, error)

CreateKeyHistoryIterGasUsed returns create key history iter gas used

func CreateKvIteratorGasUsed

func CreateKvIteratorGasUsed(gasUsed uint64) (uint64, error)

CreateKvIteratorGasUsed create kv iter gas used

func DelStateGasUsed

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

DelStateGasUsed returns del state gas used

func EmitEventGasUsed

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

EmitEventGasUsed returns emit event gas used

func GetArgsGasUsed

func GetArgsGasUsed(gasUsed uint64, args map[string]string) (uint64, error)

GetArgsGasUsed returns get args gas used

func GetBatchStateGasUsed

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

GetBatchStateGasUsed 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(gasUsed uint64, value []byte) (uint64, error)

GetStateGasUsed returns get state gas used

func InitFuncGasUsed

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

InitFuncGasUsed returns init func gas used

func InitFuncGasUsedOld

func InitFuncGasUsedOld(gasUsed uint64, parameters map[string][]byte, keys ...string) (uint64, error)

InitFuncGasUsedOld returns old init func gas used

func PutStateGasUsed

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

PutStateGasUsed 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