Vanguard

First Flight #56
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Compilation Failure Due to Undefined `CREATE2_FACTORY` Variable

ROOT + IMPACT

Description

The deployLaunchHook.s.sol script relies on the HookMiner library to pre-calculate (mine) the contract address before deployment. This process requires the address of the deterministic CREATE2 factory that will be used for the actual deployment.

In the provided code, the constant CREATE2_FACTORY is declared but is commented out. However, this variable is subsequently referenced in the run() function inside the HookMiner.find(...) call. This causes the Solidity compiler to fail immediately with an "Undeclared identifier" error, making it impossible to compile or execute the deployment script.

Solidity

// deployLaunchHook.s.sol
// CREATE2 factory address for deploying hooks with specific flags
// address constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; <--- COMMENTED OUT
function run() public {
// ...
// @audit Variable 'CREATE2_FACTORY' is used here but is not defined in scope
(address hookAddress, bytes32 salt) =
HookMiner.find(CREATE2_FACTORY, flags, type(TokenLaunchHook).creationCode, constructorArgs);

Risk

Likelihood: High (Certainty)

  • The compiler will strictly enforce variable declaration rules. The script cannot be run or tested in its current state.

Impact: High

  • Denial of Service (Development): Developers and auditors cannot compile the codebase or run the deployment scripts.

  • Deployment Failure: The protocol cannot be deployed to any network until this syntax error is resolved.

Proof of Concept

  1. Navigate to script/deployLaunchHook.s.sol.

  2. Observe Line 14-15: The CREATE2_FACTORY definition is commented out.

  3. Observe Line 34: The code attempts to access CREATE2_FACTORY.

  4. Run Command: forge build or forge script script/deployLaunchHook.s.sol.

  5. Result: Compiler Error.

    Plaintext

    Error: Undeclared identifier.
    --> script/deployLaunchHook.s.sol:34:28:
    |
    | HookMiner.find(CREATE2_FACTORY, flags, type(TokenLaunchHook).creationCode, constructorArgs);
    | ^^^^^^^^^^^^^^^

Recommended Mitigation

Uncomment the definition of the CREATE2_FACTORY constant.

Diff

- // address constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
+ address constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
Updates

Appeal created

chaossr Lead Judge 17 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Undefined CREATE2_FACTORY constant

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!