hats-finance / Metrom-0xfdfc6d4ac5807d7460da20a3a1c0c84ef2b9c5a2

Smart contracts for the Metrom project.
GNU General Public License v3.0
0 stars 0 forks source link

`ossify` Function Should Check `ossified` Before Assignment #52

Open hats-bug-reporter[bot] opened 5 months ago

hats-bug-reporter[bot] commented 5 months ago

Github username: @0xmahdirostami Twitter username: 0xmahdirostami Submission hash (on-chain): 0x01288c88f486123005de7b9bf0421f21ed6b77cc1495accf1bc49c91771f37d1 Severity: low

Description: Description The ossify function is designed to set the ossified state to true and emit an event. However, it does not currently check if ossified is already true before performing these actions.

Impact If ossify is called when ossified is already true, the function will emit an event unnecessarily, which could lead to incorrect event logs and potentially misleading information for users or developers relying on these logs.

Mitigation Add a check to ensure ossified is false before setting it to true and emitting the event.

/// @inheritdoc IMetrom
function ossify() external {
    if (msg.sender != owner) revert Forbidden();
+   if (ossified) revert Ossified();
    ossified = true;
    emit Ossify();
}

This change ensures that the ossify function only sets the state and emits the event when the contract is not already ossified, preventing redundant events and maintaining accurate logs.

luzzif commented 5 months ago

This is informational more than low, not a real vuln imho.