Solidity v0.8.4 is here - Adds custom structured errors and more!

Sharing this a bit later here, but better late than never… :relaxed:

Last week, Solidity v0.8.4 was released!

v0.8.4 adds custom structured errors, bytes.concat(...), allows more flexible configuration of the SMTChecker and fixes a bug in the Solidity ABI decoder v2.

:open_book:: Solidity 0.8.4 Release Announcement | Solidity Blog
:bug:: Solidity ABI Decoder Bug For Multi-Dimensional Memory Arrays | Solidity Blog
:floppy_disk:: Release Version 0.8.4 · ethereum/solidity · GitHub

Important Bugfixes

On April 5th, 2021, a bug in the Solidity ABI decoder v2 was reported by John Toman of the Certora development team. For two-dimensional arrays and specially crafted data in memory, the result of abi.decode can depend on data elsewhere in memory. Calldata decoding is not affected. The bug is present in all prior versions of ABI coder v2 and was assigned a severity level of “very low”. Read all details on the bug and who should be concerned in the corresponding security alert.

Notable New Features

Custom Errors

Errors can now be defined inside and outside of contracts (including interfaces and libraries). This provides a convenient and gas-efficient way to explain to users why an operation failed. Read more details on Custom Errors in this explainer post.

SMTChecker

We are starting to deprecate pragma experimental SMTChecker;. From Solidity 0.8.4 on the standard way to activate the SMTChecker is by either using the CLI option --model-checker-engine {all,chc,bmc} or the JSON option settings.modelChecker.engine={all,chc,bmc}. The pragma version will still work until the next breaking release, where it will be removed completely. Furthermore, the SMTChecker now also verifies whether index accesses are safe, and allows users to choose precisely which contracts should be analyzed, potentially reducing the complexity of the generated symbolic model and increasing proving power.

Spread the Word

Feel free to share the announcements linked above or the tweet below in your networks. :love_letter: :bird:

1 Like

Hello, @franzihei,

Based on this same article you mentioned, I’ve understood that this recent Solidity feature Custom Errors would behavior in the same way as a failed condition in require statement, since it says:

require(condition, “error message”) should be translated to if (!condition) revert CustomError().

However, as you can see in this verified contract on Goerli: https://goerli.etherscan.io/address/0xa69ff680173d7317a2bb482b2d00ca99323e01d5, which has the following three very simular functions, the testFailRevert gas cost is systematically higher than the other two functions.

Is there any explanation about it?

Thanks a lot!

  function testFailRequire() external {
        for (uint256 i = 0; i < 100; i++) {
            greeting = "consome gas";
        }
        require(false);
    }

    function testFailRevert() external {
        for (uint256 i = 0; i < 100; i++) {
            greeting = "consome gas";
        }
        revert UnevitactableError();
    }

    function testFailAssert() external {
        for (uint256 i = 0; i < 100; i++) {
            greeting = "consome gas";
        }
        assert(false);
    }