File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,8 @@ pub mod pallet {
198
198
ExtractDestDataFailed ,
199
199
/// Failed on the decimal converter
200
200
DecimalConversionFail ,
201
+ /// Deposit nonce has reached max integer qvalue
202
+ DepositNonceOverflow ,
201
203
/// Function unimplemented
202
204
Unimplemented ,
203
205
}
@@ -484,7 +486,10 @@ pub mod pallet {
484
486
485
487
// Bump deposit nonce
486
488
let deposit_nonce = DepositCounts :: < T > :: get ( dest_domain_id) ;
487
- DepositCounts :: < T > :: insert ( dest_domain_id, deposit_nonce + 1 ) ;
489
+ DepositCounts :: < T > :: insert (
490
+ dest_domain_id,
491
+ deposit_nonce. checked_add ( 1 ) . ok_or ( Error :: < T > :: DepositNonceOverflow ) ?,
492
+ ) ;
488
493
489
494
// convert the asset decimal
490
495
let decimal_converted_amount =
@@ -742,11 +747,11 @@ pub mod pallet {
742
747
}
743
748
let amount: u128 = U256 :: from_big_endian ( & data[ 0 ..32 ] )
744
749
. try_into ( )
745
- . expect ( "Amount convert failed. qed ." ) ;
750
+ . expect ( "Amount conversion failed." ) ;
746
751
let recipient_len: usize = U256 :: from_big_endian ( & data[ 32 ..64 ] )
747
752
. try_into ( )
748
- . expect ( "Length convert failed. qed ." ) ;
749
- if data. len ( ) != ( 64 + recipient_len) {
753
+ . expect ( "Length conversion failed." ) ;
754
+ if ( data. len ( ) - 64 ) != recipient_len {
750
755
return None
751
756
}
752
757
let recipient = data[ 64 ..data. len ( ) ] . to_vec ( ) ;
You can’t perform that action at this time.
0 commit comments