Proposal: CGP081 (on-chain 109) MU01 Patch1: Multi-collateral Mento Decimal Fix

Hi all,

During the initial mainnet testing of MU01, we identified a bug in the BiPoolManager, which fails to handle different token precisions correctly. This issue surfaced due to the introduction of axlUSDC, which has 6 decimals, while the original implementation was built to only accommodate tokens with 18 decimals.

To resolve this bug, we propose always representing internal buckets with 18 decimal precision, using precision multipliers for all tokens. The precision multiplier will be calculated as 1^(18 - tokenDecimals). This ensures accurate conversions between different token precisions.

Our solution involves creating a global mapping for token => precisionMultiplier, which avoids breaking changes to the existing storage structure and makes upgrading easier. However, upgrading will require two transactions: changing the implementation and configuring the precision retroactively.

We have thoroughly tested the proposed solution with test cases targeting different token precisions. In addition to these tests, we ran additional tests on a fork of Celo Mainnet with the proposed solution applied. The results of both the targeted tests and the mainnet fork tests have demonstrated the effectiveness of our proposed fix in addressing the token precision issue.
The patch has also been verified and added to the audit report by Verilog.

Once this proposal has passed and been executed we will continue the phased deployment of MU01.

We look forward to the community’s engagement and collaboration on enhancing and reinforcing the protocol.

Mento Labs :fist:

Useful Links

2 Likes