Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove indices from node-template #5025

Merged
merged 5 commits into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions bin/node-template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sp_core::{Pair, Public, sr25519};
use node_template_runtime::{
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
IndicesConfig, SudoConfig, SystemConfig, WASM_BINARY, Signature
SudoConfig, SystemConfig, WASM_BINARY, Signature
};
use sp_consensus_aura::sr25519::{AuthorityId as AuraId};
use grandpa_primitives::{AuthorityId as GrandpaId};
Expand Down Expand Up @@ -127,21 +127,18 @@ fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
indices: Some(IndicesConfig {
indices: vec![],
}),
balances: Some(BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(),
}),
sudo: Some(SudoConfig {
key: root_key,
}),
aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
}),
sudo: Some(SudoConfig {
key: root_key,
}),
}
}

Expand Down
2 changes: 0 additions & 2 deletions bin/node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ aura = { version = "2.0.0-dev", default-features = false, package = "pallet-aura
balances = { version = "2.0.0-dev", default-features = false, package = "pallet-balances", path = "../../../frame/balances" }
frame-support = { version = "2.0.0-dev", default-features = false, path = "../../../frame/support" }
grandpa = { version = "2.0.0-dev", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" }
indices = { version = "2.0.0-dev", default-features = false, package = "pallet-indices", path = "../../../frame/indices" }
randomness-collective-flip = { version = "2.0.0-dev", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" }
sudo = { version = "2.0.0-dev", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" }
system = { version = "2.0.0-dev", default-features = false, package = "frame-system", path = "../../../frame/system" }
Expand Down Expand Up @@ -49,7 +48,6 @@ std = [
"frame-executive/std",
"frame-support/std",
"grandpa/std",
"indices/std",
"randomness-collective-flip/std",
"serde",
"sp-api/std",
Expand Down
26 changes: 4 additions & 22 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use sp_runtime::{
impl_opaque_keys, MultiSignature,
};
use sp_runtime::traits::{
BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto, IdentifyAccount
BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount
};
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -132,7 +132,7 @@ impl system::Trait for Runtime {
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = Indices;
type Lookup = IdentityLookup<AccountId>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
/// The index type for blocks.
Expand Down Expand Up @@ -177,23 +177,6 @@ impl grandpa::Trait for Runtime {
type Event = Event;
}

parameter_types! {
/// How much an index costs.
pub const IndexDeposit: u128 = 100;
}

impl indices::Trait for Runtime {
/// The type for recording indexing into the account enumeration. If this ever overflows, there
/// will be problems!
type AccountIndex = AccountIndex;
/// The ubiquitous event type.
type Event = Event;
/// The currency type.
type Currency = Balances;
/// How much an index costs.
type Deposit = IndexDeposit;
}

parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
Expand Down Expand Up @@ -250,21 +233,20 @@ construct_runtime!(
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
Timestamp: timestamp::{Module, Call, Storage, Inherent},
Aura: aura::{Module, Config<T>, Inherent(Timestamp)},
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
Indices: indices::{Module, Call, Storage, Event<T>, Config<T>},
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: transaction_payment::{Module, Storage},
Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>},
// Used for the module template in `./template.rs`
TemplateModule: template::{Module, Call, Storage, Event<T>},
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
}
);

/// The address format for describing accounts.
pub type Address = <Indices as StaticLookup>::Source;
pub type Address = AccountId;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 224,
impl_version: 2,
impl_version: 3,
apis: RUNTIME_API_VERSIONS,
};

Expand Down
2 changes: 1 addition & 1 deletion frame/indices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl<T: Trait> StaticLookup for Module<T> {
type Source = address::Address<T::AccountId, T::AccountIndex>;
type Target = T::AccountId;

fn lookup(a: Self::Source) -> Result<T::AccountId, LookupError> {
fn lookup(a: Self::Source) -> Result<Self::Target, LookupError> {
Self::lookup_address(a).ok_or(LookupError)
}

Expand Down