sherlock-audit / 2024-02-optimism-2024-judging

6 stars 4 forks source link

Discrepency between Natspec comment and logic implementation #237

Closed sherlock-admin3 closed 7 months ago

sherlock-admin3 commented 7 months ago

Discrepency between Natspec comment and logic implementation

Low/Info issue submitted by Shield

Summary

Discrepency between Natspec comment and logic implementation in DisputeGameFactory.create

Vulnerability Detail

In the DisputeGameFactory.create function the GameId is packed as shown below:

    GameId id = LibGameId.pack(_gameType, Timestamp.wrap(uint64(block.timestamp)), proxy_);

Here the gameType is of uint32 and the Timestamp is of uint64 and the proxy is an address of bytes20.

But the natspec comment in the DisputeTypes.sol contract has the GameId packed variable details are as follows:

/// @notice A GameId represents a packed 1 byte game ID, an 11 byte timestamp, and a 20 byte address.

Hence there is a discrepancy (with regards to game ID and timestamp) between the variable type size in the natspec comments and the actual gameId construction

Impact

the wrong natspec comments impacts the readability of the code

Code Snippet

https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/DisputeGameFactory.sol#L116

Tool used

Manual Review

Recommendation

update the natspec comment

sherlock-admin4 commented 7 months ago

The protocol team fixed this issue in the following PRs/commits: https://github.com/ethereum-optimism/optimism/pull/10152