testutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecp256k1Key

func GenerateSecp256k1Key() (*ecdsa.PrivateKey, []byte, mitotypes.EthAddress)

GenerateSecp256k1Key generates a new secp256k1 private key and returns the private key, compressed pubkey, and eth address

func HexToCompressedPubkey

func HexToCompressedPubkey(hexPubkey string) []byte

HexToCompressedPubkey converts a hex string to compressed pubkey bytes

func PubkeyToConsAddr

func PubkeyToConsAddr(pubkey []byte) sdk.ConsAddress

PubkeyToConsAddr converts a pubkey to a consensus address

Types

type MockEvmEngineKeeper

type MockEvmEngineKeeper struct {
	InsertWithdrawalFn func(ctx context.Context, withdrawalAddr common.Address, amountGwei uint64) error
}

MockEvmEngineKeeper is a mock of EvmEngineKeeper interface for testing

func (MockEvmEngineKeeper) InsertWithdrawal

func (m MockEvmEngineKeeper) InsertWithdrawal(ctx context.Context, withdrawalAddr common.Address, amountGwei uint64) error

type MockSlashingKeeper

type MockSlashingKeeper struct {
	AddPubkeyFn             func(ctx context.Context, pubkey cryptotypes.PubKey) error
	UnjailFromConsAddrFn    func(ctx context.Context, consAddr sdk.ConsAddress) error
	AfterValidatorBondedFn  func(ctx context.Context, consAddr sdk.ConsAddress) error
	AfterValidatorCreatedFn func(ctx context.Context, consPubKey cryptotypes.PubKey) error
}

MockSlashingKeeper is a mock of SlashingKeeper interface for testing

func (MockSlashingKeeper) AddPubkey

func (m MockSlashingKeeper) AddPubkey(ctx context.Context, pubkey cryptotypes.PubKey) error

func (MockSlashingKeeper) AfterValidatorBonded

func (m MockSlashingKeeper) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress) error

func (MockSlashingKeeper) AfterValidatorCreated

func (m MockSlashingKeeper) AfterValidatorCreated(ctx context.Context, consPubKey cryptotypes.PubKey) error

func (MockSlashingKeeper) UnjailFromConsAddr

func (m MockSlashingKeeper) UnjailFromConsAddr(ctx context.Context, consAddr sdk.ConsAddress) error

type TestKeeper

type TestKeeper struct {
	Keeper     *keeper.Keeper
	Ctx        sdk.Context
	Cdc        codec.Codec
	StoreKey   storetypes.StoreKey
	MockSlash  *MockSlashingKeeper
	MockEvmEng *MockEvmEngineKeeper
}

TestKeeper is a minimal working keeper for testing

func NewTestKeeper

func NewTestKeeper(s *suite.Suite) TestKeeper

NewTestKeeper returns a test keeper with minimal working dependencies

func (TestKeeper) RegisterTestValidator

func (tk TestKeeper) RegisterTestValidator(collateral math.Uint, extraVotingPower math.Uint, jailed bool) types.Validator

RegisterTestValidator is a helper function to register a validator for testing

func (TestKeeper) SetupDefaultTestParams

func (tk TestKeeper) SetupDefaultTestParams() types.Params

SetupDefaultTestParams sets up test parameters with commonly used default values

func (TestKeeper) SetupTestParams

func (tk TestKeeper) SetupTestParams(params types.Params) types.Params

SetupTestParams sets up standard test parameters for tests

Jump to

Keyboard shortcuts

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