I want to use WEIGHT_PER_SECOND in this code :

parameter_types! {
    pub const BlockHashCount: BlockNumber = 2400;
    pub const Version: RuntimeVersion = VERSION;
    /// We allow for 2 seconds of compute with a 6 second average block time.
    pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights
        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
    pub const SS58Prefix: u8 = 42;

and I use this code for import WEIGHT_PER_SECOND :

    pub use frame_support::{
        ConstU128, ConstU32, ConstU64, ConstBool,ConstU8, KeyOwnerProofSystem,Nothing, Randomness, StorageInfo,
        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},

I used this part of code in previous versions of substrate but in this version I faced this problem.

What's the problem, and how can I solve it?

1 Answer 1


It was renamed to WEIGHT_REF_TIME_PER_SECOND since with chromatic weights the weight has two components. Ref time and Proof Size.
There also is WEIGHT_PROOF_SIZE_PER_MB here.

  • it show me this error : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct Weight, found u64``
    – Mr Coder
    Feb 1, 2023 at 18:03
  • 1
    You can construct a two-dimensional Weight with Weight::from_parts by passing in the ref-time and proof size. So for example Weight::from_parts(2 * WEIGHT_REF_TIME_PER_SECOND, 5 * WEIGHT_PROOF_SIZE_PER_MB). Feb 1, 2023 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.