mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
on_initialize return weight consumed and default cost to default DispatchInfo instead of zero (#5382)
* frame update * doc * move offchain worker trait also * fix weigh merge * indentation * reorder for better git diff * comment * fix benchmark * remove test
This commit is contained in:
@@ -23,7 +23,10 @@
|
||||
pub use pallet_timestamp;
|
||||
|
||||
use sp_std::{result, prelude::*};
|
||||
use frame_support::{decl_storage, decl_module, traits::{FindAuthor, Get, Randomness as RandomnessT}};
|
||||
use frame_support::{
|
||||
decl_storage, decl_module, traits::{FindAuthor, Get, Randomness as RandomnessT},
|
||||
weights::{Weight, SimpleDispatchInfo, WeighData},
|
||||
};
|
||||
use sp_timestamp::OnTimestampSet;
|
||||
use sp_runtime::{generic::DigestItem, ConsensusEngineId, Perbill, PerThing};
|
||||
use sp_runtime::traits::{IsMember, SaturatedConversion, Saturating, Hash};
|
||||
@@ -171,8 +174,10 @@ decl_module! {
|
||||
const ExpectedBlockTime: T::Moment = T::ExpectedBlockTime::get();
|
||||
|
||||
/// Initialization
|
||||
fn on_initialize(now: T::BlockNumber) {
|
||||
fn on_initialize(now: T::BlockNumber) -> Weight {
|
||||
Self::do_initialize(now);
|
||||
|
||||
SimpleDispatchInfo::default().weigh_data(())
|
||||
}
|
||||
|
||||
/// Block finalization
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
//! Consensus extension module tests for BABE consensus.
|
||||
|
||||
use super::*;
|
||||
use frame_support::traits::OnFinalize;
|
||||
use mock::{new_test_ext, Babe, System};
|
||||
use sp_runtime::{traits::OnFinalize, testing::{Digest, DigestItem}};
|
||||
use sp_runtime::testing::{Digest, DigestItem};
|
||||
use sp_consensus_vrf::schnorrkel::{RawVRFOutput, RawVRFProof};
|
||||
use pallet_session::ShouldEndSession;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user