Skip to content

Commit 516c95a

Browse files
authored
Fixed a bug in get_max_long (#669)
1 parent 90981f4 commit 516c95a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

crates/hyperdrive-math/src/long.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ impl State {
165165
}
166166
}
167167

168+
// Ensure that the final result is less than the absolute max and clamp
169+
// to the budget.
170+
if max_base_amount >= absolute_max_base_amount {
171+
panic!("Reached absolute max bond amount in `get_max_long`.");
172+
}
173+
if max_base_amount >= budget {
174+
return budget;
175+
}
176+
168177
max_base_amount
169178
}
170179

0 commit comments

Comments
 (0)