Skip to content

Reject interoperable addresses whith both chain reference and addresses empty#6331

Merged
Amxx merged 4 commits intoOpenZeppelin:masterfrom
Amxx:fix/erc7930/reject-empty-reference-and-addresse
Feb 12, 2026
Merged

Reject interoperable addresses whith both chain reference and addresses empty#6331
Amxx merged 4 commits intoOpenZeppelin:masterfrom
Amxx:fix/erc7930/reject-empty-reference-and-addresse

Conversation

@Amxx
Copy link
Collaborator

@Amxx Amxx commented Feb 6, 2026

Fixes L-06

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@Amxx Amxx added this to the 5.6 milestone Feb 6, 2026
@Amxx Amxx requested a review from a team as a code owner February 6, 2026 14:25
@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

🦋 Changeset detected

Latest commit: 0e591ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Walkthrough

The changes modify the InteroperableAddress contract to validate that inputs are rejected when both chain reference and addresses are empty. The parsing logic in tryParseV1 and tryParseV1Calldata functions is updated so that success is now determined by whether chainReferenceLength or addrLength are non-zero, rather than being unconditionally true. The chainType field is conditionally read only when success is true. Corresponding test vectors are updated to reflect these parsing changes, including a new test case for the empty chain reference and address scenario. A changeset file is added to document the minor release.

Suggested labels

breaking change

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: rejecting interoperable addresses when both chain reference and addresses are empty, which aligns with the code modifications in the changeset.
Description check ✅ Passed The description references 'Fixes L-06' and indicates the PR aims to reject interoperable addresses with empty chain reference and addresses, which relates directly to the changeset modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

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 `@test/utils/draft-InteroperableAddress.test.js`:
- Around line 119-125: Fix the typo in the test case description: change "empry
chain reference and address" to "empty chain reference and address" in the test
mapping (the key/value pair where the address string is '0x000100420000') so the
test description reads correctly.

'unsupported version': '0x00020000010100',
// version + ref: missing chainReferenceLength and addressLength
'too short (case 1)': '0x00010000',
'too short (case 1)': '0x00010042',
Copy link
Member

Choose a reason for hiding this comment

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

I don't get why we're changing this test case. With the new code, this is rejected because both chainReferenceLength and addrLength are zero. So the old test still passes: parseV1 reverts and tryParseV1 returns false.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The current test uses an (invalid) interroperable address with a chainType = 0. When we look at the output of the tryParse, and we see success = false, chainType = 0, we have no way to know if the chain type was parsed (and contains a zero) or if it was not parsed, because the error was detected.

That is why I think we should use a non zero chaintype to make a clear distinction.

@@ -116,11 +116,13 @@ describe('ERC7390', function () {
// version 2 + some data
'unsupported version': '0x00020000010100',
// version + ref: missing chainReferenceLength and addressLength
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// version + ref: missing chainReferenceLength and addressLength
// version + ref: missing chainReferenceLength and address buffer shorter than its declared length

Copy link
Collaborator Author

@Amxx Amxx Feb 11, 2026

Choose a reason for hiding this comment

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

In this case there is not address length.

0x00010042....
  ^^^^         version
      ^^^^     chain type
          ^^   expected location of the chainReferenceLength
            ^^ expected location of the addressLength (if the chainReferenceLength was zero)

There is no chainReferenceLength, and no addressLength. We are not even looking into the chain reference and address buffer

'too short (case 1)': '0x00010042',
// version + ref + chainReference: missing addressLength
'too short (case 2)': '0x000100000101',
'too short (case 2)': '0x000100420101',
Copy link
Member

Choose a reason for hiding this comment

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

Also the old test here was fine

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same answer :)

'too short (case 2)': '0x000100420101',
// version + ref + chainReference + addressLength + part of the address: missing 2 bytes of the address
'too short (case 3)': '0x00010000010114d8da6bf26964af9d7eed9e03e53415d37aa9',
'too short (case 3)': '0x00010042010114d8da6bf26964af9d7eed9e03e53415d37aa9',
Copy link
Member

Choose a reason for hiding this comment

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

Same

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same answer :)

@Amxx Amxx merged commit 766e7bc into OpenZeppelin:master Feb 12, 2026
21 checks passed
@Amxx Amxx deleted the fix/erc7930/reject-empty-reference-and-addresse branch February 12, 2026 15:15
Amxx added a commit that referenced this pull request Feb 12, 2026
…es empty (#6331)

Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
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