Skip to main content

Questions tagged [no-std]

The tag has no usage guidance.

3 votes
1 answer
40 views

Is there a way to use a crate that depends on the `std` in substrate OCW?

from what I've learned so far, the OCW is designed specifically for executing heavy and time-consuming computations outside of the runtime. As the OCW is not a part of runtime/wasm, I guess the OCW ...
Yahor Tsaryk's user avatar
1 vote
1 answer
172 views

Why is serde always std-gated in substrate?

I regularly see serde implemented for various structs across the substrate ecosystem, usually in the single-liner form below. Why is that gated behind the std feature? In serde's documentation, it's ...
Nate Armstrong's user avatar
0 votes
1 answer
67 views

Bech32 encode/decode library for no_std to convert bytes32 into string address in runtime pallet?

I want to convert bytes into string address. I have only two options because of Junction limitation: bytes32 or bytes20. pub enum Junction { ... AccountId32 { network: Option<NetworkId>, ...
rust.dev's user avatar
  • 529
2 votes
2 answers
100 views

Calling std-based host function from a pallet

Based on: Use std only rust library to extend substrate runtime interface? How to understand [runtime-interface] and `Externalities`? I understand that I should be able to: have a crate that is not ...
pmikolajczyk41's user avatar
4 votes
1 answer
114 views

How to parse an ss58 address in no_std rust

In another question How do I work with SS58 encoded addresses? the same question was addressed, this is however about how to do it without the std lib. How to convert an ss58 stored in a String to an ...
Simson's user avatar
  • 1,201
2 votes
1 answer
39 views

Why not implement the sp_std::fmt::Debug for AccountId32 in non-std

https://github.com/paritytech/substrate/blob/d443f148ce0aa6a51798b86c6b3ae54113786f94/primitives/core/src/crypto.rs#L584-L595 Why not implement the sp_std::fmt::Debug for AccountId32 in non-std like ...
zjb0807's user avatar
  • 21
5 votes
0 answers
197 views

How to check if a pallet can be compiled to no-std/WASM?

How to check if a pallet can be compiled to no-std/WASM? I ran: cargo build --no-default-features --target wasm32-unknown-unknown But this didn't work. IIUC, we need some ENV to build the pallet to ...
AurevoirXavier's user avatar
  • 10.8k
1 vote
1 answer
111 views

Why `features = ["std"]` is not necessary in the `[dev-dependencies]` some crates like `sp-io`?

We often use some basic substrate crates such as sp-core, and sp-io while doing pallet tests. In general, those dependencies are put under [dev-dependencies]. But I have an issue with whether we ...
boundless-forest's user avatar
1 vote
1 answer
33 views

Using Valico JSON validator in my pallet

Currently I have problem that Valico is using std based packages like serde and serde_json. Is there any workaround to use this package? UPDATE1: I managed to fork repo and fix some dependencies but ...
Brano Hozza's user avatar
0 votes
0 answers
41 views

How to TRACE "duplicated lang item in crate std: ..."

I have an error of duplicated std, I know there is a lot of questions with the same problem, that's why I'm asking how to search for the problem. I basically have an error of this form (I'm trying to ...
Nathan's user avatar
  • 454
0 votes
1 answer
44 views

fail to use a no_std friendly dependence in smart contract

I try to use barebones-x509 which is no_std friendly to parse x509 certificate. But encounter the mistake. Will you have some advice? error: duplicate lang item in crate `std` (which `barebones_x509` ...
dayday2019's user avatar
0 votes
2 answers
125 views

How to set timestamp in benchmarks?

Is it possible to use std for benchmarks? If not, how can I get timestamps in a benchmark? I tried using this but it didn't compile: #[cfg(feature = "runtime-benchmarks")] extern crate std;...
Robert La Ferla's user avatar
0 votes
1 answer
57 views

Use std only rust library to extend substrate runtime interface?

I have some rust libraries and they have don't have a no_std implementation. Can I use runtime interface to call those libraries?
TaiZe Wang's user avatar
3 votes
2 answers
73 views

Get results of some std operations in benchmarks

We faced a situation the other day where we needed some result of std operations inside of our benchmarks. Specifically, we were looking to generate key pairs and signatures from types given by ...
Justin Frevert's user avatar
2 votes
1 answer
2k views

error: `#[panic_handler]` function required, but not found

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 ...
bingo_boingo_bungus's user avatar

15 30 50 per page