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

Create2 doesn't bubble up returndata on revert #5046

Closed
frangio opened this issue May 16, 2024 · 1 comment · Fixed by #5052
Closed

Create2 doesn't bubble up returndata on revert #5046

frangio opened this issue May 16, 2024 · 1 comment · Fixed by #5052

Comments

@frangio
Copy link
Contributor

frangio commented May 16, 2024

When a contract deployment fails in Create2, returndata is ignored even though it may contain a revert reason that should probably be bubbled up like the Address library does for calls. I haven't checked if Solidity does this for native contract creation.

revert Errors.FailedDeployment();

@ernestognw
Copy link
Member

Seems like it does bubble up the revert reason. I tested the following in Remix:

pragma solidity ^0.8.24;

contract A {
    constructor() {
        revert("Some message");
    }
}

contract Test {
    constructor() {
        new A{salt:keccak256("some salt")}();
    }
}

The result is that Some message is shown in the console.

Reason provided by the contract: "Some message".

Although it seems to be the default behavior in Solidity, this is one of those cases where bubbling up the revert reason adds an extra instruction that nobody asked for 🤔.

Although factories should rely mostly on Clones for deterministic deployments instead of Create2, I wonder if there's a use case we this extra instruction would represent significative costs.

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 a pull request may close this issue.

2 participants