Assessment reports>Spectral Modelers>Threat Model>replaceOptOutTopNModeler

Function: replaceOptOutTopNModeler(uint256 _oldModelerIndex, address _newModeler, uint256 _medianPerformanceResults)

This function replaces a modeler in the topNModelers array with a new modeler based on their performance results.

Inputs

  • _oldModelerIndex

    • Control: Controlled by the caller.

    • Constraints: Must be less than the length of the topNModelers array.

    • Impact: Identifies the index of the modeler to be replaced in the topNModelers array.

  • _newModeler

    • Control: Controlled by the caller.

    • Constraints: N/A.

    • Impact: The new modeler to be inserted into the topNModelers array.

  • _medianPerformanceResults

    • Control: Controlled by the caller.

    • Constraints: N/A.

    • Impact: The new index position of the _newModeler in the topNModelers array.

Branches and code coverage

Intended branches

  • Validation of _oldModelerIndex.

  • Finding the new index for _newModeler based on _medianPerformanceResults.

  • Reordering of the topNModelers array and updating the modelerToMedian mapping.

Negative behavior

  • Revert if _oldModelerIndex is out of bounds.

Zellic © 2024Back to top ↑