bool public override auctionOngoing;
uint256 public override auctionStart;
bool public override hasBonded;
uint256 public override bondAmount;
uint256 public override bondTimestamp;
bool public override initialized;
the above state variable use 6 slot of memory , if we declare same type of variable in a row then they can be packed in one slot
uint256 public override auctionStart;
uint256 public override bondAmount;
uint256 public override bondTimestamp;
bool public override auctionOngoing;
bool public override hasBonded;
bool public override initialized;
now the above state variable will take only 4 slot of memory because all three bool variable can be packed in the single slot
Handle
JMukesh
Vulnerability details
Impact
bool public override auctionOngoing; uint256 public override auctionStart; bool public override hasBonded; uint256 public override bondAmount; uint256 public override bondTimestamp; bool public override initialized;
the above state variable use 6 slot of memory , if we declare same type of variable in a row then they can be packed in one slot
uint256 public override auctionStart; uint256 public override bondAmount; uint256 public override bondTimestamp; bool public override auctionOngoing; bool public override hasBonded; bool public override initialized;
now the above state variable will take only 4 slot of memory because all three bool variable can be packed in the single slot
Proof of Concept
https://github.com/code-423n4/2021-09-defiProtocol/blob/52b74824c42acbcd64248f68c40128fe3a82caf6/contracts/contracts/Auction.sol#L16
Tools Used
manual review
Recommended Mitigation Steps