Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.8.3 #588

Merged
merged 24 commits into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from 22 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
809 changes: 446 additions & 363 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://darwinia.network/"
license = "GPL-3.0"
name = "darwinia"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.8.2"
version = "0.8.3"

[[bin]]
name = "darwinia"
Expand Down
14 changes: 6 additions & 8 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://darwinia.network/"
license = "GPL-3.0"
name = "darwinia-cli"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.8.2"
version = "0.8.3"

[package.metadata.wasm-pack.profile.release]
# `wasm-opt` has some problems on linux, see
Expand All @@ -20,12 +20,11 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
# crates
log = { version = "0.4.11" }
serde = { version = "1.0.117", optional = true }
structopt = { version = "0.3.20" }
tokio = { version = "0.3.3", optional = true, features = ["rt-multi-thread"] }
toml = { version = "0.5.7", optional = true }
wasm-bindgen = { version = "0.2.68", optional = true }
wasm-bindgen-futures = { version = "0.4.18", optional = true }
serde = { version = "1.0.118", optional = true }
structopt = { version = "0.3.21" }
tokio = { version = "0.3.5", optional = true, features = ["rt-multi-thread"] }
wasm-bindgen = { version = "0.2.69", optional = true }
wasm-bindgen-futures = { version = "0.4.19", optional = true }
# darwinia client
darwinia-cli = { optional = true, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
# darwinia service
Expand Down Expand Up @@ -57,7 +56,6 @@ default = [
cli = [
"serde",
"tokio",
"toml",
"sc-cli",
"sc-network",
"sc-tracing",
Expand Down
14 changes: 7 additions & 7 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ homepage = "https://darwinia.network/"
license = "GPL-3.0"
name = "darwinia-service"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.8.2"
version = "0.8.3"

[dependencies]
# crates
codec = { package = "parity-scale-codec", version = "1.3.5", features = ["derive"] }
futures = { version = "0.3.8" }
log = { version = "0.4.11" }
serde = { version = "1.0.117", features = ["derive"] }
serde_json = { version = "1.0.59" }
array-bytes = { version = "0.3.0" }
codec = { package = "parity-scale-codec", version = "1.3.5", features = ["derive"] }
futures = { version = "0.3.8" }
log = { version = "0.4.11" }
serde = { version = "1.0.118", features = ["derive"] }
serde_json = { version = "1.0.61" }
# darwinia frame
array-bytes = { git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-balances-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-header-mmr-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-staking-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
Expand Down
31 changes: 15 additions & 16 deletions node/service/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use super::{
get_account_id_from_seed, get_authority_keys_from_seed, testnet_accounts, Extensions,
DEFAULT_PROTOCOL_ID,
};
use array_bytes::fixed_hex_bytes_unchecked;
use crab_runtime::{constants::currency::COIN, *};
use darwinia_primitives::{AccountId, Balance};

Expand Down Expand Up @@ -71,8 +70,8 @@ pub fn crab_build_spec_genesis() -> GenesisConfig {
const RING_TOKEN_ADDRESS: &'static str = "0xb52FBE2B925ab79a821b261C82c5Ba0814AAA5e0";
const KTON_TOKEN_ADDRESS: &'static str = "0x1994100c58753793D52c6f457f189aa3ce9cEe94";

let root: AccountId = fixed_hex_bytes_unchecked!(ROOT, 32).into();
let multi_sig: AccountId = fixed_hex_bytes_unchecked!(MULTI_SIG, 32).into();
let root: AccountId = array_bytes::hex_str_array_unchecked!(ROOT, 32).into();
let multi_sig: AccountId = array_bytes::hex_str_array_unchecked!(MULTI_SIG, 32).into();
let genesis_validator: (
AccountId,
AccountId,
Expand All @@ -81,10 +80,10 @@ pub fn crab_build_spec_genesis() -> GenesisConfig {
ImOnlineId,
AuthorityDiscoveryId,
) = {
let stash = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_SR, 32);
let controller = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_SR, 32);
let session = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_SR, 32);
let grandpa = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_ED, 32);
let stash = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_SR, 32);
let controller = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_SR, 32);
let session = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_SR, 32);
let grandpa = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_ED, 32);

(
stash.into(),
Expand All @@ -110,7 +109,7 @@ pub fn crab_build_spec_genesis() -> GenesisConfig {
"0xc45f075b5b1aa0145c469f57bd741c02272c1c0c41e9518d5a32426030d98232",
]
.iter()
.map(|s| fixed_hex_bytes_unchecked!(s, 32).into())
.map(|s| array_bytes::hex_str_array_unchecked!(s, 32).into())
.collect::<Vec<_>>();

GenesisConfig {
Expand Down Expand Up @@ -186,10 +185,10 @@ pub fn crab_build_spec_genesis() -> GenesisConfig {
}),
pallet_sudo: Some(SudoConfig { key: root }),
darwinia_ethereum_backing: Some(EthereumBackingConfig {
token_redeem_address: fixed_hex_bytes_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: fixed_hex_bytes_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: fixed_hex_bytes_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: fixed_hex_bytes_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
token_redeem_address: array_bytes::hex_str_array_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: array_bytes::hex_str_array_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: array_bytes::hex_str_array_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: array_bytes::hex_str_array_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
ring_locked: 7_569_833 * COIN,
kton_locked: 30_000 * COIN,
..Default::default()
Expand Down Expand Up @@ -314,10 +313,10 @@ pub fn crab_testnet_genesis(
}),
pallet_sudo: Some(SudoConfig { key: root }),
darwinia_ethereum_backing: Some(EthereumBackingConfig {
token_redeem_address: fixed_hex_bytes_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: fixed_hex_bytes_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: fixed_hex_bytes_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: fixed_hex_bytes_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
token_redeem_address: array_bytes::hex_str_array_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: array_bytes::hex_str_array_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: array_bytes::hex_str_array_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: array_bytes::hex_str_array_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
ring_locked: 1 << 56,
kton_locked: 1 << 56,
..Default::default()
Expand Down
48 changes: 24 additions & 24 deletions node/service/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use super::{
get_account_id_from_seed, get_authority_keys_from_seed, testnet_accounts, Extensions,
DEFAULT_PROTOCOL_ID,
};
use array_bytes::fixed_hex_bytes_unchecked;
use darwinia_primitives::{AccountId, BlockNumber};
use darwinia_runtime::{
constants::{currency::COIN, time::DAYS},
Expand Down Expand Up @@ -110,7 +109,7 @@ pub fn darwinia_build_spec_genesis() -> GenesisConfig {
}

rings
.entry(fixed_hex_bytes_unchecked!(address, 32).into())
.entry(array_bytes::hex_str_array_unchecked!(address, 32).into())
.and_modify(|ring_| *ring_ += ring)
.or_insert(ring);

Expand Down Expand Up @@ -138,7 +137,7 @@ pub fn darwinia_build_spec_genesis() -> GenesisConfig {
let ring = ring / COIN;

rings
.entry(fixed_hex_bytes_unchecked!(address, 32).into())
.entry(array_bytes::hex_str_array_unchecked!(address, 32).into())
.and_modify(|ring_| *ring_ += ring)
.or_insert(ring);
}
Expand All @@ -158,7 +157,7 @@ pub fn darwinia_build_spec_genesis() -> GenesisConfig {
let kton = kton / COIN;

ktons
.entry(fixed_hex_bytes_unchecked!(address, 32).into())
.entry(array_bytes::hex_str_array_unchecked!(address, 32).into())
.and_modify(|kton_| *kton_ += kton)
.or_insert(kton);
}
Expand All @@ -169,15 +168,16 @@ pub fn darwinia_build_spec_genesis() -> GenesisConfig {
assert!(genesis_validator_1_stash_endowed);
assert!(genesis_validator_2_stash_endowed);

let root: AccountId = fixed_hex_bytes_unchecked!(ROOT, 32).into();
let da_crabk: AccountId = fixed_hex_bytes_unchecked!(DA_CRABK, 32).into();
let team_vesting: AccountId = fixed_hex_bytes_unchecked!(TEAM_VESTING, 32).into();
let foundation_vesting: AccountId = fixed_hex_bytes_unchecked!(FOUNDATION_VESTING, 32).into();
let root: AccountId = array_bytes::hex_str_array_unchecked!(ROOT, 32).into();
let da_crabk: AccountId = array_bytes::hex_str_array_unchecked!(DA_CRABK, 32).into();
let team_vesting: AccountId = array_bytes::hex_str_array_unchecked!(TEAM_VESTING, 32).into();
let foundation_vesting: AccountId =
array_bytes::hex_str_array_unchecked!(FOUNDATION_VESTING, 32).into();
let genesis_validator_1: (AccountId, AccountId, SessionKeys) = {
let stash = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_1_STASH, 32);
let controller = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_1_CONTROLLER, 32);
let session = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_1_SESSION, 32);
let grandpa = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_1_GRANDPA, 32);
let stash = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_1_STASH, 32);
let controller = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_1_CONTROLLER, 32);
let session = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_1_SESSION, 32);
let grandpa = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_1_GRANDPA, 32);

(
stash.into(),
Expand All @@ -191,10 +191,10 @@ pub fn darwinia_build_spec_genesis() -> GenesisConfig {
)
};
let genesis_validator_2: (AccountId, AccountId, SessionKeys) = {
let stash = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_2_STASH, 32);
let controller = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_2_CONTROLLER, 32);
let session = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_2_SESSION, 32);
let grandpa = fixed_hex_bytes_unchecked!(GENESIS_VALIDATOR_2_GRANDPA, 32);
let stash = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_2_STASH, 32);
let controller = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_2_CONTROLLER, 32);
let session = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_2_SESSION, 32);
let grandpa = array_bytes::hex_str_array_unchecked!(GENESIS_VALIDATOR_2_GRANDPA, 32);

(
stash.into(),
Expand Down Expand Up @@ -282,10 +282,10 @@ pub fn darwinia_build_spec_genesis() -> GenesisConfig {
}),
pallet_sudo: Some(SudoConfig { key: root }),
darwinia_ethereum_backing: Some(EthereumBackingConfig {
token_redeem_address: fixed_hex_bytes_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: fixed_hex_bytes_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: fixed_hex_bytes_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: fixed_hex_bytes_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
token_redeem_address: array_bytes::hex_str_array_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: array_bytes::hex_str_array_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: array_bytes::hex_str_array_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: array_bytes::hex_str_array_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
// Los Angeles: 9/24/2020, 7:42:52 PM
// Berlin : 9/25/2020, 10:42:52 AM
// Beijing: 9/25/2020, 9:42:52 AM
Expand Down Expand Up @@ -410,10 +410,10 @@ pub fn darwinia_testnet_genesis(
darwinia_vesting: Some(Default::default()),
pallet_sudo: Some(SudoConfig { key: root }),
darwinia_ethereum_backing: Some(EthereumBackingConfig {
token_redeem_address: fixed_hex_bytes_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: fixed_hex_bytes_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: fixed_hex_bytes_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: fixed_hex_bytes_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
token_redeem_address: array_bytes::hex_str_array_unchecked!(TOKEN_REDEEM_ADDRESS, 20).into(),
deposit_redeem_address: array_bytes::hex_str_array_unchecked!(DEPOSIT_REDEEM_ADDRESS, 20).into(),
ring_token_address: array_bytes::hex_str_array_unchecked!(RING_TOKEN_ADDRESS, 20).into(),
kton_token_address: array_bytes::hex_str_array_unchecked!(KTON_TOKEN_ADDRESS, 20).into(),
ring_locked: 1 << 56,
kton_locked: 1 << 56,
..Default::default()
Expand Down
4 changes: 2 additions & 2 deletions node/service/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dar";
#[serde(rename_all = "camelCase")]
pub struct Extensions {
/// Block numbers with known hashes.
pub fork_blocks: sc_client_api::ForkBlocks<darwinia_primitives::Block>,
pub fork_blocks: sc_client_api::ForkBlocks<darwinia_primitives::OpaqueBlock>,
/// Known bad block hashes.
pub bad_blocks: sc_client_api::BadBlocks<darwinia_primitives::Block>,
pub bad_blocks: sc_client_api::BadBlocks<darwinia_primitives::OpaqueBlock>,
}

/// Generate a crypto pair from seed.
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub use sc_service::{
pub use chain_spec::{CrabChainSpec, DarwiniaChainSpec};
pub use client::DarwiniaClient;
pub use crab_runtime;
pub use darwinia_primitives::Block;
pub use darwinia_primitives::OpaqueBlock as Block;
pub use darwinia_runtime;

// --- std ---
Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://darwinia.network/"
license = "GPL-3.0"
name = "darwinia-primitives"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.8.2"
version = "0.8.3"

[dependencies]
# crates
Expand Down
49 changes: 7 additions & 42 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,13 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]

/// App-specific crypto used for reporting equivocation/misbehavior in BABE,
/// GRANDPA and Parachains, described in the white paper as the fisherman role.
/// Any rewards for misbehavior reporting will be paid out to this account.
pub mod fisherman {
// --- substrate ---
use sp_core::crypto::KeyTypeId;
// --- crates ---
use super::{Signature, Verify};

/// Key type for the reporting module. Used for reporting BABE, GRANDPA
/// and Parachain equivocations.
pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"fish");

mod app {
use sp_application_crypto::{app_crypto, sr25519};
app_crypto!(sr25519, super::KEY_TYPE);
}

/// Identity of the equivocation/misbehavior reporter.
pub type FishermanId = app::Public;

/// An `AppCrypto` type to allow submitting signed transactions using the fisherman
/// application key as signer.
pub struct FishermanAppCrypto;
impl frame_system::offchain::AppCrypto<<Signature as Verify>::Signer, Signature>
for FishermanAppCrypto
{
type RuntimeAppPublic = FishermanId;
type GenericPublic = sp_core::sr25519::Public;
type GenericSignature = sp_core::sr25519::Signature;
}
}

// --- substrate ---
pub use sp_runtime::traits::{BlakeTwo256, Hash as HashT, IdentifyAccount, Verify};
/// Opaque, encoded, unchecked extrinsic.
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;

// --- substrate ---
use sp_core::H256;
use sp_runtime::{generic, MultiSignature};
use sp_runtime::{
generic,
traits::{BlakeTwo256, IdentifyAccount, Verify},
MultiSignature, OpaqueExtrinsic,
};

/// An index to a block.
/// 32-bits will allow for 136 years of blocks assuming 1 block per second.
Expand Down Expand Up @@ -87,10 +53,9 @@ pub type Power = u32;

/// Header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;

/// Block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Block ID.
pub type BlockId = generic::BlockId<Block>;
pub type OpaqueBlock = generic::Block<Header, OpaqueExtrinsic>;

#[ignore]
#[test]
Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://darwinia.network/"
license = "GPL-3.0"
name = "darwinia-rpc"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.8.2"
version = "0.8.3"

[dependencies]
# crates
Expand Down
4 changes: 3 additions & 1 deletion rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ use std::sync::Arc;
// --- substrate ---
use sp_api::ProvideRuntimeApi;
// --- darwinia ---
use darwinia_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Nonce, Power};
use darwinia_primitives::{
AccountId, Balance, BlockNumber, Hash, Nonce, OpaqueBlock as Block, Power,
};

/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://darwinia.network/"
license = "GPL-3.0"
name = "darwinia-runtime-common"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.8.2"
version = "0.8.3"

[dependencies]
# crates
Expand Down
Loading