Skip to content

Conversation

@prestoalvarez
Copy link

Description:

  • Route the three formatEvmV1 overloads through formatV1 to keep encoding logic in one place.
  • Reduce duplication so future format tweaks only touch the shared implementation.

@prestoalvarez prestoalvarez requested a review from a team as a code owner November 1, 2025 16:06
@changeset-bot
Copy link

changeset-bot bot commented Nov 1, 2025

⚠️ No Changeset found

Latest commit: 693b743

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Walkthrough

Three EVM V1 formatting helper functions in contracts/utils/draft-InteroperableAddress.sol are refactored to delegate to a centralized formatV1 function. Each formatEvmV1 variant now calls formatV1 with a zeroed chainType parameter and corresponding payloads, replacing manual abi.encodePacked constructions. The encoding logic is consolidated in formatV1 while the helpers specify parameters appropriate to their respective use cases.

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
Title Check ✅ Passed The PR title "Refactor ERC‑7930 EVM format helpers to reuse shared encoder" accurately captures the main objective of the changeset. It clearly identifies the specific files being modified (ERC‑7930 EVM format helpers), describes the action being taken (refactor), and explains the purpose (reuse shared encoder). The title is concise, specific, and directly related to the actual changes shown in the summary where three formatEvmV1 overloads are reworked to delegate to formatV1.
Description Check ✅ Passed The PR description is clearly related to the changeset and provides meaningful context. It specifically mentions routing the three formatEvmV1 overloads through formatV1 to centralize encoding logic and reduce duplication, which directly aligns with the changes described in the raw summary. The description explains both what is being changed and why, demonstrating a good understanding of the refactoring's purpose.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 8631702 and 693b743.

📒 Files selected for processing (1)
  • contracts/utils/draft-InteroperableAddress.sol (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-03T13:14:57.679Z
Learnt from: Amxx
Repo: OpenZeppelin/openzeppelin-contracts PR: 5914
File: contracts/crosschain/bridges/BridgeERC20.sol:57-58
Timestamp: 2025-10-03T13:14:57.679Z
Learning: In cross-chain bridge contracts like BridgeERC20, when processing incoming messages in _processMessage, avoid validation checks that revert on malformed addresses. Reverting would create cross-chain inconsistency where tokens are locked/burned on the source chain but never minted on the destination. Instead, use best-effort address extraction (e.g., address(bytes20(toBinary))) to maintain atomicity across chains. If tokens are minted to an incorrect address due to user error, recovery may be possible through admin controls rather than leaving funds permanently locked.

Applied to files:

  • contracts/utils/draft-InteroperableAddress.sol
⏰ 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). (8)
  • GitHub Check: Redirect rules - solidity-contracts
  • GitHub Check: Header rules - solidity-contracts
  • GitHub Check: slither
  • GitHub Check: halmos
  • GitHub Check: tests-upgradeable
  • GitHub Check: tests-foundry
  • GitHub Check: coverage
  • GitHub Check: tests
🔇 Additional comments (3)
contracts/utils/draft-InteroperableAddress.sol (3)

47-49: LGTM! Clean delegation to shared encoder.

The refactoring correctly delegates to formatV1 with the EIP-155 chainType (0x0000), a computed chain reference, and the packed address. Both parameters are non-empty, satisfying formatV1's requirement.


54-56: LGTM! Correctly encodes chain-only interoperable address.

The refactoring correctly delegates to formatV1 with the EIP-155 chainType, a computed chain reference from the chainid, and an empty address. The chain reference will be non-empty for any valid chainid, satisfying formatV1's requirement.


61-63: LGTM! Correctly encodes address-only interoperable address.

The refactoring correctly delegates to formatV1 with the EIP-155 chainType, an empty chain reference, and the packed address. The packed address is 20 bytes (non-empty), satisfying formatV1's requirement.


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.

@Amxx
Copy link
Collaborator

Amxx commented Nov 3, 2025

While these changes make sens, they also significantly increase the cost of using this function. This woul affect contract such as protocole gateways, the open bridge, and other.

We can see that change affecting the ERC7786GatewayMock
Capture d’écran du 2025-11-03 11-17-56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants