Skip to content

feat: cosmos evm module#3991

Merged
skosito merged 84 commits intodevelopfrom
cosmos-evm
Aug 4, 2025
Merged

feat: cosmos evm module#3991
skosito merged 84 commits intodevelopfrom
cosmos-evm

Conversation

@skosito
Copy link
Member

@skosito skosito commented Jun 19, 2025

Description

diff for evm fork to review together: zeta-chain/evm@main...zeta-chain:evm:integration-fixes-latest

areas of concerns:

  • migration in evm fork, with some old proto types like ethermint EthAccount needed for this
  • eth account replaced by base account
  • changes in cli commands, for example for adding key
  • changes in ante handlers (might revert some depending on evm mempool that is incoming)
  • new field evm-chain-id hardcoded in config, but here i am parsing it from cosmos chain
    ...

Related

Dependencies

Summary by CodeRabbit

  • New Features

    • Migrated from Ethermint to the Cosmos EVM module, updating EVM and ERC20 integration.
    • Added support for explicit EVM chain ID configuration and improved chain ID handling.
    • Introduced new CLI commands and enhanced documentation, including CometBFT support and expanded EVM utilities.
    • Enabled account config overrides and improved upgrade/test orchestration.
  • Bug Fixes

    • Improved transaction logging and error handling in EVM-related operations.
    • Fixed chain ID extraction and configuration consistency.
  • Refactor

    • Removed stateful precompile contract tests and related contract bindings.
    • Updated dependencies and replaced Ethermint imports with Cosmos EVM equivalents.
    • Modularized contract deployment and upgrade logic for better maintainability.
  • Chores

    • Upgraded Go and dependency versions.
    • Cleaned up unused configuration and test files.
    • Updated Docker and environment configurations for localnet and orchestrator.
  • Documentation

    • Overhauled CLI documentation to reflect new commands, options, and module changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 19, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This change set removes all stateful precompile contract tests and their associated Solidity contracts, Go bindings, and helper code from the end-to-end (E2E) test suite. All files, interfaces, and test logic related to the bank, staking, distribute, and prototype precompiles—both direct and through contract calls—are deleted. The corresponding Go bindings, ABI, and JSON artifacts are also removed, along with test registration and helper functions.

Changes

Cohort / File(s) Change Summary
E2E Precompile Contract Tests (Bank, Staking, Distribute, Prototype)
e2e/e2etests/test_precompiles_bank.go, e2e/e2etests/test_precompiles_bank_through_contract.go, e2e/e2etests/test_precompiles_distribute_and_claim.go, e2e/e2etests/test_precompiles_distribute_and_claim_through_contract.go, e2e/e2etests/test_precompiles_prototype.go, e2e/e2etests/test_precompiles_prototype_through_contract.go, e2e/e2etests/test_precompiles_staking.go, e2e/e2etests/test_precompiles_staking_through_contract.go
Deleted all E2E test files for stateful precompile contracts, including direct and contract-mediated tests for bank, staking, distribute, and prototype precompiles.
Test Contract Solidity, ABI, JSON, and Go Bindings
e2e/contracts/testbank/TestBank.abi, e2e/contracts/testbank/TestBank.go, e2e/contracts/testbank/TestBank.json, e2e/contracts/testbank/TestBank.sol, e2e/contracts/testbank/bindings.go, e2e/contracts/testprototype/TestPrototype.abi, e2e/contracts/testprototype/TestPrototype.go, e2e/contracts/testprototype/TestPrototype.json, e2e/contracts/testprototype/TestPrototype.sol, e2e/contracts/testprototype/bindings.go, e2e/contracts/teststaking/TestStaking.abi, e2e/contracts/teststaking/TestStaking.go, e2e/contracts/teststaking/TestStaking.json, e2e/contracts/teststaking/TestStaking.sol, e2e/contracts/teststaking/bindings.go
Deleted all Solidity source, ABI, JSON, and Go binding files for TestBank, TestPrototype, and TestStaking contracts.
Bank Precompile Interface and Bindings
precompiles/bank/IBank.abi, precompiles/bank/IBank.gen.go, precompiles/bank/IBank.json, precompiles/bank/IBank.sol
Deleted the IBank precompile contract interface, its events, functions, Go bindings, and ABI/JSON files.
Test Registration and Helper Cleanup
e2e/e2etests/e2etests.go, e2e/e2etests/helpers.go
Removed all test name constants and test registrations for precompile tests; deleted helper functions (bigAdd, bigSub).

Sequence Diagram(s)

Omitted due to the nature of the changes (mass file and feature removal, no new control flow introduced).

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~65 minutes

Possibly related PRs

  • feat!: bank precompile #2860: Implements a bank precompile contract and integrates it into the application and precompile management, directly related to the removal of these precompile tests and interfaces.

Suggested reviewers

  • swift1337
  • lumtis
  • gartnera
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cosmos-evm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@skosito skosito requested review from kingpinXD and swift1337 August 4, 2025 10:26
Copy link
Contributor

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Huge work.

@skosito skosito changed the title feat: cosmos evm module [WIP] feat: cosmos evm module Aug 4, 2025
@skosito skosito marked this pull request as ready for review August 4, 2025 13:42
@skosito skosito requested a review from a team as a code owner August 4, 2025 13:42
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 16

🔭 Outside diff range comments (2)
e2e/runner/setup_zevm.go (1)

303-305: Correct ZEVM gateway address in TestDAppV2 deployment

In e2e/runner/setup_zevm.go, the call to DeployTestDAppV2 is still using r.GatewayEVMAddr. For ZEVM setup it should pass r.GatewayZEVMAddr instead.

• Location: e2e/runner/setup_zevm.go, around line 303
• Change the final parameter of the deploy call accordingly:

- testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(
-     r.ZEVMAuth, r.ZEVMClient, true, r.GatewayEVMAddr,
- )
+ testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(
+     r.ZEVMAuth, r.ZEVMClient, true, r.GatewayZEVMAddr,
+ )
 require.NoError(r, err)

This ensures the ZEVM gateway is correctly targeted rather than reusing the EVM gateway.

contrib/localnet/orchestrator/start-zetae2e.sh (1)

10-12: Ensure the trap also fires on normal script termination

The current trap only listens to SIGINT and SIGTERM. When the script finishes successfully (e.g., exit 0), orphaned background jobs will survive.
Add EXIT to the trap list to guarantee cleanup in all exit paths.

-trap 'kill -- -$$' SIGINT SIGTERM
+trap 'kill -- -$$' SIGINT SIGTERM EXIT
♻️ Duplicate comments (6)
cmd/zetae2e/local/monitor_priority_txs.go (1)

115-115: LGTM: Cosmos EVM module migration implemented correctly.

The type URL string has been properly updated from /ethermint.evm.v1.MsgEthereumTx to /cosmos.evm.vm.v1.MsgEthereumTx, which aligns with the broader codebase migration to Cosmos EVM modules.

go.mod (2)

297-298: Core cosmos/evm dependency added successfully

The addition of github.com/cosmos/evm v1.0.0-rc2 is the foundation for migrating from Ethermint to Cosmos EVM modules. Note that this is a release candidate version.


417-420: Replace directives properly configured for EVM migration

The replace directives correctly point to:

  • ZetaChain's fork of cosmos/evm for custom modifications
  • Cosmos's fork of go-ethereum for EVM compatibility

This is a standard approach for maintaining project-specific modifications.

app/ante/sig_verification.go (1)

21-47: Signature verification gas consumer correctly implemented

The implementation properly handles different public key types:

  • Fixed gas cost for secp256k1 variants
  • Delegates multisig handling to a separate function
  • Falls back to SDK default for other types

The separation of multisig handling avoids the recursion concern mentioned in past reviews.

cmd/zetacored/root.go (2)

69-69: Address TODO comments regarding default EVM chain ID usage.

These TODO comments indicate uncertainty about using the default EVM chain ID for the temporary app instance. Since this temporary app is only used to obtain autoCLI options and is not persisted, using the default value is acceptable. Consider removing these TODOs or documenting why the default is appropriate in this context.

Also applies to: 73-73


280-280: Resolve key format decision for Cosmos EVM commands.

The TODO questions whether to default to Ethereum keys. Based on past review feedback, it's recommended to maintain Cosmos address format for Cosmos commands to ensure consistency with existing behavior.

🧹 Nitpick comments (32)
changelog.md (1)

12-12: Entry ordering breaks numerical chronology
The new PR link #3991 is inserted after #4063, interrupting the ascending order used for the surrounding items (3961‒4063). Re-order the list (or document the intended sorting rule) to preserve quick visual scanning of recent additions.

contrib/rpcimportable/go.mod (1)

8-13: Comment now contradicts reality
Lines 8-10 state that “we should not tolerate any other replacements”, yet additional replace directives are introduced below. Update the comment to reflect the new, sanctioned exceptions (Cosmos Geth & EVM fork) so future maintainers are not mis-led.

cmd/zetae2e/local/evm.go (1)

98-98: Clarify the TODO comment and add tracking.

The comment indicates temporary disablement due to setup differences, but the "zeta" test goroutine still executes. Please clarify what exactly is disabled and consider adding an issue reference for tracking this temporary change.

Consider improving the comment:

-	// TODO evm: tmp comment out because of setup difference between zetae2e-ante and zetae2e
+	// TODO(issue-link): Temporarily disabled due to setup differences between zetae2e-ante and zetae2e binaries
+	// Related to upgrade testing infrastructure - see PR #3991
cmd/zetacored/config/activators.go (1)

11-15: Consider using decimal notation for EIP identifiers.

The octal notation (0o000, 0o001, 0o002) for EIP identifiers may cause confusion since EIPs are conventionally referenced in decimal. Consider using decimal notation for better readability and consistency with EIP standards.

-var CosmosEVMActivators = map[int]func(*vm.JumpTable){
-	0o000: eips.Enable0000,
-	0o001: eips.Enable0001,
-	0o002: eips.Enable0002,
-}
+var CosmosEVMActivators = map[int]func(*vm.JumpTable){
+	0: eips.Enable0000,
+	1: eips.Enable0001,
+	2: eips.Enable0002,
+}
e2e/runner/upgrade_v33.go (1)

13-21: Consider extracting duplicate receipt validation logic.

Both ensureReceiptEVM and ensureReceiptZEVM share identical logic except for the client. Consider extracting a generic helper to reduce duplication.

+func ensureReceipt(r *E2ERunner, client *ethclient.Client, tx *ethtypes.Transaction, failMessage string) {
+    receipt := utils.MustWaitForTxReceipt(r.Ctx, client, tx, r.Logger, r.ReceiptTimeout)
+    msg := "tx %s receipt status is not successful: %s"
+    require.Equal(
+        r,
+        ethtypes.ReceiptStatusSuccessful,
+        receipt.Status,
+        msg,
+        receipt.TxHash.String(),
+        failMessage,
+    )
+}
+
 ensureReceiptEVM := func(tx *ethtypes.Transaction, failMessage string) {
-    receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)
-    msg := "tx %s receipt status is not successful: %s"
-    require.Equal(
-        r,
-        ethtypes.ReceiptStatusSuccessful,
-        receipt.Status,
-        msg,
-        receipt.TxHash.String(),
-        failMessage,
-    )
+    ensureReceipt(r, r.EVMClient, tx, failMessage)
 }
 ensureReceiptZEVM := func(tx *ethtypes.Transaction, failMessage string) {
-    receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)
-    msg := "tx %s receipt status is not successful: %s"
-    require.Equal(
-        r,
-        ethtypes.ReceiptStatusSuccessful,
-        receipt.Status,
-        msg,
-        receipt.TxHash.String(),
-        failMessage,
-    )
+    ensureReceipt(r, r.ZEVMClient, tx, failMessage)
 }

Also applies to: 25-33

app/eips/eips.go (2)

7-10: Document the rationale for constant values.

The constants Multiplier and SstoreConstantGas lack documentation explaining their specific values. Consider adding comments that explain why Multiplier is set to 10 and SstoreConstantGas to 500, referencing the relevant EIP specifications.

 var (
-	Multiplier        = uint64(10)
-	SstoreConstantGas = uint64(500)
+	// Multiplier increases gas costs for CREATE, CREATE2, and CALL opcodes by 10x
+	// as specified in the corresponding EIP implementations
+	Multiplier        = uint64(10)
+	// SstoreConstantGas sets a fixed gas cost for SSTORE operations
+	// as defined in the EIP specification
+	SstoreConstantGas = uint64(500)
 )

16-22: Consider adding input validation for robustness.

The function directly modifies the JumpTable without validating that the input parameter is non-nil. While this may be acceptable in the current controlled usage context, adding a nil check would improve robustness.

 func Enable0000(jt *vm.JumpTable) {
+	if jt == nil {
+		return
+	}
 	currentValCreate := jt[vm.CREATE].GetConstantGas()
 	jt[vm.CREATE].SetConstantGas(currentValCreate * Multiplier)
e2e/txserver/zeta_tx_server.go (1)

120-120: Improve the unsafe conversion comment.

The #nosec G115 comment could be more descriptive about why this conversion is safe in this specific context.

-	cdc, reg := newCodec(uint64(zetachain.ChainId)) //#nosec G115 chain id won't exceed uint64
+	cdc, reg := newCodec(uint64(zetachain.ChainId)) //#nosec G115 -- ZetaChain.ChainId is int64, safe to convert to uint64
Makefile (1)

354-372: Upgrade configuration updates look good

The changes properly update the upgrade test configuration:

  • OLD_VERSION correctly updated to v32.0.2
  • NODE_VERSION and NODE_COMMIT build args properly passed
  • Trailing backslash fix prevents build errors

Consider keeping the .PHONY declaration immediately before the target for better organization:

+.PHONY: zetanode-upgrade
 zetanode-upgrade: e2e-images
e2e/runner/setup_evm.go (1)

114-117: Consider consolidating deployment methods to reduce function parameter passing.

The ensureTxReceipt function is passed as a parameter to both deployment methods. Since these methods are part of the same runner struct, consider making ensureTxReceipt a method of the runner to avoid parameter passing and improve cohesion.

-func (r *E2ERunner) DeployTestDAppV2(ensureTxReceipt func(tx *ethtypes.Transaction, failMessage string)) {
+func (r *E2ERunner) DeployTestDAppV2() {
+	ensureTxReceipt := func(tx *ethtypes.Transaction, failMessage string) {
+		receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)
+		r.requireTxSuccessful(receipt, failMessage)
+	}
cmd/zetae2e/local/local.go (1)

319-321: Add documentation for the SUI ZRC20 balance assertion logic.

The condition checking !testSui || deployerRunner.IsRunningTssMigration() before asserting the balance is not immediately clear. Consider adding a comment explaining why the balance should be zero after upgrade v32.0.2.

+		// After upgrade v32.0.2, the SUI ZRC20 balance in the Gas Stability Pool should be zero
+		// unless we're running TSS migration tests (which may have different balance expectations)
		balance, err := deployerRunner.SUIZRC20.BalanceOf(&bind.CallOpts{}, fungibletypes.GasStabilityPoolAddressEVM())
contrib/localnet/orchestrator/start-zetae2e.sh (2)

41-58: Consider exponential back-off when polling for zetacored version

A fixed 1 s delay for up to 10 retries may still hit the node before it’s ready, yet wastes time when the node is slow. Using exponential back-off (e.g., 1 s, 2 s, 4 s …) shortens happy-path latency while remaining robust.

No functional breakage, but improves resilience and CI run-time.


190-196: Suppress ShellCheck SC2155 warnings or split assignment

Inline command substitution inside assignment (relayer=$(config_str ...)) shadows the command’s exit status and triggers SC2155. Either:

  1. Split declaration and assignment:
local relayer
relayer=$(config_str '.observer_relayer_accounts.relayer_accounts[0].solana_address')
  1. Or explicitly suppress per line with # shellcheck disable=SC2155.

Keeps the script free of static-analysis noise.

docs/cli/zetacored/cli.md (17)

24-27: Replace hard-tabs with spaces in the top-level bullet

The newly-added bullet still contains a hard tab character, triggering MD010 and breaking visual alignment in many Markdown renderers.

-* [zetacored comet](#zetacored-comet)	 - CometBFT subcommands
+* [zetacored comet](#zetacored-comet) - CometBFT subcommands

214-447: Missing fenced-code languages & hard-tabs across the entire “comet” section

Dozens of code blocks lack a language identifier (MD040) and every bullet continues to use hard tabs (MD010).
Please:

  1. Prefix each triple-backtick with bash (these blocks are CLI invocations, not Go).
  2. Replace the tab after every * with two spaces for consistent indentation.

This cleans up lint errors and renders the syntax-highlighted commands correctly.


1310-1311: Eliminate hard-tab in keys menu

Same MD010 violation as earlier.

-* [zetacored keys list-key-types](#zetacored-keys-list-key-types)	 - List all key types
+* [zetacored keys list-key-types](#zetacored-keys-list-key-types) - List all key types

1583-1616: keys list-key-types docs – add language tag & untabify

The synopsis, examples and inherited-options blocks miss bash and still contain hard tabs. Fix as in previous comments.


5104-5108: Add language for evidence example

-```
+```bash
 zetacored query evidence evidence DF0C23E8634E...

5148-5152: Add language for list example

-```
+```bash
 zetacored query evidence list --page=2 --page-limit=50

5270-5280: Add language tag to account synopsis block

-```
+```bash
 zetacored query evm account ADDRESS [flags]

9518-9528: Snapshots dump example – add language tag

-```
+```bash
 zetacored snapshots dump [height] [format] [flags]

9543-9557: Snapshots export – language tag & hard-tab

Same fix pattern as earlier.


9572-9585: Snapshots list – add bash and remove tab

Consistent with other snapshot commands.


9600-9614: Snapshots load – language tag required

Add bash to fenced code block.


9628-9646: Snapshots restore – language tag missing

Add bash to fenced code block.


9814-9815: Remove tab in status section bullet

-* [zetacored](#zetacored)	 - Zetacore Daemon (server)
+* [zetacored](#zetacored) - Zetacore Daemon (server)

9854-9858: Hard-tab in tx menu

Replace the tab after “evm”.


12530-12533: Untabify bullet

-* [zetacored tx evm send](#zetacored-tx-evm-send)	 - Send funds from one account to another.
+* [zetacored tx evm send](#zetacored-tx-evm-send) - Send funds from one account to another.

16854-16855: Untabify bullet in upgrade menu

Swap tab for space to kill MD010.


16921-16970: Cancel-upgrade-proposal docs: add language tags & remove tabs

Apply the same fixes: bash on fenced blocks, spaces instead of tabs in bullets.

cmd/zetacored/root.go (2)

378-392: Dynamic EVM chain ID resolution implemented correctly.

The implementation properly:

  • Extracts chain ID from app options
  • Converts to ZetaChain format
  • Passes the chain ID to the app constructor

The TODO comment on line 391 appears redundant as the code already correctly uses the EVM chain ID.

-		uint64(zetachain.ChainId), //#nosec G115 chain id won't exceed uint64 // TODO evm: evm chain id?
+		uint64(zetachain.ChainId), //#nosec G115 chain id won't exceed uint64

412-431: Consistent chain ID handling in app export.

The implementation maintains consistency with the newApp method for chain ID extraction. The TODO comment on line 430 is redundant.

-		uint64(zetachain.ChainId), //#nosec G115 chain id won't exceed uint64 // TODO evm: evm chain id?
+		uint64(zetachain.ChainId), //#nosec G115 chain id won't exceed uint64

Copy link
Contributor

@swift1337 swift1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments/notes.

@skosito skosito added this pull request to the merge queue Aug 4, 2025
@github-actions github-actions bot added the MERGE_FAILED Merge Queue CI failed label Aug 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 4, 2025
@skosito skosito added the ADMIN_UPGRADE_TESTS Run make start-upgrade-test-admin label Aug 4, 2025
@skosito skosito enabled auto-merge August 4, 2025 21:12
@skosito skosito added this pull request to the merge queue Aug 4, 2025
Merged via the queue into develop with commit fdbe71b Aug 4, 2025
48 checks passed
@skosito skosito deleted the cosmos-evm branch August 4, 2025 22:01
// Copyright 2023 ZetaChain
// modified to exclude gentx transaction type from the min gas price check
package ante

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EthMinGasPriceDecorator and EthMempoolFeeDecorator decorators are both unused and can be removed.

Comment on lines 153 to 156
func (b *Backend) FeeHistory(
userBlockCount ethmath.HexOrDecimal64, // number blocks to fetch, maximum is 100
userBlockCount math.HexOrDecimal64, // number blocks to fetch, maximum is 100
lastBlock rpc.BlockNumber, // the block to start search , to oldest
rewardPercentiles []float64, // percentiles to fetch reward

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewardPercentiles can be a very large slice containing many elements, and if so, it can result in a panic when creating the slice in line 205. Limit the number of elements to e.g. 100.

blocks := int64(userBlockCount)
maxBlockCount := int64(b.cfg.JSONRPC.FeeHistoryCap)

blocks := int64(userBlockCount) // #nosec G115 -- checked for int overflow already

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contrary to the comment, the value is not checked if it can overflow.

The value can be set larger than what fits into int64 -> overflows to negative value. As a result, it will panic when creating the slice in line 202

reward := make([][]*hexutil.Big, blocks)

Copy link

@berndartmueller berndartmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In app/app.go#L180:

emissionstypes.UndistributedTSSRewardsPool:      nil

For completeness, add feemarkettypes.ModuleName: nil

In app/app.go#L189:

govtypes.ModuleName:            true,

Add evmtypes.ModuleName and feemarkettypes.ModuleName to blockedReceivingModAcc. No direct implications, but still good to have.

In app/modules.goL#247:

evmtypes.ModuleName,

According to the Cosmos EVM docs (https://evm.cosmos.network/integrate), this should be before feemarkettypes.ModuleName in orderEndBlockers. Cannot find an impact, though.

options.AccountKeeper,
options.FeeMarketKeeper,
options.EvmKeeper,
options.MaxTxGasWanted,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it does not use the value of srvflags.EVMMaxTxGasWanted, instead it resolves to TransactionGasLimit uint64 = 10_000_000

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was intentional it seems https://github.com/zeta-chain/node/pull/3344/files so we can keep it like this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, gotcha!

feemarket.NewAppModule(app.FeeMarketKeeper, feeSs),
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs),
feemarket.NewAppModule(app.FeeMarketKeeper),
vm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.AccountKeeper.AddressCodec()),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that the erc20 module is not added here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not added because we are not using erc20 module atm directly, just as part of evm keeper constructor, but do you think it should be added regardless?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, no need to add it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADMIN_UPGRADE_TESTS Run make start-upgrade-test-admin breaking:cli MERGE_FAILED Merge Queue CI failed nosec SOLANA_TESTS Run make start-solana-test SUI_TESTS Run make start-sui-tests TON_TESTS Runs TON E2E tests UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light UPGRADE_TESTS Run make start-upgrade-tests

Projects

None yet

5 participants