Documentation ¶
Index ¶
- Variables
- func BenchConsensusRange(b *testing.B, start, stop int, ...)
- func CalculateNewRoundAccountTotals(t *gotesting.T, newRoundDeltas ledgercore.AccountDeltas, ...) (newTotals ledgercore.AccountTotals)
- func GenerateInitState(tb testing.TB, proto protocol.ConsensusVersion, baseAlgoPerAccount int) (genesisInitState ledgercore.InitState, ...)
- func Genesis(naccts int) (ledgercore.InitState, []basics.Address, []*crypto.SignatureSecrets)
- func GenesisWithProto(naccts int, proto protocol.ConsensusVersion) (ledgercore.InitState, []basics.Address, []*crypto.SignatureSecrets)
- func NewTestGenesis(opts ...TestGenesisOption) (bookkeeping.GenesisBalances, []basics.Address, []*crypto.SignatureSecrets)
- func PoolAddr() basics.Address
- func RandomAccountData(rewardsBase uint64) basics.AccountData
- func RandomAccounts(niter int, simpleAccounts bool) map[basics.Address]basics.AccountData
- func RandomAddress() basics.Address
- func RandomAppLocalState() basics.AppLocalState
- func RandomAppParams() basics.AppParams
- func RandomAssetHolding(forceFrozen bool) basics.AssetHolding
- func RandomAssetParams() basics.AssetParams
- func RandomDeltas(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64) (updates ledgercore.AccountDeltas, ...)
- func RandomDeltasBalanced(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64) (updates ledgercore.AccountDeltas, ...)
- func RandomDeltasBalancedFull(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, ...) (updates ledgercore.AccountDeltas, ...)
- func RandomDeltasBalancedImpl(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, ...) (updates ledgercore.AccountDeltas, ...)
- func RandomDeltasFull(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, ...) (updates ledgercore.AccountDeltas, ...)
- func RandomDeltasImpl(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, ...) (updates ledgercore.AccountDeltas, ...)
- func RandomFullAccountData(rewardsLevel uint64, lastCreatableID *basics.CreatableIndex, ...) basics.AccountData
- func RandomNote() []byte
- func RandomOnlineAccountData(rewardsBase uint64) basics.AccountData
- func SinkAddr() basics.Address
- func TestConsensusRange(t *testing.T, start, stop int, ...)
- func WithAndWithoutLRUCache(t *testing.T, cfg config.Local, test func(t *testing.T, cfg config.Local))
- type GenesisCfg
- type TestGenesisOption
Constants ¶
This section is empty.
Variables ¶
var TurnOffRewards = func(cfg *GenesisCfg) { cfg.rewardsPoolAmount = basics.MicroAlgos{Raw: 100_000} }
TurnOffRewards turns off the rewards pool for tests that are sensitive to "surprise" balance changes.
Functions ¶
func BenchConsensusRange ¶
func BenchConsensusRange(b *testing.B, start, stop int, bench func(t *testing.B, ver int, cv protocol.ConsensusVersion))
BenchConsensusRange is for getting benchmarks across consensus versions.
func CalculateNewRoundAccountTotals ¶
func CalculateNewRoundAccountTotals(t *gotesting.T, newRoundDeltas ledgercore.AccountDeltas, newRoundRewardLevel uint64, newRoundConsensusParams config.ConsensusParams, prevRoundBalances map[basics.Address]basics.AccountData, prevRoundTotals ledgercore.AccountTotals) (newTotals ledgercore.AccountTotals)
CalculateNewRoundAccountTotals calculates the accounts totals for a given round
func GenerateInitState ¶
func GenerateInitState(tb testing.TB, proto protocol.ConsensusVersion, baseAlgoPerAccount int) (genesisInitState ledgercore.InitState, initKeys map[basics.Address]*crypto.SignatureSecrets)
GenerateInitState generates testing init state
func Genesis ¶
func Genesis(naccts int) (ledgercore.InitState, []basics.Address, []*crypto.SignatureSecrets)
Genesis creates a genesis state for naccts accounts using the ConsensusCurrentVersion
func GenesisWithProto ¶
func GenesisWithProto(naccts int, proto protocol.ConsensusVersion) (ledgercore.InitState, []basics.Address, []*crypto.SignatureSecrets)
GenesisWithProto creates a genesis state for naccts accounts using the proto consensus protocol
func NewTestGenesis ¶
func NewTestGenesis(opts ...TestGenesisOption) (bookkeeping.GenesisBalances, []basics.Address, []*crypto.SignatureSecrets)
NewTestGenesis creates a bunch of accounts, splits up 10B algos between them and the rewardspool and feesink, and gives out the addresses and secrets it creates to enable tests. For special scenarios, manipulate these return values before using newTestLedger.
func RandomAccountData ¶
func RandomAccountData(rewardsBase uint64) basics.AccountData
RandomAccountData generates a random AccountData with no associated resources.
func RandomAccounts ¶
RandomAccounts generates a random set of accounts map
func RandomAppLocalState ¶
func RandomAppLocalState() basics.AppLocalState
RandomAppLocalState creates a random basics.AppLocalState
func RandomAppParams ¶
RandomAppParams creates a random basics.AppParams
func RandomAssetHolding ¶
func RandomAssetHolding(forceFrozen bool) basics.AssetHolding
RandomAssetHolding creates a random basics.AssetHolding. If forceFrozen is set the Frozen field is set to True to prevent possible empty AssetHolding struct
func RandomAssetParams ¶
func RandomAssetParams() basics.AssetParams
RandomAssetParams creates a random basics.AssetParams
func RandomDeltas ¶
func RandomDeltas(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64) (updates ledgercore.AccountDeltas, totals map[basics.Address]ledgercore.AccountData, imbalance int64)
RandomDeltas generates a random set of accounts delta
func RandomDeltasBalanced ¶
func RandomDeltasBalanced(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64) (updates ledgercore.AccountDeltas, totals map[basics.Address]ledgercore.AccountData)
RandomDeltasBalanced generates a random set of accounts delta
func RandomDeltasBalancedFull ¶
func RandomDeltasBalancedFull(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, lastCreatableID *basics.CreatableIndex) (updates ledgercore.AccountDeltas, totals map[basics.Address]ledgercore.AccountData)
RandomDeltasBalancedFull generates a random set of accounts delta
func RandomDeltasBalancedImpl ¶
func RandomDeltasBalancedImpl(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, simple bool, lastCreatableID *basics.CreatableIndex) (updates ledgercore.AccountDeltas, totals map[basics.Address]ledgercore.AccountData)
RandomDeltasBalancedImpl generates a random set of accounts delta
func RandomDeltasFull ¶
func RandomDeltasFull(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, lastCreatableID *basics.CreatableIndex) (updates ledgercore.AccountDeltas, totals map[basics.Address]ledgercore.AccountData, imbalance int64)
RandomDeltasFull generates a random set of accounts delta
func RandomDeltasImpl ¶
func RandomDeltasImpl(niter int, base map[basics.Address]basics.AccountData, rewardsLevel uint64, simple bool, lastCreatableID *basics.CreatableIndex) (updates ledgercore.AccountDeltas, totals map[basics.Address]ledgercore.AccountData, imbalance int64)
RandomDeltasImpl generates a random set of accounts delta
func RandomFullAccountData ¶
func RandomFullAccountData(rewardsLevel uint64, lastCreatableID *basics.CreatableIndex, assets map[basics.AssetIndex]struct{}, apps map[basics.AppIndex]struct{}) basics.AccountData
RandomFullAccountData generates a random AccountData
func RandomOnlineAccountData ¶
func RandomOnlineAccountData(rewardsBase uint64) basics.AccountData
RandomOnlineAccountData is similar to RandomAccountData but always creates online account
func TestConsensusRange ¶
func TestConsensusRange(t *testing.T, start, stop int, test func(t *testing.T, ver int, cv protocol.ConsensusVersion, cfg config.Local))
TestConsensusRange allows for running tests against a range of consensus versions. Generally `start` will be the version that introduced the feature, and `stop` will be 0 to indicate it should work right on up through vFuture. `stop` will be an actual version number if we're confirming that something STOPS working as of a particular version. When writing the test for a new feature that is currently in vFuture, use the expected version number as `start`. That will correspond to vFuture until a new consensus version is created and inserted in consensusByNumber. At that point, your feature is probably active in that version. (If it's being held in vFuture, just increment your `start`.)
Types ¶
type GenesisCfg ¶
type GenesisCfg struct { OnlineCount int // contains filtered or unexported fields }
GenesisCfg provides a configuration object for NewTestGenesis.
type TestGenesisOption ¶
type TestGenesisOption func(*GenesisCfg)
TestGenesisOption provides functional options for testGenesisCfg.