Skip to content

Conversation

@skosito
Copy link
Contributor

@skosito skosito commented Jul 28, 2025

Description

with cosmos 0.53.4 this issue with proposal handler was fixed cosmos/cosmos-sdk#25008 so we dont need to maintain forked code anymore

this also bumps to 0.53.4 including changes from 0.53.3 that we need because of security patch https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.3

closes #2156

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • Refactor

    • Replaced custom mempool and proposal handler logic with standard Cosmos SDK implementations.
    • Introduced a new Ethereum-compatible signer extraction adapter for enhanced transaction compatibility.
    • Streamlined mempool initialization and configuration.
  • Dependency Updates

    • Upgraded several dependencies, including Cosmos SDK and related libraries, for improved stability and compatibility.
  • Chores

    • Removed legacy custom mempool code and associated tests.
    • Updated documentation to reflect recent changes and code cleanup.

@skosito skosito added the UPGRADE_TESTS Run make start-upgrade-tests label Jul 28, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 28, 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 removes the custom priority nonce mempool fork and its related proposal handler, tests, and sender extraction utilities, replacing them with the standard Cosmos SDK priority mempool and a custom Ethereum signer extraction adapter. The application initialization is updated accordingly, and dependencies are bumped to support the new approach.

Changes

Cohort / File(s) Change Summary
Removal of Custom Mempool Implementation and Utilities
pkg/mempool/priority_nonce_mempool.go, pkg/mempool/priority_nonce_mempool_test.go, pkg/mempool/custom_proposal_handler.go, pkg/mempool/custom_proposal_handler_test.go, pkg/mempool/mempool_test.go, pkg/mempool/senders_with_nonce.go
Deleted custom priority nonce mempool implementation, sender extraction utilities, custom proposal handler, and all related tests.
App Initialization and Integration
cmd/zetacored/root.go, app/app.go
Replaced custom mempool setup with Cosmos SDK's priority mempool; integrated a custom Ethereum signer extraction adapter; removed references to deleted custom components.
Signer Extraction Adapter
app/signer.go
Introduced EthSignerExtractionAdapter to handle Ethereum transaction signer extraction, delegating to fallback for non-Ethereum cases.
Dependency Management
go.mod
Upgraded Cosmos SDK and related dependencies to versions supporting custom signer extractors.
Documentation
changelog.md
Added changelog entry noting the cleanup of forked mempool code.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant SDKMempool
    participant EthSignerAdapter
    participant DefaultSignerAdapter

    App->>SDKMempool: Initialize PriorityMempool (with EthSignerAdapter)
    App->>EthSignerAdapter: GetSigners(tx)
    alt Ethereum Tx
        EthSignerAdapter->>App: Extract Ethereum sender/nonce
        EthSignerAdapter-->>SDKMempool: Return Ethereum signer(s)
    else Non-Ethereum Tx
        EthSignerAdapter->>DefaultSignerAdapter: GetSigners(tx)
        DefaultSignerAdapter-->>EthSignerAdapter: Return default signer(s)
        EthSignerAdapter-->>SDKMempool: Return default signer(s)
    end
    App->>SDKMempool: Set as mempool in BaseApp
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove priority nonce mempool fork and use Cosmos SDK's built-in functionality (#2156)
Remove code referencing custom signer extractors and proposal handlers (#2156)
Update application to use new Cosmos SDK mempool and signer extraction (#2156)

Assessment against linked issues: Out-of-scope changes

No out-of-scope functional code changes were identified. All modifications directly support the migration away from the custom mempool and adoption of the standard Cosmos SDK mechanisms as specified in the linked issue.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cleanup-mempool-fork

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 marked this pull request as ready for review July 28, 2025 22:05
@skosito skosito requested a review from a team as a code owner July 28, 2025 22:05
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: 0

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

29-29: Fix markdown link formatting.

Remove the space between the PR number and URL to properly format the markdown link.

-* [4060] (https://github.com/zeta-chain/node/pull/4060) - cleanup forked mempool code
+* [4060](https://github.com/zeta-chain/node/pull/4060) - cleanup forked mempool code
app/signer.go (1)

12-14: Incorrect comment - this is a custom implementation, not default.

The comment incorrectly states this is "the default implementation" when it's actually a custom adapter specifically for Ethereum transaction signer extraction.

-// EthSignerExtractionAdapter is the default implementation of SignerExtractionAdapter. It extracts the signers
-// from a cosmos-sdk tx via GetSignaturesV2.
+// EthSignerExtractionAdapter is a custom implementation of SignerExtractionAdapter that extracts signers
+// from Ethereum transactions within Cosmos SDK transactions, falling back to the default extractor for other transaction types.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 854040f and 99aa85b.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (11)
  • app/app.go (0 hunks)
  • app/signer.go (1 hunks)
  • changelog.md (1 hunks)
  • cmd/zetacored/root.go (3 hunks)
  • go.mod (4 hunks)
  • pkg/mempool/custom_proposal_handler.go (0 hunks)
  • pkg/mempool/custom_proposal_handler_test.go (0 hunks)
  • pkg/mempool/mempool_test.go (0 hunks)
  • pkg/mempool/priority_nonce_mempool.go (0 hunks)
  • pkg/mempool/priority_nonce_mempool_test.go (0 hunks)
  • pkg/mempool/senders_with_nonce.go (0 hunks)
💤 Files with no reviewable changes (7)
  • pkg/mempool/senders_with_nonce.go
  • app/app.go
  • pkg/mempool/custom_proposal_handler_test.go
  • pkg/mempool/priority_nonce_mempool.go
  • pkg/mempool/mempool_test.go
  • pkg/mempool/custom_proposal_handler.go
  • pkg/mempool/priority_nonce_mempool_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit Configuration File

Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

Files:

  • app/signer.go
  • cmd/zetacored/root.go
🧠 Learnings (5)
📓 Common learnings
Learnt from: gartnera
PR: zeta-chain/node#3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like `cmd/zetae2e/init.go` in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: skosito
PR: zeta-chain/node#3939
File: go.mod:52-52
Timestamp: 2025-05-30T16:31:30.275Z
Learning: The ethermint dependency updates in the zeta-chain/node repository are typically moves between feature branches and main branch of the same fork, not breaking API changes. CI status should be verified before assuming compilation issues.
Learnt from: gartnera
PR: zeta-chain/node#3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in `zetaclient/orchestrator/orchestrator.go`, avoid suggesting refactoring that is unrelated to the current PR.
Learnt from: gartnera
PR: zeta-chain/node#3228
File: cmd/zetaclientd/start.go:222-231
Timestamp: 2024-11-27T22:02:48.034Z
Learning: In the `zetaclient` codebase, port numbers like `26657` are hardcoded, and changing them to be configurable via the config struct is considered unrelated refactoring.
Learnt from: gartnera
PR: zeta-chain/node#3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: gartnera
PR: zeta-chain/node#3489
File: pkg/chains/chains.go:0-0
Timestamp: 2025-02-06T15:31:32.723Z
Learning: SuiMainnet uses chain ID 105 (temporarily) instead of 101 to avoid collision with ZetaChainPrivnet. This is tracked in issue #3491 for proper resolution.
changelog.md (10)

Learnt from: gartnera
PR: #3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in zetaclient/orchestrator/orchestrator.go, avoid suggesting refactoring that is unrelated to the current PR.

Learnt from: skosito
PR: #3939
File: go.mod:52-52
Timestamp: 2025-05-30T16:31:30.275Z
Learning: The ethermint dependency updates in the zeta-chain/node repository are typically moves between feature branches and main branch of the same fork, not breaking API changes. CI status should be verified before assuming compilation issues.

Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.

Learnt from: gartnera
PR: #3228
File: cmd/zetaclientd/start.go:222-231
Timestamp: 2024-11-27T22:02:48.034Z
Learning: In the zetaclient codebase, port numbers like 26657 are hardcoded, and changing them to be configurable via the config struct is considered unrelated refactoring.

Learnt from: kingpinXD
PR: #3503
File: e2e/runner/require.go:0-0
Timestamp: 2025-02-07T19:33:35.631Z
Learning: In e2e tests for the zeta-chain/node repository, minimize computation and avoid redundant checks that are already covered by unit tests to ensure faster execution. For example, ballot sorting is verified in unit tests, so e2e tests can safely assume the order.

Learnt from: ws4charlie
PR: #4053
File: e2e/e2etests/test_bitcoin_std_deposit.go:42-42
Timestamp: 2025-07-28T18:08:13.883Z
Learning: In Bitcoin deposit E2E tests for the ZetaChain project, DepositBTCWithAmount is preferred over DepositBTCWithExactAmount because depositing exact amounts to a ZEVM receiver is complex. The tests use rough amounts and then calculate the actual received amount from the raw Bitcoin transaction to verify balance changes, making the tests more robust and less flaky.

Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:184-247
Timestamp: 2024-07-05T00:02:31.446Z
Learning: The CreateSignerObserverBTC function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.

Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.

Learnt from: gartnera
PR: #3489
File: pkg/chains/chains.go:0-0
Timestamp: 2025-02-06T15:31:32.723Z
Learning: SuiMainnet uses chain ID 105 (temporarily) instead of 101 to avoid collision with ZetaChainPrivnet. This is tracked in issue #3491 for proper resolution.

Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/orchestrator.go:192-217
Timestamp: 2024-07-04T23:46:38.428Z
Learning: The GetUpdatedSigner method in zetaclient/orchestrator/orchestrator.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go and zetaclient/orchestrator/orchestrator_test.go.

go.mod (5)

Learnt from: gartnera
PR: #2817
File: contrib/rpcimportable/go.mod:1-3
Timestamp: 2024-09-24T18:43:46.232Z
Learning: In this project, minor version differences in Go modules are acceptable and do not require strict consistency.

Learnt from: gartnera
PR: #2817
File: contrib/rpcimportable/go.mod:5-6
Timestamp: 2024-09-24T18:45:32.028Z
Learning: In the contrib/rpcimportable test, the go.mod file should be empty when committed, and the go.sum file should not be committed, as committing go.sum causes the test to fail.

Learnt from: gartnera
PR: #3395
File: .github/workflows/reusable-sim.yml:29-30
Timestamp: 2025-01-22T22:46:58.820Z
Learning: The zeta-chain/node repository uses Go version >= 1.22. Do not suggest downgrading to earlier versions like 1.21.

Learnt from: gartnera
PR: #2934
File: go.mod:343-343
Timestamp: 2024-09-30T14:26:21.719Z
Learning: Importing different major versions is allowed in Go.

Learnt from: gartnera
PR: #3105
File: cmd/zetae2e/local/bitcoin.go:8-8
Timestamp: 2024-11-06T21:11:34.420Z
Learning: In the e2e codebase, it's acceptable to use github.com/stretchr/testify/require outside of test files.

app/signer.go (5)

Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.

Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The CreateSignerObserverEVM function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.

Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/orchestrator.go:192-217
Timestamp: 2024-07-04T23:46:38.428Z
Learning: The GetUpdatedSigner method in zetaclient/orchestrator/orchestrator.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go and zetaclient/orchestrator/orchestrator_test.go.

Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:184-247
Timestamp: 2024-07-05T00:02:31.446Z
Learning: The CreateSignerObserverBTC function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.

Learnt from: gartnera
PR: #3485
File: e2e/utils/sui/signer.go:24-35
Timestamp: 2025-02-06T16:29:58.925Z
Learning: The Sui blockchain requires signatures in [R || S || V] format, which is best generated using go-ethereum's crypto.Sign function that takes an ecdsa.PrivateKey.

cmd/zetacored/root.go (9)

Learnt from: gartnera
PR: #3228
File: cmd/zetaclientd/start.go:222-231
Timestamp: 2024-11-27T22:02:48.034Z
Learning: In the zetaclient codebase, port numbers like 26657 are hardcoded, and changing them to be configurable via the config struct is considered unrelated refactoring.

Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.

Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec.go:55-64
Timestamp: 2024-10-10T18:18:17.785Z
Learning: In the pkg/memo package, the functions NewCodecABI and NewCodecCompact are defined and accessible within the package scope, eliminating the need for explicit import statements in this file.

Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.

Learnt from: gartnera
PR: #2817
File: pkg/sdkconfig/sdkconfig.go:29-36
Timestamp: 2024-09-24T18:45:45.448Z
Learning: In pkg/sdkconfig/sdkconfig.go, the current implementation of the Set and SetDefault functions is intentional, and further refactoring is unnecessary.

Learnt from: gartnera
PR: #3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in zetaclient/orchestrator/orchestrator.go, avoid suggesting refactoring that is unrelated to the current PR.

Learnt from: gartnera
PR: #3077
File: cmd/zetae2e/local/local.go:188-191
Timestamp: 2024-10-31T21:15:55.881Z
Learning: In Go file cmd/zetae2e/local/local.go, the network is fully functional before calling FundEmissionsPool(), so retry logic is unnecessary.

Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.

Learnt from: gartnera
PR: #3395
File: .github/workflows/reusable-sim.yml:29-30
Timestamp: 2025-01-22T22:46:58.820Z
Learning: The zeta-chain/node repository uses Go version >= 1.22. Do not suggest downgrading to earlier versions like 1.21.

🪛 markdownlint-cli2 (0.17.2)
changelog.md

29-29: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: start-upgrade-test / e2e
🔇 Additional comments (3)
go.mod (1)

20-20: Dependency updates align with PR objectives.

The Cosmos SDK upgrade to v0.53.4 successfully incorporates the security patches mentioned in the PR description. The accompanying dependency updates for spf13/cast, spf13/pflag, and sigs.k8s.io/yaml are appropriate transitive updates that maintain compatibility.

Also applies to: 49-52, 298-298, 345-345

app/signer.go (1)

10-43: Well-structured Ethereum signer extraction implementation.

The adapter correctly identifies Ethereum transactions by checking for the specific extension type and extracts the signer data appropriately. The fallback mechanism ensures compatibility with standard Cosmos SDK transactions.

cmd/zetacored/root.go (1)

281-308: Successful migration to standard SDK mempool implementation.

The refactoring correctly replaces the custom mempool with the standard Cosmos SDK priority mempool while maintaining Ethereum transaction support through the custom signer extraction adapter. The explicit proposal handler setup ensures proper transaction processing in the consensus layer.

@skosito skosito enabled auto-merge July 29, 2025 20:04
@skosito skosito added this pull request to the merge queue Jul 29, 2025
Merged via the queue into develop with commit 1a75053 Jul 29, 2025
66 of 68 checks passed
@skosito skosito deleted the cleanup-mempool-fork branch July 29, 2025 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking:cli UPGRADE_TESTS Run make start-upgrade-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove priority nonce mempool fork once cosmos is upgraded

5 participants