5

I'm currently studying/debugging the Treasury and the Society pallets. So I keep running the cargo build --release to get my changes on a new binary.

But the build takes too long (minutes) just to reflect an addition/removal of a log::info!("...") line.

Is there a better (quicker) way to debug the runtime?

1 Answer 1

5

Great question!

You can always use the Substrate Playground.

As far as builds, I typically work off of the substrate-node-template repo which is "lighter" than the full substrate repo (which includes all the pallets) when it comes to building the whole codebase.

For development purposes I will run cargo build without the --release flag which according to rust will skip optimizations and therefore should be faster. cargo check is even faster but does not produce the final binary.

If I am debugging a specific pallet, I will only compile that pallet (without the release flag): cargo build -p super-pallet instead of compiling the entire node. You can also run cargo check -p super-pallet which should be even faster.

As a side note, for code-related debugging I recommend the rust analyzer extension in VS Code in combination with GitLens which is useful for debugging Substrate code.

And there are also helpful Substrate debugging tips here:

1
  • 2
    Thanks for all the tips, @bruno! I would only add the option to run cargo test -p super-pallet for a specific pallet in order to quick check its code. Commented Feb 16, 2022 at 8:42

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.