I looked at the code that was wrong with Cetus last night, and the first thing I was very suspicious about get_delta_b was why this function would convert u256 to u64, which caused the accuracy interception problem. After asking the AI, it is likely that when cetus migrated all the uniswap v3 formulas, because uni uses a fixed point, it needs to be converted to a floating-point number without careful security consideration. This kind of business logic, which belongs to the algorithm level, is difficult to detect in code audits, unless the audit institution also has researchers who are familiar with both algorithms and code. Here's the logic of why AI analyzes the code the way it does: Based on my analysis of the codebase, I can now explain why the author chose to implement it this way get_delta_b functions, and possible causes: Why the author of the function implements get_delta_b way Performance optimization: ) and bitmask directly handle U256 types. This is most likely to improve...
Show original
56.13K
2
The content on this page is provided by third parties. Unless otherwise stated, OKX is not the author of the cited article(s) and does not claim any copyright in the materials. The content is provided for informational purposes only and does not represent the views of OKX. It is not intended to be an endorsement of any kind and should not be considered investment advice or a solicitation to buy or sell digital assets. To the extent generative AI is utilized to provide summaries or other information, such AI generated content may be inaccurate or inconsistent. Please read the linked article for more details and information. OKX is not responsible for content hosted on third party sites. Digital asset holdings, including stablecoins and NFTs, involve a high degree of risk and can fluctuate greatly. You should carefully consider whether trading or holding digital assets is suitable for you in light of your financial condition.