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

ensure on_initialize_with_bump_era under block weight limit #2816

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["resolver"]

[workspace]
members = [
"modules/*",
Expand Down
12 changes: 11 additions & 1 deletion runtime/acala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ impl module_homa::Config for Runtime {
type XcmInterface = XcmInterface;
type WeightInfo = weights::module_homa::WeightInfo<Runtime>;
type NominationsProvider = NomineesElection;
type ProcessRedeemRequestsLimit = ConstU32<2_000>;
type ProcessRedeemRequestsLimit = ConstU32<1_000>;
}

parameter_types! {
Expand Down Expand Up @@ -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::<Runtime>::on_initialize_with_bump_era(
<Runtime as module_homa::Config>::ProcessRedeemRequestsLimit::get(),
);
let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2);
assert!(weight.all_lt(block_weight));
}
}
12 changes: 11 additions & 1 deletion runtime/karura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ impl module_homa::Config for Runtime {
type XcmInterface = XcmInterface;
type WeightInfo = weights::module_homa::WeightInfo<Runtime>;
type NominationsProvider = NomineesElection;
type ProcessRedeemRequestsLimit = ConstU32<2_000>;
type ProcessRedeemRequestsLimit = ConstU32<1_000>;
}

parameter_types! {
Expand Down Expand Up @@ -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::<Runtime>::on_initialize_with_bump_era(
<Runtime as module_homa::Config>::ProcessRedeemRequestsLimit::get(),
);
let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2);
assert!(weight.all_lt(block_weight));
}
}
12 changes: 11 additions & 1 deletion runtime/mandala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ impl module_homa::Config for Runtime {
type XcmInterface = XcmInterface;
type WeightInfo = weights::module_homa::WeightInfo<Runtime>;
type NominationsProvider = NomineesElection;
type ProcessRedeemRequestsLimit = ConstU32<2_000>;
type ProcessRedeemRequestsLimit = ConstU32<1_000>;
}

parameter_types! {
Expand Down Expand Up @@ -2865,4 +2865,14 @@ mod tests {
);
});
}

#[test]
fn check_on_initialize_with_bump_era_weight() {
use module_homa::WeightInfo;
let weight = weights::module_homa::WeightInfo::<Runtime>::on_initialize_with_bump_era(
<Runtime as module_homa::Config>::ProcessRedeemRequestsLimit::get(),
);
let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2);
assert!(weight.all_lt(block_weight));
}
}
Loading