Substrate loading runtime wasm blob in Native execution mode. #5669
Labels
I2-bug
The node fails to follow expected behavior.
I10-unconfirmed
Issue might be valid, but it's not yet known.
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
Hello,
I recently noticed a bottleneck in my project's unit tests where substrate was loading the wasm blob (takes ~1s) when my test was configured to run in NativeWhenPossible mode. This is happening because here substrate is delegating to the wasm blob to load the runtime version. It looks like we can get the runtime version from the NativeVersion struct field of the NativeElseWasmExecutor struct instead of the wasm blob.
With this small change, the wasm load is avoided and my test (which spins up many nodes as a test network) runs 15s faster:
We are on an older fork of substrate, but it looks like this is still an issue in the new repo as well. https://github.com/paritytech/polkadot-sdk/blob/master/substrate/client/executor/src/executor.rs#L650
Does substrate need to go to the wasm blob to cross-check its version with the native version, or is this just an oversight in the implementation? Would a new "AlwaysNative" ExecutionStrategy be a better solution?
Let me know and I can send a PR.
The text was updated successfully, but these errors were encountered: