Function overloading
Some functions in the codebase are overloaded. That makes code less readable and increases the probability of missing bugs.\\nFor example, there are a lot of `reduce` function implementations in DelegationController:\\n```\\nfunction reduce(PartialDifferencesValue storage sequence, uint amount, uint month) internal returns (Fraction memory) {\\n    require(month.add(1) >= sequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    if (sequence.firstUnprocessedMonth == 0) {\\n        return createFraction(0);\\n    }\\n    uint value = getAndUpdateValue(sequence, month);\\n    if (value == 0) {\\n        return createFraction(0);\\n    }\\n\\n    uint \\_amount = amount;\\n    if (value < amount) {\\n        \\_amount = value;\\n    }\\n\\n    Fraction memory reducingCoefficient = createFraction(value.sub(\\_amount), value);\\n    reduce(sequence, reducingCoefficient, month);\\n    return reducingCoefficient;\\n}\\n\\nfunction reduce(PartialDifferencesValue storage sequence, Fraction memory reducingCoefficient, uint month) internal {\\n    reduce(\\n        sequence,\\n        sequence,\\n        reducingCoefficient,\\n        month,\\n        false);\\n}\\n\\nfunction reduce(\\n    PartialDifferencesValue storage sequence,\\n    PartialDifferencesValue storage sumSequence,\\n    Fraction memory reducingCoefficient,\\n    uint month) internal\\n{\\n    reduce(\\n        sequence,\\n        sumSequence,\\n        reducingCoefficient,\\n        month,\\n        true);\\n}\\n\\nfunction reduce(\\n    PartialDifferencesValue storage sequence,\\n    PartialDifferencesValue storage sumSequence,\\n    Fraction memory reducingCoefficient,\\n    uint month,\\n    bool hasSumSequence) internal\\n{\\n    require(month.add(1) >= sequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    if (hasSumSequence) {\\n        require(month.add(1) >= sumSequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    }\\n    require(reducingCoefficient.numerator <= reducingCoefficient.denominator, "Increasing of values is not implemented");\\n    if (sequence.firstUnprocessedMonth == 0) {\\n        return;\\n    }\\n    uint value = getAndUpdateValue(sequence, month);\\n    if (value == 0) {\\n        return;\\n    }\\n\\n    uint newValue = sequence.value.mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n    if (hasSumSequence) {\\n        subtract(sumSequence, sequence.value.sub(newValue), month);\\n    }\\n    sequence.value = newValue;\\n\\n    for (uint i = month.add(1); i <= sequence.lastChangedMonth; ++i) {\\n        uint newDiff = sequence.subtractDiff[i].mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n        if (hasSumSequence) {\\n            sumSequence.subtractDiff[i] = sumSequence.subtractDiff[i].sub(sequence.subtractDiff[i].sub(newDiff));\\n        }\\n        sequence.subtractDiff[i] = newDiff;\\n    }\\n}\\n\\nfunction reduce(\\n    PartialDifferences storage sequence,\\n    Fraction memory reducingCoefficient,\\n    uint month) internal\\n{\\n    require(month.add(1) >= sequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    require(reducingCoefficient.numerator <= reducingCoefficient.denominator, "Increasing of values is not implemented");\\n    if (sequence.firstUnprocessedMonth == 0) {\\n        return;\\n    }\\n    uint value = getAndUpdateValue(sequence, month);\\n    if (value == 0) {\\n        return;\\n    }\\n\\n    sequence.value[month] = sequence.value[month].mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n\\n    for (uint i = month.add(1); i <= sequence.lastChangedMonth; ++i) {\\n        sequence.subtractDiff[i] = sequence.subtractDiff[i].mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n    }\\n}\\n```\\n
Resolution\\nFixed in skalenetwork/skale-manager#181\\nAvoid function overloading as a general guideline.
```\\nfunction reduce(PartialDifferencesValue storage sequence, uint amount, uint month) internal returns (Fraction memory) {\\n    require(month.add(1) >= sequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    if (sequence.firstUnprocessedMonth == 0) {\\n        return createFraction(0);\\n    }\\n    uint value = getAndUpdateValue(sequence, month);\\n    if (value == 0) {\\n        return createFraction(0);\\n    }\\n\\n    uint \\_amount = amount;\\n    if (value < amount) {\\n        \\_amount = value;\\n    }\\n\\n    Fraction memory reducingCoefficient = createFraction(value.sub(\\_amount), value);\\n    reduce(sequence, reducingCoefficient, month);\\n    return reducingCoefficient;\\n}\\n\\nfunction reduce(PartialDifferencesValue storage sequence, Fraction memory reducingCoefficient, uint month) internal {\\n    reduce(\\n        sequence,\\n        sequence,\\n        reducingCoefficient,\\n        month,\\n        false);\\n}\\n\\nfunction reduce(\\n    PartialDifferencesValue storage sequence,\\n    PartialDifferencesValue storage sumSequence,\\n    Fraction memory reducingCoefficient,\\n    uint month) internal\\n{\\n    reduce(\\n        sequence,\\n        sumSequence,\\n        reducingCoefficient,\\n        month,\\n        true);\\n}\\n\\nfunction reduce(\\n    PartialDifferencesValue storage sequence,\\n    PartialDifferencesValue storage sumSequence,\\n    Fraction memory reducingCoefficient,\\n    uint month,\\n    bool hasSumSequence) internal\\n{\\n    require(month.add(1) >= sequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    if (hasSumSequence) {\\n        require(month.add(1) >= sumSequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    }\\n    require(reducingCoefficient.numerator <= reducingCoefficient.denominator, "Increasing of values is not implemented");\\n    if (sequence.firstUnprocessedMonth == 0) {\\n        return;\\n    }\\n    uint value = getAndUpdateValue(sequence, month);\\n    if (value == 0) {\\n        return;\\n    }\\n\\n    uint newValue = sequence.value.mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n    if (hasSumSequence) {\\n        subtract(sumSequence, sequence.value.sub(newValue), month);\\n    }\\n    sequence.value = newValue;\\n\\n    for (uint i = month.add(1); i <= sequence.lastChangedMonth; ++i) {\\n        uint newDiff = sequence.subtractDiff[i].mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n        if (hasSumSequence) {\\n            sumSequence.subtractDiff[i] = sumSequence.subtractDiff[i].sub(sequence.subtractDiff[i].sub(newDiff));\\n        }\\n        sequence.subtractDiff[i] = newDiff;\\n    }\\n}\\n\\nfunction reduce(\\n    PartialDifferences storage sequence,\\n    Fraction memory reducingCoefficient,\\n    uint month) internal\\n{\\n    require(month.add(1) >= sequence.firstUnprocessedMonth, "Can't reduce value in the past");\\n    require(reducingCoefficient.numerator <= reducingCoefficient.denominator, "Increasing of values is not implemented");\\n    if (sequence.firstUnprocessedMonth == 0) {\\n        return;\\n    }\\n    uint value = getAndUpdateValue(sequence, month);\\n    if (value == 0) {\\n        return;\\n    }\\n\\n    sequence.value[month] = sequence.value[month].mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n\\n    for (uint i = month.add(1); i <= sequence.lastChangedMonth; ++i) {\\n        sequence.subtractDiff[i] = sequence.subtractDiff[i].mul(reducingCoefficient.numerator).div(reducingCoefficient.denominator);\\n    }\\n}\\n```\\n