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

[Bug-Candidate]: abi.encodePacked failing with solc 0.8.25 and cancun evm version #1315

Open
shaka0x opened this issue Sep 19, 2024 · 1 comment

Comments

@shaka0x
Copy link

shaka0x commented Sep 19, 2024

Describe the issue:

I was getting the Deploying the contract * failed (revert, out-of-gas, sending ether to an non-payable constructor, etc.) error in my project. Unfortunately this error is quite hard to debug. After long time changing my code and commenting out stuff I realized the problem was in the execution of abi.encodePacked in my setup function.

My foundry.toml file includes the following:

evm_version = "cancun"
solc = "0.8.25"

Commenting out the evm_version or lowering solc to 0.8.24 removed the issue. So the problem seems to be using abi.encodePacked in the constructor when I am using cancun evm version and solc 0.8.25.

Same error appears if I use abi.encode.

Code example to reproduce the issue:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

contract Tester {
    constructor() payable {
        bytes memory b = bytes("foo");
        abi.encodePacked(b);
    }

    function foo() public {}
}

Version:

2.2.4

Relevant log output:

echidna: Deploying the contract 0x00a329c0648769A73afAc7F9381E08FB43dBEA72 failed (revert, out-of-gas, sending ether to an non-payable constructor, etc.):
@elopez
Copy link
Member

elopez commented Sep 19, 2024

Hi! Echidna 2.2.4 does not have full support for Cancun, and seeing that you don't experience the same issue if you run with solc 0.8.24, it's possible you're hitting one of the limitations there (eg missing MCOPY support). For the time being, either use 0.8.24 which works, or alternatively, try updating to a newer echidna build from the master branch; we recently updated hevm and that should hopefully mean it supports Cancun fully now.

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

No branches or pull requests

3 participants
@elopez @shaka0x and others