Fees are stored at full 18-decimal 64-bit precision at the ProtocolFeeController (and calculations are performed on full words), but the aggregate fees are stored with 24-bit precision at the Vault. This corresponds to 0.00001% resolution on fees (which seems like plenty, even for computed values).
As it was, setting fees with a precision greater than this would cause a discrepancy between the ProtocolFeeController's computations (e.g., when splitting fees), and the Vault. If you tried to set a fee of 1.000005%, it would be truncated to 1% in the Vault, so that if you set the fee and then immediately retrieved it, you would not get the same value.
This PR checks for this case at the ProtocolFeeController, and reverts if you try to set a fee with "too high" precision.
Type of change
[ ] Bug fix
[X] New feature
[ ] Breaking change
[ ] Dependency changes
[ ] Code refactor / cleanup
[ ] Documentation or wording changes
[ ] Other
Checklist:
[X] The diff is legible and has no extraneous changes
[ ] Complex code has been commented, including external interfaces
[ ] Tests have 100% code coverage
[X] The base branch is either main, or there's a description of how to merge
Description
Fees are stored at full 18-decimal 64-bit precision at the ProtocolFeeController (and calculations are performed on full words), but the aggregate fees are stored with 24-bit precision at the Vault. This corresponds to 0.00001% resolution on fees (which seems like plenty, even for computed values).
As it was, setting fees with a precision greater than this would cause a discrepancy between the ProtocolFeeController's computations (e.g., when splitting fees), and the Vault. If you tried to set a fee of 1.000005%, it would be truncated to 1% in the Vault, so that if you set the fee and then immediately retrieved it, you would not get the same value.
This PR checks for this case at the ProtocolFeeController, and reverts if you try to set a fee with "too high" precision.
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution
Resolves #602