Submitted by EV_om, also found by ZanyBonzy and haxatron
Wormhole only supports sending tokens in 8 decimal precision. This is addressed in the code via the getBridgingDecimals() method, which is overridden in WormholeDepositProcessorL1 to return 8. This is then passed as parameter to calculateStakingIncentives() in the Dispenser contract to normalize the transferAmount sent via the bridge to the smaller precision and return the remaining amount to the Tokenomics contract.
However, the withheld amount from the target chain is then subtracted from the transferAmount, so its important that this amount is also normalized in order to avoid precision loss if the resulting amount after subtracting became unnormalized. This is highlighted in the code in the following comment:
However, this is not actually the case and withheld amounts returned via Wormhole are in fact unnormalized. While the amounts are normalized if synced via the fallback privileged syncWithheldAmountMaintenance() function, this logic isnt implemented in the syncWithheldAmount() function, which will be called in the normal flow of operations as follows:
Unnormalized amount will be sent via Wormhole any time a withheld amount is synced from L2. This has several consequences:
Implement the normalizing logic in syncWithheldAmount() as well.
Decimal
kupermind (Olas) disputed and commented:
0xA5DF (judge) commented:
EV_om (warden) commented:
kupermind (Olas) acknowledged and commented:
Note: For full discussion, see here.
Olas mitigated
Varun_05 (warden) commented:
