Skip to content

Conversation

@LesnyRumcajs
Copy link
Member

@LesnyRumcajs LesnyRumcajs commented Nov 6, 2025

Summary of changes

Changes introduced in this pull request:

		// The field should be "input" by spec, but many clients use "data" so we support
		// both, but prefer "input".

JSON-RPC strictness at its finest.

Reference issue to close (if applicable)

Part of #6214. It still doesn't work, but there seem to be issues in the mempool, to be resolved in a separate PR.

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Summary by CodeRabbit

  • New Features
    • RPC methods eth_call and eth_estimateGas now accept "input" as an alternative parameter name in addition to "data" for improved compatibility.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

This pull request adds support for input as an alternative field name for data in the EthCallMessage struct via a serde alias, enabling RPC clients to use either field name. A changelog entry documents this addition.

Changes

Cohort / File(s) Summary
Changelog update
CHANGELOG.md
Added entry documenting support for input as an alias for data in eth_call and eth_estimateGas RPC methods (PR #6234)
Serde alias addition
src/rpc/methods/eth/types.rs
Added serde alias to EthCallMessage.data field to accept both "input" and "data" during deserialization; added inline comment explaining the rationale; public API signature remains unchanged

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 'fix: support input as param in eth_call' directly and specifically describes the main change: adding support for the 'input' parameter in the eth_call RPC method, which aligns with the changeset modifications in eth/types.rs and CHANGELOG updates.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-invalid-name-eth-call

📜 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 d63f67e and 124bcc8.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • src/rpc/methods/eth/types.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: LesnyRumcajs
Repo: ChainSafe/forest PR: 5907
File: src/rpc/methods/state.rs:523-570
Timestamp: 2025-08-06T15:44:33.467Z
Learning: LesnyRumcajs prefers to rely on BufWriter's Drop implementation for automatic flushing rather than explicit flush() calls in Forest codebase.
⏰ 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). (7)
  • GitHub Check: Build Ubuntu
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
🔇 Additional comments (2)
CHANGELOG.md (1)

58-59: LGTM! Clear changelog entry.

The changelog entry accurately documents the change and follows the established format.

src/rpc/methods/eth/types.rs (1)

317-319: LGTM! Clean implementation of field alias for interoperability.

The addition of the alias = "input" attribute correctly allows deserialization from either "input" or "data" field names while maintaining backward compatibility by keeping "data" as the serialization key. The comment clearly explains the rationale.

Please verify that there is test coverage for the new alias. Consider adding a test that deserializes an EthCallMessage with the "input" field to ensure the alias works as expected:

#[test]
fn test_eth_call_message_input_alias() {
    // Test deserialization with "input" field
    let json_with_input = r#"{"to":"0x1234567890123456789012345678901234567890","input":"0x1234"}"#;
    let msg: EthCallMessage = serde_json::from_str(json_with_input).unwrap();
    assert!(msg.data.is_some());
    
    // Test deserialization with "data" field still works
    let json_with_data = r#"{"to":"0x1234567890123456789012345678901234567890","data":"0x1234"}"#;
    let msg: EthCallMessage = serde_json::from_str(json_with_data).unwrap();
    assert!(msg.data.is_some());
}

Also confirm that eth_estimateGas mentioned in the changelog uses the same EthCallMessage struct.


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

@LesnyRumcajs LesnyRumcajs force-pushed the fix-invalid-name-eth-call branch from 566442a to 124bcc8 Compare November 6, 2025 10:42
@LesnyRumcajs LesnyRumcajs marked this pull request as ready for review November 6, 2025 10:44
@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner November 6, 2025 10:44
@LesnyRumcajs LesnyRumcajs requested review from akaladarshi and hanabi1224 and removed request for a team November 6, 2025 10:44
@LesnyRumcajs LesnyRumcajs added the RPC requires calibnet RPC checks to run on CI label Nov 6, 2025
@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit 90e0e2a Nov 6, 2025
57 of 81 checks passed
@LesnyRumcajs LesnyRumcajs deleted the fix-invalid-name-eth-call branch November 6, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants