Skip to content

Use implementation ABI when decoding proxy calls#276

Draft
Genmin wants to merge 1 commit into
safe-global:mainfrom
Genmin:codex/proxy-implementation-abi-decoding
Draft

Use implementation ABI when decoding proxy calls#276
Genmin wants to merge 1 commit into
safe-global:mainfrom
Genmin:codex/proxy-implementation-abi-decoding

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 28, 2026

What

Fixes #242 by letting the decoder use the stored implementation contract ABI when a proxy contract ABI does not contain the incoming selector.

The existing metadata flow already persists Contract.implementation and queues metadata retrieval for that implementation. This change wires that data into DataDecoderService.get_abi_function: proxy ABI selectors are still preferred, then implementation ABI selectors are checked, then the existing global selector fallback remains unchanged.

Why

For proxy contracts like the Sepolia example in #242, the proxy address can have metadata but the callable application selector is only present on the implementation ABI. Without this, decoding can fall through to a generic selector match and produce misleading argument names.

Tests

  • uv run --with ruff ruff check app/services/data_decoder.py app/tests/services/test_data_decoder.py
  • uv run --with ruff ruff format --check app/services/data_decoder.py app/tests/services/test_data_decoder.py
  • ENV_FILE=.env.test DB_NAME=testdb uv run mypy app/services/data_decoder.py app/tests/services/test_data_decoder.py
  • In-process decoder sanity check with a mocked proxy -> implementation lookup, including a misleading generic mint(address,uint256,uint256) fallback ABI

I also attempted the DB-backed regression directly:

  • ENV_FILE=.env.test DB_NAME=testdb uv run pytest app/tests/services/test_data_decoder.py::TestDataDecoderService::test_decode_proxy_using_implementation_abi -q

That is blocked in my local environment because this repo expects local Postgres on localhost:5432, and Docker is not available here to start the test services.

@github-actions
Copy link
Copy Markdown


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. Posted by the CLA Assistant Lite bot.

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.

Function signature collision

1 participant