{
    "Function": "getCorrectValueForInsertAfter",
    "File": "src/contracts/core/Slasher.sol",
    "Parent Contracts": [
        "src/contracts/permissions/Pausable.sol",
        "src/contracts/interfaces/IPausable.sol",
        "src/contracts/interfaces/ISlasher.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [
        "StructuredLinkedList",
        "StructuredLinkedList",
        "StructuredLinkedList"
    ],
    "Internal Calls": [
        "_uintToAddress",
        "_uintToAddress"
    ],
    "Library Calls": [
        "getNextNode",
        "getNextNode",
        "getHead"
    ],
    "Low-Level Calls": [],
    "Code": "function getCorrectValueForInsertAfter(address operator, uint32 updateBlock) public view returns (uint256) {\n        uint256 node = _operatorToWhitelistedContractsByUpdate[operator].getHead();\n        /**\n         * Special case:\n         * If the node being inserted in the linked list has an `updateBlock` that is less than the HEAD of the list, then we set `insertAfter = HEAD`.\n         * In _updateMiddlewareList(), the new node will be pushed to the front (HEAD) of the list.\n         */\n        if (_whitelistedContractDetails[operator][_uintToAddress(node)].latestUpdateBlock > updateBlock) {\n            return HEAD;\n        }\n        /**\n         * `node` being zero (i.e. equal to 'HEAD') indicates an empty/non-existent node, i.e. reaching the end of the linked list.\n         * Since the linked list is ordered in ascending order of update blocks, we simply start from the head of the list and step through until\n         * we find a the *last* `node` for which `_whitelistedContractDetails[operator][node].latestUpdateBlock <= updateBlock`, or\n         * otherwise reach the end of the list.\n         */\n        (, uint256 nextNode) = _operatorToWhitelistedContractsByUpdate[operator].getNextNode(node);\n        while ((nextNode != HEAD) && (_whitelistedContractDetails[operator][_uintToAddress(node)].latestUpdateBlock <= updateBlock)) {\n            node = nextNode;\n            (, nextNode) = _operatorToWhitelistedContractsByUpdate[operator].getNextNode(node);\n        }\n        return node;\n    }"
}