vm

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 65 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TestPostProcessingEventType = "test_post_processing_event"

Variables

This section is empty.

Functions

func BenchmarkAddBalance

func BenchmarkAddBalance(b *testing.B)

func BenchmarkAddLog

func BenchmarkAddLog(b *testing.B)

func BenchmarkAddRefund

func BenchmarkAddRefund(b *testing.B)

func BenchmarkApplyMessage

func BenchmarkApplyMessage(b *testing.B)

func BenchmarkApplyMessageWithDynamicFeeTx

func BenchmarkApplyMessageWithDynamicFeeTx(b *testing.B)

func BenchmarkApplyMessageWithLegacyTx

func BenchmarkApplyMessageWithLegacyTx(b *testing.B)

func BenchmarkApplyTransaction

func BenchmarkApplyTransaction(b *testing.B)

func BenchmarkApplyTransactionWithDynamicFeeTx

func BenchmarkApplyTransactionWithDynamicFeeTx(b *testing.B)

func BenchmarkApplyTransactionWithLegacyTx

func BenchmarkApplyTransactionWithLegacyTx(b *testing.B)

func BenchmarkCreateAccountExisting

func BenchmarkCreateAccountExisting(b *testing.B)

func BenchmarkCreateAccountNew

func BenchmarkCreateAccountNew(b *testing.B)

func BenchmarkEmitLogs

func BenchmarkEmitLogs(b *testing.B)

func BenchmarkGetParams

func BenchmarkGetParams(b *testing.B)

func BenchmarkMessageCall

func BenchmarkMessageCall(b *testing.B)

func BenchmarkSetCode

func BenchmarkSetCode(b *testing.B)

func BenchmarkSetNonce

func BenchmarkSetNonce(b *testing.B)

func BenchmarkSetParams

func BenchmarkSetParams(b *testing.B)

func BenchmarkSetState

func BenchmarkSetState(b *testing.B)

func BenchmarkSnapshot

func BenchmarkSnapshot(b *testing.B)

func BenchmarkSubBalance

func BenchmarkSubBalance(b *testing.B)

func BenchmarkSuicide

func BenchmarkSuicide(b *testing.B)

func BenchmarkTokenMint

func BenchmarkTokenMint(b *testing.B)

func BenchmarkTokenTransfer

func BenchmarkTokenTransfer(b *testing.B)

func BenchmarkTokenTransferFrom

func BenchmarkTokenTransferFrom(b *testing.B)

func DoBenchmark

func DoBenchmark(b *testing.B, txBuilder TxBuilder)

func TestIterateContracts

func TestIterateContracts(t *testing.T, create network.CreateEvmApp, options ...network.ConfigOption)

Types

type EvmAnteTestSuite

type EvmAnteTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func NewEvmAnteTestSuite

func NewEvmAnteTestSuite(create network.CreateEvmApp, opts ...network.ConfigOption) *EvmAnteTestSuite

func (*EvmAnteTestSuite) TestBuildEvmExecutionCtx

func (s *EvmAnteTestSuite) TestBuildEvmExecutionCtx()

type FailureHook

type FailureHook struct{}

FailureHook always fail

func (*FailureHook) PostTxProcessing

func (dh *FailureHook) PostTxProcessing(_ sdk.Context, _ common.Address, _ core.Message, _ *ethtypes.Receipt) error

type GenesisTestSuite

type GenesisTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

GenesisTestSuite defines a testify suite for genesis integration tests.

func NewGenesisTestSuite

func NewGenesisTestSuite(create network.CreateEvmApp, options ...network.ConfigOption) *GenesisTestSuite

func (*GenesisTestSuite) SetupTest

func (s *GenesisTestSuite) SetupTest()

SetupTest resets state before each test method

func (*GenesisTestSuite) TestExportGenesis

func (s *GenesisTestSuite) TestExportGenesis()

TestExportGenesis verifies ExportGenesis output

func (*GenesisTestSuite) TestInitGenesis

func (s *GenesisTestSuite) TestInitGenesis()

TestInitGenesis runs various scenarios against InitGenesis

type KeeperTestSuite

type KeeperTestSuite struct {
	suite.Suite

	Network *network.UnitTestNetwork
	Create  network.CreateEvmApp
	Options []network.ConfigOption
	Handler grpc.Handler
	Keyring keyring.Keyring
	Factory factory.TxFactory

	EnableFeemarket  bool
	EnableLondonHF   bool
	MintFeeCollector bool
}

func NewKeeperTestSuite

func NewKeeperTestSuite(create network.CreateEvmApp, options ...network.ConfigOption) *KeeperTestSuite

func SetupContract

func SetupContract(b *testing.B) (*KeeperTestSuite, common.Address)

func SetupTestMessageCall

func SetupTestMessageCall(b *testing.B) (*KeeperTestSuite, common.Address)

func (*KeeperTestSuite) CreateTestTx

func (s *KeeperTestSuite) CreateTestTx(msg *types.MsgEthereumTx, priv cryptotypes.PrivKey) authsigning.Tx

func (*KeeperTestSuite) DeployTestContract

func (s *KeeperTestSuite) DeployTestContract(t require.TestingT, ctx sdk.Context, owner common.Address, supply *big.Int) common.Address

DeployTestContract deploy a test erc20 contract and returns the contract address

func (*KeeperTestSuite) DeployTestMessageCall

func (s *KeeperTestSuite) DeployTestMessageCall(t require.TestingT) common.Address

DeployTestMessageCall deploy a test erc20 contract and returns the contract address

func (*KeeperTestSuite) EvmDenom

func (s *KeeperTestSuite) EvmDenom() string

func (*KeeperTestSuite) SetupTest

func (s *KeeperTestSuite) SetupTest()

func (*KeeperTestSuite) SignSetCodeAuthorization added in v0.5.0

func (s *KeeperTestSuite) SignSetCodeAuthorization(authority testKeyring.Key, auth ethtypes.SetCodeAuthorization) ethtypes.SetCodeAuthorization

func (*KeeperTestSuite) StateDB

func (s *KeeperTestSuite) StateDB() *statedb.StateDB

func (*KeeperTestSuite) TestAddAddressToAccessList

func (s *KeeperTestSuite) TestAddAddressToAccessList()

func (*KeeperTestSuite) TestAddBalance

func (s *KeeperTestSuite) TestAddBalance()

func (*KeeperTestSuite) TestAddLog

func (s *KeeperTestSuite) TestAddLog()

func (*KeeperTestSuite) TestAddSlotToAccessList

func (s *KeeperTestSuite) TestAddSlotToAccessList()

func (*KeeperTestSuite) TestApplyMessage

func (s *KeeperTestSuite) TestApplyMessage()

func (*KeeperTestSuite) TestApplyMessageChargesGasOnCommitError added in v0.6.4

func (s *KeeperTestSuite) TestApplyMessageChargesGasOnCommitError()

func (*KeeperTestSuite) TestApplyMessageWithConfig

func (s *KeeperTestSuite) TestApplyMessageWithConfig()

func (*KeeperTestSuite) TestApplyMessageWithNegativeAmount

func (s *KeeperTestSuite) TestApplyMessageWithNegativeAmount()

func (*KeeperTestSuite) TestApplyTransaction

func (s *KeeperTestSuite) TestApplyTransaction()

func (*KeeperTestSuite) TestApplyTransactionWithTxPostProcessing added in v0.5.0

func (s *KeeperTestSuite) TestApplyTransactionWithTxPostProcessing()

func (*KeeperTestSuite) TestBalance

func (s *KeeperTestSuite) TestBalance()

func (*KeeperTestSuite) TestBaseFee

func (s *KeeperTestSuite) TestBaseFee()

func (*KeeperTestSuite) TestCallEVM

func (s *KeeperTestSuite) TestCallEVM()

func (*KeeperTestSuite) TestCallEVMWithData

func (s *KeeperTestSuite) TestCallEVMWithData()

func (*KeeperTestSuite) TestCallEVMWithDataGasBoundedByTxGasMeter added in v0.6.4

func (s *KeeperTestSuite) TestCallEVMWithDataGasBoundedByTxGasMeter()

func (*KeeperTestSuite) TestCheckSenderBalance

func (s *KeeperTestSuite) TestCheckSenderBalance()

func (*KeeperTestSuite) TestCommitIdempotency added in v0.6.0

func (s *KeeperTestSuite) TestCommitIdempotency()

TestCommitIdempotency verifies that calling FlushToCacheCtx multiple times without any state changes produces identical results across all branches in commitWithCtx: - DeleteAccount (self-destructed) - SetCode/DeleteCode (code operations) - SetAccount (account updates) - SetState/DeleteState (storage operations)

func (*KeeperTestSuite) TestCommitIdempotencyWithCodeDeletion added in v0.6.0

func (s *KeeperTestSuite) TestCommitIdempotencyWithCodeDeletion()

TestCommitIdempotencyWithCodeDeletion tests idempotency of code deletion

func (*KeeperTestSuite) TestCommitIdempotencyWithSelfDestruct added in v0.6.0

func (s *KeeperTestSuite) TestCommitIdempotencyWithSelfDestruct()

TestCommitIdempotencyWithSelfDestruct tests idempotency of account deletion

func (*KeeperTestSuite) TestCommitIdempotencyWithStorage added in v0.6.0

func (s *KeeperTestSuite) TestCommitIdempotencyWithStorage()

TestCommitIdempotencyWithStorage tests idempotency of storage operations

func (*KeeperTestSuite) TestCommittedState

func (s *KeeperTestSuite) TestCommittedState()

func (*KeeperTestSuite) TestContextSetConsensusParams

func (s *KeeperTestSuite) TestContextSetConsensusParams()

func (*KeeperTestSuite) TestCreateAccount

func (s *KeeperTestSuite) TestCreateAccount()

func (*KeeperTestSuite) TestDeleteAccount

func (s *KeeperTestSuite) TestDeleteAccount()

func (*KeeperTestSuite) TestEIP7702NonceIncrement added in v0.7.0

func (s *KeeperTestSuite) TestEIP7702NonceIncrement()

TestEIP7702NonceIncrement tests that when a user with EIP-7702 delegation deploys a contract whose constructor calls back to the user (via the delegation) and deploys more contracts, the user's nonce is correctly incremented.

This test reproduces a bug where the nonce was unconditionally reset to msg.Nonce+1 after evm.Create(), ignoring any nonce increments that occurred during execution.

Bug scenario: 1. User (with EIP-7702 delegation) sends contract creation tx with nonce N 2. evm.Create() increments User's nonce to N+1 3. Constructor calls back to User via delegation, deploying more contracts 4. Each nested CREATE increments User's nonce (N+2, N+3, ...) 5. BUG: After evm.Create() returns, nonce is reset to N+1, losing all increments

func (*KeeperTestSuite) TestEVMConfig

func (s *KeeperTestSuite) TestEVMConfig()

func (*KeeperTestSuite) TestEmpty

func (s *KeeperTestSuite) TestEmpty()

func (*KeeperTestSuite) TestEmptyRequest

func (s *KeeperTestSuite) TestEmptyRequest()

func (*KeeperTestSuite) TestEndBlock

func (s *KeeperTestSuite) TestEndBlock()

func (*KeeperTestSuite) TestEstimateGas

func (s *KeeperTestSuite) TestEstimateGas()

func (*KeeperTestSuite) TestEstimateGasWithStateOverrides added in v0.7.0

func (s *KeeperTestSuite) TestEstimateGasWithStateOverrides()

func (*KeeperTestSuite) TestEthCall

func (s *KeeperTestSuite) TestEthCall()

func (*KeeperTestSuite) TestEthereumTx

func (s *KeeperTestSuite) TestEthereumTx()

func (*KeeperTestSuite) TestEvmHooks

func (s *KeeperTestSuite) TestEvmHooks()

func (*KeeperTestSuite) TestExist

func (s *KeeperTestSuite) TestExist()

func (*KeeperTestSuite) TestGasToRefund

func (s *KeeperTestSuite) TestGasToRefund()

func (*KeeperTestSuite) TestGetAccountLocked added in v0.6.1

func (s *KeeperTestSuite) TestGetAccountLocked()

TestGetAccountLocked verifies Keeper.GetAccount snapshots LockedCoins for the EVM denom into the Account at load time. The snapshot powers the commit path's bank-balance reconstruction without re-reading LockedCoins after a precompile may have mutated DelegatedVesting on a vesting account.

func (*KeeperTestSuite) TestGetAccountOrEmpty

func (s *KeeperTestSuite) TestGetAccountOrEmpty()

func (*KeeperTestSuite) TestGetAccountStorage

func (s *KeeperTestSuite) TestGetAccountStorage()

func (*KeeperTestSuite) TestGetCodeHash

func (s *KeeperTestSuite) TestGetCodeHash()

func (*KeeperTestSuite) TestGetCoinbaseAddress

func (s *KeeperTestSuite) TestGetCoinbaseAddress()

func (*KeeperTestSuite) TestGetEthIntrinsicGas

func (s *KeeperTestSuite) TestGetEthIntrinsicGas()

func (*KeeperTestSuite) TestGetHashFn

func (s *KeeperTestSuite) TestGetHashFn()

func (*KeeperTestSuite) TestGetNonce

func (s *KeeperTestSuite) TestGetNonce()

func (*KeeperTestSuite) TestGetProposerAddress

func (s *KeeperTestSuite) TestGetProposerAddress()

func (*KeeperTestSuite) TestKeeperSetOrDeleteCode

func (s *KeeperTestSuite) TestKeeperSetOrDeleteCode()

func (*KeeperTestSuite) TestNonceInQuery

func (s *KeeperTestSuite) TestNonceInQuery()

func (*KeeperTestSuite) TestParams

func (s *KeeperTestSuite) TestParams()

func (*KeeperTestSuite) TestPostTxProcessingFailureLogReversion

func (s *KeeperTestSuite) TestPostTxProcessingFailureLogReversion()

func (*KeeperTestSuite) TestPrepareAccessList

func (s *KeeperTestSuite) TestPrepareAccessList()

func (*KeeperTestSuite) TestQueryAccount

func (s *KeeperTestSuite) TestQueryAccount()

func (*KeeperTestSuite) TestQueryBalance

func (s *KeeperTestSuite) TestQueryBalance()

func (*KeeperTestSuite) TestQueryBaseFee

func (s *KeeperTestSuite) TestQueryBaseFee()

func (*KeeperTestSuite) TestQueryCode

func (s *KeeperTestSuite) TestQueryCode()

func (*KeeperTestSuite) TestQueryCosmosAccount

func (s *KeeperTestSuite) TestQueryCosmosAccount()

func (*KeeperTestSuite) TestQueryParams

func (s *KeeperTestSuite) TestQueryParams()

func (*KeeperTestSuite) TestQueryStorage

func (s *KeeperTestSuite) TestQueryStorage()

func (*KeeperTestSuite) TestQueryTxLogs

func (s *KeeperTestSuite) TestQueryTxLogs()

TODO: Fix this one

func (*KeeperTestSuite) TestQueryValidatorAccount

func (s *KeeperTestSuite) TestQueryValidatorAccount()

func (*KeeperTestSuite) TestRefund

func (s *KeeperTestSuite) TestRefund()

func (*KeeperTestSuite) TestRefundGas

func (s *KeeperTestSuite) TestRefundGas()

func (*KeeperTestSuite) TestRegisterPreinstalls

func (s *KeeperTestSuite) TestRegisterPreinstalls()

func (*KeeperTestSuite) TestResetGasMeterAndConsumeGas

func (s *KeeperTestSuite) TestResetGasMeterAndConsumeGas()

func (*KeeperTestSuite) TestSetAndGetCodeHash

func (s *KeeperTestSuite) TestSetAndGetCodeHash()

func (*KeeperTestSuite) TestSetBalance

func (s *KeeperTestSuite) TestSetBalance()

func (*KeeperTestSuite) TestSetBalanceAllowsEOA added in v0.6.1

func (s *KeeperTestSuite) TestSetBalanceAllowsEOA()

func (*KeeperTestSuite) TestSetBalanceRejectsModuleAccounts added in v0.6.1

func (s *KeeperTestSuite) TestSetBalanceRejectsModuleAccounts()

func (*KeeperTestSuite) TestSetBalanceWithLocked added in v0.6.1

func (s *KeeperTestSuite) TestSetBalanceWithLocked()

func (*KeeperTestSuite) TestSetCode

func (s *KeeperTestSuite) TestSetCode()

func (*KeeperTestSuite) TestSetNonce

func (s *KeeperTestSuite) TestSetNonce()

func (*KeeperTestSuite) TestSnapshot

func (s *KeeperTestSuite) TestSnapshot()

func (*KeeperTestSuite) TestState

func (s *KeeperTestSuite) TestState()

func (*KeeperTestSuite) TestSubBalance

func (s *KeeperTestSuite) TestSubBalance()

func (*KeeperTestSuite) TestSuicide

func (s *KeeperTestSuite) TestSuicide()

func (*KeeperTestSuite) TestTraceBlock

func (s *KeeperTestSuite) TestTraceBlock()

func (*KeeperTestSuite) TestTraceCall added in v0.5.0

func (s *KeeperTestSuite) TestTraceCall()

func (*KeeperTestSuite) TestTraceTx

func (s *KeeperTestSuite) TestTraceTx()

func (*KeeperTestSuite) TestUpdateParams

func (s *KeeperTestSuite) TestUpdateParams()

func (*KeeperTestSuite) TestUpdateParamsAuthority added in v0.7.0

func (s *KeeperTestSuite) TestUpdateParamsAuthority()

TestUpdateParamsAuthority verifies that the EVM keeper resolves the authority through the consensus AuthorityParams when set, and otherwise falls back to the keeper's authority.

func (*KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance

func (s *KeeperTestSuite) TestVerifyFeeAndDeductTxCostsFromUserBalance()

TestVerifyFeeAndDeductTxCostsFromUserBalance is a test method for both the VerifyFee function and the DeductTxCostsFromUserBalance method.

NOTE: This method combines testing for both functions, because these used to be in one function and share a lot of the same setup. In practice, the two tested functions will also be sequentially executed.

func (*KeeperTestSuite) TransferERC20Token

func (s *KeeperTestSuite) TransferERC20Token(t require.TestingT, contractAddr, from, to common.Address, amount *big.Int) *evmtypes.MsgEthereumTx

type LogRecordHook

type LogRecordHook struct {
	Logs []*ethtypes.Log
}

LogRecordHook records all the logs

func (*LogRecordHook) PostTxProcessing

func (dh *LogRecordHook) PostTxProcessing(_ sdk.Context, _ common.Address, _ core.Message, receipt *ethtypes.Receipt) error

type NestedEVMExtensionCallSuite

type NestedEVMExtensionCallSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

NestedEVMExtensionCallSuite covers the flash loan exploit scenarios.

func NewNestedEVMExtensionCallSuite

func NewNestedEVMExtensionCallSuite(create network.CreateEvmApp, options ...network.ConfigOption) *NestedEVMExtensionCallSuite

func (*NestedEVMExtensionCallSuite) SetupSuite

func (s *NestedEVMExtensionCallSuite) SetupSuite()

SetupSuite loads static data before any test

func (*NestedEVMExtensionCallSuite) SetupTest

func (s *NestedEVMExtensionCallSuite) SetupTest()

SetupTest resets blockchain state before each test case or entry

func (*NestedEVMExtensionCallSuite) TestFlashLoanExploit

func (s *NestedEVMExtensionCallSuite) TestFlashLoanExploit()

TestFlashLoanExploit runs the two flash loan methods

type TxBuilder

type TxBuilder func(suite *KeeperTestSuite, contract common.Address) *types.MsgEthereumTx

Jump to

Keyboard shortcuts

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