{
    "Function": "performChallengeBisectionStep",
    "File": "src/contracts/middleware/PaymentManager.sol",
    "Parent Contracts": [
        "src/contracts/permissions/Pausable.sol",
        "src/contracts/interfaces/IPausable.sol",
        "src/contracts/interfaces/IPaymentManager.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "_updateStatus",
        "_updateChallengeAmounts",
        "require(bool,string)",
        "require(bool,string)",
        "_updateChallengeAmounts"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function performChallengeBisectionStep(address operator, bool secondHalf, uint96 amount1, uint96 amount2)\n        external\n    {\n        // copy challenge struct to memory\n        PaymentChallenge memory challenge = operatorToPaymentChallenge[operator];\n\n        ChallengeStatus status = challenge.status;\n\n        require(\n            (status == ChallengeStatus.CHALLENGER_TURN && challenge.challenger == msg.sender)\n                || (status == ChallengeStatus.OPERATOR_TURN && challenge.operator == msg.sender),\n            \"PaymentManager.performChallengeBisectionStep: Must be challenger and their turn or operator and their turn\"\n        );\n\n        require(\n            block.timestamp < challenge.settleAt,\n            \"PaymentManager.performChallengeBisectionStep: Challenge has already settled\"\n        );\n\n        uint32 fromTaskNumber = challenge.fromTaskNumber;\n        uint32 toTaskNumber = challenge.toTaskNumber;\n        uint32 diff = (toTaskNumber - fromTaskNumber) / 2;\n\n        /**\n         * @notice Change the challenged interval to the one the challenger cares about.\n         * If the difference between the current start and end is even, then the new interval has an endpoint halfway in-between\n         * If the difference is odd = 2n + 1, the new interval has a \"from\" endpoint at (start + n = end - (n + 1)) if the second half is challenged,\n         * or a \"to\" endpoint at (end - (2n + 2)/2 = end - (n + 1) = start + n) if the first half is challenged\n         * In other words, it's simple when the difference is even, and when the difference is odd, we just always make the first half the smaller one.\n         */\n        if (secondHalf) {\n            challenge.fromTaskNumber = fromTaskNumber + diff;\n            _updateChallengeAmounts(operator, DissectionType.SECOND_HALF, amount1, amount2);\n        } else {\n            challenge.toTaskNumber = fromTaskNumber + diff;\n            _updateChallengeAmounts(operator, DissectionType.FIRST_HALF, amount1, amount2);\n        }\n\n        // update who must respond next to the challenge\n        _updateStatus(operator, diff);\n\n        // extend the settlement time for the challenge, giving the next participant in the interactive fraudproof `paymentFraudproofInterval` to respond\n        challenge.settleAt = uint32(block.timestamp + paymentFraudproofInterval);\n\n        // update challenge struct in storage\n        operatorToPaymentChallenge[operator] = challenge;\n\n        emit PaymentBreakdown(\n            operator, challenge.fromTaskNumber, challenge.toTaskNumber, challenge.amount1, challenge.amount2\n            );\n    }"
}