From 57b3d30f8d628a433011371016f020c8a1e0b3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Tue, 15 Aug 2023 03:08:16 +0200 Subject: [PATCH 1/2] Update lib.rs Fix the surplus weight calculation of `Transact` --- xcm/xcm-executor/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-executor/src/lib.rs b/xcm/xcm-executor/src/lib.rs index a48cd3259d67..6606e655fe7e 100644 --- a/xcm/xcm-executor/src/lib.rs +++ b/xcm/xcm-executor/src/lib.rs @@ -569,7 +569,7 @@ impl XcmExecutor { }, }; let actual_weight = maybe_actual_weight.unwrap_or(weight); - let surplus = weight.saturating_sub(actual_weight); + let surplus = require_weight_at_most.saturating_sub(actual_weight); // We assume that the `Config::Weigher` will counts the `require_weight_at_most` // for the estimate of how much weight this instruction will take. Now that we know // that it's less, we credit it. From b481b12244cef79f7e4f0ebc5fc3a4e42ca3ff62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=BCber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Tue, 15 Aug 2023 04:30:12 +0200 Subject: [PATCH 2/2] Update xcm/xcm-executor/src/lib.rs Co-authored-by: Keith Yeung --- xcm/xcm-executor/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcm/xcm-executor/src/lib.rs b/xcm/xcm-executor/src/lib.rs index 6606e655fe7e..d1fc7ed2233b 100644 --- a/xcm/xcm-executor/src/lib.rs +++ b/xcm/xcm-executor/src/lib.rs @@ -570,7 +570,7 @@ impl XcmExecutor { }; let actual_weight = maybe_actual_weight.unwrap_or(weight); let surplus = require_weight_at_most.saturating_sub(actual_weight); - // We assume that the `Config::Weigher` will counts the `require_weight_at_most` + // We assume that the `Config::Weigher` will count the `require_weight_at_most` // for the estimate of how much weight this instruction will take. Now that we know // that it's less, we credit it. //