Raisebox Faucet

First Flight #50
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

[L-02] Deployment script missing return statement

Deployment script missing return statement that makes it cumbersome to use in tests

Description

Deployment scripts are used temporarily just for execution, and if used in the test suite (as with this project) you would expect the instance or contract address to be returned.
The test suite is manually deploying its own testing instance instead of checking the deployed contract through this script.

The script itself is correct (apart from the deployment contract name).

// Root cause in the codebase with @> marks to highlight the relevant section
contract DeployRaiseboxContract is Script {
@> RaiseBoxFaucet public raiseBox;
function run() public {
vm.startBroadcast();
raiseBox = new RaiseBoxFaucet(
"raiseboxtoken",
"RB",
1000 * 10 ** 18,
0.005 ether,
1 ether
);
vm.stopBroadcast();
}
}

Risk

Impact:

  • Multiple identical deployments in test suite

  • Deployment script is not tested properly and can lead to drift in tested to actual deployment parameters

Recommended Mitigation

Return freshly deployed RaiseBoxFaucet instead of storing it as state variable, and fix script deployment name.

-contract DeployRaiseboxContract is Script {
+contract DeployRaiseboxFaucet is Script {
- RaiseBoxFaucet public raiseBox;
- function run() public {
+ function run() public returns (RaiseBoxFaucet){
vm.startBroadcast();
- raiseBox = new RaiseBoxFaucet(
+ RaiseBoxFaucet raiseBox = new RaiseBoxFaucet(
"raiseboxtoken",
"RB",
1000 * 10 ** 18,
0.005 ether,
1 ether
);
vm.stopBroadcast();
+ return raiseBox;
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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

Give us feedback!