Closed code423n4 closed 2 years ago
kenzo
By putting the bool variables declared in Auction one after the other, solidity will pack them and save gas in deployment.
Around 13000 gas can be saved.
Relevant lines: https://github.com/code-423n4/2021-10-defiprotocol/blob/main/contracts/contracts/Auction.sol#L16:#L28
Manual analysis, hardhat, hardhat-gas-reporter.
Declare the bool variables together:
bool public override initialized; bool public override auctionOngoing; bool public override hasBonded;
Duplicate of #46
Handle
kenzo
Vulnerability details
Vulnerability details
By putting the bool variables declared in Auction one after the other, solidity will pack them and save gas in deployment.
Impact
Around 13000 gas can be saved.
Proof of Concept
Relevant lines: https://github.com/code-423n4/2021-10-defiprotocol/blob/main/contracts/contracts/Auction.sol#L16:#L28
Tools Used
Manual analysis, hardhat, hardhat-gas-reporter.
Recommended Mitigation Steps
Declare the bool variables together: