Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: medium
Invalid

Missing Event Emission will Obscure MarketPlace Status Updates

Summary

The updateMarketPlaceStatus function updates the status of a marketplace but fails to emit an event to log this change. This omission can obscure status updates and make it challenging to track changes, affecting the transparency and auditability of the contract.

Vulnerability Details

The updateMarketPlaceStatus function allows the contract owner to update the status of a marketplace by specifying its name and the new status. The relevant code snippet is:

function updateMarketPlaceStatus(
string calldata _marketPlaceName,
MarketPlaceStatus _status
) external onlyOwner {
address marketPlace = GenerateAddress.generateMarketPlaceAddress(
_marketPlaceName
);
MarketPlaceInfo storage marketPlaceInfo = marketPlaceInfoMap[
marketPlace
];
marketPlaceInfo.status = _status;
}

This function successfully updates the status field of the MarketPlaceInfo struct associated with the provided marketplace address. However, it does not emit an event to notify interested parties of this change. Events are crucial in smart contracts for providing an auditable trail of significant actions and updates.

Affected LoC:

Impact

The lack of event emission means that updates to the marketplace status will not be logged on the blockchain, making it difficult for users and other stakeholders to track when and why the status was changed. This can lead to a lack of transparency and accountability, as changes to critical contract parameters are not publicly recorded. This could result in potential disputes or confusion about the current status of the marketplace, impacting user trust and the overall integrity of the contract.

Tools Used

Manual

Recommendations

To address this issue, it is essential to emit an event whenever the updateMarketPlaceStatus function is called. This will provide transparency and allow users to track changes to the marketplace status. The updated function should include an event definition and emission as follows:

+event MarketPlaceStatusUpdated(
+ string marketPlaceName,
+ MarketPlaceStatus newStatus
);
function updateMarketPlaceStatus(
string calldata _marketPlaceName,
MarketPlaceStatus _status
) external onlyOwner {
address marketPlace = GenerateAddress.generateMarketPlaceAddress(
_marketPlaceName
);
MarketPlaceInfo storage marketPlaceInfo = marketPlaceInfoMap[
marketPlace
];
marketPlaceInfo.status = _status;
+ emit MarketPlaceStatusUpdated(_marketPlaceName, _status);
}
Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.