Several instances of incorrect or misleading documentation/NatSpec comments have been identified across the protocol's codebase. These inaccuracies can cause confusion among developers, auditors, and users, leading to potential misunderstandings, improper use of the contracts, and overlooked vulnerabilities. Accurate documentation is crucial for the secure and correct functioning of smart contracts.
Instance 1: Incorrect @param Description in register Function
In the register function, the @param description incorrectly refers to unregistering an Oracle:
Issue: The @param comment should describe registering, not unregistering, as this is the register function.
Instance 2: Misleading @dev Comment in state Variable Declaration
In the BuyerAgent contract, the documentation for the state variable implies that only the oracle can update it via updateState:
However, the updateState function is protected by the onlyAuthorized modifier:
This means the function can be called by the owner, operator, or Swan—not exclusively by the oracle.
Issue: The comment misleads readers into thinking only the oracle can update the state, which is not the case.
Instance 3: Reference to Non-Existent Variable in oracleStateRequests Mapping
Again, in the BuyerAgent contract:
Issue: The comment refers to isOracleTaskProcessed, which doesn't exist. The correct variable is isOracleRequestProcessed.
Inaccurate or misleading documentation can significantly impact the protocol's security, usability, and reliability. Developers, users and integrators may misinterpret how functions should be used or the access controls in place, leading to incorrect implementations or introducing bugs.
Manual Review
It is recommended to perform a review of all documentation and NatSpec comments throughout the codebase to identify and correct inaccuracies and inconsistencies. Updating the comments to accurately reflect the code's functionality and access controls will enhance clarity and prevent misunderstandings.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.