diff --git a/primitives/self-contained/src/checked_extrinsic.rs b/primitives/self-contained/src/checked_extrinsic.rs index 9148e45183..1ee1ff7c30 100644 --- a/primitives/self-contained/src/checked_extrinsic.rs +++ b/primitives/self-contained/src/checked_extrinsic.rs @@ -15,7 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use frame_support::dispatch::{DispatchInfo, GetDispatchInfo}; +use frame_support::{ + dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo}, + pallet_prelude::Weight, +}; use sp_runtime::{ traits::{ self, DispatchInfoOf, Dispatchable, MaybeDisplay, Member, PostDispatchInfoOf, @@ -62,7 +65,7 @@ impl traits::Applyable where AccountId: Member + MaybeDisplay, Call: Member - + Dispatchable + + Dispatchable + SelfContainedCall, Extra: SignedExtension, Origin: From>, @@ -148,7 +151,26 @@ where TransactionValidityError::Invalid(InvalidTransaction::BadProof), )?; let post_info = match res { - Ok(info) => info, + Ok(PostDispatchInfo { + actual_weight, + pays_fee, + }) => { + if let Some(weight) = &actual_weight { + // Ethereum extrinsic size is accounted twice for proof size, + // so we need to substract it's size here. + PostDispatchInfo { + actual_weight: Some( + weight.saturating_sub(Weight::from_parts(0, len as u64)), + ), + pays_fee, + } + } else { + PostDispatchInfo { + actual_weight, + pays_fee, + } + } + } Err(err) => err.post_info, }; Extra::post_dispatch(