The endGame
function of the TwentyOne
contract uses the delete
operation to reset the dynamic arrays playersDeck[player].playersCards
and dealersDeck[player].dealersCards
. However, this approach does not completely clear the arrays' underlying storage. While the delete
operation sets the length of the arrays to zero, it does not remove residual data in storage, leading to potential inefficiencies in subsequent array operations.
delete playersDeck[player].playersCards
and delete dealersDeck[player].dealersCards
only set the length of the arrays to zero, leaving residual storage intact.
Residual storage data increases gas costs for future operations and may result in unintended behaviors.
Inefficient gas usage during subsequent operations.
Potential for stale data causing unexpected behavior in edge cases.
Replace the delete
operation with an explicit truncation of the dynamic arrays to ensure complete removal of data from storage
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.