Skip to content

Commit

Permalink
Revert weight changes & limit block consumption to 1/10th
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Oct 3, 2024
1 parent 228da0a commit e8ebcfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion substrate/frame/distribution/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<T: Config> Pallet<T> {
// funds for created `SpendInfos`. the function will be use in a hook.

pub fn begin_block(now: BlockNumberFor<T>) -> Weight {
let max_block_weight = T::BlockWeights::get().max_block;
let max_block_weight = T::BlockWeights::get().max_block/10;
let epoch = T::EpochDurationBlocks::get();

//We reach the check period
Expand Down
9 changes: 3 additions & 6 deletions substrate/frame/opf/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,10 @@ impl<T: Config> Pallet<T> {
// To be executed in a hook, on_initialize
pub fn on_idle_function(now: BlockNumberFor<T>, limit: Weight) -> Weight {
let mut meter = WeightMeter::with_limit(limit);
//let max_block_weight = T::BlockWeights::get().max_block;
let max_block_weight = T::BlockWeights::get().max_block/10;

if meter
.try_consume(<T as Config>::WeightInfo::unlock_funds(T::MaxWhitelistedProjects::get()))
.is_err()
{
return <T as Config>::WeightInfo::unlock_funds(T::MaxWhitelistedProjects::get());
if meter.try_consume(max_block_weight).is_err() {
return meter.consumed();
}
let mut round_index = VotingRoundNumber::<T>::get();

Expand Down

0 comments on commit e8ebcfc

Please sign in to comment.