@@ -402,7 +402,7 @@ fn map_price_aggregated(
402402
403403 let mut aggregated_total = Decimal :: zero ( ) ;
404404 let mut aggregated_count = 0 ;
405- let mut aggregated_weightage = 0u8 ;
405+ let mut aggregated_weightage = 0 ;
406406
407407 let oracles_len = oracles. len ( ) ;
408408 for oracle in oracles {
@@ -424,12 +424,8 @@ fn map_price_aggregated(
424424 let time_diff = Decimal :: from ( feed. time ) - Decimal :: from ( context. block . time ) ;
425425 if Decimal :: abs ( & time_diff) < dec ! ( 3600 ) {
426426 aggregated_count += 1 ;
427- aggregated_weightage =
428- aggregated_weightage
429- . checked_add ( oracle. weightage )
430- . context ( OtherSnafu {
431- msg : "Error adding oracle weightage" ,
432- } ) ?;
427+ aggregated_weightage += oracle. weightage ;
428+
433429 log:: trace!(
434430 "SetOracleData weightage: {:?} * oracle_price.amount: {:?}" ,
435431 aggregated_weightage,
@@ -785,8 +781,8 @@ pub fn invalidate_oracle_interval(
785781 aggregated : OraclePriceAggregatedIntervalAggregated {
786782 amount : aggregated_amount. to_string ( ) ,
787783 weightage : aggregated_weightage
788- . to_u8 ( )
789- . context ( ToPrimitiveSnafu { msg : "to_u8 " } ) ?,
784+ . to_u32 ( )
785+ . context ( ToPrimitiveSnafu { msg : "to_u32 " } ) ?,
790786 count,
791787 oracles : OraclePriceAggregatedIntervalAggregatedOracles {
792788 active : aggregated_active
@@ -847,8 +843,8 @@ fn forward_aggregate(
847843 aggregated : OraclePriceAggregatedIntervalAggregated {
848844 amount : aggregated_amount. to_string ( ) ,
849845 weightage : aggregated_weightage
850- . to_u8 ( )
851- . context ( ToPrimitiveSnafu { msg : "to_u8 " } ) ?,
846+ . to_u32 ( )
847+ . context ( ToPrimitiveSnafu { msg : "to_u32 " } ) ?,
852848 count,
853849 oracles : OraclePriceAggregatedIntervalAggregatedOracles {
854850 active : aggregated_active
0 commit comments