Skip to content
Misconfiguration Audit finding Beginner

Unused admin state variable increases deployment and storage costs.

An unused admin state variable is declared and set during initialisation but never read, while access control is handled by role-based checks. This wastes a storage slot and increases deployment gas costs, but does not create a security vulnerability.

Lock0down Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

50393 sc insight unused admin state variable increases deployment and storage costs

Submitted on Jul 24th 2025 at 08:01:20 UTC by @Lock0down for Attackathon | Plume Network

Description

Brief / Intro

An unused admin state variable was identified in Raffle.sol. The variable is declared and set to msg.sender in the initialize function but is never read or used elsewhere in the contract.

Access control is already implemented via AccessControlUpgradeable using ADMIN_ROLE and the onlyRole modifier. Therefore, the admin variable is redundant and consumes a storage slot needlessly, increasing deployment gas costs and the contract's storage size. Removing it would reduce gas at deployment and simplify the contract state.

Proof of Concept

This qualifies as an Insight ("Code Optimizations and Enhancements") because it targets unnecessary gas costs resulting from redundant storage writes.

Relevant excerpts from the contract:

Solidity
// state declaration
address public admin;
Solidity
function initialize(address _spinContract, address _supraRouter) public initializer {
    __AccessControl_init();
    __UUPSUpgradeable_init();

    spinContract = ISpin(_spinContract);
    supraRouter = ISupraRouterContract(_supraRouter);
    admin = msg.sender; // <--- The variable is set here
    nextPrizeId = 1;

    _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
    _grantRole(ADMIN_ROLE, msg.sender);
    _grantRole(SUPRA_ROLE, _supraRouter);
}

The admin variable is never read or referenced later; administrative checks use onlyRole(ADMIN_ROLE).

Impact on gas: the initial SSTORE for admin during deployment consumes gas. Removing the declaration and assignment eliminates that SSTORE and slightly reduces the contract's storage footprint.

Proposed Solution

{% hint style="info" %} Remove the redundant admin state variable declaration and the admin = msg.sender; assignment from initialize. Access control remains enforced via AccessControlUpgradeable roles, so this change does not affect functionality or security and reduces deployment gas costs. {% endhint %}

The original report as published on Immunefi, by Lock0down. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a leftover state variable from an earlier design, kept even though access control was moved to role-based checks.

Impact

No security impact is claimed; the only effect is unnecessary deployment gas and a slightly larger storage footprint.

What the attacker needed

None

The fix

The redundant variable and its assignment should be removed, since role-based access control already covers the same purpose.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract can store small pieces of data permanently on the blockchain, and each storage slot costs money (gas) to write. This contract saved an extra admin address that nothing ever reads, so it paid for storage it did not need. It is a code-cleanliness and cost issue, not a way for an attacker to break in.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.