diff --git a/toolkit/pallets/session-validator-management/src/lib.rs b/toolkit/pallets/session-validator-management/src/lib.rs index 37a1b1740..b5ff42f26 100644 --- a/toolkit/pallets/session-validator-management/src/lib.rs +++ b/toolkit/pallets/session-validator-management/src/lib.rs @@ -213,7 +213,14 @@ pub mod pallet { }); if *validators_param != validators { - return Err(InherentError::InvalidValidators); + if *call_selection_inputs_hash == computed_selection_inputs_hash { + return Err(InherentError::InvalidValidators(computed_selection_inputs_hash)); + } else { + return Err(InherentError::InvalidValidatorsHashMismatch( + computed_selection_inputs_hash, + call_selection_inputs_hash.clone(), + )); + } } if *call_selection_inputs_hash != computed_selection_inputs_hash { diff --git a/toolkit/primitives/session-validator-management/src/lib.rs b/toolkit/primitives/session-validator-management/src/lib.rs index 6f12c558e..c01cc2570 100644 --- a/toolkit/primitives/session-validator-management/src/lib.rs +++ b/toolkit/primitives/session-validator-management/src/lib.rs @@ -14,19 +14,21 @@ pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"/ariadne"; pub enum InherentError { #[cfg_attr( feature = "std", - error("The validators in the block do not match the calculated validators") + error("The validators in the block do not match the calculated validators. Input data hash ({}) is valid.", .0.to_hex_string()) )] - InvalidValidators, + InvalidValidators(SizedByteString<32>), #[cfg_attr( feature = "std", - error("Candidates inherent required: committee needs to be stored one epoch in advance") + error("The validators and input data hash in the block do not match the calculated values. Expected hash: {}, got: {}", + .0.to_hex_string(), + .1.to_hex_string()) )] - CommitteeNeedsToBeStoredOneEpochInAdvance, + InvalidValidatorsHashMismatch(SizedByteString<32>, SizedByteString<32>), #[cfg_attr( feature = "std", - error("Inherent called with data hash {0:?} but {1:?} expected from inherent data") + error("Candidates inherent required: committee needs to be stored one epoch in advance") )] - DataHashMismatch(SizedByteString<32>, SizedByteString<32>), + CommitteeNeedsToBeStoredOneEpochInAdvance, } impl IsFatalError for InherentError {