Skip to content

Commit 1826089

Browse files
fix: error mapping for fee_provision in excess_balance hint (#2236)
* fix: error mapping for fee_provision in excess_balance hint * Update CHANGELOG.md --------- Co-authored-by: Julian Gonzalez Calderon <gonzalezcalderonjulian@gmail.com>
1 parent 57a2ed2 commit 1826089

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#### Upcoming Changes
44

5+
* fix: error mapping for fee_provision in excess_balance hint [#2236](https://github.com/lambdaclass/cairo-vm/pull/2236)
6+
57
* fix: ArcTooBig parameter order in assert_le_felt. [#2234](https://github.com/lambdaclass/cairo-vm/pull/2234)
68

79
* chore: Bump Rust toolchain to 1.89 [#2245](https://github.com/lambdaclass/cairo-vm/pull/2245)

vm/src/hint_processor/builtin_hint_processor/excess_balance.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,12 @@ pub fn excess_balance_hint(
376376
.checked_add(unrealized_funding_pnl)
377377
.and_then(|sum| sum.checked_add(token_assets_value_d))
378378
.ok_or_else(|| HintError::ExcessBalanceCalculationFailed("account_value".into()))?;
379-
let fee_provision = fees
379+
let fee = fees
380380
.get(&account)
381-
.and_then(|fee| abs_balance_value.checked_mul(*fee))
382381
.ok_or_else(|| HintError::ExcessBalanceKeyError("fees".into()))?;
382+
let fee_provision = abs_balance_value
383+
.checked_mul(*fee)
384+
.ok_or_else(|| HintError::ExcessBalanceCalculationFailed("fee_provision".into()))?;
383385
let margin_requirement = position_margin
384386
.checked_add(fee_provision)
385387
.ok_or_else(|| HintError::ExcessBalanceCalculationFailed("margin_requirements".into()))?;

0 commit comments

Comments
 (0)