Skip to content

Conversation

@krishanu717
Copy link

@krishanu717 krishanu717 commented Nov 8, 2025

This fixes an issue where SafeFactory.deploySafe() would incorrectly throw 'SafeProxy was not deployed correctly' on custom chains due to variations in how different RPC providers format event logs.

  • Added robust event log parsing with multiple fallback mechanisms
  • Added comprehensive test suite for different log formats
  • Handles both v1.0.0 and v1.3.0+ Safe versions
  • Supports logs with missing/null topics
  • Handles case sensitivity in addresses

Fixes #650

What it solves

Resolves #

How this PR fixes it


Note

Strengthens SafeProxy address extraction with topic-based fast path and robust fallbacks; adds e2e tests for multiple versions and malformed logs.

  • Contracts utils (packages/protocol-kit/src/contracts/utils.ts):
    • getSafeAddressFromDeploymentTx:
      • Add topic-based fast-path lookup and ABI decoding for ProxyCreation.
      • Fallback: manual address extraction from log.data (bytes 12–32) with validation, then ABI decode per-log.
      • Early failure on missing/empty logs; final explicit error if no address found.
  • Tests (packages/protocol-kit/tests/e2e/getSafeAddressFromDeploymentTx.test.ts):
    • Add coverage for Safe v1.3.0 and v1.0.0 event formats, missing/null topics, valid data-only logs, and error cases (no logs, null logs, invalid data).

Written by Cursor Bugbot for commit c87953c. This will update automatically on new commits. Configure here.

…obal#650)

This fixes an issue where SafeFactory.deploySafe() would incorrectly throw
'SafeProxy was not deployed correctly' on custom chains due to variations
in how different RPC providers format event logs.

- Added robust event log parsing with multiple fallback mechanisms
- Added comprehensive test suite for different log formats
- Handles both v1.0.0 and v1.3.0+ Safe versions
- Supports logs with missing/null topics
- Handles case sensitivity in addresses

Fixes safe-global#650
@github-actions
Copy link

github-actions bot commented Nov 8, 2025

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

if (args && args.length) return args[0] as string
}
} catch (e) {
console.log('Fast path failed:', e)
Copy link

Choose a reason for hiding this comment

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

Bug: Debug Output Polluting Production Console

A console.log statement was left in the production code that logs error details when the fast path for event parsing fails. This debugging code pollutes console output in production environments and should be removed or replaced with proper error handling.

Fix in Cursor Fix in Web

Copy link
Author

🤖 AUTOMATED NOTICE — Action Required

This PR fixes #650 (SafeFactory failing to detect ProxyCreation on some custom RPCs). Relevant tests covering this change passed locally (protocol-kit tests: 48 passing). However, the CLA Assistant check is blocking merge because one or more committers have not signed the Contributor License Agreement (CLA).

What to do (quick):

  1. If you committed to this branch, open the PR → Checks → CLA Assistant and click the Sign link (cla-assistant.io) while logged into your GitHub account.
  2. If your commits used an email not linked to your GitHub account, either add that email to your GitHub account and sign the CLA, or reply here and we can rewrite the affected commit authors and force-push a cleaned branch.

Detected committers (please verify): Germán Martínez, Dani Somoza, Yago Pérez Vázquez, Daniel (dasanra), Richard Meissner, dependabot (automated). See the CLA Assistant details for the full list.

If you want an automated author-rewrite: reply with and supply the canonical author name/email to use, and confirm is OK. I will then perform a safe rewrite and post an update.

Generated: Automated-style reminder to speed review & unblock merge. Confidence: high. Thank you!

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

if (isAddress(proxyCreationAddress)) {
// Return extracted address if it matches the expected address format
return proxyCreationAddress
}
Copy link

Choose a reason for hiding this comment

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

Bug: Fallback returns wrong address for Safe v1.4.1+

For Safe v1.4.1+, the ProxyCreation event has the proxy address as an indexed parameter, which means it's stored in topics[1], not in the data field. The data field only contains the singleton address. When the fast path fails for v1.4.1+ deployments, the manual extraction fallback at log.data.slice(26, 66) extracts from the wrong field, returning the singleton address instead of the deployed proxy address.

Fix in Cursor Fix in Web

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.

SafeFactory for custom chainId throws the error: SafeProxy was not deployed correctly.

1 participant