Add integrity check for signed extensions (#1780)

* Add integrity check for signed extensions

* Remove unneeded type specification
This commit is contained in:
Serban Iorga
2023-01-18 12:47:20 +02:00
committed by Bastian Köcher
parent 4cdb85247e
commit 2ff3a7aa38
13 changed files with 64 additions and 19 deletions
@@ -26,6 +26,7 @@ use bp_runtime::{Chain, ChainId};
use codec::Encode;
use frame_support::{storage::generator::StorageValue, traits::Get};
use frame_system::limits;
use sp_runtime::traits::SignedExtension;
/// Macro that ensures that the runtime configuration and chain primitives crate are sharing
/// the same types (index, block number, hash, hasher, account id and header).
@@ -319,3 +320,15 @@ pub fn check_message_lane_weights<C: Chain, T: frame_system::Config>(
this_chain_max_unconfirmed_messages,
);
}
/// Check that the `AdditionalSigned` type of a wrapped runtime is the same as the one of the
/// corresponding actual runtime.
///
/// This method doesn't perform any `assert`. If the condition is not true it will generate a
/// compile-time error.
pub fn check_additional_signed<SignedExt, IndirectSignedExt: SignedExtension>()
where
SignedExt: SignedExtension,
IndirectSignedExt: SignedExtension<AdditionalSigned = SignedExt::AdditionalSigned>,
{
}