I have compiled my code successfully and it is running fine in development mode, when I make the staging environment for the same with 3 nodes the code written inside #[cfg(feature = "std")]
is not working properly, means the code inside #[cfg(feature = "std")]
is just skipping during runtime.
1 Answer
With --execution native
, you can force your node to run in native mode. If the local spec_version
match with the on-chain spec_version
, some code will be executed in native mode automatically.
But there are a few things you need to know:
- the code must be no side-effect on the result
- your native node must compile from the latest runtime version code, different runtime versions might have different wasm code
- once the chain gets runtime upgrade, you should upgrade your native node or don't use the native mode
Generally, the std code is some logging code. It doesn't affect the execution result.
All in all, you must not get two different results between native and wasm env. Otherwise, this will cause a consensus problem.
no-std