From 7ce479626de1cc2965f3908c6f2ea5b22dfdd5af Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Mon, 14 Oct 2024 13:50:09 +1300 Subject: [PATCH] add test for on_initialize_with_bump_era to ensure the weight within block weight limit --- Cargo.toml | 2 -- runtime/acala/src/lib.rs | 10 ++++++++++ runtime/karura/src/lib.rs | 10 ++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index be9b92439..04bec0853 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["resolver"] - [workspace] members = [ "modules/*", diff --git a/runtime/acala/src/lib.rs b/runtime/acala/src/lib.rs index b1cc16320..197a21998 100644 --- a/runtime/acala/src/lib.rs +++ b/runtime/acala/src/lib.rs @@ -2719,4 +2719,14 @@ mod tests { If the limit is too strong, maybe consider increasing the limit", ); } + + #[test] + fn check_on_initialize_with_bump_era_weight() { + use module_homa::WeightInfo; + let weight = weights::module_homa::WeightInfo::::on_initialize_with_bump_era( + ::ProcessRedeemRequestsLimit::get(), + ); + let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2); + assert!(weight.all_lt(block_weight)); + } } diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index b98bdf3ec..b6bad2e71 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -2752,4 +2752,14 @@ mod tests { If the limit is too strong, maybe consider increasing the limit", ); } + + #[test] + fn check_on_initialize_with_bump_era_weight() { + use module_homa::WeightInfo; + let weight = weights::module_homa::WeightInfo::::on_initialize_with_bump_era( + ::ProcessRedeemRequestsLimit::get(), + ); + let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2); + assert!(weight.all_lt(block_weight)); + } }