Feat/derived tx evm 0.4.0 - #13
Merged
Merged
Conversation
* fix * fix-lint * lint-go * fix
* start building * do packet callbacks * push change sources side to have specific callbacks * cleanup * add documentation * start testing framework * finish up test framework * better error testing * success test cases * fix address issue * Allow multihop tokens Create ERC20 precompiles for tokens that have more than 1 hop * set allowance on erc20 - checks if erc20 exists (should exist because this callback is after the erc20 callback) - sets allowance for ibc'd erc20 for the full transfer amount to the contract on behalf of the isolated address * fail if contract address is not contract fails out if the contract address provided has no code. this prevents silent successes if the contract address is an EOA * fix initialization in app.go include erc20 keeper * check for contract in timeout and ack and fix tests * use remaining context gas as max gas * re-add compiled contracts * lints * md lints * wip: happy path testing * change middleware order * update erc20 gas * fix call * wip: tests, failing out of gas every evm call * wip: tests, failing out of gas every evm call * Happy path testing + lints * uncomment previous test * clean up * gas handling and docs * add tests for recv, ack, timeout * lints * small fixes * fix errors in testcase after update * Rename approve output decoding * Check receiver tokens instead of callback contract * Don't panic in ibc middleware * Apply suggestions from code review Co-authored-by: Eric Warehime <eric.warehime@gmail.com> Co-authored-by: Hyunwoo Lee <124245155+zsystm@users.noreply.github.com> --------- Co-authored-by: Vlad <vladjdk@gmail.com> Co-authored-by: Eric Warehime <eric.warehime@gmail.com> Co-authored-by: Hyunwoo Lee <124245155+zsystm@users.noreply.github.com>
* refactor(precompiles): apply journal-based revert approach * refactor: remove unused Snapshot type * chore: fix lint
* test refactoring evmd as separate package - we can make sure more clean dependency: only evmd -> evmd allows. not vice versa. test re-structuring - tests using network + evmd moved into evm/tests/integration - test file names are changed from *_test.go to test_*.go, so any client chains can leverage cosmos/evm's test suites with their own application refactoring - all integration tests in evm uses EvmApp interface. so it allows other client application can leverage cosmos/evm's test suites. - evmd implements methods of EvmApp - separate Erc20Keeper interface to avoid cyclic import between erc20/keeper and precompiles/erc20 - change backend member variables to public. this is for making testing refactoring easier. if there are some security concern, we should consider introducing getters. removed un-used files * upstream merge and resolve conflicts * fix lints & ci removed already migrated test also * fix ci * fix lint issues * fix ginkgo issues and update testing ci, makefile * gci formatted and re-organize authz test * add missed test case * fix ci issue * erc20 cyclic dependencies resolved * chore: typo * chore: package name * chore: test convention * chore: test convention * chore: align convention * un-do un-necessary change pb files should not be touched * re-organize ibc testing dir and make ibc testsing using EvmApp, not evmd * fix Makefile * change go mod name to github.com/cosmos/evm/evmd * merge main & resolve conflicts * fix lint
* fix unmarshalling of uint64 for "0x..." strings * lint fix
* add equivalent test * ftmr * lint-fix * clean-up * ok
* update * cleanup * unnecessary
…os#219) * tests: add ics20 precompile tests and refactor test utils - Make gas limit configurable for testing lower gas limit scenario - Get ibctesting.AppCreator when create coordinator, so other applications can leverage this test suits. - Make GenerateContractCallArgs as separate function. This doens't have to be a member method of TxFactory implementation. un-necessary dependency. - SendEvmTx now supports contract creation. * fix ibc test suite and ics20 tx vulnerability Previous ibc test suite uses different bond denom ("stake) with EVM denom ("aatom"). Even though it could be different technically, but we need to make sure everything works correctly with default config (bond denom == evm denom). Wit this commit, we can make sure IBC and ICS20 transfers with default config should work well. Updated test util for writing test cases more easily. * add revert test case * fix lint * implement safeCopyInputs and add query test case Currently, Arguments.Copy in geth panics if there are type mismatch. Returning error instead makes more sense * applied PR reviews
Lines 24/25 `NoWithWeto` >> `NoWithVeto`
* tests: add ics20 precompile tests and refactor test utils
- Make gas limit configurable for testing lower gas limit scenario
- Get ibctesting.AppCreator when create coordinator, so other applications can leverage this test suits.
- Make GenerateContractCallArgs as separate function. This doens't have to be a member method of TxFactory implementation. un-necessary dependency.
- SendEvmTx now supports contract creation.
* fix ibc test suite and ics20 tx vulnerability
Previous ibc test suite uses different bond denom ("stake) with EVM denom ("aatom"). Even though it could be different technically, but we need to make sure everything works correctly with default config (bond denom == evm denom).
Wit this commit, we can make sure IBC and ICS20 transfers with default config should work well.
Updated test util for writing test cases more easily.
* add revert test case
* fix lint
* implement safeCopyInputs and add query test case
Currently, Arguments.Copy in geth panics if there are type mismatch. Returning error instead makes more sense
* refactor: decouple evm from evmd and relocate evmd-specific tests
- Moved shared test/data files from evmd to evm to eliminate evm → evmd dependency
- Relocated evmd-bound tests that directly depend on App implementation into evmd/
- Refactored remaining evmd-dependent tests to use EvmApp interface instead
- Updated Makefile to reflect cmd relocation under evmd/
* fix ci and update test-helper's config path
* resolve conflicts after merge upstream
* nit: changed filename
Variables in evmd_config.go are defined for serving evmd
* chore: update importing package name
* Refactor: relocate evmd-specific configurations and add test counterparts
Moved evmd-specific app configurations under the evmd/ directory to improve modularity and maintain clearer separation between evmd and other components.
Introduced corresponding configuration files under testutil/ to support test applications, since relocating the original files required new equivalents for testing purposes.
* Refactor: relocate app specific ante handler
* fix solidity test config path
* chore: update import package name
Co-authored-by: Vlad J <vladjdk@gmail.com>
…le call (cosmos#244) * feat(x/vm): add cacheStack for CacheMultiStore snapshot * fix(x/vm): StateDB.snapshotter * feat(x/vm): add keys field to x/vm keeper and use keys for snapshot * deps: remove cosmossdk.io/store fork * refactor(x/vm): refactor snapshot multi store and add comments * test(x/vm): add benchmark test for snapshotmulti.Store * test(precompiles): add edge case test for precompile * refactor(x/vm): modify snapshot stores dep(evmd): go mod tidy refactor: change package name of stack based store refactor(x/vm/store): modify type casting refactor(x/vm): rename store packages * fix(x/vm): order store keys for snapshot store * chore(x/vm/store): modify comments * chore(x/vm/store): add comments * test(x/vm/store): add unit tests * chore(x/vm): fix lint * chore: fix lint * chore: fix lint * chore(x/vm/store): remove unnecessary function call * test: modify TestCMS * fix(tests): precompile test case that intermittently fails * chore(x/vm/store): rename variable cms into snapshotStore in test code * chore: resolve merge conflict * chore(x/vm) fix lint * chore: fix typo * chore: modify comment * chore(x/vm/store): add comments * test(x/vm/store): add test case for overwrite to same key
* fix(vm/keeper): add return data of ApplyMessageWithConfig for ErrExecutionReverted * fix(precompile): modify return data of distribution precompile for revert error * test: remove redundant test case * chore(precompiles/staking): modify description for integration test case * chore: fix lint * fix(precompiles): modify return data of precompiles for revert error * fix: broken test cases after modifying precompile err to revert err * refactor:(precompiles) convert error that precompile.Run returns to ErrExecutionReverted * wip: test(precompiles/staking): fix test cases * chore: compile latest test contracts * fix(precompiles/staking): check revert reason or integration test cases * test(precompiles/staking): fix unit test * test(precompiles/distribution): improve integration test * test(precompiles/erc20): improve integration test * test(precompiles/ics20): improve integration test * test(precompiles/slashing): add slashing integration test for proof of audit issue fix * chore: fix lint * chore: fix lint
…cosmos#201) * feat(precompiles): add BalanceHandler to handle native balance change * refactor: remove parts of calling SetBalanceChangeEntries * chore: fix lint * chore(precompiles/distribution): remove unused helper function * chore(precompiles): modify comments * chore: restore modification to be applied later * chore: fix typo * chore: resolve conflict * chore: fix lint * test(precompiles/common) add unit test cases * chore: fix lint * fix(test): precompile test case that intermittently fails * refactor: move mock evm keeper to x/vm/types/mocks * chore: add KVStoreKeys() method to mock evmKeeper * refactoring balance handling * test(precompile/common): improve unit test for balance handler * refactor(precompiles): separate common logic * Revert "refactor(precompiles): separate common logic" This reverts commit 25b89f3. * Revert "Merge pull request #1 from zsystm/poc/precompiles-balance-handler" This reverts commit 46cd527, reversing changes made to b532fd5. --------- Co-authored-by: zsystm <actor93kor@gmail.com> Co-authored-by: Vlad J <vladjdk@gmail.com>
* fix: align eth_feeHistory with geth resolve EarliestBlockNumber from 0 to -5 for more info, ethereum/go-ethereum@bc36f2d * cleanup * Apply suggestions from code review --------- Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
* fix: align filter block tag with geth * align invalid block range check * align pending tag check * fail to filter out logs with earliest tag when resolve EarliestBlockNumber from 0 to -5 * for more info, ethereum/go-ethereum@bc36f2d * cleanup * Apply suggestions from code review * cleanup --------- Co-authored-by: Vlad J <vladjdk@gmail.com> Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
r or s could be less than 32 bytes sometimes. we should leftpad always to handle that cases also.
…os#267) The consensus address was previously used in its bech32-encoded form (a 52-character string), which is incorrect. This led to attempts to interpret a bech32 string directly as a 20-byte address, resulting in invalid conversions and data loss. This fix ensures the bech32 consensus address is properly decoded into its original 20-byte form before further processing, preserving the correct address representation expected in EVM-compatible byte format. Co-authored-by: Vlad J <vladjdk@gmail.com>
* fix: non-eip-155 tx panic when get signer Closes: cosmos#280 * treat zero chainID differently * fix zero check * fix comment * fix conditon
* add default router for evidence keeper * fix type handling When calling submitEvidence through hardhat(ethers.js), type conversion from args[1] into Equivocation doesn't work. * fix lint * enable evidence precompile at local_node.sh * implement no-op evidence handler * remove un-used code --------- Co-authored-by: Vlad J <vladjdk@gmail.com>
* abci * eip1559 * grpc * msg * params * keeper * integration * rename * align utils test that depends on NewTestSuite bank config evm * keep evmd -> evm dependency * set antehandler before seal * cleanup * cleanup cfg * cleanup * cleanup * reuse * vm * genesis * fee * param * statedb * add evmd * revert * test: cleanup EvmAppOptions related config
* fix: align BytesToAddress in parseHexAddress that requires exact 20-byte instead of direct Address conversion * test --------- Co-authored-by: Vlad J <vladjdk@gmail.com>
* comments * further * more * proto * remaining * changelog * mocks * space * mock-final * rm * Auto-fix markdown lint issues * tidy --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* fix: align precompiles map with available static check for more info, https://github.com/cosmos/evm/blob/be2c215481ef1466328811d878675be75c90edf3/x/vm/keeper/static_precompiles.go#L46 * add doc
…ingTxStream in build time (cosmos#440) * feat: enforce app creator returning application implementing AppWithPendingTxStream in build time * update application interface and app creator wiring for EVM server integration * use cosmosevmserver.Application interface instead of servertypes.Application with assertion * add new Application interface and AppCreator type to support pending tx stream * add doc
* fix * move-to-lib * godoc * cl * Auto-fix markdown lint issues * bump for ci * bump for ci * fix * fix * fix --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* wip * wip: iterator * nil check * wip: selectby * add todo * pointer * pointer 2 * remove impl, type assertions * add txpool locally * change statedb types to interface * fix tests * scaffold app setup * Add initial tests to ExtMempool * real priority nonce mempool + fixes * improve test for wrong denom ordering * move initialization to mempool * ok * Nonce gap tx test * revert * bloom parsing dumb * redundant * ignore this dir for markdown linting * Cleanup + Test SelectBy * implement blockchain * update systemtest test tag * add subscription * fix tests * wiring and bug fixes and todos and etc * wip * fix * WIP on vlad/mempool * Auto stash before checking out "origin/vlad/mempool" * rpc no error * clean up logging * verification * Add broadcasting * add retries to tx results * feature: Add txpool namespace stubs ahead of app-side mempool implementation (cosmos#344) * add txpool implementation stubs * update interface * fix lint --------- Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io> * txpool endpoint * wip refactor * do not allow block 1 submission * fix some tests * fix more tests * fix last remaining evmd test * add second registry for testing * wip: integration tests * wip: functional tests time to add more test cases * fix tests and chain * demo ready todo: fix removals * fix removals (out of gas errors should be skipped) * add gas to config * attempt to fix flakes * strict equalities * FIXED FLAKES * reformat tests into original structure * nonce gap tests * add demo test and fix prev system case * remove done todos and the other mempool * add instructions to remove mempool * remove mocks * lint fixes * review test cases * add some more test cases * fix scripts * add more backoff for testing * remove logs from simplesends * fix systest CI * skip test for now see if main one works * Update .markdownlintignore Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io> * Update evmd/tests/integration/create_app.go Co-authored-by: Eric Warehime <eric.warehime@gmail.com> * Refactor: Rename 'nonce' to 'accountNonce' in IncrementNonce function * refactor app.go imports * extract atest to constant * fix nonce name test * use actual release * evmd use release tag * refactor ctx -> getCtxCallback * rename errors2 and types2 to sdkerrors and sdktypes * group vars in mempool init * privatize newBlockchain * enhance mempool init readability on nil checks * move txPool checks to right after initialization * use errors.Is for nonce gap errors in rpc * group vars * Update tests/systemtests/.gitignore * refactor iterator to make it more readable * refactor iterator to make it more readable * rename blocked -> queued and runnable -> pending * explain some questionable naming choices * add some status constants * add logging * move custom endblocker to vm * fix rpc error compare * fix system tests * lints * fixed from main merge * rename mempool to experimental * Auto-fix markdown lint issues * we tidy * overflow comment * add changelog entry * Update evmd/app.go Co-authored-by: Hyunwoo Lee <124245155+zsystm@users.noreply.github.com> * remove comment * initialize txpool unconditionally * sort by effective gas tips instead of fees on cosmos * lints * small test cleanup --------- Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com> Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io> Co-authored-by: Abdul Malek <me@almk.dev> Co-authored-by: Eric Warehime <eric.warehime@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hyunwoo Lee <124245155+zsystm@users.noreply.github.com>
* remove deprecated apis (removed from geth) * add changelog * chore: fix link
… HexAddressFromBech32String (cosmos#454) * fix: apply multi decode functions instead of string contains check in HexAddressFromBech32String * align for account, validator, and consensus addresses like sdk * https://github.com/cosmos/cosmos-sdk/blob/release/v0.53.x/client/debug/main.go#L262 * test
* fix: cleanup unused cancel function in filter * doc * test --------- Co-authored-by: Vlad J <vladjdk@gmail.com>
* add guide * callout * Auto-fix markdown lint issues * fix-nit diff --git c/docs/migrations/v0.3.0_to_v0.4.0.md i/docs/migrations/v0.3.0_to_v0.4.0.md index 222b9e2..a5308d1 100644 --- c/docs/migrations/v0.3.0_to_v0.4.0.md +++ i/docs/migrations/v0.3.0_to_v0.4.0.md @@ -33,7 +33,7 @@ Bump the `cosmos/evm` dependency in `go.mod` and tidy modules: ### 1.2 Transitive bumps (observed in `go.sum`) -Check for minor dependency bumps such as minor bumps (e.g., `google.golang.org/protobuf`, `github.com/gofrs/flock`, `github.com/consensys/gnark-crypto`). Run the following commands: +Check for minor dependency bumps (e.g., `google.golang.org/protobuf`, `github.com/gofrs/flock`, `github.com/consensys/gnark-crypto`). Run the following commands: ```bash go mod tidy --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…se (cosmos#442) * fix: avoid nil pointer by checking error in gov precompile FromResponse * doc * add test --------- Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
* update log package * cl
* initial doc * add diagram and description * add transaction flow diagram * reorganizing * Auto-fix markdown lint issues * add links to tools and an example script link * Warning callout --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…go mod tidy compatibility
… fix RevertError to store raw bytes, replace removed BalanceHandlerFactory with GetBalanceHandler, drop OS-app integration tests incompatible with standalone module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
Merges upstream
cosmos/evm v0.4.0(104 commits, 682 files) into the pushchain fork while preserving all pushchain-specific customizations: derivedEVM transactions, baseFeeBurn logic, and RPC/trace fixes.
Upstream changes adopted
Dependencies
go-ethereum→v0.0.0-20250806193535-2fc7571efa91(cosmos fork of go-ethereum 1.16)cometbft→v0.38.18dop251/gojaupgraded (JS tracer dependency)Breaking API changes
MsgEthereumTx.Fromchanged fromstringto[]byte;Hashis now a computed method, not a settable field;Datafield removed in favour ofAsTransaction()FromEthereumTx()is now void (was returning an error)UnpackTxDatafunction removedEthHeaderFromTendermint→EthHeaderFromComet;TendermintBlock*→CometBlock*;BlockNumberFromTendermint*→BlockNumberFromComet*Backendstruct fields exported (uppercase:ClientCtx,RPCClient,Logger,Cfg,EvmChainID,Indexer, …)CallEVM/CallEVMWithDatagain agasCap *big.IntparameterFeeHistoryfirst parameter changed fromrpc.BlockNumbertomath.HexOrDecimal64#305)AddressCodecoptions instead ofbankKeeper; ICS-20 precompile gainsbankKeeperas first parameter; gov precompile gainsAddressCodecNewTransactionFromMsgsignature changed;NewRPCTransactionnow takes*evmtypes.MsgEthereumTxSecurity / audit fixes (batches 1–5)
#373,#377,#382,#388,#389,#392,#398— security audit patches across precompiles and state transitionsNew upstream features
applyAuthorization,validateAuthorization) in state transition#408)#249):batch-request-limit,batch-response-max-sizeconfig fieldsdebug_traceTransactionblock-height mismatch fix (#384)#332)#289)Pushchain customizations preserved
All commits from
feat/derived-tx-evm-0.3.2are intact:MsgEthereumTxhandling via extendedRefundGas(ctx, msg, leftoverGas, gasUsed, baseFee, denom).rpc/backend/tracing.go.eth_getBlockByNumber,eth_getBlockByHash,eth_getTransactionByHash,eth_getTransactionReceiptcorrectly surfacex/vmConsensusVersion bumped to 2; v0.2.x → v0.3.x params migration retained.EVMConfigurator, notapp.toml.Conflict resolutions — key decisions
x/vm/keeper/state_transition.goMerged EIP-7702 authorization handling from upstream around the existing baseFeeBurn /
RefundGascall. Upstream'sRefundGas(ctx, msg, leftoverGas, denom)was extended to the pushchain signatureRefundGas(ctx, msg, leftoverGas, gasUsed, baseFee, denom).rpc/backend/tx_info.goGetTxByEthHash,GetTxByTxIndex, andQueryCometTxIndexer(renamed fromqueryTendermintTxIndexer) return a third value*rpctypes.TxResultAdditionalFieldsto carry derived-tx metadata.GetTransactionReceiptrewritten to useformatTxReceipt(avoids removedUnpackTxData), with a dual path for regular vs derived txs.rpc/backend/blocks.goEthMsgsFromCometBlockreturns([]*MsgEthereumTx, []*TxResultAdditionalFields). Block formatting routes derived txs through a newNewRPCTransactionFromIncompleteMsghelper (avoids sender-recovery failure on zero-signature derived txs).rpc/types/utils.goAdded
NewRPCTransactionFromIncompleteMsgto build anRPCTransactionfrom a derived-txMsgEthereumTxwhose canonical hash and sender arepre-supplied (not recoverable from V/R/S).
precompiles/erc20/msgsrv.go(pushchain) andbank_msg_server_wrapper.go(v0.4.0 rename) were duplicate declarations. Merged pointer-receiver cases(
*bankkeeper.BaseKeeper,*precisebankkeeper.Keeper) intobank_msg_server_wrapper.goand deletedmsgsrv.go.evmd/precompiles.goRemoved evidence precompile block. Updated staking, gov, slashing, and ICS-20 constructors to v0.4.0 signatures.
Files changed (highlights)
go.mod/go.sum— dependency bumpsx/vm/keeper/state_transition.go— EIP-7702 + baseFeeBurn mergex/vm/keeper/call_evm.go—gasCapparam; derived-tx call logic retainedx/vm/keeper/keeper.go,grpc_query.go,module.go— upstream updatesrpc/backend/backend.go,blocks.go,tx_info.go,tracing.go,chain_info.go,account_info.gorpc/namespaces/ethereum/eth/api.go—FeeHistorysignature,BlockNumberFromCometrpc/namespaces/ethereum/eth/filters/utils.go— stdlibslicesreplacesx/exp/slicesrpc/types/utils.go—NewRPCTransactionFromIncompleteMsgaddedevmd/app.go,evmd/precompiles.goserver/config/toml.go— batch size limit fields addedprecompiles/erc20/bank_msg_server_wrapper.go— pointer keeper cases merged intests/integration/— call sites updated for new return arities andRefundGassignatureTest File Changes
1.
x/vm/types/errors.go—RevertErrorstores raw bytesFailing test:
TestNewExecErrorWithReasoninx/vm/types/errors_test.goRoot cause: Upstream v0.4.0 changed
RevertErrorto align with go-ethereum's revert format (PR cosmos#289). The fieldreasonwasstring(the unpacked human-readable message), but the correct format is raw ABI-encoded bytes so callers can decode it themselves. The test asserted the hex-encoded raw bytes asErrorData()output.Fix:
reason string→reason []byteresult) instead of the unpacked string (reason)ErrorData()now returnshexutil.Encode(e.reason)instead ofe.reason"github.com/ethereum/go-ethereum/common/hexutil"import2.
x/vm/statedb/statedb.go— Guard nil EventManager inNew()Failing tests:
TestRevertSnapshotand all other statedb tests that createstatedb.New(sdk.Context{}, ...).Root cause: Upstream v0.4.0 added event-snapshot support to
Snapshot(). It now callss.ctx.EventManager().Events()to capture the event state at snapshot time. The tests pass an emptysdk.Context{}which has a nil EventManager, causing a nil pointer panic whenSnapshot()is called.Fix: In
New(), detect a nil EventManager and install a fresh one:3.
testutil/testdata/debug/debug.go— Replace removedBalanceHandlerFactoryAPIFailing test: Build failure in
precompiles/commonpulling in this new file.Root cause: This file was created (as a copy from
evmd/tests/testdata/debug/) to fix ago mod tidydependency issue. The originalevmdversion usedcmn.NewBalanceHandlerFactory(bankKeeper)andp.BalanceHandlerFactory, but v0.4.0 removedBalanceHandlerFactoryfromcmn.Precompileentirely. The balance handler is now accessed lazily viap.GetBalanceHandler().Fix:
BalanceHandlerFactory: cmn.NewBalanceHandlerFactory(bankKeeper)from struct literalp.GetBalanceHandler()calls:p.GetBalanceHandler().BeforeBalanceChange(ctx)p.GetBalanceHandler().AfterBalanceChange(ctx, stateDB)fmt.Printfthat printedp.BalanceHandlerFactorypointer4. Upstream OS-app integration tests — Deleted
Files deleted:
precompiles/common/setup_test.goprecompiles/common/balance_handler_integration_test.goprecompiles/erc20/bank_msg_server_wrapper_test.goprecompiles/slashing/integration_test.goRoot cause: These test files were introduced in upstream v0.4.0 and reference
testutil/integration/os/— a test infrastructure package tied to the upstream reference chain app (evmos/os). This package does not exist in thegithub.com/cosmos/evmfork:testutil/integration/os/factorytestutil/integration/os/grpctestutil/integration/os/networktestutil/integration/os/keyringThe fork's equivalent infrastructure (
testutil/integration/evm/) requires aCreateEvmAppfactory function as the first argument toNewUnitTestNetwork. The app constructor lives in theevmd/submodule, which cannot be imported by the maingithub.com/cosmos/evmmodule (separate Go module, would create a circular dependency).Additionally, tests used direct struct field access (
nw.App.BankKeeper,nw.App.EVMKeeper,nw.App.PreciseBankKeeper) that don't exist on theevm.EvmAppinterface — which only exposes getter methods (GetBankKeeper(),GetEVMKeeper(),GetPreciseBankKeeper()).Resolution: Deleted from their current locations. The integration coverage properly belongs in
evmd/tests/integration/precompiles/where the full app is available. The unit-test files in these packages (balance_handler_test.go,types_test.go,abi_test.go,slashing/types_test.go) were not affected and continue to pass.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
mainbranch