Skip to content

Conversation

@XinyuCRO
Copy link
Contributor

@XinyuCRO XinyuCRO commented Dec 12, 2025

ethermint PR: crypto-org-chain/ethermint#804

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

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 an option to allow unprotected (non-EIP-155) transactions via JSON-RPC.
  • Tests

    • Added integration tests verifying unprotected transactions are accepted when enabled.
    • Added a test marker and fixtures to support EVM-related integration tests.
  • Chores

    • Updated module references and build metadata.
    • Added test configuration and helper utilities to support the new behavior.

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

@XinyuCRO XinyuCRO requested a review from a team as a code owner December 12, 2025 07:26
@XinyuCRO XinyuCRO requested review from JayT106 and randy-cro and removed request for a team December 12, 2025 07:26
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

Adds JSON-RPC support for AllowUnprotectedTxs via a changelog entry and test config, updates the Ethermint module pin/hash, adds an integration test and fixture to verify unprotected tx replay, registers an evm pytest marker, and refactors test funding helpers.

Changes

Cohort / File(s) Change Summary
Dependency updates
go.mod, gomod2nix.toml
Updated Ethermint replacement pin to v0.22.1-0.20251215023157-2a810952cdc4 in go.mod and updated corresponding sha256 entry in gomod2nix.toml.
Changelog
CHANGELOG.md
Added an UNRELEASED entry referencing PR #1934 describing the addition of the AllowUnprotectedTxs JSON-RPC configuration option.
Test configuration
integration_tests/configs/allow-unprotected-txs.jsonnet
New Jsonnet config enabling allow_unprotected_txs in app JSON-RPC settings and EVM genesis params; sets no_base_fee/base_fee for the replay-tx fixture.
Test harness
integration_tests/conftest.py
Registered a new pytest marker for evm module tests.
Integration tests
integration_tests/test_basic.py
Added module-scoped fixture cronos_allow_unprotected_txs (node started with allow-unprotected config) and test test_replay_tx_allowed_when_unprotected_enabled that submits a raw unprotected tx and asserts success.
Test utilities
integration_tests/utils.py
Added fund_address(w3, addr, fund) helper and updated fund_acc(w3, acc, fund) to call fund_address for reuse.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect dependency pin/hash changes in go.mod and gomod2nix.toml for consistency.
  • Review allow-unprotected-txs.jsonnet keys/paths for app-config and genesis EVM params.
  • Verify test fixture starts node with the intended config (allow-unprotected, base-fee disabled).
  • Check the raw transaction used in the test and its assertions.
  • Confirm fund_address behavior and its usage in tests.

Suggested labels

cronos

Suggested reviewers

  • JayT106
  • calvinaco

Poem

🐇 I hopped through lines with whiskers bright,
Enabled unprotected txs by lantern-light,
A config here, a test to play,
Ethermint bumped — I danced away! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 accurately describes the main change: adding an AllowUnprotectedTxs configuration option to JSON-RPC settings, which is confirmed by CHANGELOG.md entry and the new configuration/test files.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch xyz/fix/allow-unprotected-txs

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d96a252 and fd850a6.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod (1 hunks)
  • gomod2nix.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • go.mod
  • gomod2nix.toml
⏰ 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). (19)
  • GitHub Check: integration_tests (ibc)
  • GitHub Check: integration_tests (mint)
  • GitHub Check: integration_tests (evm)
  • GitHub Check: integration_tests (gov)
  • GitHub Check: integration_tests (gas)
  • GitHub Check: integration_tests (upgrade)
  • GitHub Check: integration_tests (ica)
  • GitHub Check: integration_tests (slow)
  • GitHub Check: integration_tests (ibc_rly_evm)
  • GitHub Check: integration_tests (unmarked)
  • GitHub Check: integration_tests (ibc_timeout)
  • GitHub Check: integration_tests (ibc_rly_gas)
  • GitHub Check: integration_tests (ibc_update_client)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: gomod2nix
  • GitHub Check: Run golangci-lint
  • GitHub Check: semgrep-cloud-platform/scan

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.

@socket-security
Copy link

socket-security bot commented Dec 12, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​crypto-org-chain/​ethermint@​v0.22.1-0.20251208051817-9f5d1db3246d ⏵ v0.22.1-0.20251215023157-2a810952cdc475 +110010010070

View full report

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 (3)
CHANGELOG.md (1)

10-10: Consider calling out security implications in the changelog entry (opt-in; replay-risk tradeoff).
Since “allow unprotected txs” materially weakens replay protection guarantees, a short note that it’s opt-in and should be enabled only for specific compatibility/testing scenarios would help operators.

integration_tests/utils.py (1)

861-870: func_address funding assertion is brittle; consider “top-up” semantics and >= checks.
Current behavior won’t top up partially-funded accounts and assumes post-state is exactly fund. If these tests ever reuse addresses or run against environments that pre-fund accounts, it may flake.

 def func_address(w3, addr, fund=3000000000000000000):
-    if w3.eth.get_balance(addr, "latest") == 0:
+    bal = w3.eth.get_balance(addr, "latest")
+    if bal < fund:
         tx = {"to": addr, "value": fund, "gasPrice": w3.eth.gas_price}
-        send_transaction(w3, tx)
-        assert w3.eth.get_balance(addr, "latest") == fund
+        # send only the delta to reach `fund`
+        tx["value"] = fund - bal
+        send_transaction(w3, tx)
+        assert w3.eth.get_balance(addr, "latest") >= fund
integration_tests/test_basic.py (1)

995-1005: Fixed base port (27100) can cause test collisions in parallel runs; prefer dynamically allocated ports.
If CI shards/xdist runs modules in parallel, a hard-coded port is a common flake source. Consider deriving from worker_id/env (or reuse existing port allocation helpers if present).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63b6a38 and e520241.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • CHANGELOG.md (1 hunks)
  • go.mod (1 hunks)
  • gomod2nix.toml (1 hunks)
  • integration_tests/configs/allow-unprotected-txs.jsonnet (1 hunks)
  • integration_tests/conftest.py (1 hunks)
  • integration_tests/test_basic.py (2 hunks)
  • integration_tests/utils.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
integration_tests/test_basic.py (2)
integration_tests/utils.py (1)
  • func_address (861-865)
integration_tests/network.py (2)
  • setup_custom_cronos (155-197)
  • w3 (39-42)
⏰ 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). (19)
  • GitHub Check: gomod2nix
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-14)
  • GitHub Check: unittest
  • GitHub Check: integration_tests (evm)
  • GitHub Check: integration_tests (ibc_rly_gas)
  • GitHub Check: integration_tests (ibc_timeout)
  • GitHub Check: integration_tests (upgrade)
  • GitHub Check: integration_tests (slow)
  • GitHub Check: integration_tests (ibc)
  • GitHub Check: integration_tests (unmarked)
  • GitHub Check: integration_tests (ibc_rly_evm)
  • GitHub Check: integration_tests (gov)
  • GitHub Check: integration_tests (mint)
  • GitHub Check: integration_tests (gas)
  • GitHub Check: integration_tests (ica)
  • GitHub Check: integration_tests (ibc_update_client)
  • GitHub Check: Run golangci-lint
🔇 Additional comments (5)
integration_tests/conftest.py (1)

13-28: LGTM: marker registration for evm is the right way to avoid pytest warnings.

integration_tests/test_basic.py (1)

1007-1028: Nice coverage: validates unprotected-tx acceptance end-to-end; consider asserting the failure mode when disabled too.
You already have test_replay_protection for the rejection case; this complements it well. Only suggestion: also assert receipt["from"]/sender matches expected to avoid a false positive if the fixture file changes.

gomod2nix.toml (1)

326-329: Nix pin and go.mod are in lockstep for ethermint. Both files reference the same version (v0.22.1-0.20251212064215-b7d7f71a9cc0) and replacement target (github.com/crypto-org-chain/ethermint). The pseudo-version and commit hash b7d7f71a9cc0 are consistent.

go.mod (1)

306-306: Ethermint bump migrates AllowUnprotectedTxs from global param to per-node RPC configuration.

This dependency bump implements the intended feature: the allow_unprotected_txs parameter has moved from a global VM module setting to explicit per-node RPC configuration. By default, Ethermint rejects non-EIP-155 transactions; operators must explicitly enable the node RPC option to permit them. No unintended consensus or tx-validation changes were introduced—only the intentional parameter migration.

integration_tests/configs/allow-unprotected-txs.jsonnet (1)

1-29: Verify the json-rpc config key is actually consumed by Ethermint.

The allow-unprotected-txs key in app-config follows the jsonnet hyphenated naming convention (consistent with other json-rpc keys in default.jsonnet), and the genesis-level allow_unprotected_txs field correctly matches the proto definition. However, no references to this config key exist in the Cronos codebase itself—it's read upstream by Ethermint's JSON-RPC server initialization. Confirm with Ethermint that allow-unprotected-txs (hyphenated) is the expected viper config key; if not, the effective config will silently ignore this setting despite the jsonnet merge succeeding.

Copy link
Collaborator

@thomas-nguy thomas-nguy left a comment

Choose a reason for hiding this comment

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

Perhaps add it to the release/v1.6.x branch as well to release it on testnet

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.

4 participants