Skip to content

Conversation

@songgaoye
Copy link
Contributor

@songgaoye songgaoye commented Jan 19, 2026

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

--cronos.disable-tx-replacement broken - Flag doesn't disable replacement in mempool

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features

    • Added a configuration option to disable transaction replacement in the mempool.
  • Behavior

    • Mempool now respects and logs the disable setting, preserving or enabling replacement accordingly.
  • Tests

    • Added test coverage to confirm the disable option prevents transaction replacement.
  • Documentation

    • Changelog updated with the new improvement.

✏️ Tip: You can customize this high-level summary in your review settings.

@songgaoye songgaoye requested a review from a team as a code owner January 19, 2026 10:17
@songgaoye songgaoye requested review from XinyuCRO and thomas-nguy and removed request for a team January 19, 2026 10:17
@github-actions

This comment has been minimized.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Important

Review skipped

Draft detected.

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

Adds an AppOption to disable mempool transaction replacement and conditions mempool initialization to omit the TxReplacement rule when the flag is set; a unit test verifies the TxReplacement field is nil when disabled.

Changes

Cohort / File(s) Summary
Mempool config & initialization
app/app.go
Adds disableTxReplacement via FlagDisableTxReplacement; builds a local PriorityNonceMempoolConfig, logs mempool settings when applicable, and sets cfg.TxReplacement only when the flag is false.
Tests
app/mempool_test.go
New test TestDisableTxReplacementRemovesMempoolRule and helper loadUnexportedField; creates an in-memory app with DisableTxReplacement=true, reflects into the priority nonce mempool config, and asserts TxReplacement is nil.
Changelog
CHANGELOG.md
Adds UNRELEASED entry noting the new option to disable mempool TxReplacement (PR #1960).

Sequence Diagram(s)

(Skipped — changes are localized configuration/control-flow without multi-component sequential interactions needing visualization.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • thomas-nguy
  • XinyuCRO
  • mmsqe

Poem

🐰 I twitched my whiskers, flipped a tiny flag,

"No swap today," I said — the mempool skips a jag.
Tests hop in circles, searching hidden fields,
Logs whisper settings, tidy as my shields.
A carrot for the merge, a joyful little brag. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: disabling TxReplacement in mempool when a specific flag is set, which matches the core functionality introduced across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@songgaoye songgaoye changed the title fix(mempool): disable TxReplacement in mempool when FlagDisableTxReplacement set fix: disable TxReplacement in mempool when FlagDisableTxReplacement set Jan 19, 2026
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: 1

🤖 Fix all issues with AI agents
In `@app/mempool_test.go`:
- Around line 22-24: Remove the misplaced t.Helper() call from the test function
TestDisableTxReplacementRemovesMempoolRule; t.Helper() should only be used
inside helper functions (e.g., loadUnexportedField), so delete the t.Helper()
invocation in that test and ensure any shared helper logic that needs t.Helper()
is placed in the helper function instead.
🧹 Nitpick comments (2)
app/app.go (1)

993-996: Consider reusing the disableTxReplacement variable.

The flag FlagDisableTxReplacement is read again from appOpts here, but it was already read into disableTxReplacement at line 387. Reusing the variable would be cleaner and ensure consistency.

♻️ Suggested refactor
-	mempoolCacheMaxTxs := mempoolMaxTxs
-	if cast.ToBool(appOpts.Get(FlagDisableTxReplacement)) {
+	mempoolCacheMaxTxs := mempoolMaxTxs
+	if disableTxReplacement {
 		mempoolCacheMaxTxs = -1
 	}
app/mempool_test.go (1)

19-19: Consider renaming the import alias to avoid shadowing the package name.

The import app "github.com/evmos/ethermint/evmd" uses the alias app, which shadows the current package name. This could cause confusion when reading the code.

♻️ Suggested refactor
-	app "github.com/evmos/ethermint/evmd"
+	evmd "github.com/evmos/ethermint/evmd"

Then update line 27:

-		flags.FlagHome:            app.DefaultNodeHome,
+		flags.FlagHome:            evmd.DefaultNodeHome,

@thomas-nguy
Copy link
Collaborator

thomas-nguy commented Jan 20, 2026

Sorry for the confusion

TxReplacement is enabled by

This PR disable the AnteCache in case the flag is set to true
https://github.com/crypto-org-chain/cronos/pull/1906/files#diff-0f1d2976054440336a576d47a44a37b80cdf6701dd9113012bce0e3c425819b7R986

If AnteCache is disable then TxReplacement is not possible because the ante handler enforces tx to be send in order

@songgaoye songgaoye marked this pull request as draft January 20, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants