Documentation
¶
Index ¶
- Constants
- func GenSignedMockTx(r *rand.Rand, txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, ...) (sdk.Tx, error)
- func NextFactoryFn(factories []simsx.WeightedFactory, r *rand.Rand) func() simsx.SimMsgFactoryX
- type ByteSource
- type FutureOpsRegistry
- type GenericTxDecoder
- type RandSource
- type SeededRandomSource
- type TXBuilder
- type TXBuilderFn
- type Tx
- type ValSetHistory
- type WeightedValidator
- type WeightedValidators
Constants ¶
const DefaultGenTxGas = 10_000_000
Variables ¶
This section is empty.
Functions ¶
func GenSignedMockTx ¶
func GenSignedMockTx( r *rand.Rand, txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey, ) (sdk.Tx, error)
GenSignedMockTx generates a signed mock transaction.
func NextFactoryFn ¶
func NextFactoryFn(factories []simsx.WeightedFactory, r *rand.Rand) func() simsx.SimMsgFactoryX
NextFactoryFn shuffles and processes a list of weighted factories, returning a selection function for factory objects.
Types ¶
type ByteSource ¶
type ByteSource struct {
// contains filtered or unexported fields
}
ByteSource offers deterministic pseudo-random numbers for math.Rand with fuzzer support. The 'seed' data is read in big endian to uint64. When exhausted, it falls back to a standard random number generator initialized with a specific 'seed' value.
func NewByteSource ¶
func NewByteSource(fuzzSeed []byte, seed int64) *ByteSource
NewByteSource creates a new ByteSource with a specified byte slice and seed. This gives a fixed sequence of pseudo-random numbers. Initially, it utilizes the byte slice. Once that's exhausted, it continues generating numbers using the provided seed.
func (ByteSource) GetSeed ¶
func (s ByteSource) GetSeed() int64
GetSeed is not supported and will panic
func (*ByteSource) Int63 ¶
func (s *ByteSource) Int63() int64
func (*ByteSource) Seed ¶
func (s *ByteSource) Seed(seed int64)
Seed is not supported and will panic
func (*ByteSource) Uint64 ¶
func (s *ByteSource) Uint64() uint64
type FutureOpsRegistry ¶
type FutureOpsRegistry struct {
// contains filtered or unexported fields
}
FutureOpsRegistry is a registry for scheduling and retrieving operations mapped to future block times.
func NewFutureOpsRegistry ¶
func NewFutureOpsRegistry() *FutureOpsRegistry
NewFutureOpsRegistry constructor
func (*FutureOpsRegistry) Add ¶
func (l *FutureOpsRegistry) Add(blockTime time.Time, fx simsx.SimMsgFactoryX)
Add schedules a new operation for the given block time
func (*FutureOpsRegistry) PopScheduledFor ¶
func (l *FutureOpsRegistry) PopScheduledFor(blockTime time.Time) []simsx.SimMsgFactoryX
PopScheduledFor retrieves and removes all scheduled operations up to the specified block time from the registry.
type GenericTxDecoder ¶
type GenericTxDecoder[T Tx] struct { // contains filtered or unexported fields }
GenericTxDecoder Encoder type that implements transaction.Codec
func NewGenericTxDecoder ¶
func NewGenericTxDecoder[T Tx](txConfig client.TxConfig) *GenericTxDecoder[T]
NewGenericTxDecoder constructor
func (*GenericTxDecoder[T]) Decode ¶
func (t *GenericTxDecoder[T]) Decode(bz []byte) (T, error)
Decode implements transaction.Codec.
func (*GenericTxDecoder[T]) DecodeJSON ¶
func (t *GenericTxDecoder[T]) DecodeJSON(bz []byte) (T, error)
DecodeJSON implements transaction.Codec.
type RandSource ¶
RandSource defines an interface for random number sources with a method to retrieve the seed.
type SeededRandomSource ¶
SeededRandomSource wraps a random source with an associated seed value for reproducible random number generation. It implements the RandSource interface, allowing access to both the random source and seed.
func NewSeededRandSource ¶
func NewSeededRandSource(seed int64) *SeededRandomSource
NewSeededRandSource constructor
func (SeededRandomSource) GetSeed ¶
func (r SeededRandomSource) GetSeed() int64
func (*SeededRandomSource) Seed ¶
func (r *SeededRandomSource) Seed(seed int64)
type TXBuilder ¶
type TXBuilder[T Tx] interface { // Build creates a signed transaction Build(ctx context.Context, ak simsx.AccountSource, senders []simsx.SimAccount, msg sdk.Msg, r *rand.Rand, chainID string, ) (T, error) }
TXBuilder abstract transaction builder
type TXBuilderFn ¶
type TXBuilderFn[T Tx] func(ctx context.Context, ak simsx.AccountSource, senders []simsx.SimAccount, msg sdk.Msg, r *rand.Rand, chainID string) (T, error)
TXBuilderFn adapter that implements the TXBuilder interface
func (TXBuilderFn[T]) Build ¶
func (b TXBuilderFn[T]) Build(ctx context.Context, ak simsx.AccountSource, senders []simsx.SimAccount, msg sdk.Msg, r *rand.Rand, chainID string) (T, error)
type Tx ¶
type Tx = transaction.Tx
type ValSetHistory ¶
type ValSetHistory struct {
// contains filtered or unexported fields
}
func NewValSetHistory ¶
func NewValSetHistory(initialHeight uint64) *ValSetHistory
NewValSetHistory constructor. The maximum of historic valsets must not exceed the block or time limit for valid evidence.
func (*ValSetHistory) Add ¶
func (h *ValSetHistory) Add(blockTime time.Time, vals WeightedValidators)
func (*ValSetHistory) MissBehaviour ¶
func (h *ValSetHistory) MissBehaviour(r *rand.Rand) []comet.Evidence
MissBehaviour determines if a random validator misbehaves, creating and returning evidence for duplicate voting. Returns a slice of comet.Evidence if misbehavior is detected; otherwise, returns nil. Has a 1% chance of generating evidence for a validator's misbehavior. Recursively checks for other misbehavior instances and combines their evidence if any. Utilizes a random generator to select a validator and evidence-related attributes.
func (*ValSetHistory) SetMaxHistory ¶
func (h *ValSetHistory) SetMaxHistory(v int)
SetMaxHistory sets the maximum number of historical validator sets to retain. Reduces retained history if it exceeds the limit.
type WeightedValidator ¶
WeightedValidator represents a validator for usage in the sims runner.
func (WeightedValidator) Compare ¶
func (a WeightedValidator) Compare(b WeightedValidator) int
Compare determines the order between two WeightedValidator instances. Returns -1 if the caller has higher Power, 1 if it has lower Power, and defaults to comparing their Address bytes.
type WeightedValidators ¶
type WeightedValidators []WeightedValidator
WeightedValidators represents a slice of WeightedValidator, used for managing and processing validator sets.
func (WeightedValidators) NewCommitInfo ¶
func (v WeightedValidators) NewCommitInfo(r *rand.Rand) comet.CommitInfo
NewCommitInfo build Comet commit info for the validator set
func (WeightedValidators) TotalPower ¶
func (v WeightedValidators) TotalPower() int64
func (WeightedValidators) Update ¶
func (v WeightedValidators) Update(updates []appmodulev2.ValidatorUpdate) WeightedValidators