-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
In the metadata::gas
module, we are panicking if the function costs is negative, in multiple places, but the actual data type is a signed integer.
cairo_native/src/metadata/gas.rs
Line 99 in ac3e1a4
TryInto::<usize>::try_into(*val) |
We should handle the case of a negative gas cost, either by returning a Native Assert in case its impossible, or handling it in case its possible.
See the Native Assert module definition on instructions on how and why to use it:
Lines 133 to 138 in ac3e1a4
/// In Cairo Native we want to avoid the use of panic, even in situation where | |
/// it *should* never happen. The downside of this is that we lose: | |
/// - Possible compiler opitimizations | |
/// - Stack backtrace on error | |
/// | |
/// This modules aims to avoid panics while still obtaining a stack backtrace on eventual errors. |
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
In Review