Remove without_storage_info for messages pallet (#1487)

* draft: remove without_storage_info for messages pallet

* some cleanup
This commit is contained in:
Svyatoslav Nikolsky
2022-07-04 15:05:44 +03:00
committed by Bastian Köcher
parent 60edd0c436
commit 7d97e576d0
32 changed files with 283 additions and 181 deletions
@@ -65,11 +65,6 @@ pub mod parachains;
/// at next runtime upgrade.
pub const EXTRA_STORAGE_PROOF_SIZE: u32 = 1024;
/// Maximal size (in bytes) of encoded (using `Encode::encode()`) account id.
///
/// All polkadot-like chains are using same crypto.
pub const MAXIMAL_ENCODED_ACCOUNT_ID_SIZE: u32 = 32;
/// All Polkadot-like chains allow normal extrinsics to fill block up to 75 percent.
///
/// This is a copy-paste from the Polkadot repo's `polkadot-runtime-common` crate.
@@ -429,18 +424,6 @@ pub fn account_info_storage_key(id: &AccountId) -> Vec<u8> {
#[cfg(test)]
mod tests {
use super::*;
use sp_runtime::codec::Encode;
#[test]
fn maximal_encoded_account_id_size_is_correct() {
let actual_size = AccountId::from([0u8; 32]).encode().len();
assert!(
actual_size <= MAXIMAL_ENCODED_ACCOUNT_ID_SIZE as usize,
"Actual size of encoded account id for Polkadot-like chains ({}) is larger than expected {}",
actual_size,
MAXIMAL_ENCODED_ACCOUNT_ID_SIZE,
);
}
#[test]
fn should_generate_storage_key() {
@@ -93,7 +93,7 @@ pub type ParaHasher = crate::Hasher;
pub struct ParaHeadsProof(pub Vec<Vec<u8>>);
impl Size for ParaHeadsProof {
fn size_hint(&self) -> u32 {
fn size(&self) -> u32 {
u32::try_from(self.0.iter().fold(0usize, |sum, node| sum.saturating_add(node.len())))
.unwrap_or(u32::MAX)
}