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

safety precautions for on_idle hook #864

Merged
Merged
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
4 changes: 4 additions & 0 deletions pallets/rolldown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ pub mod pallet {
fn on_idle(_now: BlockNumberFor<T>, mut remaining_weight: Weight) -> Weight {
let mut used_weight = Weight::default();

// given aproximated nature of weights for huge blob read/wirtes and complicated
// benchmarks of on_idle_hook lets consider only 80% of remaining weight
remaining_weight = remaining_weight.saturating_mul(8).saturating_div(10);

// already cached by using in on_initialize hook
if !T::MaintenanceStatusProvider::is_maintenance() {
let get_update_size_cost = T::DbWeight::get().reads(2);
Expand Down
Loading