diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1fb11783..f4a9c77421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ #### Upcoming Changes +* fix: error mapping for fee_provision in excess_balance hint [#2236](https://github.com/lambdaclass/cairo-vm/pull/2236) + * fix: ArcTooBig parameter order in assert_le_felt. [#2234](https://github.com/lambdaclass/cairo-vm/pull/2234) * chore: Bump Rust toolchain to 1.89 [#2245](https://github.com/lambdaclass/cairo-vm/pull/2245) diff --git a/vm/src/hint_processor/builtin_hint_processor/excess_balance.rs b/vm/src/hint_processor/builtin_hint_processor/excess_balance.rs index 4c676053ce..5d22b3d33d 100644 --- a/vm/src/hint_processor/builtin_hint_processor/excess_balance.rs +++ b/vm/src/hint_processor/builtin_hint_processor/excess_balance.rs @@ -376,10 +376,12 @@ pub fn excess_balance_hint( .checked_add(unrealized_funding_pnl) .and_then(|sum| sum.checked_add(token_assets_value_d)) .ok_or_else(|| HintError::ExcessBalanceCalculationFailed("account_value".into()))?; - let fee_provision = fees + let fee = fees .get(&account) - .and_then(|fee| abs_balance_value.checked_mul(*fee)) .ok_or_else(|| HintError::ExcessBalanceKeyError("fees".into()))?; + let fee_provision = abs_balance_value + .checked_mul(*fee) + .ok_or_else(|| HintError::ExcessBalanceCalculationFailed("fee_provision".into()))?; let margin_requirement = position_margin .checked_add(fee_provision) .ok_or_else(|| HintError::ExcessBalanceCalculationFailed("margin_requirements".into()))?;