File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
crates/pallet-evm-swap/src/tests Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -265,3 +265,31 @@ fn swap_both_fails_bridge_evm_no_funds() {
265265 ) ;
266266 } ) ;
267267}
268+
269+ /// This test verifies that both calls fail in case bridge native balance results into overflow.
270+ #[ test]
271+ fn swap_both_fails_bridge_native_overflow ( ) {
272+ new_test_ext ( ) . execute_with_ext ( |_| {
273+ Balances :: write_balance ( & BridgePotNative :: get ( ) , Balance :: MAX ) . unwrap ( ) ;
274+
275+ // Invoke the `swap` under test.
276+ assert_noop ! (
277+ EvmSwap :: swap(
278+ RuntimeOrigin :: signed( source_swap_native_account( ) ) ,
279+ target_swap_evm_account( ) ,
280+ 100 ,
281+ ) ,
282+ DispatchError :: Arithmetic ( ArithmeticError :: Overflow )
283+ ) ;
284+
285+ // Invoke the `swap_keep_alive` under test.
286+ assert_noop ! (
287+ EvmSwap :: swap_keep_alive(
288+ RuntimeOrigin :: signed( source_swap_native_account( ) ) ,
289+ target_swap_evm_account( ) ,
290+ 100 ,
291+ ) ,
292+ DispatchError :: Arithmetic ( ArithmeticError :: Overflow )
293+ ) ;
294+ } ) ;
295+ }
You can’t perform that action at this time.
0 commit comments