Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

[Backport] #220 Apache License and #223 Minor Refactoring #228

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 14 additions & 13 deletions node/build.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// This file is part of Trappist.

// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

Expand Down
29 changes: 15 additions & 14 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// This file is part of Trappist.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use parachains_common::{AccountId, Signature};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
Expand Down Expand Up @@ -45,7 +46,7 @@ impl Extensions {

/// Helper function to generate a crypto pair from seed
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
TPublic::Pair::from_string(&format!("//{seed}"), None)
.expect("static values are valid; qed")
.public()
}
Expand Down
23 changes: 20 additions & 3 deletions node/src/chain_spec/stout.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// This file is part of Trappist.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::chain_spec::{
get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION,
};
Expand Down Expand Up @@ -97,11 +114,11 @@ fn testnet_genesis(
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
balances: endowed_accounts.into_iter().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: stout_runtime::ParachainInfoConfig { parachain_id: id },
collator_selection: stout_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
invulnerables: invulnerables.iter().map(|(acc, _)| acc).cloned().collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
..Default::default()
},
Expand Down Expand Up @@ -129,7 +146,7 @@ fn testnet_genesis(
},
assets: AssetsConfig { assets: vec![], accounts: vec![], metadata: vec![] },
council: CouncilConfig {
members: invulnerables.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
members: invulnerables.into_iter().map(|x| x.0).collect::<Vec<_>>(),
phantom: Default::default(),
},
dex: Default::default(),
Expand Down
46 changes: 28 additions & 18 deletions node/src/chain_spec/trappist.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// This file is part of Trappist.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::chain_spec::{
get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION,
};
Expand Down Expand Up @@ -150,11 +167,11 @@ pub fn testnet_genesis(
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
balances: endowed_accounts.into_iter().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: trappist_runtime::ParachainInfoConfig { parachain_id: id },
collator_selection: trappist_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
invulnerables: invulnerables.iter().map(|(acc, _)| acc).cloned().collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
..Default::default()
},
Expand Down Expand Up @@ -185,7 +202,7 @@ pub fn testnet_genesis(
},
assets: AssetsConfig { assets: vec![], accounts: vec![], metadata: vec![] },
council: CouncilConfig {
members: invulnerables.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
members: invulnerables.into_iter().map(|x| x.0).collect::<Vec<_>>(),
phantom: Default::default(),
},
treasury: Default::default(),
Expand Down Expand Up @@ -259,32 +276,25 @@ fn trappist_live_genesis(
balances: BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.chain(std::iter::once(root_key.clone()))
.map(|k| {
if k == root_key {
(k, 1_000_000_000_000_000_000)
} else {
(k, 1_500_000_000_000_000_000)
}
})
.map(|x| (x.clone(), 1_500_000_000_000_000_000))
.chain(std::iter::once((root_key.clone(), 1_000_000_000_000_000_000)))
.collect(),
},
parachain_info: trappist_runtime::ParachainInfoConfig { parachain_id: id },
collator_selection: trappist_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
invulnerables: invulnerables.iter().map(|(acc, _)| acc).cloned().collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
..Default::default()
},
democracy: Default::default(),
session: SessionConfig {
keys: invulnerables
.iter()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc.clone(), // validator id
session_keys(aura.clone()), // session keys
acc.clone(), // account id
acc, // validator id
session_keys(aura), // session keys
)
})
.collect(),
Expand All @@ -302,7 +312,7 @@ fn trappist_live_genesis(
assets: AssetsConfig { assets: vec![], accounts: vec![], metadata: vec![] },
council: CouncilConfig {
// We set the endowed accounts with balance as members of the council.
members: endowed_accounts.iter().map(|x| x.clone()).collect::<Vec<_>>(),
members: endowed_accounts,
phantom: Default::default(),
},
treasury: Default::default(),
Expand Down
31 changes: 16 additions & 15 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
// This file is part of Trappist.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::path::PathBuf;

Expand Down
31 changes: 16 additions & 15 deletions node/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
// This file is part of Trappist.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{
chain_spec,
Expand Down
29 changes: 15 additions & 14 deletions node/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// This file is part of Trappist.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

//! Cumulus test parachain collator
//! Trappist Node CLI.

#![warn(missing_docs)]
#![warn(unused_extern_crates)]
Expand Down
33 changes: 16 additions & 17 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.

// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

//! Parachain-specific RPCs implementation.
// This file is part of Trappist.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![warn(missing_docs)]

Expand Down
Loading