coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.59k stars 1.32k forks source link

lang: Return overflow error from `Lamports` trait operations #2907

Closed acheroncrypto closed 5 months ago

acheroncrypto commented 5 months ago

Problem

Currently, the default behavior of the Lamports methods is to panic on overflow (due to overflow-checks flag).

Summary of changes

Return ProgramError::ArithmeticOverflow in the case of an overflow of Lamports trait methods instead of panicking, giving more flexibility to the developer to gracefully handle overflow situations.

vercel[bot] commented 5 months ago

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.