Resizing the payout schedule with less items might revert
According to some comments in `setPayoutScheduleFixed`, reducing the number of items in the schedule is a supported use case. However in that case, the function will revert because we are iterating over as many items as there was in the previous version of the three arrays making the function revert since the new arrays have less items.\\nLet say they were 4 items in the arrays `tierWinners`, `invoiceComplete` and `supportingDocumentsComplete` and we are resizing the schedule to 3 items. Then the following function would revert because we use the length of the previous arrays instead of the new ones in the for loops.\\n```\\nfunction setPayoutScheduleFixed(\\n        uint256[] calldata _payoutSchedule,\\n        address _payoutTokenAddress\\n    ) external onlyOpenQ {\\n        require(\\n            bountyType == OpenQDefinitions.TIERED_FIXED,\\n            Errors.NOT_A_FIXED_TIERED_BOUNTY\\n        );\\n        payoutSchedule = _payoutSchedule;\\n        payoutTokenAddress = _payoutTokenAddress;\\n\\n        // Resize metadata arrays and copy current members to new array\\n        // NOTE: If resizing to fewer tiers than previously, the final indexes will be removed\\n        string[] memory newTierWinners = new string[](payoutSchedule.length);\\n        bool[] memory newInvoiceComplete = new bool[](payoutSchedule.length);\\n        bool[] memory newSupportingDocumentsCompleted = new bool[](\\n            payoutSchedule.length\\n        );\\n\\n        for (uint256 i = 0; i < tierWinners.length; i++) { <=====================================================\\n            newTierWinners[i] = tierWinners[i];\\n        }\\n        tierWinners = newTierWinners;\\n\\n        for (uint256 i = 0; i < invoiceComplete.length; i++) { <=====================================================\\n            newInvoiceComplete[i] = invoiceComplete[i];\\n        }\\n        invoiceComplete = newInvoiceComplete;\\n\\n        for (uint256 i = 0; i < supportingDocumentsComplete.length; i++) { <=====================================================\\n            newSupportingDocumentsCompleted[i] = supportingDocumentsComplete[i];\\n        }\\n        supportingDocumentsComplete = newSupportingDocumentsCompleted;\\n    }\\n```\\n\\nThe same issue exists on TieredPercentageBounty too.
```\\n        for (uint256 i = 0; i < newTierWinners.length; i++) {\\n            newTierWinners[i] = tierWinners[i];\\n        }\\n        tierWinners = newTierWinners;\\n\\n        for (uint256 i = 0; i < newInvoiceComplete.length; i++) {\\n            newInvoiceComplete[i] = invoiceComplete[i];\\n        }\\n        invoiceComplete = newInvoiceComplete;\\n\\n        for (uint256 i = 0; i < newSupportingDocumentsCompleted.length; i++) {\\n            newSupportingDocumentsCompleted[i] = supportingDocumentsComplete[i];\\n        }\\n        supportingDocumentsComplete = newSupportingDocumentsCompleted;\\n```\\n\\nNote this won't work if increasing the number of items compared to previous state must also be supported. In that case you must use the length of the smallest of the two arrays in each for loop.
Unable to resize the payout schedule to less items than the previous state.
```\\nfunction setPayoutScheduleFixed(\\n        uint256[] calldata _payoutSchedule,\\n        address _payoutTokenAddress\\n    ) external onlyOpenQ {\\n        require(\\n            bountyType == OpenQDefinitions.TIERED_FIXED,\\n            Errors.NOT_A_FIXED_TIERED_BOUNTY\\n        );\\n        payoutSchedule = _payoutSchedule;\\n        payoutTokenAddress = _payoutTokenAddress;\\n\\n        // Resize metadata arrays and copy current members to new array\\n        // NOTE: If resizing to fewer tiers than previously, the final indexes will be removed\\n        string[] memory newTierWinners = new string[](payoutSchedule.length);\\n        bool[] memory newInvoiceComplete = new bool[](payoutSchedule.length);\\n        bool[] memory newSupportingDocumentsCompleted = new bool[](\\n            payoutSchedule.length\\n        );\\n\\n        for (uint256 i = 0; i < tierWinners.length; i++) { <=====================================================\\n            newTierWinners[i] = tierWinners[i];\\n        }\\n        tierWinners = newTierWinners;\\n\\n        for (uint256 i = 0; i < invoiceComplete.length; i++) { <=====================================================\\n            newInvoiceComplete[i] = invoiceComplete[i];\\n        }\\n        invoiceComplete = newInvoiceComplete;\\n\\n        for (uint256 i = 0; i < supportingDocumentsComplete.length; i++) { <=====================================================\\n            newSupportingDocumentsCompleted[i] = supportingDocumentsComplete[i];\\n        }\\n        supportingDocumentsComplete = newSupportingDocumentsCompleted;\\n    }\\n```\\n