pingpong

package
v0.0.0-...-ff2c966 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package pingpong provides a transaction generating utility for performance testing.

Index

Constants

View Source
const ConfigFilename = "ppconfig.json"

ConfigFilename name of configuration file

Variables

View Source
var DefaultConfig = PpConfig{
	SrcAccount:      "",
	RandomizeFee:    false,
	RandomizeAmt:    false,
	RandomizeDst:    false,
	MaxRandomDst:    200000,
	MaxFee:          10000,
	MinFee:          1000,
	MaxAmt:          1000,
	TxnPerSec:       200,
	NumPartAccounts: 10,
	RunTime:         10 * time.Second,
	RefreshTime:     3600 * time.Second,
	MinAccountFunds: 100000,
	GroupSize:       1,
	NumAsset:        0,
	MinAccountAsset: 10000000,
	NumApp:          0,
	NumBoxUpdate:    0,
	NumBoxRead:      0,
	AppProgOps:      0,
	AppProgHashes:   0,
	AppProgHashSize: "sha256",
	Rekey:           false,
	MaxRuntime:      0,

	ProgramProbability: 1,

	NftAsaAccountInFlight: 5,
	NftAsaPerAccount:      900,
}

DefaultConfig object for Ping Pong

Functions

This section is empty.

Types

type CreatablesInfo

type CreatablesInfo struct {
	AssetParams map[uint64]model.AssetParams
	AppParams   map[uint64]model.ApplicationParams
	OptIns      map[uint64][]string
}

CreatablesInfo has information about created assets, apps and opting in

type PpConfig

type PpConfig struct {
	// SrcAccount is address to use as funding source for new accounts
	SrcAccount      string
	RandomizeFee    bool
	RandomizeAmt    bool
	RandomizeDst    bool
	MaxRandomDst    uint64
	MaxFee          uint64
	MinFee          uint64
	MaxAmt          uint64
	TxnPerSec       uint64
	NumPartAccounts uint32
	RunTime         time.Duration
	RefreshTime     time.Duration
	MinAccountFunds uint64
	Quiet           bool
	RandomNote      bool
	RandomLease     bool
	TotalLatencyOut string

	Program            []byte
	LogicArgs          [][]byte
	ProgramProbability float64

	GroupSize uint32
	// NumAsset is the number of assets each account holds
	NumAsset uint32
	// MinAccountAsset
	MinAccountAsset uint64
	// NumApp is the total number of apps to create
	NumApp uint32
	// NumAppOptIn is the number of apps each account opts in to
	NumAppOptIn uint32
	// NumBoxUpdate is the number of boxes used per app, where box values are updated each call
	NumBoxUpdate uint32
	// NumBoxRead is the number of boxes used per app, where box values are only read each call
	NumBoxRead      uint32
	AppProgOps      uint32
	AppProgHashes   uint32
	AppProgHashSize string
	AppGlobKeys     uint32
	AppLocalKeys    uint32
	Rekey           bool
	MaxRuntime      time.Duration
	AsyncSending    bool

	// asset spam; make lots of NFT ASAs
	NftAsaPerSecond       uint32 // e.g. 100
	NftAsaPerAccount      uint32 // 0..999
	NftAsaAccountInFlight uint32

	// configuration related to using bootstrapped ledgers built by netgoal
	// TODO: support generatedAssetsCount, generatedApplicationCount
	DeterministicKeys            bool
	GeneratedAccountsCount       uint64
	GeneratedAccountSampleMethod string
	GeneratedAccountsOffset      uint64
	GeneratedAccountsMnemonics   []string

	WeightPayment     float64
	WeightAsset       float64
	WeightApp         float64
	WeightNFTCreation float64
}

PpConfig defines configuration structure for

func LoadConfigFromFile

func LoadConfigFromFile(file string) (cfg PpConfig, err error)

LoadConfigFromFile reads and loads Ping Pong configuration

func (*PpConfig) Check

func (cfg *PpConfig) Check() error

Check returns an error if config is invalid.

func (PpConfig) Dump

func (cfg PpConfig) Dump(stream io.Writer)

Dump configuration to output stream

func (PpConfig) Save

func (cfg PpConfig) Save(file string) error

Save writes configuration to a file

func (*PpConfig) SetDefaultWeights

func (cfg *PpConfig) SetDefaultWeights()

SetDefaultWeights ensures a reasonable configuration of traffic generation weights. With no weights set, and old args about what mode to run, each activated traffic type gets a weight of 1. With no weights set and some activated traffic type other than payment, payment gets deactivated (zero weight) to maintain compatibility with prior behavior. WeightPayment must be explicitly set to add it to the mix if other modes are activated.

type WorkerState

type WorkerState struct {
	// contains filtered or unexported fields
}

WorkerState object holds a running pingpong worker

func NewPingpong

func NewPingpong(cfg PpConfig) *WorkerState

NewPingpong creates a new pingpong WorkerState

func (*WorkerState) PrepareAccounts

func (pps *WorkerState) PrepareAccounts(ac *libgoal.Client) (err error)

PrepareAccounts to set up accounts and asset accounts required for Ping Pong run

func (*WorkerState) RunPingPong

func (pps *WorkerState) RunPingPong(ctx context.Context, ac *libgoal.Client)

RunPingPong starts ping pong process

Jump to

Keyboard shortcuts

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