Skip to content

fix(eip712): Fix cyclic message types handling#4650

Merged
sergei-boiko-trustwallet merged 2 commits intomasterfrom
fix/eip712-cyclic-dependencies
Feb 12, 2026
Merged

fix(eip712): Fix cyclic message types handling#4650
sergei-boiko-trustwallet merged 2 commits intomasterfrom
fix/eip712-cyclic-dependencies

Conversation

@sergei-boiko-trustwallet
Copy link
Copy Markdown
Contributor

This pull request improves the handling of custom type dependencies in the EIP-712 message encoding logic, specifically to correctly handle cyclic dependencies between types. It also updates the test coverage to ensure cycles are handled without causing infinite loops.

Dependency resolution fix:

  • Fixed the logic in the encode_custom_type module to correctly detect and process custom type dependencies, ensuring that cyclic dependencies (such as between Person and Mail) do not cause infinite loops.

Test improvements:

  • Updated the test_build_dependencies test to include a custom types definition with an intentional cyclic dependency between Person and Mail, verifying that the dependency builder can handle cycles safely.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes EIP-712 custom type dependency resolution so cyclic type graphs don’t cause infinite traversal when building dependencies for type encoding.

Changes:

  • Fix dependency traversal condition to only enqueue unseen custom types (prevents cycles from re-queuing already-seen types).
  • Extend test_build_dependencies custom types to include a PersonMail cycle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 10, 2026

Binary size comparison

➡️ aarch64-apple-ios: 14.34 MB

➡️ aarch64-apple-ios-sim: 14.34 MB

➡️ aarch64-linux-android: 18.77 MB

➡️ armv7-linux-androideabi: 16.20 MB

➡️ wasm32-unknown-emscripten: 13.68 MB

@sergei-boiko-trustwallet sergei-boiko-trustwallet merged commit beae57f into master Feb 12, 2026
15 checks passed
@sergei-boiko-trustwallet sergei-boiko-trustwallet deleted the fix/eip712-cyclic-dependencies branch February 12, 2026 11:43
perpetua-engineering pushed a commit to perpetua-engineering/wallet-core that referenced this pull request Feb 13, 2026
* fix(eip712): Fix cyclic message types handling

* fix(eip712): Add an extra test
perpetua-engineering pushed a commit to perpetua-engineering/wallet-core that referenced this pull request Feb 25, 2026
* fix(eip712): Fix cyclic message types handling

* fix(eip712): Add an extra test
perpetua-engineering pushed a commit to perpetua-engineering/wallet-core that referenced this pull request Mar 2, 2026
* fix(eip712): Fix cyclic message types handling

* fix(eip712): Add an extra test
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