Use implementation ABI when decoding proxy calls#276
Draft
Genmin wants to merge 1 commit into
Draft
Conversation
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.implementationand queues metadata retrieval for that implementation. This change wires that data intoDataDecoderService.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.pyuv run --with ruff ruff format --check app/services/data_decoder.py app/tests/services/test_data_decoder.pyENV_FILE=.env.test DB_NAME=testdb uv run mypy app/services/data_decoder.py app/tests/services/test_data_decoder.pymint(address,uint256,uint256)fallback ABII 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 -qThat 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.