Skip to content

Comments

Use brownie's Contract API to decode EVM script calls#345

Merged
bulbozaur merged 2 commits intomasterfrom
fix/evm-calls-decoder
Apr 1, 2025
Merged

Use brownie's Contract API to decode EVM script calls#345
bulbozaur merged 2 commits intomasterfrom
fix/evm-calls-decoder

Conversation

@Psirex
Copy link
Contributor

@Psirex Psirex commented Feb 13, 2025

The current EVM script decoder is based on the AVotesParser library. However, this library has a bug that, under certain conditions (e.g., when a call is made on proxy contracts), can result in unparsed calls in the output (see screenshot below):

image

Since AVotesParser is scheduled for deprecation in the near future, fixing the issue directly in the library is suboptimal.

This PR addresses the problem by eliminating the use of AVotesParser.decode_function_call() and replacing it with a new local method, decode_encoded_call(). This method relies entirely on Brownie’s Contract API, which can natively resolve ABIs and source code from Etherscan, as well as decode call data.

Note: The new implementation requires the ETHERSCAN_TOKEN environment variable to be set in order to run the scripts.

Below is a screenshot showing the output of the updated script using the new method.:

image

@Psirex Psirex requested a review from a team as a code owner February 13, 2025 13:58
Copy link
Member

@bulbozaur bulbozaur left a comment

Choose a reason for hiding this comment

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

LGTM

@bulbozaur bulbozaur merged commit 0891ed5 into master Apr 1, 2025
1 check passed
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.

3 participants