Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better Panic message for contract call #1275

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

antonper
Copy link

@antonper antonper commented Oct 4, 2021

What I did

Newer solc versions return Panic messages that start with 0x4e487b71.
Now the console just returns some number:

>>> SafeMath.add(2**256 - 1 , 2)
35408467139433450592217433187231851964531694900788300625387963629091585785856

How I did it

Similar to how the transaction.py deals with it:

if selector == "0x4e487b71": # keccak of Panic(uint256)

How to verify it

Running any function that reverts with Solidity panic codes:
https://docs.soliditylang.org/en/v0.8.9/control-structures.html?highlight=Panic#panic-via-assert-and-error-via-require
For example, function that overflows 2 numbers.

    function panic(uint a, uint b) public pure returns (uint) {
        return a-b;
    }
    panic(1, 2)

@iamdefinitelyahuman iamdefinitelyahuman merged commit 003d4c3 into eth-brownie:master Oct 11, 2021
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