Skip to content

Commit 9b75009

Browse files
authored
release v1.3.0 - rc1 (#973)
* restore role key * cleanup * clippy * cleanup * bump versions * clippy * clippy
1 parent 89b00d2 commit 9b75009

File tree

18 files changed

+116
-125
lines changed

18 files changed

+116
-125
lines changed

Cargo.lock

Lines changed: 20 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "1.2.19"
2+
version = "1.3.0"
33
authors = ["Tangle Foundation."]
44
edition = "2021"
55
license = "Unlicense"

node/src/chainspec/mainnet.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ use sp_runtime::{
3636
};
3737
use tangle_primitives::types::{BlockNumber, Signature};
3838
use tangle_runtime::{
39-
AccountId, Balance, MaxVestingSchedules, Perbill, Precompiles, StakerStatus, TreasuryPalletId,
40-
UNIT, WASM_BINARY,
39+
AccountId, Balance, MaxVestingSchedules, Perbill, Precompiles, RoleKeyId, StakerStatus,
40+
TreasuryPalletId, UNIT, WASM_BINARY,
4141
};
4242

4343
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
@@ -61,12 +61,15 @@ where
6161
}
6262

6363
/// Generate an babe authority key.
64-
pub fn authority_keys_from_seed(stash: &str) -> (AccountId, BabeId, GrandpaId, ImOnlineId) {
64+
pub fn authority_keys_from_seed(
65+
stash: &str,
66+
) -> (AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId) {
6567
(
6668
get_account_id_from_seed::<sr25519::Public>(stash),
6769
get_from_seed::<BabeId>(stash),
6870
get_from_seed::<GrandpaId>(stash),
6971
get_from_seed::<ImOnlineId>(stash),
72+
get_from_seed::<RoleKeyId>(stash),
7073
)
7174
}
7275

@@ -78,8 +81,9 @@ fn generate_session_keys(
7881
babe: BabeId,
7982
grandpa: GrandpaId,
8083
im_online: ImOnlineId,
84+
role: RoleKeyId,
8185
) -> tangle_runtime::opaque::SessionKeys {
82-
tangle_runtime::opaque::SessionKeys { babe, grandpa, im_online }
86+
tangle_runtime::opaque::SessionKeys { babe, grandpa, im_online, role }
8387
}
8488

8589
pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
@@ -170,7 +174,7 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
170174

171175
#[allow(clippy::too_many_arguments)]
172176
fn mainnet_genesis(
173-
initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId)>,
177+
initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId)>,
174178
endowed_accounts: Vec<(AccountId, Balance)>,
175179
root_key: AccountId,
176180
chain_id: u64,
@@ -249,7 +253,7 @@ fn mainnet_genesis(
249253
(
250254
x.0.clone(),
251255
x.0.clone(),
252-
generate_session_keys(x.1.clone(), x.2.clone(), x.3.clone()),
256+
generate_session_keys(x.1.clone(), x.2.clone(), x.3.clone(), x.4.clone()),
253257
)
254258
})
255259
.collect::<Vec<_>>()

node/src/distributions/mainnet.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ pub fn get_initial_endowed_accounts(
272272
endowed_accounts.push((root_account, 5000 * UNIT)); // root key gets 5000 tokens for transactions
273273

274274
let initial_authorities = get_initial_authorities();
275+
276+
#[cfg(not(feature = "testnet"))]
277+
for (acco, _, _, _, _) in initial_authorities.iter() {
278+
endowed_accounts.push((acco.clone(), 100 * UNIT));
279+
}
280+
281+
#[cfg(feature = "testnet")]
275282
for (acco, _, _, _) in initial_authorities.iter() {
276283
endowed_accounts.push((acco.clone(), 100 * UNIT));
277284
}

node/src/mainnet_fixtures.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use sc_consensus_grandpa::AuthorityId as GrandpaId;
2020
use sc_network::config::MultiaddrWithPeerId;
2121
use sp_consensus_babe::AuthorityId as BabeId;
2222
use sp_core::crypto::UncheckedInto;
23+
use tangle_crypto_primitives::crypto::AuthorityId as RoleKeyId;
2324
use tangle_runtime::AccountId;
2425

2526
/// Mainnet root key
@@ -52,7 +53,7 @@ pub fn get_bootnodes() -> Vec<MultiaddrWithPeerId> {
5253
}
5354

5455
/// Tangle runtime initial authorities
55-
pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineId)> {
56+
pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId)> {
5657
vec![
5758
// tangle 1
5859
(
@@ -63,6 +64,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
6364
.unchecked_into(),
6465
hex!["1261548c9de1476e4e8e06e9dddd543ebbd7504ae502ac91a0eb8b6037334372"]
6566
.unchecked_into(),
67+
hex!["02320ab70b215ed1d37748d2aadae924ddb1e6042598ae9c2479684f0913cc15ae"]
68+
.unchecked_into(),
6669
),
6770
// tangle 2
6871
(
@@ -73,6 +76,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
7376
.unchecked_into(),
7477
hex!["7c04e33631ff7ae0a453827c82c4b69179e72612f982c4d9b45393f25b4f5f48"]
7578
.unchecked_into(),
79+
hex!["026fa903a87d7e0e262e5c70d6dffecca3f5262f05096a1c5bcd477e8ea63813ad"]
80+
.unchecked_into(),
7681
),
7782
// tangle 3
7883
(
@@ -83,6 +88,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
8388
.unchecked_into(),
8489
hex!["7842e1623d6a19cd267ad9b926ddb81a27c6aedc4cab58e99cd0ac3e2a53a762"]
8590
.unchecked_into(),
91+
hex!["02c876f99aa4361e7e81eb96ff325833452efb6eed6ae43abfbbed4106ac556829"]
92+
.unchecked_into(),
8693
),
8794
// tangle 4
8895
(
@@ -93,6 +100,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
93100
.unchecked_into(),
94101
hex!["c0fc962bcbc623e343d0dddf9915f9c269dced366283e76e6302612d5172281d"]
95102
.unchecked_into(),
103+
hex!["03d1198468f5ba4f67d155a576d5b2b2823265616b7669000eab08bca538d8c34c"]
104+
.unchecked_into(),
96105
),
97106
// tangle 5
98107
(
@@ -103,6 +112,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
103112
.unchecked_into(),
104113
hex!["cebebb5bf58a2a989bf8827d7360f04057835e42141162bfa17f3d12dde96a59"]
105114
.unchecked_into(),
115+
hex!["02596bcb7dfc93455d1e7bf93aa874d481590b37af0d43598506f9ed8609086ba0"]
116+
.unchecked_into(),
106117
),
107118
// snowflake
108119
(
@@ -113,6 +124,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
113124
.unchecked_into(),
114125
hex!["12fd766a9916d23c125c8b2f61b3fb9d68ecaa0dea2c4119aa5d1980dbe0c442"]
115126
.unchecked_into(),
127+
hex!["03ace29a9b62f4aee605b74a7b44624b9d96570cd70aa5d4d6f771d5824889038b"]
128+
.unchecked_into(),
116129
),
117130
// trident
118131
(
@@ -123,6 +136,8 @@ pub fn get_initial_authorities() -> Vec<(AccountId, BabeId, GrandpaId, ImOnlineI
123136
.unchecked_into(),
124137
hex!["7c623a93a6691ecc211ea709f8eb606e2c9af5ac413b2cab88e54c2d4391872a"]
125138
.unchecked_into(),
139+
hex!["020acb5833e9cace29f9f94feaff71ecd854bc79c0646ef7c2a46700313b9e83c7"]
140+
.unchecked_into(),
126141
),
127142
]
128143
}

pallets/services/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pallet-evm-precompile-balances-erc20 = { workspace = true }
6969
pallet-evm-precompileset-assets-erc20 = { workspace = true }
7070

7171
precompile-utils = { workspace = true }
72-
72+
tangle-crypto-primitives = { workspace = true }
7373
pallet-session = { workspace = true }
7474
pallet-staking = { workspace = true }
7575
pallet-multi-asset-delegation = { workspace = true }
@@ -122,6 +122,7 @@ std = [
122122
"pallet-evm-precompile-ed25519/std",
123123
"precompile-utils/std",
124124
"serde/std",
125+
"tangle-crypto-primitives/std",
125126
]
126127
try-runtime = ["frame-support/try-runtime"]
127128
runtime-benchmarks = [

pallets/services/src/impls.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::*;
22
use crate::types::BalanceOf;
3+
use frame_support::traits::OneSessionHandler;
34
use sp_std::{vec, vec::Vec};
45
use tangle_primitives::{services::Constraints, traits::ServiceManager, BlueprintId};
56

@@ -127,3 +128,34 @@ impl<T: crate::Config, Balance: Default>
127128
None
128129
}
129130
}
131+
132+
impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
133+
type Public = T::RoleKeyId;
134+
}
135+
136+
impl<T: Config> OneSessionHandler<T::AccountId> for Pallet<T> {
137+
type Key = T::RoleKeyId;
138+
139+
#[allow(clippy::multiple_bound_locations)]
140+
fn on_genesis_session<'a, I: 'a>(_validators: I)
141+
where
142+
I: Iterator<Item = (&'a T::AccountId, T::RoleKeyId)>,
143+
{
144+
}
145+
146+
#[allow(clippy::multiple_bound_locations)]
147+
fn on_new_session<'a, I: 'a>(_changed: bool, _validators: I, _queued_validators: I)
148+
where
149+
I: Iterator<Item = (&'a T::AccountId, T::RoleKeyId)>,
150+
{
151+
}
152+
153+
fn on_disabled(_i: u32) {
154+
// ignore
155+
}
156+
157+
// Distribute the inflation rewards
158+
fn on_before_session_ending() {
159+
// ignore
160+
}
161+
}

0 commit comments

Comments
 (0)