Thanks for your reply. Could you please elaborate on that. I am new to rust. Would be very helpful
you mean this --> serde = { version = '1.0.100', default-features = false, features = ['derive'] }
this already have in my cargo.toml
I mean the similar thing for primitive_types
:
primitive_types = { version = "0.10.1", features = ["serde"] }
thank you so much this i've added it in Cargo.toml file under [dependencies]
should i add it under [features] as well? if so how it should look like?
currently it is as like below
[features]
default = ['std']
std = [
'primitive-types/std'
]
The [features]
section is only for parts of your own code that are optional. You should only add it there if you are writing a library with serde support, and you want that serde support to be optional.
That seems to be unrelated to the topic of serializing U256
. You have to enable the std
feature of sp_io
to get it to work together with the standard library.
Yes I have already enabled std feature of sp_io. still stuck on it. kindly help
Please post your Cargo.toml
parking_lot = '0.11'
parity-scale-codec = { version = '2.0', default-features = false, features = ['derive'] }
# https://github.com/serde-rs/json/pull/606
#serde = {version = "0.9", default-features = false, features = ['derive'] }
serde_derive = "0.9"
#serde_json = {version = "0.9", default-features = false, features = ['alloc'] }
serde = { version = '1.0.100', default-features = true, features = ['derive'] }
serde_json = { version = '1.0.45', default-features = false, features = ['alloc'] }
futures = { version = "0.3", default-features = false}
#EthEventListenMethod dependency
web3 = { version = "0.14.0", optional = true}
tokio = { version = "0.2", default-features = false, features = ['macros']}
hex-literal = { version = "0.3.1", default-features = false }
hex = {version = "0.4.3", default-features = false}
# Substrate packages
frame-support = { version = '3.0', default-features = false }
frame-system = { version = '3.0', default-features = false }
sp-arithmetic = { version = '3.0', default-features = false }
sp-core = { version = '3.0', default-features = false }
sp-io = { version = '3.0', default-features = true}
sp-runtime = { version = '3.0', default-features = false }
sp-std = { version = '3.0', default-features = false }
sp-keystore = { version = '0.9', optional = true }
sc-keystore = {version = "3.0.0", optional = true}
# substrate-primitives = {version = "1.0.0", default-features = false}
primitive-types = {version = "0.10.1", default-features = false, features = ["serde"] }
#ethereum-types = {version = "0.12.0", default-features = false, }
#ethabi = {version = "15.0.0", default-features = false}
#uint = {version = "0.8", default-features = false}
[features]
default = ['std']
std = [
'frame-support/std',
'frame-system/std',
'parity-scale-codec/std',
'sp-keystore',
'sc-keystore',
'sp-io/std',
'sp-runtime/std',
'sp-std/std',
'sp-arithmetic/std',
'sp-keystore/std',
'web3',
'hex/std',
'tokio/macros',
'futures/std',
'primitive-types/std'
]```
Please learn how to use code blocks.
parking_lot = '0.11'
parity-scale-codec = { version = '2.0', default-features = false, features = ['derive'] }
# https://github.com/serde-rs/json/pull/606
#serde = {version = "0.9", default-features = false, features = ['derive'] }
serde_derive = "0.9"
#serde_json = {version = "0.9", default-features = false, features = ['alloc'] }
serde = { version = '1.0.100', default-features = true, features = ['derive'] }
serde_json = { version = '1.0.45', default-features = false, features = ['alloc'] }
futures = { version = "0.3", default-features = false}
#EthEventListenMethod dependency
web3 = { version = "0.14.0", optional = true}
tokio = { version = "0.2", default-features = false, features = ['macros']}
hex-literal = { version = "0.3.1", default-features = false }
hex = {version = "0.4.3", default-features = false}
# Substrate packages
frame-support = { version = '3.0', default-features = false }
frame-system = { version = '3.0', default-features = false }
sp-arithmetic = { version = '3.0', default-features = false }
sp-core = { version = '3.0', default-features = false }
sp-io = { version = '3.0', default-features = true}
sp-runtime = { version = '3.0', default-features = false }
sp-std = { version = '3.0', default-features = false }
sp-keystore = { version = '0.9', optional = true }
sc-keystore = {version = "3.0.0", optional = true}
# substrate-primitives = {version = "1.0.0", default-features = false}
primitive-types = {version = "0.10.1", default-features = false, features = ["serde"] }
#ethereum-types = {version = "0.12.0", default-features = false, }
#ethabi = {version = "15.0.0", default-features = false}
#uint = {version = "0.8", default-features = false}
[features]
default = ['std']
std = [
'frame-support/std',
'frame-system/std',
'parity-scale-codec/std',
'sp-keystore',
'sc-keystore',
'sp-io/std',
'sp-runtime/std',
'sp-std/std',
'sp-arithmetic/std',
'sp-keystore/std',
'web3',
'hex/std',
'tokio/macros',
'futures/std',
'primitive-types/std'
]
Thanks for pointing it out. Edited the previous Cargo.toml content pasted above
How are you compiling it? Try with cargo build --features std
I am doing cargo check. i am not building . in cargo check only i am facing this issue.
Tried with cargo build --features std
still same error
You could try to add the disable_panic_handler
feature to sp_io
, but it really should work based on my reading the source code.
Thank you so much for your help. That resolved the issue. But now getting another error. Really frustrating. Kindly help
error[E0046]: not all trait items implemented, missing: `Pair` --> /home/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-application-crypto-3.0.0/src/lib.rs:240:3 | 240 | impl $crate::CryptoType for Public {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Pair` in implementation
That seems like a mistake in the sp-application-crypto
crate. You should probably check the documentation to see if it mentions this, or ask the authors of the crate.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.