Documentation ¶
Overview ¶
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/Helios-Chain-Labs/ethermint/blob/main/LICENSE
Index ¶
- Constants
- Variables
- func Commit(ctx sdk.Context, app *app.EthermintApp, t time.Duration, ...) (sdk.Context, error)
- func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, ...) error
- func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, ...) error
- func NewTestGenesisState(codec codec.Codec, genesisState map[string]json.RawMessage) app.GenesisState
- func RandomAccounts(r *rand.Rand, n int) []simtypes.Account
- func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAccounts
- func Setup(isCheckTx bool, ...) *app.EthermintApp
- func SetupWithDB(isCheckTx bool, ...) *app.EthermintApp
- func SetupWithDBAndOpts(isCheckTx bool, ...) *app.EthermintApp
- func SetupWithOpts(isCheckTx bool, ...) *app.EthermintApp
- func StateFn(a *app.EthermintApp) simtypes.AppStateFn
- type BaseTestSuite
- func (suite *BaseTestSuite) MintFeeCollectorVirtual(coins sdk.Coins)
- func (suite *BaseTestSuite) SetupTest()
- func (suite *BaseTestSuite) SetupTestWithCb(t require.TestingT, ...)
- func (suite *BaseTestSuite) SetupTestWithCbAndOpts(_ require.TestingT, ...)
- func (suite *BaseTestSuite) StateDB() *statedb.StateDB
- type BaseTestSuiteWithAccount
- func (suite *BaseTestSuiteWithAccount) BuildEthTx(to *common.Address, gasLimit uint64, gasPrice *big.Int, gasFeeCap *big.Int, ...) *types.MsgEthereumTx
- func (suite *BaseTestSuiteWithAccount) CheckTx(tx []byte) abci.ResponseCheckTx
- func (suite *BaseTestSuiteWithAccount) Commit(t require.TestingT)
- func (suite *BaseTestSuiteWithAccount) DeliverTx(tx []byte) *abci.ExecTxResult
- func (suite *BaseTestSuiteWithAccount) PostSetupValidator(t require.TestingT) stakingtypes.Validator
- func (suite *BaseTestSuiteWithAccount) PrepareEthTx(msgEthereumTx *types.MsgEthereumTx, privKey *ethsecp256k1.PrivKey) []byte
- func (suite *BaseTestSuiteWithAccount) SetupAccount(t require.TestingT)
- func (suite *BaseTestSuiteWithAccount) SetupTest(t require.TestingT)
- func (suite *BaseTestSuiteWithAccount) SetupTestWithCb(t require.TestingT, ...)
- func (suite *BaseTestSuiteWithAccount) SetupTestWithCbAndOpts(t require.TestingT, ...)
- type BaseTestSuiteWithFeeMarketQueryClient
- type EVMTestSuiteWithAccountAndQueryClient
- func (suite *EVMTestSuiteWithAccountAndQueryClient) Commit(t require.TestingT)
- func (suite *EVMTestSuiteWithAccountAndQueryClient) DeployTestContract(t require.TestingT, owner common.Address, supply *big.Int, ...) common.Address
- func (suite *EVMTestSuiteWithAccountAndQueryClient) EvmDenom() string
- func (trait *EVMTestSuiteWithAccountAndQueryClient) Setup(suite *BaseTestSuite)
- func (suite *EVMTestSuiteWithAccountAndQueryClient) SetupTest(t require.TestingT)
- func (suite *EVMTestSuiteWithAccountAndQueryClient) SetupTestWithCb(t require.TestingT, ...)
Constants ¶
const ( // TestnetChainID defines the Evmos EIP155 chain ID for testnet TestnetChainID = "ethermint-9000" // BaseDenom defines the Evmos mainnet denomination BaseDenom = "inj" )
Variables ¶
var DefaultConsensusParams = &cmtproto.ConsensusParams{ Block: &cmtproto.BlockParams{ MaxBytes: 1048576, MaxGas: 81500000, }, Evidence: &cmtproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, MaxBytes: 10000, }, Validator: &cmtproto.ValidatorParams{ PubKeyTypes: []string{ tmtypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in EthermintApp testing.
Functions ¶
func Commit ¶
func Commit(ctx sdk.Context, app *app.EthermintApp, t time.Duration, vs *cmttypes.ValidatorSet) (sdk.Context, error)
Commit commits a block at a given time. Reminder: At the end of each Tendermint Consensus round the following methods are run
- BeginBlock
- DeliverTx
- EndBlock
- Commit
func FundAccount ¶
func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error
FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!
func FundModuleAccount ¶
func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error
FundModuleAccount is a utility function that funds a module account by minting and sending the coins to the address. This should be used for testing purposes only!
func NewTestGenesisState ¶
func NewTestGenesisState(codec codec.Codec, genesisState map[string]json.RawMessage) app.GenesisState
NewTestGenesisState generate genesis state with single validator
func RandomAccounts ¶
RandomAccounts creates random accounts with an ethsecp256k1 private key TODO: replace secp256k1.GenPrivKeyFromSecret() with similar function in go-ethereum
func RandomGenesisAccounts ¶
func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAccounts
RandomGenesisAccounts is used by the auth module to create random genesis accounts in simulation when a genesis.json is not specified. In contrast, the default auth module's RandomGenesisAccounts implementation creates only base accounts and vestings accounts.
func Setup ¶
func Setup(isCheckTx bool, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState) *app.EthermintApp
Setup initializes a new EthermintApp. A Nop logger is set in EthermintApp.
func SetupWithDB ¶
func SetupWithDB(isCheckTx bool, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, db dbm.DB) *app.EthermintApp
func SetupWithDBAndOpts ¶
func SetupWithDBAndOpts( isCheckTx bool, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, db dbm.DB, appOptions simtestutil.AppOptionsMap, ) *app.EthermintApp
SetupWithDBAndOpts initializes a new EthermintApp. A Nop logger is set in EthermintApp.
func SetupWithOpts ¶
func SetupWithOpts( isCheckTx bool, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, appOptions simtestutil.AppOptionsMap, ) *app.EthermintApp
func StateFn ¶
func StateFn(a *app.EthermintApp) simtypes.AppStateFn
StateFn returns the initial application state using a genesis or the simulation parameters. It is a wrapper of simapp.AppStateFn to replace evm param EvmDenom with staking param BondDenom.
Types ¶
type BaseTestSuite ¶
func (*BaseTestSuite) MintFeeCollectorVirtual ¶
func (suite *BaseTestSuite) MintFeeCollectorVirtual(coins sdk.Coins)
func (*BaseTestSuite) SetupTest ¶
func (suite *BaseTestSuite) SetupTest()
func (*BaseTestSuite) SetupTestWithCb ¶
func (suite *BaseTestSuite) SetupTestWithCb( t require.TestingT, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, )
func (*BaseTestSuite) SetupTestWithCbAndOpts ¶
func (suite *BaseTestSuite) SetupTestWithCbAndOpts( _ require.TestingT, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, appOptions simtestutil.AppOptionsMap, )
func (*BaseTestSuite) StateDB ¶
func (suite *BaseTestSuite) StateDB() *statedb.StateDB
type BaseTestSuiteWithAccount ¶
type BaseTestSuiteWithAccount struct { BaseTestSuite Address common.Address PrivKey *ethsecp256k1.PrivKey Signer keyring.Signer ConsAddress sdk.ConsAddress ConsPubKey cryptotypes.PubKey }
func (*BaseTestSuiteWithAccount) BuildEthTx ¶
func (suite *BaseTestSuiteWithAccount) BuildEthTx( to *common.Address, gasLimit uint64, gasPrice *big.Int, gasFeeCap *big.Int, gasTipCap *big.Int, accesses *ethtypes.AccessList, privKey *ethsecp256k1.PrivKey, ) *types.MsgEthereumTx
func (*BaseTestSuiteWithAccount) CheckTx ¶
func (suite *BaseTestSuiteWithAccount) CheckTx(tx []byte) abci.ResponseCheckTx
func (*BaseTestSuiteWithAccount) Commit ¶
func (suite *BaseTestSuiteWithAccount) Commit(t require.TestingT)
Commit and begin new block
func (*BaseTestSuiteWithAccount) DeliverTx ¶
func (suite *BaseTestSuiteWithAccount) DeliverTx(tx []byte) *abci.ExecTxResult
func (*BaseTestSuiteWithAccount) PostSetupValidator ¶
func (suite *BaseTestSuiteWithAccount) PostSetupValidator(t require.TestingT) stakingtypes.Validator
func (*BaseTestSuiteWithAccount) PrepareEthTx ¶
func (suite *BaseTestSuiteWithAccount) PrepareEthTx(msgEthereumTx *types.MsgEthereumTx, privKey *ethsecp256k1.PrivKey) []byte
func (*BaseTestSuiteWithAccount) SetupAccount ¶
func (suite *BaseTestSuiteWithAccount) SetupAccount(t require.TestingT)
func (*BaseTestSuiteWithAccount) SetupTest ¶
func (suite *BaseTestSuiteWithAccount) SetupTest(t require.TestingT)
func (*BaseTestSuiteWithAccount) SetupTestWithCb ¶
func (suite *BaseTestSuiteWithAccount) SetupTestWithCb( t require.TestingT, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, )
func (*BaseTestSuiteWithAccount) SetupTestWithCbAndOpts ¶
func (suite *BaseTestSuiteWithAccount) SetupTestWithCbAndOpts( t require.TestingT, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, appOptions simtestutil.AppOptionsMap, )
type BaseTestSuiteWithFeeMarketQueryClient ¶
type BaseTestSuiteWithFeeMarketQueryClient struct { BaseTestSuite // contains filtered or unexported fields }
func (*BaseTestSuiteWithFeeMarketQueryClient) Setup ¶
func (trait *BaseTestSuiteWithFeeMarketQueryClient) Setup(suite *BaseTestSuite)
func (*BaseTestSuiteWithFeeMarketQueryClient) SetupTest ¶
func (suite *BaseTestSuiteWithFeeMarketQueryClient) SetupTest()
func (*BaseTestSuiteWithFeeMarketQueryClient) SetupTestWithCb ¶
func (suite *BaseTestSuiteWithFeeMarketQueryClient) SetupTestWithCb( t require.TestingT, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, )
type EVMTestSuiteWithAccountAndQueryClient ¶
type EVMTestSuiteWithAccountAndQueryClient struct { BaseTestSuiteWithAccount // contains filtered or unexported fields }
func (*EVMTestSuiteWithAccountAndQueryClient) Commit ¶
func (suite *EVMTestSuiteWithAccountAndQueryClient) Commit(t require.TestingT)
Commit and begin new block
func (*EVMTestSuiteWithAccountAndQueryClient) DeployTestContract ¶
func (suite *EVMTestSuiteWithAccountAndQueryClient) DeployTestContract( t require.TestingT, owner common.Address, supply *big.Int, enableFeemarket bool, ) common.Address
DeployTestContract deploy a test erc20 contract and returns the contract address
func (*EVMTestSuiteWithAccountAndQueryClient) EvmDenom ¶
func (suite *EVMTestSuiteWithAccountAndQueryClient) EvmDenom() string
func (*EVMTestSuiteWithAccountAndQueryClient) Setup ¶
func (trait *EVMTestSuiteWithAccountAndQueryClient) Setup(suite *BaseTestSuite)
func (*EVMTestSuiteWithAccountAndQueryClient) SetupTest ¶
func (suite *EVMTestSuiteWithAccountAndQueryClient) SetupTest(t require.TestingT)
func (*EVMTestSuiteWithAccountAndQueryClient) SetupTestWithCb ¶
func (suite *EVMTestSuiteWithAccountAndQueryClient) SetupTestWithCb( t require.TestingT, patch func(*app.EthermintApp, app.GenesisState) app.GenesisState, )