From 2b12902104b714706def55b1dff8d4a2e8c417b0 Mon Sep 17 00:00:00 2001 From: icodezjb Date: Sun, 4 Feb 2024 18:51:48 +0800 Subject: [PATCH] Check balance overflow --- frame/evm/src/runner/stack.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frame/evm/src/runner/stack.rs b/frame/evm/src/runner/stack.rs index 828d5d8fcd..d7b0aceb55 100644 --- a/frame/evm/src/runner/stack.rs +++ b/frame/evm/src/runner/stack.rs @@ -611,10 +611,12 @@ impl<'vicinity, 'config, T: Config> StackStateT<'config> T::Currency::transfer( &source, &target, - value.low_u128().unique_saturated_into(), + value + .try_into() + .map_err(|_| ExitError::OutOfFund)?, ExistenceRequirement::AllowDeath, ) - .map_err(|_| ExitError::OutOfFund) + .map_err(|_| ExitError::OutOfFund) } fn reset_balance(&mut self, _address: H160) {