Worth noting this is the exact same library that @CetusProtocol built, which literally EVERY CLAMM on Sui relies upon.
The fix transforms this rather dodgy bit:
public fun sub(arg0: I128, arg1: I128) : I128 {
let v0 = I128{bits: u128_neg(arg1.bits)};
add(arg0, wrapping_add(v0, from(1)))
}
Into proper overflow protection:
public fun sub(arg0: I128, arg1: I128) : I128 {
let v0 = wrapping_sub(arg0, arg1);
let v1 = sign(arg0) != sign(arg1) && sign(arg0) != sign(v0);
assert!(!v1, 0);
v0
}
Massive kudos to @bluefinapp for securing the entire Sui CLAMM ecosystem! This is precisely the sort of rigorous security work that benefits everyone.
During our ongoing formal verification with our partners at @AsymptoticTech, of integer-mate – a core math library used across many Sui protocols – we identified an edge case where signed subtraction could behave incorrectly when the second operand reached its minimum possible value.
While the bug had no impact on Bluefin’s systems, the uncertainty around how others might use the library prompted us to act quickly - preparing an improved implementation with our security partners and working closely with Sui Foundation to spread the word to affected DEXs so they could fix this bug.
Thank you to everyone involved: @AsymptoticTech for the deep dive and spotting the edge case, @osec_io’s @NotDeGhost for jumping in on verification, and @SuiNetwork for leading a swift and coordinated response.
This is the kind of collaboration that sets Sui apart. Security is an ongoing commitment, and this quick identification and solve shows we're in this together.
We’ll continue investing in formal verification, architecture reviews, and ecosystem-wide coordination to raise the bar for secure and verifiable DeFi.
2
3.23K
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.