Skip to content

Conversation

@fubuloubu
Copy link
Member

What I did

Narrow the heuristic which triggers the masterCopy() call to a contract to determine if it is a SafeProxy type. This should reduce/eliminate most of the instances where Ape tries the call and it fails and creates a log like so:

reverted without message
0xC8C8...6793.0xa619486e()

How I did it

We can add a couple extra ~free checks on code and slot_0 value before triggering masterCopy():

  1. check that the method ID for masterCopy() (0xa619486e) is actually in the proxy code (should always be true, but has potential for false positives)
  2. check that slot_0 is "address-like" (has 12 leading empty bytes, and at least 12/32 non-empty bytes)

How to verify it

Anything weird happens

Checklist

  • All changes are completed
  • Change is covered in tests
    - [ ] Documentation is complete

@fubuloubu fubuloubu requested a review from antazoey December 17, 2025 23:20
@fubuloubu
Copy link
Member Author

With:

$ rm ~/.ape/optimism/mainnet/**/0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507.json
$ ape console --network optimism:mainnet:node
INFO:     Connecting to existing Reth node at https://optimism-rpc.publicnode.com.
                                                                      
In [1]: Contract("0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507")
Out[1]: <UniversalRouter 0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507>

Without:

$ rm ~/.ape/optimism/mainnet/**/0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507.json
$ ape console --network optimism:mainnet:node
INFO:     Connecting to existing Geth node at https://mainnet.optimism.io.

In [1]: Contract("0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507")
0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507.0xa619486e()
Out[1]: <UniversalRouter 0x851116D9223fabED8E56C0E6b8Ad0c31d98B3507>

@fubuloubu fubuloubu enabled auto-merge (squash) December 17, 2025 23:27
@fubuloubu fubuloubu force-pushed the refactor/ethereum/safe-proxy-heuristic branch from b0727aa to 8e60376 Compare December 19, 2025 21:58
@fubuloubu fubuloubu force-pushed the refactor/ethereum/safe-proxy-heuristic branch from 8e60376 to ca860b8 Compare January 15, 2026 05:25
@fubuloubu fubuloubu force-pushed the refactor/ethereum/safe-proxy-heuristic branch from ca860b8 to b693334 Compare January 15, 2026 05:26
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.

2 participants