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

[FAIL. Reason: revert: INITIALIZATION_FAILED] #1060

Closed
SvenMeyer opened this issue Dec 3, 2023 · 2 comments
Closed

[FAIL. Reason: revert: INITIALIZATION_FAILED] #1060

SvenMeyer opened this issue Dec 3, 2023 · 2 comments

Comments

@SvenMeyer
Copy link

I have some strange errors [FAIL. Reason: revert: INITIALIZATION_FAILED] and nowhere I can find/google some information about it.

I have a factory deploying a ERC20 (actually xERC20 token), working fine so far, made some changes which should not affect this code (replaced Ownable with AccessControl)

It looks like these errors may not have much to do with the code or show up at least asynchronously.

Like, I have this simple test

contract UnitNames is Base {
  function testName() public {
    assertEq('Test', _xerc20.name());
  }

  function testSymbol() public {
    assertEq('TST', _xerc20.symbol());
  }
}

If I run unit and e2e tests, this error shows up between the two (apparently successful) tests ... and also in later tests.

image

If I just run the unit tests , at least the two simple tests run fine ... (No [FAIL. Reason: revert: INITIALIZATION_FAILED] messages between these two tests).

image

@SvenMeyer
Copy link
Author

SvenMeyer commented Dec 4, 2023

Looks like it's coming from a failed CREATE3 call from solmate

    function deploy(
        bytes32 salt,
        bytes memory creationCode,
        uint256 value
    ) internal returns (address deployed) {
        bytes memory proxyChildBytecode = PROXY_BYTECODE;

        address proxy;
        assembly {
            // Deploy a new contract with our pre-made bytecode via CREATE2.
            // We start 32 bytes into the code to avoid copying the byte length.
            proxy := create2(0, add(proxyChildBytecode, 32), mload(proxyChildBytecode), salt)
        }
        require(proxy != address(0), "DEPLOYMENT_FAILED");

        deployed = getDeployed(salt);
        (bool success, ) = proxy.call{value: value}(creationCode);
        require(success && deployed.code.length != 0, "INITIALIZATION_FAILED");
    }

... and I could be even a totally unrelated bug caused by me 😬
I just have no clue at the moment why this happens.

@Evalir
Copy link
Member

Evalir commented Dec 4, 2023

Right, this seems like it might be an user bug as this comes from solmate—mind if we take this to the foundry telegram chat so we or other people can help you? This way we keep the issue tracker clean. Thanks!

@Evalir Evalir closed this as completed Dec 4, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Book Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants