mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
srml/authority-discovery: Introduce srml module to sign and verify (#3385)
In order to have authorities (validators) discover each other, they need
to publish their public addresses by their ip address on the Kademlia
Dht indexed by their public key. This payload needs to be signed by a
key identifying them as a valid authority.
Code inside `/core` does not know the current set of authorities nor
can it assume what kind of cryptography primitives are currently in use.
Instead it can retrieve its public key and the current set of
authorities from the runtime and have it sign and verify Dht payloads.
This commit enables code in `/core` to do so by introducing a srml
module and runtime api to:
1. Retrieve own public key.
2. Retrieve public keys of current authority set.
3. Sign a Dht payload.
4. Verify a Dht payload.
This commit makes the logic from the previous commit
(`core/consensus/common/primitives.ConsensusApi`)
cf80af9255 obsolete and thus removes it.
This commit is contained in:
@@ -46,6 +46,7 @@ system = { package = "srml-system", path = "../../srml/system" }
|
||||
balances = { package = "srml-balances", path = "../../srml/balances" }
|
||||
support = { package = "srml-support", path = "../../srml/support", default-features = false }
|
||||
im_online = { package = "srml-im-online", path = "../../srml/im-online", default-features = false }
|
||||
authority-discovery = { package = "srml-authority-discovery", path = "../../srml/authority-discovery", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
keystore = { package = "substrate-keystore", path = "../../core/keystore" }
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
use primitives::{Pair, Public, crypto::UncheckedInto};
|
||||
pub use node_primitives::{AccountId, Balance};
|
||||
use node_runtime::{
|
||||
BabeConfig, BalancesConfig, ContractsConfig, CouncilConfig, DemocracyConfig,
|
||||
ElectionsConfig, GrandpaConfig, ImOnlineConfig, IndicesConfig,
|
||||
SessionConfig, SessionKeys, StakerStatus, StakingConfig, SudoConfig, SystemConfig,
|
||||
TechnicalCommitteeConfig, WASM_BINARY,
|
||||
AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, ContractsConfig, CouncilConfig, DemocracyConfig,
|
||||
ElectionsConfig, GrandpaConfig, ImOnlineConfig, IndicesConfig, SessionConfig, SessionKeys, StakerStatus,
|
||||
StakingConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, WASM_BINARY,
|
||||
};
|
||||
use node_runtime::constants::{time::*, currency::*};
|
||||
pub use node_runtime::GenesisConfig;
|
||||
@@ -171,6 +170,9 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||
im_online: Some(ImOnlineConfig {
|
||||
keys: vec![],
|
||||
}),
|
||||
authority_discovery: Some(AuthorityDiscoveryConfig{
|
||||
keys: vec![],
|
||||
}),
|
||||
grandpa: Some(GrandpaConfig {
|
||||
authorities: vec![],
|
||||
}),
|
||||
@@ -302,6 +304,9 @@ pub fn testnet_genesis(
|
||||
im_online: Some(ImOnlineConfig {
|
||||
keys: vec![],
|
||||
}),
|
||||
authority_discovery: Some(AuthorityDiscoveryConfig{
|
||||
keys: vec![],
|
||||
}),
|
||||
grandpa: Some(GrandpaConfig {
|
||||
authorities: vec![],
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user