Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport parity storage limitation test #655

Merged
merged 1 commit into from
Aug 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions runtimes/eden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,42 @@ mod tests {

is_submit_signed_transaction::<Runtime>();
}

#[test]
#[ignore = "failing due to preimage depency"]
fn check_pallet_storage_sizes() {
use frame_support::traits::StorageInfoTrait;
let mut storage_info = AllPalletsWithSystem::storage_info();
println!(
"| {:^30} | {:^30} | {:^10} | {:^15} |",
"Pallet", "Storage", "Max Values", "Max Size"
);
println!("| {:-<30} | {:-<30} | {:-<10} | {:-<15} |", "", "", "", "");

storage_info.sort_by_key(|k| k.max_size);
storage_info.reverse();

let mut failed = 0;

for info in storage_info {
let pallet_name = String::from_utf8(info.pallet_name).unwrap();
let storage_name = String::from_utf8(info.storage_name).unwrap();
println!(
"| {:<30} | {:<30} | {:<10} | {:<15} |",
pallet_name,
storage_name,
format!("{:?}", info.max_values),
format!("{:?}", info.max_size)
);

if let Some(size) = info.max_size {
// We set the limit for storage size at 4MB
if size > 4 * 1024 * 1024 {
failed += 1;
}
}
}

assert!(failed == 0, "{} pallets have too big storage", failed);
}
}