Skip to content

feat(ethrpc): Add idempotencyKey support to ERC20 TransferFrom#174

Merged
dhyaniarun1993 merged 5 commits intomainfrom
arun/feat/erc20-idempotency-key
Apr 2, 2026
Merged

feat(ethrpc): Add idempotencyKey support to ERC20 TransferFrom#174
dhyaniarun1993 merged 5 commits intomainfrom
arun/feat/erc20-idempotency-key

Conversation

@dhyaniarun1993
Copy link
Copy Markdown
Member

@dhyaniarun1993 dhyaniarun1993 commented Mar 31, 2026

Description

This PR introduces an idempotencyKey parameter to the ERC20 TransferFrom method and its implementation. This is the first step toward supporting an intent-based mempool and miner architecture for EthRPC. The idempotencyKey will be used to uniquely identify and track transfer intents, enabling safe retries and reconciliation between Canton ledger state and synthetic EVM state.

  • Adds idempotencyKey to ERC20 interface and implementation.
  • Prepares the codebase for future mempool and miner logic.
  • Lays the foundation for eventual consistency and robust transaction tracking.

This change is backward-compatible(internal service) and does not alter existing transfer semantics, but is required for the upcoming mempool and miner features.

@dhyaniarun1993 dhyaniarun1993 self-assigned this Mar 31, 2026
@dhyaniarun1993 dhyaniarun1993 added the Type: Feature Added to issues and PRs to identify that the change is a new feature. label Mar 31, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces idempotency support for token transfers by adding an idempotency key (or command ID) to the Token and ERC20 interfaces and their respective implementations. The Ethereum RPC service now utilizes the transaction hash as the idempotency key for these operations. Review feedback suggests ensuring robustness by generating a UUID if the command ID is empty to prevent gRPC failures, addressing potential idempotency issues caused by non-deterministic timestamps in command arguments, and noting that the interface modifications constitute breaking changes for external consumers.

@dhyaniarun1993
Copy link
Copy Markdown
Member Author

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements idempotent token transfers by introducing an idempotencyKey parameter across the Token and ERC20 interfaces, which is mapped to the Canton CommandId. The ethService now uses the Ethereum transaction hash as this key. Review feedback highlights a backward compatibility issue where the new mandatory check for the idempotencyKey would break existing callers; it is recommended to generate a random UUID if the key is missing and update the documentation accordingly.

@salindne salindne self-requested a review March 31, 2026 19:20
@dhyaniarun1993 dhyaniarun1993 merged commit b427b58 into main Apr 2, 2026
2 checks passed
@dhyaniarun1993 dhyaniarun1993 deleted the arun/feat/erc20-idempotency-key branch April 2, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature Added to issues and PRs to identify that the change is a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants