3

I was making parity-bridges-common compatible to the stable version of polkadot-v0.9.32. I'm getting the error:

expected struct Weight , found integer.

Because earlier the weight in the frame-support was u64 but now it`s struct Weight

struct Weight
 {
    #[codec(compact)]
    /// The weight of computational time used based on some reference hardware.
    ref_time: u64,
    #[codec(compact)]
    /// The weight of storage space used by proof of validity.
    proof_size: u64,
}

Can someone please guide me through this.

enter image description here

2 Answers 2

1

You should convert u64 to Weight struct

Try this from_parts method :https://paritytech.github.io/substrate/master/src/sp_weights/weight_v2.rs.html#118

Example:

Weight::from_parts(25_000_000, u64::MAX)

1
2

Since weight is now two dimensional, you need to provide a Proof size component as well.
The exact value for this depends on the use-case; exactly like the exact Reference Time component depends on the use-case. u64::MAX should just be a place holder and not a default value.

You can then use Weight::from_parts instead of a simple u64 to construct a Weight instance.

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.