NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect parameter encoding in Deployer library may lead to initialization failures in `Deployer.sol`

Summary

Vulnerability Detail

The Deployer library contains functions deployERC721Bridgeable() and deployERC1155Bridgeable() that incorrectly encode initialization parameters for the deployed contracts. These functions use abi.encodeWithSelector() with abi.encode() nested inside, which results in the parameters being encoded into a single bytes array. However, the initialize() functions of the deployed contracts expect separate parameters, not a single encoded bytes array.

For example, in deployERC721Bridgeable():

bytes memory dataInit = abi.encodeWithSelector(
ERC721Bridgeable.initialize.selector,
abi.encode(name, symbol)
);

Impact

This incorrect encoding can prevent proper initialization of the deployed contracts, potentially leading to unexpected behavior or vulnerabilities.

Tools Used

Manual Review

Recommendation

To fix this issue, the parameters should be passed directly to abi.encodeWithSelector():

bytes memory dataInit = abi.encodeWithSelector(
ERC721Bridgeable.initialize.selector,
name,
symbol
);

Similar changes should be applied to the deployERC1155Bridgeable() function. This correction ensures that the initialization parameters are properly encoded and passed to the deployed contracts, allowing for correct initialization.

Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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