Improper status tracking
Description
The functions respondToOpTask
, respondToRdTask
, and forceRespondToOpTask
contain multiple occurrences of a basic coding mistake. The code uses the comparison operator ==
instead of the assignment operator =
when updating the idToTaskStatus
mapping. The task statuses are therefore not being updated correctly, leading to inconsistencies in the contract's state management.
In the
respondToOpTask
function (lines 257 and 279)
idToTaskStatus[TaskType.OP_TASK][taskResponse.referenceTaskIndex] == TaskStatus.RESPONDED;
...
idToTaskStatus[TaskType.OP_TASK][taskResponse.referenceTaskIndex] == TaskStatus.COMPLETED;
In the
respondToRdTask
function (line 492 and line 511)
idToTaskStatus[TaskType.RD_TASK][taskResponse.referenceTaskIndex] == TaskStatus.RESPONDED;
...
idToTaskStatus[TaskType.RD_TASK][taskResponse.referenceTaskIndex] == TaskStatus.COMPLETED;
In the
forceRespondToOpTask
function (line 383)
idToTaskStatus[TaskType.OP_TASK][taskResponse.referenceTaskIndex] == TaskStatus.COMPLETED;
Impact
Since the task statuses are not updated due to the incorrect operator, the contract will behave like the tasks are still in their initial state. This can lead to reprocessing of tasks, duplication, or failure to recognize completed tasks.
Recommendations
We recommend correcting these lines to use the assignment operator =
as intended.
Remediation
This issue has been acknowledged by Gasp, and a fix was implemented in commit 10e4ba5c↗.