helpers

package
v3.0.0-rc Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConsensusParams = &abci.ConsensusParams{
	Block: &abci.BlockParams{
		MaxBytes: 1048576,
		MaxGas:   -1,
	},
	Evidence: &tmproto.EvidenceParams{
		MaxAgeNumBlocks: 1000000,
		MaxAgeDuration:  504 * time.Hour,
		MaxBytes:        100000,
	},
	Validator: &tmproto.ValidatorParams{
		PubKeyTypes: []string{
			tmtypes.ABCIPubKeyTypeEd25519,
		},
	},
}

DefaultConsensusParams defines the default Tendermint consensus params used in fxCore testing.

Functions

func AddTestAddr

func AddTestAddr(myApp *app.App, ctx sdk.Context, addr sdk.AccAddress, coins sdk.Coins)

func AddTestAddrs

func AddTestAddrs(myApp *app.App, ctx sdk.Context, accNum int, coins sdk.Coins) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func AddTestAddrsIncremental

func AddTestAddrsIncremental(myApp *app.App, ctx sdk.Context, accNum int, coins sdk.Coins) []sdk.AccAddress

func CheckBalance

func CheckBalance(t *testing.T, myApp *app.App, addr sdk.AccAddress, balances sdk.Coins)

CheckBalance checks the balance of an account.

func CreateMultiECDSA

func CreateMultiECDSA(count int) []*ecdsa.PrivateKey

func CreateRandomAccounts

func CreateRandomAccounts(accNum int) []sdk.AccAddress

CreateRandomAccounts generated addresses in random order

func DefGenesisState

func DefGenesisState(cdc codec.Codec) app.GenesisState

func GenTx

func GenTx(gen client.TxConfig, msgs []sdk.Msg, gasPrice sdk.Coin, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)

GenTx generates a signed mock transaction.

func GenerateAddress

func GenerateAddress() common.Address

GenerateAddress generates an Ethereum address.

func GenerateAddressByModule

func GenerateAddressByModule(module string) string

GenerateAddressByModule generates an Ethereum or Tron address.

func GenerateGenesisValidator

func GenerateGenesisValidator(validatorNum int, initCoins sdk.Coins) (valSet *tmtypes.ValidatorSet, genAccs authtypes.GenesisAccounts, balances []banktypes.Balance)

func GenerateZeroAddressByModule

func GenerateZeroAddressByModule(module string) string

GenerateZeroAddressByModule generates an Ethereum or Tron zero address.

func IsLocalTest

func IsLocalTest() bool

func NewEthPrivKey

func NewEthPrivKey() cryptotypes.PrivKey

NewEthPrivKey generates an Ethereum address and its corresponding private key.

func NewMnemonic

func NewMnemonic() string

func NewPriKey

func NewPriKey() cryptotypes.PrivKey

NewPriKey generates cosmos-sdk accAddress private key.

func NewPubKeyFromHex

func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)

NewPubKeyFromHex returns a PubKey from a hex string.

func NewRandDenom

func NewRandDenom() string

func NewRandSymbol

func NewRandSymbol() string

func PrivKeyFromMnemonic

func PrivKeyFromMnemonic(mnemonic string, algo hd.PubKeyType, account, index uint32) (cryptotypes.PrivKey, error)

func Setup

func Setup(isCheckTx bool, isShowLog bool) *app.App

func SetupTestingApp

func SetupTestingApp() (ibctesting.TestingApp, map[string]json.RawMessage)

SetupTestingApp initializes the IBC-go testing application

func SetupWithGenesisAccounts

func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.App

SetupWithGenesisAccounts initializes a new App with the provided genesis accounts and possible balances.

func SetupWithGenesisValSet

func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.App

SetupWithGenesisValSet initializes a new App with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit (10^6) in the default token of the app from first genesis account. A Nop logger is set in App.

func SignCheckDeliver

func SignCheckDeliver(t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, header tmproto.Header,
	msgs []sdk.Msg, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error)

SignCheckDeliver checks a generated signed transaction and simulates a block commitment with the given transaction. A test assertion is made using the parameter 'expPass' against the result. A corresponding result is returned.

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type Signer

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

Signer defines a type that is used on testing for signing MsgEthereumTx

func NewSigner

func NewSigner(sk cryptotypes.PrivKey) *Signer

func (Signer) AccAddress

func (s Signer) AccAddress() sdk.AccAddress

func (Signer) Address

func (s Signer) Address() common.Address

func (Signer) PrivKey

func (s Signer) PrivKey() cryptotypes.PrivKey

func (Signer) Sign

func (s Signer) Sign(_ string, msg []byte) ([]byte, cryptotypes.PubKey, error)

Sign signs the message using the underlying private key

func (Signer) SignByAddress

func (s Signer) SignByAddress(address sdk.Address, msg []byte) ([]byte, cryptotypes.PubKey, error)

SignByAddress sign byte messages with a user key providing the address.

Jump to

Keyboard shortcuts

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