[FAIL. Reason: revert: INITIALIZATION_FAILED]
SvenMeyer opened this issue · 2 comments
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.
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).
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.
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!