Skip to content
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
1,127 changes: 568 additions & 559 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ edition = "2021"
homepage = "https://darwinia.network"
license = "GPL-3.0"
repository = "https://github.com/darwinia-network/darwinia"
version = "6.9.0"
version = "6.9.1"

[workspace.dependencies]
# crates.io
array-bytes = { version = "7.1" }
array-bytes = { version = "9.1" }
codec = { package = "parity-scale-codec", version = "3.6", default-features = false }
ethabi = { version = "18.0", default-features = false }
ethereum = { version = "0.15", default-features = false, features = ["with-codec"] }
Expand Down
51 changes: 32 additions & 19 deletions node/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
// crates.io
use array_bytes::Dehexify;
#[cfg(feature = "dev")]
use serde_json::Value;
// darwinia
Expand Down Expand Up @@ -108,7 +109,7 @@ pub fn development_config() -> ChainSpec {
let genesis_config_patch = if let Value::Object(mut m) = genesis_config_patch {
m.insert(
"sudo".into(),
serde_json::json!({ "key": Some(array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(ALITH)) }),
serde_json::json!({ "key": Some(array_bytes::dehexify_array_then_into::<_, AccountId, 20>(ALITH).unwrap()) }),
);

Value::Object(m)
Expand All @@ -132,68 +133,80 @@ pub fn development_config() -> ChainSpec {
pub fn genesis_config() -> ChainSpec {
let collators = [
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x196f03b77a1acd0db080006b04d2f3a991ebbe68",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xa05255010ee986b9684a444d10a74aa0ecbe781f5002e871665add894752cc7e",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x4D3D5958B948e8d749FaB0236b179fCC55d9aAc0",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xf8f82edfc6899552e5a32aa381e53723d2c39594638cb8f7e2572fef74b05255",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x7aE2a0914db8bFBdad538b0eAc3Fa473A0e07843",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xdaf5c4506b82f617245150216a73c0eb4f2603848c02413db66f991846777845",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x9F33a4809aA708d7a399fedBa514e0A0d15EfA85",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xdcff1219121687391353b17e798b10e87f6e578b2a01e032375f2f14a0712b57",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x0a1287977578F888bdc1c7627781AF1cc000e6ab",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0x28a8af71db9703e6b8960d1dcb742deca13c574f81f781be5dbde84ec8d66d45",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0xEB7e82A67CDFA3E742e0f3315Fd4EEd7B05730CC",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xfee21e4e4865380734882253d27612da0e4413c93e5c817e38b8c5e034de7270",
)
.unwrap()
.unchecked_into(),
),
),
Expand Down
43 changes: 27 additions & 16 deletions node/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
// crates.io
use array_bytes::Dehexify;
#[cfg(feature = "dev")]
use serde_json::Value;
// darwinia
Expand Down Expand Up @@ -108,7 +109,7 @@ pub fn development_config() -> ChainSpec {
let genesis_config_patch = if let Value::Object(mut m) = genesis_config_patch {
m.insert(
"sudo".into(),
serde_json::json!({ "key": Some(array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(ALITH)) }),
serde_json::json!({ "key": Some(array_bytes::dehexify_array_then_into::<_, AccountId, 20>(ALITH).unwrap()) }),
);

Value::Object(m)
Expand All @@ -132,57 +133,67 @@ pub fn development_config() -> ChainSpec {
pub fn genesis_config() -> ChainSpec {
let collators = [
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x196f03b77a1acd0db080006b04d2f3a991ebbe68",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xa05255010ee986b9684a444d10a74aa0ecbe781f5002e871665add894752cc7e",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x7aE2a0914db8bFBdad538b0eAc3Fa473A0e07843",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xdaf5c4506b82f617245150216a73c0eb4f2603848c02413db66f991846777845",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x9F33a4809aA708d7a399fedBa514e0A0d15EfA85",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xdcff1219121687391353b17e798b10e87f6e578b2a01e032375f2f14a0712b57",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0x0a1287977578F888bdc1c7627781AF1cc000e6ab",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0x28a8af71db9703e6b8960d1dcb742deca13c574f81f781be5dbde84ec8d66d45",
)
.unwrap()
.unchecked_into(),
),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(
"0xEB7e82A67CDFA3E742e0f3315Fd4EEd7B05730CC",
),
)
.unwrap(),
session_keys(
array_bytes::hex2array_unchecked(
<[u8; 32]>::dehexify(
"0xfee21e4e4865380734882253d27612da0e4413c93e5c817e38b8c5e034de7270",
)
.unwrap()
.unchecked_into(),
),
),
Expand Down
22 changes: 12 additions & 10 deletions node/src/chain_spec/koi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use std::{
str::FromStr,
time::{SystemTime, UNIX_EPOCH},
};
// crates.io
use array_bytes::Dehexify;
// darwinia
use super::*;
use koi_runtime::*;
Expand Down Expand Up @@ -70,13 +72,13 @@ pub fn development_config() -> ChainSpec {
// Governance stuff.
"technicalCommittee": {
"members": [
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(ALITH),
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(BALTATHAR)
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(ALITH).unwrap(),
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(BALTATHAR).unwrap()
]
},

// Utility stuff.
"sudo": { "key": Some(array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(ALITH)) },
"sudo": { "key": Some(array_bytes::dehexify_array_then_into::<_, AccountId, 20>(ALITH).unwrap()) },

// XCM stuff.
"polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION) },
Expand Down Expand Up @@ -129,16 +131,16 @@ pub fn development_config() -> ChainSpec {
pub fn genesis_config() -> ChainSpec {
let collators = [
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(C1),
session_keys(array_bytes::hex2array_unchecked(C1_AURA).unchecked_into()),
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(C1).unwrap(),
session_keys(<[u8; 32]>::dehexify(C1_AURA).unwrap().unchecked_into()),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(C2),
session_keys(array_bytes::hex2array_unchecked(C2_AURA).unchecked_into()),
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(C2).unwrap(),
session_keys(<[u8; 32]>::dehexify(C2_AURA).unwrap().unchecked_into()),
),
(
array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(C3),
session_keys(array_bytes::hex2array_unchecked(C3_AURA).unchecked_into()),
array_bytes::dehexify_array_then_into::<_, AccountId, 20>(C3).unwrap(),
session_keys(<[u8; 32]>::dehexify(C3_AURA).unwrap().unchecked_into()),
),
];
let genesis_config_patch = serde_json::json!({
Expand Down Expand Up @@ -171,7 +173,7 @@ pub fn genesis_config() -> ChainSpec {
},

// Utility stuff.
"sudo": { "key": Some(array_bytes::hex_n_into_unchecked::<_, AccountId, 20>(SUDO)) },
"sudo": { "key": Some(array_bytes::dehexify_array_then_into::<_, AccountId, 20>(SUDO).unwrap()) },

// XCM stuff.
"polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION) },
Expand Down
20 changes: 9 additions & 11 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ where
[
// Bind the `Alice` to `Alith` to make `--alice` work for development.
(
array_bytes::hex_n_into_unchecked::<_, _, 20>(ALITH),
array_bytes::dehexify_array_then_into::<_, _, 20>(ALITH).unwrap(),
f(get_collator_keys_from_seed("Alice")),
),
],
[
array_bytes::hex_n_into_unchecked::<_, _, 20>(ALITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(BALTATHAR),
array_bytes::hex_n_into_unchecked::<_, _, 20>(CHARLETH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(DOROTHY),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ETHAN),
array_bytes::hex_n_into_unchecked::<_, _, 20>(FAITH),
array_bytes::dehexify_array_then_into::<_, _, 20>(ALITH).unwrap(),
array_bytes::dehexify_array_then_into::<_, _, 20>(BALTATHAR).unwrap(),
array_bytes::dehexify_array_then_into::<_, _, 20>(CHARLETH).unwrap(),
array_bytes::dehexify_array_then_into::<_, _, 20>(DOROTHY).unwrap(),
array_bytes::dehexify_array_then_into::<_, _, 20>(ETHAN).unwrap(),
array_bytes::dehexify_array_then_into::<_, _, 20>(FAITH).unwrap(),
],
)
}
Expand Down Expand Up @@ -163,10 +163,8 @@ where
// Fetch the latest spec every 14 days.
if let Ok(date) = metadata.modified() {
if let Ok(elapsed) = date.elapsed() {
if elapsed.as_secs() > 60 * 60 * 24 * 14 {
if fs::remove_file(p.clone()).is_ok() {
download();
}
if elapsed.as_secs() > 60 * 60 * 24 * 14 && fs::remove_file(p.clone()).is_ok() {
download();
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions node/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,14 +813,18 @@ where
block_import: instant_finalize::InstantFinalizeBlockImport::new(client.clone()),
proposer_factory,
create_inherent_data_providers: move |block, ()| {
// crates.io
use array_bytes::Dehexify;

let maybe_current_para_block = client_for_cidp.number(block);
let maybe_current_block_head = client_for_cidp.expect_header(block);
let client_for_xcm = client_for_cidp.clone();
// TODO: hack for now.
let additional_key_values = Some(vec![(
array_bytes::hex2bytes_unchecked(
<Vec<u8>>::dehexify(
"1cb6f36e027abb2091cfb5110ab5087f06155b3cd9a8c9e5e9a23fd5dc13a5ed",
),
)
.unwrap(),
cumulus_primitives_aura::Slot::from_timestamp(
sp_timestamp::Timestamp::current(),
slot_duration,
Expand Down
4 changes: 2 additions & 2 deletions pallet/account-migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ frame-system = { workspace = true }
pallet-assets = { workspace = true }
pallet-balances = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
# polkadot-sdk optional
frame-benchmarking = { workspace = true, optional = true }

[dev-dependencies]
pallet-timestamp = { workspace = true, features = ["std"] }
sp-keyring = { workspace = true }
sp-io = { workspace = true, features = ["std"] }
sp-keyring = { workspace = true, features = ["std"] }
sp-version = { workspace = true, features = ["std"] }

[features]
Expand Down
Loading
Loading