Skip to content

Commit

Permalink
fix: value should be below max_felt
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyRo1 committed Oct 23, 2023
1 parent d322421 commit ac75aab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/oracle/oracle.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ mod Oracle {
let pack_value: felt252 = value.timestamp.into()
+ value.volume.into() * TIMESTAMP_SHIFT_U32
+ value.price.into() * VOLUME_SHIFT_U132;
assert(pack_value.into() <= MAX_FELT, 'EntryStorePacking:value too big');
assert(pack_value.into() < MAX_FELT, 'EntryStorePacking:value too big');
pack_value
}
fn unpack(value: felt252) -> EntryStorage {
Expand Down Expand Up @@ -404,7 +404,7 @@ mod Oracle {
+ value.value.into() * CHECKPOINT_TIMESTAMP_SHIFT_U32
+ converted_agg_mode.into() * CHECKPOINT_VALUE_SHIFT_U160
+ value.num_sources_aggregated.into() * CHECKPOINT_AGGREGATION_MODE_SHIFT_U172;
assert(pack_value.into() <= MAX_FELT, 'CheckpointPacking:value too big');
assert(pack_value.into() < MAX_FELT, 'CheckpointPacking:value too big');
pack_value
}
fn unpack(value: felt252) -> Checkpoint {
Expand Down

0 comments on commit ac75aab

Please sign in to comment.