https://github.com/cardinal-cryptography/dev-runtime-interfaces
A collection of useful, dirty runtime interfaces
https://github.com/cardinal-cryptography/dev-runtime-interfaces
Last synced: 4 months ago
JSON representation
A collection of useful, dirty runtime interfaces
- Host: GitHub
- URL: https://github.com/cardinal-cryptography/dev-runtime-interfaces
- Owner: Cardinal-Cryptography
- Created: 2024-03-26T14:17:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-04T08:02:58.000Z (about 1 year ago)
- Last Synced: 2025-01-09T03:49:00.418Z (6 months ago)
- Language: Rust
- Size: 25.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aleph-dev-runtime-interfaces
A collection of runtime interfaces (Substrate's concept for outsourcing computation from Runtime to the host) for Aleph Zero chain.
_For development / debugging purposes only._# Usage
1. Clone the repository:
```bash
git clone https://github.com/Cardinal-Cryptography/dev-runtime-interfaces
```2. Change the source of Substrate libraries in [`Cargo.toml`](./Cargo.toml), e.g.:
```toml
sp-runtime-interface = { git = "https://github.com/Cardinal-Cryptography/polkadot-sdk.git", branch = "my-experimental-branch", default-features = false }
```3. Add the runtime interfaces to your **node** (enabling the interfaces you need with features) in the node's `Cargo.toml`, e.g.:
```toml
aleph-dev-runtime-interfaces = { path = "local/path/to/the/clone", features = ["std", "now"] }
```4. Register host functions in the node's executor:
```rust
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
type ExtendHostFunctions = (aleph_dev_runtime_interfaces::now::HostFunctions,);
// ...
}
```5. Add the runtime interfaces to your **runtime** (enabling the features you need with features) in the target pallets' `Cargo.toml`, e.g.:
```toml
aleph-dev-runtime-interfaces = { path = "local/path/to/the/clone", default-features = false, features = ["now"] }
```6. Use the runtime interfaces in your runtime:
```rust
#[pallet::weight(...)]
pub fn call(...) -> ... {
log::error!("[call][start] {}", aleph_runtime_interfaces::now::now());
// ...
}
```