Questions tagged [no-std]
The no-std tag has no usage guidance.
14
questions
0
votes
0
answers
23
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` ...
0
votes
2
answers
38
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;...
0
votes
1
answer
30
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?
3
votes
2
answers
52
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 ...
2
votes
1
answer
358
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 ...
0
votes
1
answer
62
views
app_crypto!(sr25519, KEY_TYPE): cannot find trait `TryFrom` in this scope
I am building an ocw demo, the code is from https://github.com/paritytech/substrate/blob/master/frame/examples/offchain-worker/src/lib.rs, when using polkadot-v0.9.25 version, it appears got this ...
1
vote
1
answer
23
views
AssemblyScript Contracts with Javascript Standard Library
I am trying to implement a non-Rust contract using WASM.. Can anyone provide an example, please, of a small contract which returns the balance of an account, completely written in TypeScript / ...
0
votes
1
answer
255
views
duplicate lang item in crate `std` (which `my_crate` depends on): `panic_impl`
I have this hierarchy in my substrate parachain project:
my_parachain/
├── ...
├── runtime folder
└── runtime-common folder
Cargo.lock
Cargo.toml
The above runtime-common has some constants and types ...
0
votes
1
answer
79
views
How can I read JSON files in substrate
I am trying to modify the kitties pallet(https://docs.substrate.io/tutorials/v3/kitties/pt1/) in order to read some json data from an already existing file.
So, I need to read the contents of the file ...
2
votes
1
answer
84
views
Pallet Fails to Build Because of `std` Macros
I am currently facing this Error:
Using rustc version: rustc 1.62.0-nightly (e85edd9a8 2022-04-28)
Compiling frame-support v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=...
1
vote
2
answers
60
views
How to execute an ELF binary after a successful transaction
I am working on figuring out an efficient way to run an ELF binary after successful transaction. I also want to pass arguments along the execution.
Example: /bin/ping 1.1.1.1
OCW might be a solution, ...
2
votes
2
answers
197
views
How to enable `std` features in pallets?
I'm trying to implement simple PoW for my node. After debugging all other stuff I've encountered the problem where finality-grandpa and storage do not get compiled because standard library macros are (...
11
votes
2
answers
121
views
What's the best way to compute square root in Substrate?
I'm working on a quadratic voting function, and I'm trying to use a function like square root. There is no square root function in sp that I could find. What is the best way to do this?
1
vote
2
answers
39
views
Trying to implement Substrate client on IoT, any suggestions?
I'm trying to implement a Substrate client on IoT, to send a basic extrinsic that stores as an example, a key-value. This code needs to run on ARM or ESP32 kinds of chips.
Are there any suggestions on ...