util

package
v1.12.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPendingActionList added in v0.5.0

func CheckPendingActionList(
	cs api.CoreService,
	pendingActionMap *ttl.Cache,
	balancemap map[string]*big.Int,
) (bool, error)

CheckPendingActionList will go through the pending action list, for an executed action: 1) update the expectation balance map if the action has been run successfully 2) remove the action from pending list

func DeployContract added in v0.4.4

func DeployContract(
	client iotexapi.APIServiceClient,
	counter map[string]uint64,
	delegates []*AddressKey,
	executionGasLimit int,
	executionGasPrice int64,
	executionData string,
	retryNum int,
	retryInterval int,
) (hash.Hash256, error)

DeployContract deploys a smart contract before starting action injections

func GetActionByActionHash added in v1.6.3

func GetActionByActionHash(api api.CoreService, actHash hash.Hash256) (*iotexapi.ActionInfo, error)

GetActionByActionHash acquires action by calling coreService

func GetAllBalanceMap added in v0.5.0

func GetAllBalanceMap(
	client iotexapi.APIServiceClient,
	chainaddrs []*AddressKey,
) map[string]*big.Int

GetAllBalanceMap returns a account balance map of all admins and delegates

func GetReceiptByAction added in v1.6.3

func GetReceiptByAction(api api.CoreService, actHash hash.Hash256) (*iotextypes.Receipt, error)

GetReceiptByAction acquires receipt by calling coreService

func GetTotalTsfCreated added in v0.5.0

func GetTotalTsfCreated() uint64

GetTotalTsfCreated returns number of total transfer action created

func GetTotalTsfFailed added in v0.5.0

func GetTotalTsfFailed() uint64

GetTotalTsfFailed returns number of total transfer action failed

func GetTotalTsfSentToAPI added in v0.5.0

func GetTotalTsfSentToAPI() uint64

GetTotalTsfSentToAPI returns number of total transfer action successfully send through GRPC

func GetTotalTsfSucceeded added in v0.5.0

func GetTotalTsfSucceeded() uint64

GetTotalTsfSucceeded returns number of total transfer action created

func InitCounter

func InitCounter(client iotexapi.APIServiceClient, addrKeys []*AddressKey) (map[string]uint64, error)

InitCounter initializes the map of nonce counter of each address

func InjectByAps

func InjectByAps(
	wg *sync.WaitGroup,
	aps float64,
	counter map[string]uint64,
	transferGasLimit int,
	transferGasPrice int64,
	transferPayload string,
	voteGasLimit int,
	voteGasPrice int64,
	contract string,
	executionAmount int,
	executionGasLimit int,
	executionGasPrice int64,
	executionData string,
	fpToken blockchain.FpToken,
	fpContract string,
	debtor *AddressKey,
	creditor *AddressKey,
	client iotexapi.APIServiceClient,
	admins []*AddressKey,
	delegates []*AddressKey,
	duration time.Duration,
	retryNum int,
	retryInterval int,
	resetInterval int,
	expectedBalances map[string]*big.Int,
	cs api.CoreService,
	pendingActionMap *ttl.Cache,
)

InjectByAps injects Actions in APS Mode

func InjectByInterval

func InjectByInterval(
	transferNum int,
	transferGasLimit int,
	transferGasPrice int,
	transferPayload string,
	voteNum int,
	voteGasLimit int,
	voteGasPrice int,
	executionNum int,
	contract string,
	executionAmount int,
	executionGasLimit int,
	executionGasPrice int,
	executionData string,
	interval int,
	counter map[string]uint64,
	client iotexapi.APIServiceClient,
	admins []*AddressKey,
	delegates []*AddressKey,
	retryNum int,
	retryInterval int,
)

InjectByInterval injects Actions in Interval Mode

Types

type AddressKey added in v0.4.4

type AddressKey struct {
	EncodedAddr string
	PriKey      crypto.PrivateKey
}

AddressKey contains the encoded address and private key of an account

func LoadAddresses

func LoadAddresses(keypairsPath string, chainID uint32) ([]*AddressKey, error)

LoadAddresses loads key pairs from key pair path and construct addresses

type KeyPair

type KeyPair struct {
	PK string `yaml:"pubKey"`
	SK string `yaml:"priKey"`
}

KeyPair contains the public and private key of an address

type KeyPairs

type KeyPairs struct {
	Pairs []KeyPair `yaml:"pkPairs"`
}

KeyPairs indicate the keypair of accounts getting transfers from Creator in genesis block

Jump to

Keyboard shortcuts

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