Make AuthorityId generic (#1296)

* BlockAuthorityId convenience type

* Rename AuthorityId -> Ed25519AuthorityId to make it more precise

* Generalize AuthorityId up to substrate-client

* Fix in client-db

* rename: BlockAuthorityId -> AuthorityIdFor

* typo: should be digest item

* Fix test-runtime authorityId mismatch

One states that AuthorityId is u64 while the other states that it's Ed25519AuthorityId.

* Fix more u64 - Ed25519AuthorityId mismatch

* Fix compile of most of the srml modules

* Continue to pin aura and grandpa with ed25519 and fix compile

* Add MaybeHash trait

* Fix node-runtime compile

* Fix network tests
This commit is contained in:
Wei Tang
2019-01-08 11:14:18 +01:00
committed by Benjamin Kampmann
parent 043831cfb0
commit 71d889b692
46 changed files with 234 additions and 216 deletions
+4 -4
View File
@@ -16,7 +16,7 @@
//! Substrate chain configurations.
use primitives::{AuthorityId, ed25519};
use primitives::{Ed25519AuthorityId, ed25519};
use node_primitives::AccountId;
use node_runtime::{ConsensusConfig, CouncilSeatsConfig, CouncilVotingConfig, DemocracyConfig,
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, TreasuryConfig,
@@ -158,7 +158,7 @@ pub fn staging_testnet_config() -> ChainSpec {
}
/// Helper function to generate AuthorityID from seed
pub fn get_authority_id_from_seed(seed: &str) -> AuthorityId {
pub fn get_authority_id_from_seed(seed: &str) -> Ed25519AuthorityId {
let padded_seed = pad_seed(seed);
// NOTE from ed25519 impl:
// prefer pkcs#8 unless security doesn't matter -- this is used primarily for tests.
@@ -167,9 +167,9 @@ pub fn get_authority_id_from_seed(seed: &str) -> AuthorityId {
/// Helper function to create GenesisConfig for testing
pub fn testnet_genesis(
initial_authorities: Vec<AuthorityId>,
initial_authorities: Vec<Ed25519AuthorityId>,
upgrade_key: AccountId,
endowed_accounts: Option<Vec<AuthorityId>>,
endowed_accounts: Option<Vec<Ed25519AuthorityId>>,
) -> GenesisConfig {
let endowed_accounts = endowed_accounts.unwrap_or_else(|| {
vec![