From 29eb5333540c9a353755c466729d85f1e04918fe Mon Sep 17 00:00:00 2001
From: Sebastian Kunert <skunert49@gmail.com>
Date: Tue, 28 Jan 2025 14:59:59 +0100
Subject: [PATCH] Improve `set_validation_data` error message. (#7359)

The old error message was often confusing, because the real reason for
the error will be printed during inherent execution.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
---
 cumulus/pallets/parachain-system/src/lib.rs | 8 ++++++--
 prdoc/pr_7359.prdoc                         | 7 +++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 prdoc/pr_7359.prdoc

diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs
index fa754ea29cc..624f91e7fdf 100644
--- a/cumulus/pallets/parachain-system/src/lib.rs
+++ b/cumulus/pallets/parachain-system/src/lib.rs
@@ -309,8 +309,12 @@ pub mod pallet {
 			<UpgradeRestrictionSignal<T>>::kill();
 			let relay_upgrade_go_ahead = <UpgradeGoAhead<T>>::take();
 
-			let vfp = <ValidationData<T>>::get()
-				.expect("set_validation_data inherent needs to be present in every block!");
+			let vfp = <ValidationData<T>>::get().expect(
+				r"Missing required set_validation_data inherent. This inherent must be
+				present in every block. This error typically occurs when the set_validation_data
+				execution failed and was rejected by the block builder. Check earlier log entries
+				for the specific cause of the failure.",
+			);
 
 			LastRelayChainBlockNumber::<T>::put(vfp.relay_parent_number);
 
diff --git a/prdoc/pr_7359.prdoc b/prdoc/pr_7359.prdoc
new file mode 100644
index 00000000000..e54fcb877d1
--- /dev/null
+++ b/prdoc/pr_7359.prdoc
@@ -0,0 +1,7 @@
+title: Improve `set_validation_data` error message.
+doc:
+- audience: Runtime Dev
+  description: Adds a more elaborate error message to the error that appears when `set_validation_data` is missing in a parachain block.
+crates:
+- name: cumulus-pallet-parachain-system
+  bump: patch
-- 
GitLab