I'm trying to add Substrate to my project and am encountering this error when trying to compile. Do I need to set this explicitly somewhere in my runtime? I see there is an implementation in sp_io
but not sure how to tell the compiler to use it, or perhaps there is a different way that I'm supposed to add this functionality back into a no_std
project? I haven't worked super extensively with no_std
feature (or lack thereof), so might be missing something. I could implement it myself but since I don't see that in the example project I figure there must be a way that I'm unaware of.
I don't have anything in my project really as of yet, just trying to figure out which dependencies I need and which I can prune for my very simple use case. Here is my build file:
[package]
name = "core"
version = "0.1.0"
description = "Core logic & chain."
edition = "2021"
[dependencies]
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" } #Added this to try to get the `#[panic_handler]` impl
[build-dependencies]
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.23" }
[features]
default = ["std"]
std = [
"frame-support/std",
"frame-system/std",
"pallet-transaction-payment/std",
"sp-api/std",
"sp-std/std",
"sp-core/std",
"sp-io/std"
]
build.rs
use substrate_wasm_builder::WasmBuilder;
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
}
All I have in lib.rs
#![cfg_attr(not(feature = "std"), no_std)]
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));