In the constructor, the state variable s_TokenCounter (a uint256) is explicitly assigned the value 0:
solidity
Solidity automatically initializes all state variables to their default values during contract creation. For uint256, the default value is 0. Therefore, this explicit assignment is redundant.
This line generates an unnecessary SSTORE operation in the deployed bytecode. Although the storage slot is already 0 (original value = new value = 0), the EVM still incurs gas costs for the operation:
A "no-op" SSTORE (setting a slot to its current value) costs approximately 2,100 gas (cold SLOAD access under EIP-2929) plus additional overhead.
This increases the contract deployment cost by a few thousand gas without providing any functional benefit.
While the gas impact is minor compared to overall deployment costs, it represents avoidable inefficiency.
State variables declared without an initializer are set to 0 before the constructor executes. The assignment in the constructor performs a redundant write to a slot that is already at the target value.
Remove the redundant assignment:
solidity
This change reduces deployment gas consumption and aligns with Solidity best practices for gas-efficient code.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.