For example, if a have a variable of type <T as frame_system::Config>::BlockNumber how could I convert it into a u64, simply putting u64::from doesn't work.

1 Answer 1

use sp_runtime::traits::SaturatedConversion;

fn f(block_number: BlockNumber) {
  • Depending on what is the intended behaviour when the block number doesn't fit into 64 bits, using CheckedConversion might be an option as well. Commented Sep 27, 2022 at 9:07

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.