-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Do not depend on native runtimes for RuntimeApi
#7451
Conversation
These runtime api implementations are only used to make the compiler think that we have implemented all required runtime apis. They will not be called as we switch the executor to `WasmExecutor`. In the near future we will not require these fake implementations anymore after Substrate has shifted away from this compile time requirement. This brings us the advantage that the `polkadot-service` doesn't need to depend on the runtimes for getting the `RuntimeApi` type. It also removes around 1min of build time on my machine ;)
RuntimeApi
} | ||
|
||
#[cfg(feature = "westend-native")] | ||
fn westend_sign_call( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: westend/kusama/rococo sign_call seems to be exact copies (mod runtime name). Maybe this could be somehow avoided (macro maybe?).
bot fmt |
@bkchr https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3107029 was started for your command Comment |
@bkchr Command |
…ot into bkchr-fake-runtime-api
The CI pipeline was cancelled due to failure one of the required jobs. |
* Companion for Polkadot#7451 paritytech/polkadot#7451 * Update Substrate & Polkadot * FMT * Fix integration tests * Bring back `polkadot-native` feature for now * 🤦
* Companion for Polkadot#7451 paritytech/polkadot#7451 * Update Substrate & Polkadot * FMT * Fix integration tests * Bring back `polkadot-native` feature for now * 🤦
The
RuntimeApi
type is being generated byimpl_runtime_apis!
. It is used to check at compile time which runtime apis are implemented. The problem with this is that it requires to import the native runtimes. In the future Substrate will remove this requirement on statically proving that some runtime api is implemented. We also want to move out the runtimes from the Polkadot repo to the fellowship and thus, we could also not depend on them any more and this pull request brings us closer to this goal.This pull request workarounds the compile runtime api check by implementing the runtime apis for some fake runtime. This fake runtime api is then used to fulfill the compile time checks. To ensure that we do not call the native runtime api of your fake implementation, we switch the executor to
WasmExecutor
. This executor can only work with the wasm runtime and nothing else.Besides that the pull request removes the
polkadot-client
crate. This crate was adding complexity that isn't required anymore.Another advantage is that it removes around 1min of build time on my machine ;)
cumulus companion: paritytech/cumulus#2807