Documentation
¶
Index ¶
- Constants
- func GenMorseAccount(t gocuke.TestingT, index uint64) *migrationtypes.MorseAccount
- func GenMorseApplication(t gocuke.TestingT, idx uint64) *migrationtypes.MorseApplication
- func GenMorseApplicationStakeAmount(index uint64) int64
- func GenMorseClaimableAccount(t gocuke.TestingT, index uint64, ...) *migrationtypes.MorseClaimableAccount
- func GenMorsePrivateKey(t gocuke.TestingT, seed uint64) cometcrypto.PrivKey
- func GenMorseSupplierStakeAmount(index uint64) int64
- func GenMorseUnstakedBalanceAmount(index uint64) int64
- func GenMorseValidator(t gocuke.TestingT, idx uint64) *migrationtypes.MorseValidator
- func NewMorseStateExportAndAccountState(t gocuke.TestingT, numAccounts int, ...) (export *migrationtypes.MorseStateExport, ...)
- func NewMorseStateExportAndAccountStateBytes(t gocuke.TestingT, numAccounts int, ...) (morseStateExportBz []byte, morseAccountStateBz []byte)
- type MorseAccountActorType
- func AllApplicationMorseAccountActorType(index uint64) MorseAccountActorType
- func AllSupplierMorseAccountActorType(index uint64) MorseAccountActorType
- func AllUnstakedMorseAccountActorType(index uint64) MorseAccountActorType
- func RoundRobinAllMorseAccountActorTypes(index uint64) MorseAccountActorType
- type MorseAccountActorTypeDistributionFn
Constants ¶
const ( MorseUnstakedActor = MorseAccountActorType(iota) MorseApplicationActor MorseSupplierActor // NumMorseAccountActorTypes is the number of MorseAccountActorTypes. // It takes advantage of the fact that the enum is zero-indexed. NumMorseAccountActorTypes )
Variables ¶
This section is empty.
Functions ¶
func GenMorseAccount ¶ added in v0.0.14
func GenMorseAccount(t gocuke.TestingT, index uint64) *migrationtypes.MorseAccount
GenMorseAccount returns a new MorseAccount fixture. The given index is used to deterministically generate the account's address and unstaked balance.
func GenMorseApplication ¶ added in v0.0.14
func GenMorseApplication(t gocuke.TestingT, idx uint64) *migrationtypes.MorseApplication
GenMorseApplication returns a new MorseApplication fixture. The given index is used to deterministically generate the application's address and staked tokens.
func GenMorseApplicationStakeAmount ¶ added in v0.0.14
GenMorseApplicationStakeAmount returns an amount by applying the given index to a pattern such that the generated amount is unique to the application stake (as opposed to the unstaked balance or supplier stake) and the given index. E.g.: - GenMorseApplicationStakeAmount(0) = 100010 - GenMorseApplicationStakeAmount(1) = 200020 - GenMorseApplicationStakeAmount(10) = 1000100
func GenMorseClaimableAccount ¶ added in v0.0.14
func GenMorseClaimableAccount( t gocuke.TestingT, index uint64, distributionFn func(uint64) MorseAccountActorType, ) *migrationtypes.MorseClaimableAccount
GenMorseClaimableAccount returns a new MorseClaimableAccount fixture. The given index is used to deterministically generate the account's address and staked tokens. The given distribution function is used to determine the account's actor type (and stake if applicable).
func GenMorsePrivateKey ¶ added in v0.0.14
func GenMorsePrivateKey(t gocuke.TestingT, seed uint64) cometcrypto.PrivKey
GenMorsePrivateKey creates a new ed25519 private key from the given seed.
func GenMorseSupplierStakeAmount ¶ added in v0.0.14
GenMorseSupplierStakeAmount returns an amount by applying the given index to a pattern such that the generated amount is unique to the supplier stake (as opposed to the unstaked balance or application stake) and the given index. E.g.: - GenMorseApplicationStakeAmount(0) = 10100 - GenMorseApplicationStakeAmount(1) = 20200 - GenMorseApplicationStakeAmount(10) = 101000
func GenMorseUnstakedBalanceAmount ¶ added in v0.0.14
GenMorseUnstakedBalanceAmount returns an amount by applying the given index to a pattern such that the generated amount is unique to the unstaked balance (as opposed to actor stake(s)) and the given index. E.g.: - GenMorseApplicationStakeAmount(0) = 1000001 - GenMorseApplicationStakeAmount(1) = 2000002 - GenMorseApplicationStakeAmount(10) = 10000010
func GenMorseValidator ¶ added in v0.0.14
func GenMorseValidator(t gocuke.TestingT, idx uint64) *migrationtypes.MorseValidator
GenMorseValidator returns a new MorseValidator fixture. The given index is used to deterministically generate the validator's address and staked tokens.
func NewMorseStateExportAndAccountState ¶
func NewMorseStateExportAndAccountState( t gocuke.TestingT, numAccounts int, distributionFn MorseAccountActorTypeDistributionFn, ) (export *migrationtypes.MorseStateExport, state *migrationtypes.MorseAccountState)
NewMorseStateExportAndAccountState returns MorseStateExport and MorseAccountState structs populated with: - Random account addresses - Monotonically increasing balances/stakes - Unstaked, application, supplier accounts are distributed according to the given distribution function.
func NewMorseStateExportAndAccountStateBytes ¶
func NewMorseStateExportAndAccountStateBytes( t gocuke.TestingT, numAccounts int, distributionFn MorseAccountActorTypeDistributionFn, ) (morseStateExportBz []byte, morseAccountStateBz []byte)
NewMorseStateExportAndAccountStateBytes returns:
- A serialized MorseStateExport. This is the JSON output of `pocket util export-genesis-for-reset`. It is used to generate the MorseAccountState.
- Its corresponding MorseAccountState. This is the JSON output of `pocketd migrate collect-morse-accounts`. It is used to persist the canonical Morse migration state (snapshot) from on Shannon.
The states are populated with: - Random account addresses - Monotonically increasing balances/stakes - Unstaked, application, supplier accounts are distributed according to the given distribution function.
Types ¶
type MorseAccountActorType ¶ added in v0.0.14
type MorseAccountActorType int
MorseAccountActorType is an enum which represents all possible staked and unstaked actor types which are considered in the migration module.
func AllApplicationMorseAccountActorType ¶ added in v0.0.14
func AllApplicationMorseAccountActorType(index uint64) MorseAccountActorType
AllApplicationMorseAccountActorType returns MorseApplicationActor for every index.
func AllSupplierMorseAccountActorType ¶ added in v0.0.14
func AllSupplierMorseAccountActorType(index uint64) MorseAccountActorType
AllSupplierMorseAccountActorType returns MorseSupplierActor for every index.
func AllUnstakedMorseAccountActorType ¶ added in v0.0.14
func AllUnstakedMorseAccountActorType(index uint64) MorseAccountActorType
AllUnstakedMorseAccountActorType returns MorseUnstakedActor for every index.
func RoundRobinAllMorseAccountActorTypes ¶ added in v0.0.14
func RoundRobinAllMorseAccountActorTypes(index uint64) MorseAccountActorType
RoundRobinAllMorseAccountActorTypes cyclically returns each MorseAccountActorType, one after the other, as the index increases. It is used to map a test account index to the test actor that's generated.
type MorseAccountActorTypeDistributionFn ¶ added in v0.0.14
type MorseAccountActorTypeDistributionFn func(index uint64) MorseAccountActorType
MorseAccountActorTypeDistributionFn is a function which returns a MorseAccountActorType derived from the given index. It is intended to be used in conjunction with MorseStateExport and MorseAccountState fixture generation logic.
func NewSingleMorseAccountActorTypeFn ¶ added in v0.0.14
func NewSingleMorseAccountActorTypeFn(actorType MorseAccountActorType) MorseAccountActorTypeDistributionFn
NewSingleMorseAccountActorTypeFn returns a MorseAccountActorTypeDistributionFn which returns the given actor type for every index.