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

missing crate node-primitives on crates.io for 2.0.0-alpha.5 #28

Closed
brenzi opened this issue Mar 31, 2020 · 5 comments
Closed

missing crate node-primitives on crates.io for 2.0.0-alpha.5 #28

brenzi opened this issue Mar 31, 2020 · 5 comments

Comments

@brenzi
Copy link

brenzi commented Mar 31, 2020

I just tried to migrate our node to 2.0.0-alpha.5 starting with a fresh node-template.
For my pallet test mock I use use node_primitives::{AccountId, Signature};

But that crate is not on crates.io.

Therefore I'm stuck migrating.

@brenzi
Copy link
Author

brenzi commented Mar 31, 2020

same for substrate-test-runtime-client

@JoshOrndorff
Copy link
Contributor

The node_primitives crate is for use specifically in the demonstration node that lives in the Substrate repo. This is evidenced by the fact that it lives in bin/node/pirmitives. The two imports you mentioned, AccountId and Signature are both type aliases to things that are in the library part of the Substrate repo and are published on crates.io.

This node template, makes the same type aliases directly in the runtime's lib.rs (AccountId, Signature). If you're basing your node on this template, you can use those type aliases directly, or if you like having them in a separate crate, you can move them to their own crate. You could call that crate node-primitives and let it's context make it clear what node they are for or you could give it a name like brenzis-node-primitives. You can see polkadot also [follows this pattern](https://github.com/paritytech/polkadot/tree/master/primitives

@brenzi
Copy link
Author

brenzi commented Mar 31, 2020

ok. but how about substrate-test-runtime-client? Where should I get use test_client::AccountKeyring; from? From sp_keyring I guess?

@JoshOrndorff
Copy link
Contributor

TBH, I'm not nearly as familiar with that one. I guess maybe from here https://substrate.dev/rustdocs/master/sp_keyring/test/index.html

@gnunicorn is that right?

@gnunicorn
Copy link

gnunicorn commented Apr 1, 2020

@brenzi node-* are meant for the substrate-node-default-implementation only, are very opinionated and not suitable for reusability but part of the executable only. We are still discussing whether we eventually publish them on crates.io but for the time being (and probably 2.0 release), these won't be published there (as we can't and won't give the same semver stability guarantees for the binary).

That said, what you are asking for is literally something you can (and should) define yourself:

use sp_runtime::{
	generic, traits::{Verify, IdentifyAccount}, MultiSignature
};

pub type Signature = MultiSignature;

pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;

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

No branches or pull requests

3 participants