Router Tolerance
Overview
Router tolerance is a safety mechanism that allows for minor discrepancies between expected and actual returns when interacting with components. This accounts for potential rounding differences in share/asset calculations across different protocols.
Configuration
Set by Registry Owner via
setTolerance()
functionCan be configured independently for each Router
Default value is 1 (smallest possible unit)
Should be kept minimal to ensure tight bounds on returns
Example Usage
// If actual shares returned are within tolerance of expected, transaction succeeds
if ((sharesReturned + tolerance) < expectedShares) {
revert ErrorsLib.InsufficientSharesReturned();
}
Governance Process
Registry Owner identifies need for tolerance adjustment
Proposes new tolerance value based on component behavior
Executes
setTolerance()
on target Router:
router.setTolerance(newToleranceValue);
Tolerance values should be carefully considered as they represent acceptable slippage in component interactions. Higher values provide more flexibility but reduce precision of return validation.
Last updated