File tree Expand file tree Collapse file tree
runtime/hydradx/src/weights Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1117,6 +1117,7 @@ pub mod pallet {
11171117 /// - `ShareAssetInPoolAssets`: If the share asset is among the pool assets.
11181118 /// - `AssetNotRegistered`: If one or more assets are not registered in the AssetRegistry.
11191119 /// - `InvalidAmplification`: If the amplification parameter is invalid.
1120+ /// - `IncorrectInitialPegs`: If the number of peg sources does not match the number of assets.
11201121 /// - `MissingTargetPegOracle`: If the target peg oracle entry is missing.
11211122 /// - `IncorrectAssetDecimals`: If the assets have different decimals.
11221123 ///
@@ -2216,10 +2217,18 @@ impl<T: Config> Pallet<T> {
22162217 peg_sources. len( ) ,
22172218 "Pool assets and peg sources must have the same length"
22182219 ) ;
2220+ ensure ! (
2221+ pool_assets. len( ) == peg_sources. len( ) ,
2222+ Error :: <T >:: IncorrectInitialPegs
2223+ ) ;
22192224 debug_assert ! (
22202225 pool_assets. windows( 2 ) . all( |w| w[ 0 ] <= w[ 1 ] ) ,
22212226 "pool_assets must be sorted ascending"
22222227 ) ;
2228+ ensure ! (
2229+ pool_assets. windows( 2 ) . all( |w| w[ 0 ] <= w[ 1 ] ) ,
2230+ Error :: <T >:: IncorrectAssets
2231+ ) ;
22232232
22242233 if pool_assets. is_empty ( ) {
22252234 // Should never happen
You can’t perform that action at this time.
0 commit comments