-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add build targets for building a runtime without custom host function references, suitable for using with Chopsticks #2651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nction references, suitable for using with Chopsticks
enddynayn
left a comment
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.
Nice! 👍
aramikm
left a comment
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.
You need to bump the version for runtime since you are adding a new runtime
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
| // Block reindex_offchain if we've disabled custom host functions | ||
| #[cfg(feature = "no-custom-host-functions")] | ||
| RuntimeCall::Msa(pallet_msa::Call::reindex_offchain { .. }) => false, | ||
|
|
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.
Keeping consistent with existing precedent: rather than remove this extrinsic from the pallet (which would cause metadata to be different), if custom host functions are disabled we simply filter the call.
| - name: Set Up Cargo Deny | ||
| run: | | ||
| cargo install --force --locked cargo-deny@0.18.5 | ||
| cargo install --force --locked cargo-deny@0.18.9 |
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.
Had to bump cargo-deny because the latest advisory DB was not parseable with 0.18.5. Selected the current latest, 0.18.9
| { id = "RUSTSEC-2025-0057", reason = "Remove when https://github.com/paritytech/polkadot-sdk/pull/8714 is merged into a stable release. (Should be in stable2509 tag)"}, | ||
| { id = "RUSTSEC-2025-0118", reason = "Remove when polkadot-sdk updates to a fixed wasmtime."} | ||
| { id = "RUSTSEC-2025-0118", reason = "Remove when polkadot-sdk updates to a fixed wasmtime."}, | ||
| { id = "RUSTSEC-2025-0137", reason = "Transitive dependency polkadot-sdk => alloy-primitives => ruint; Fixed ruint >= 1.17.1. No dependency fixes upstream yet." } |
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.
Added an exception. No fixes yet in the dependency path; probably not until polkadot-sdk@stable2603 at least.
aramikm
left a comment
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.
Looks great!
Goal
The goal of this PR is to enable building a WASM runtime that can be used directly with Chopsticks to build blocks.
Chopsticks runs its own node code that does not include Frequency's custom host functions. While it is possible to instruct Chopsticks to ignore unresolved host function references when loading the WASM, there remains the problem that any runtime calls to the unresolved host function(s) will result in a WASM trap/abort.
This PR adds a new Cargo feature flag,
no-host-functions, that causes the WASM runtime to be compiled without any compile-time OR runtime references to custom host functions, thereby enabling such a runtime to be used to produce blocks when running under Chopsticks.Usage
In order to build a WASM runtime suitable for using with Chopsticks, see the README
Checklist