In the getRoundPhase
function of the BuyerAgent.sol
contract, there is a potential usability issue if the marketParams
array is empty. The function currently assumes that marketParams
will always contain elements, and it does not check for an empty array before accessing it. If marketParams
is empty, any call to getRoundPhase
will revert, disrupting user experience and potentially leading to unexpected transaction failures. it will primarily impact user experience..
Code Snippet of Concern:
In the current implementation, if marketParams
is empty, getRoundPhase
will revert because it tries to access elements that do not exist. This lack of a null check can lead to unexpected transaction reverts, impacting user experience negatively, especially as getRoundPhase
is commonly used within the key protocol’s operations in the list()
and relist()
function in the swan.sol
contract, as a rest of this, If marketParams
is empty when these functions are called, getRoundPhase
will revert due to an out-of-bounds array access, causing any call to list
or relist
to fail unexpectedly.
This issue affects core functions and can cause disruptions in the following ways:
As list
and relist
are critical functions for asset creation and re-listing, any failure due to missing marketParams
would prevent users from performing these key actions: users interacting with functions that call getRoundPhase
may experience unexpected reverts, especially if the marketParams
array is temporarily empty due to timing or initialization issues. This can result in a poor user experience, as users may be uncertain why transactions fail.
Frequent reverts due to unexpected issues with marketParams
could lead users to question the reliability of the protocol, which may impact adoption and user satisfaction over time.
If marketParams
becomes empty during key operations, this could prevent users from interacting with the protocol as expected, potentially leading to a temporary service disruption.
Manual Review
Add a Non-Null Check for marketParams
:
In the getRoundPhase
function, include a check to ensure that marketParams
is not empty. If marketParams.length == 0
, return an error or revert with a meaningful message to indicate that market parameters are unavailable.
For example:
Adding this check will ultimately prevent unexpected reverts in list
and relist
if marketParams
is not populated, improving the robustness and reliability of these critical operations.
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.