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

Parse Panic Solidity 0.8 revert data (as found in overflow) #1209

Closed
frangio opened this issue Jan 29, 2021 · 3 comments
Closed

Parse Panic Solidity 0.8 revert data (as found in overflow) #1209

frangio opened this issue Jan 29, 2021 · 3 comments
Labels
type:feature Feature request

Comments

@frangio
Copy link
Contributor

frangio commented Jan 29, 2021

Solidity 0.8 introduced a new Panic(uint256) encoding for revert data, used in Solidity built-in errors such as overflow. This is a new alternative to the existing Error(string) encoding.

From a quick test using hardhat console and hardhat-ethers, triggering an overflow prints Error: Transaction reverted for an unrecognized reason..

// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.0;

contract Panic {
    function test() public returns (uint) {
        return uint(0) - uint(1);
    }
}

This should produce an error with a message that identifies it as a panic, together with the corresponding error code. We want to extend expectRevert from OpenZeppelin Test Helpers to detect panics as well.

@frangio
Copy link
Contributor Author

frangio commented Mar 1, 2021

Any updates on this? 🙂

@alcuadrado
Copy link
Member

We'll probably start working on this after this week's release.

@fvictorio
Copy link
Member

Hardhat 2.4.0 now supports panic codes 🎉

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:feature Feature request
Projects
None yet
Development

No branches or pull requests

4 participants