Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using synedrion as a dependency of a pallet #961

Closed
ameba23 opened this issue Jul 25, 2024 · 3 comments · Fixed by #955
Closed

Using synedrion as a dependency of a pallet #961

ameba23 opened this issue Jul 25, 2024 · 3 comments · Fixed by #955

Comments

@ameba23
Copy link
Contributor

ameba23 commented Jul 25, 2024

@HCastano wants to use synedrion as a dependency of a pallet - probably the registry pallet.

This means it needs to work on wasm with no-std - which it should do since it doesn't use the standard library and is tested on wasm.

Hernando tried making an empty #![no_std] crate with the following two dependencies:

synedrion = { path="<my local copy>", default-features=false }
frame-support = { version="29.0.0", default-features=false }

But on compiling gets the following error:

❯ cargo check --no-default-features --target wasm32-unknown-unknown
    Checking sp-io v31.0.0
error[E0152]: found duplicate lang item `panic_impl`
    --> /Users/hcastano/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sp-io-31.0.0/src/lib.rs:1768:1
     |
1768 | / pub fn panic(info: &core::panic::PanicInfo) -> ! {
1769 | |     let message = sp_std::alloc::format!("{}", info);
1770 | |     #[cfg(feature = "improved_panic_error_reporting")]
1771 | |     {
...    |
1778 | |     }
1779 | | }
     | |_^
     |
     = note: the lang item is first defined in crate `std` (which `serde` depends on)
     = note: first definition in `std` loaded from /Users/hcastano/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libstd-2bf3225a2841264f.rlib
     = note: second definition in the local crate (`sp_io`)

For more information about this error, try `rustc --explain E0152`.
error: could not compile `sp-io` (lib) due to 1 previous error

Doing cargo tree --edges features shows that serde's std feature is introduced by dependencies of frame-support, not synedrion - which is why i have made this issue here rather than in synedrion. But strangely, if we remove synedrion as a dependency, the crate will build, even though we can see that the std feature of serde is still present with cargo-tree.

But frame-support is used by our pallets with no issues.

And if i add synedrion as a dependency of the registry pallet, the pallet compiles, as does the entropy binary. So although this seems strange, im not sure its an issue. Or maybe i just can't see the issue.

@fjarri
Copy link
Member

fjarri commented Jul 26, 2024

Is it still the case after entropyxyz/synedrion#137 ?

@ameba23
Copy link
Contributor Author

ameba23 commented Jul 31, 2024

Is it still the case after entropyxyz/synedrion#137 ?

yes - although that has for sure made a difference - on earlier commits there is a different compiler error.

@ameba23
Copy link
Contributor Author

ameba23 commented Jul 31, 2024

From @HCastano:

So you are able to get pallet-registry compiling with Synedrion as a dependency?
Are you compiling for the Wasm target and no default features?

Ah sorry no you are right with cargo build --target wasm32-unknown-unknown --no-default-features i see the same duplicate panic implementation error as above.

I am not sure how to figure this out because without synedrion as a dependency, the crate builds, but we can still see serde v1.0.204 with feature std is in the dependency tree.

I am confused that the entropy chain node still compiles when we have the registry pallet with synedrion as a dependency - does the chain node not build the runtime internally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants