Skip to content

Commit

Permalink
Merge pull request #179 from AurevoirXavier/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
hackfisher authored Dec 20, 2019
2 parents fa4c8b9 + a2c4a28 commit a980333
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 107 deletions.
14 changes: 0 additions & 14 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ panic = 'unwind'
members = [
"core/cli",
"core/ethash",
"core/merkle-mountain-range",
"core/fly-client",
# "core/merkle-mountain-range",
# "core/fly-client",
"core/sr-eth-primitives",
"core/merkle-patricia-trie",

Expand Down
9 changes: 0 additions & 9 deletions boot-conf/develop/alice.json

This file was deleted.

9 changes: 0 additions & 9 deletions boot-conf/develop/bob.json

This file was deleted.

6 changes: 6 additions & 0 deletions boot-conf/testnet/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"base-path": "/tmp/darwinia-testnet/1",
"name": "testnet 1",
"validator": true,
"rpc-port": 6664
}
6 changes: 6 additions & 0 deletions boot-conf/testnet/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"base-path": "/tmp/darwinia-testnet/2",
"name": "testnet 2",
"validator": true,
"rpc-port": 6665
}
6 changes: 6 additions & 0 deletions boot-conf/testnet/3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"base-path": "/tmp/darwinia-testnet/3",
"name": "testnet 3",
"validator": true,
"rpc-port": 6666
}
6 changes: 6 additions & 0 deletions boot-conf/testnet/4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"base-path": "/tmp/darwinia-testnet/4",
"name": "testnet 4",
"validator": true,
"rpc-port": 6667
}
6 changes: 6 additions & 0 deletions boot-conf/testnet/5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"base-path": "/tmp/darwinia-testnet/5",
"name": "testnet 5",
"validator": true,
"rpc-port": 6668
}
7 changes: 7 additions & 0 deletions boot-conf/testnet/alice.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"base-path": "/tmp/darwinia-testnet/alice",
"rpc-external": true,
"ws-external": true,
"ws-port": 23333,
"rpc-cors": "all"
}
6 changes: 3 additions & 3 deletions node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ pub fn darwinia_genesis(
.iter()
.cloned()
.map(|k| (k, ENDOWMENT))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), ENDOWMENT)))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
.collect(),
vesting: vec![],
}),
staking: Some(StakingConfig {
current_era: 0,
validator_count: initial_authorities.len() as u32 * 2,
minimum_validator_count: initial_authorities.len() as u32,
validator_count: 7,
minimum_validator_count: 1,
stakers: initial_authorities
.iter()
.map(|x| (x.0.clone(), x.1.clone(), STASH, StakerStatus::Validator))
Expand Down
12 changes: 6 additions & 6 deletions node/runtime/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ pub mod time {
/// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>

// Develop
// pub const MILLISECS_PER_BLOCK: Moment = 1000;
pub const MILLISECS_PER_BLOCK: Moment = 1000;
// Production
pub const MILLISECS_PER_BLOCK: Moment = 3000;
// pub const MILLISECS_PER_BLOCK: Moment = 3000;
pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;

pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;
Expand All @@ -60,9 +60,9 @@ pub mod time {
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);

// Develop
// pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = MINUTES;
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = MINUTES;
// Production
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
// pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
pub const EPOCH_DURATION_IN_SLOTS: u64 = {
const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64;

Expand All @@ -76,9 +76,9 @@ pub mod time {

pub const SESSION_DURATION: BlockNumber = EPOCH_DURATION_IN_SLOTS as _;
// Develop
// pub const SESSION_PER_ERA: sr_staking_primitives::SessionIndex = 1;
pub const SESSION_PER_ERA: sr_staking_primitives::SessionIndex = 3;
// Production
pub const SESSION_PER_ERA: sr_staking_primitives::SessionIndex = 5;
// pub const SESSION_PER_ERA: sr_staking_primitives::SessionIndex = 5;
}

// CRITICAL NOTE: The system module maintains two constants: a _maximum_ block weight and a _ratio_
Expand Down
106 changes: 53 additions & 53 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node"),
impl_name: create_runtime_str!("darwinia-node"),
authoring_version: 3,
spec_version: 80,
impl_version: 80,
spec_version: 81,
impl_version: 81,
apis: RUNTIME_API_VERSIONS,
};

Expand Down Expand Up @@ -129,6 +129,16 @@ impl utility::Trait for Runtime {
type Call = Call;
}

parameter_types! {
pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS;
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
}
impl babe::Trait for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
type EpochChangeTrigger = babe::ExternalTrigger;
}

impl indices::Trait for Runtime {
type AccountIndex = AccountIndex;
type IsDeadAccount = Balances;
Expand Down Expand Up @@ -161,16 +171,6 @@ impl transaction_payment::Trait for Runtime {
type FeeMultiplierUpdate = TargetedFeeAdjustment<TargetBlockFullness>;
}

parameter_types! {
pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS;
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
}
impl babe::Trait for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
type EpochChangeTrigger = babe::ExternalTrigger;
}

parameter_types! {
pub const MinimumPeriod: Moment = SLOT_DURATION / 2;
}
Expand Down Expand Up @@ -224,44 +224,6 @@ impl session::historical::Trait for Runtime {
type FullIdentificationOf = staking::ExposureOf<Runtime>;
}

impl sudo::Trait for Runtime {
type Event = Event;
type Proposal = Call;
}

impl offences::Trait for Runtime {
type Event = Event;
type IdentificationTuple = session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
}

type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
parameter_types! {
pub const SessionDuration: BlockNumber = SESSION_DURATION;
}
impl im_online::Trait for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type Call = Call;
type SubmitTransaction = SubmitTransaction;
type SessionDuration = SessionDuration;
type ReportUnresponsiveness = Offences;
}

impl grandpa::Trait for Runtime {
type Event = Event;
}

parameter_types! {
pub const WindowSize: BlockNumber = 101;
pub const ReportLatency: BlockNumber = 1000;
}
impl finality_tracker::Trait for Runtime {
type OnFinalizationStalled = Grandpa;
type WindowSize = WindowSize;
type ReportLatency = ReportLatency;
}

parameter_types! {
// Develop
pub const ContractTransferFee: Balance = MICRO;
Expand Down Expand Up @@ -314,6 +276,44 @@ impl contracts::Trait for Runtime {
type BlockGasLimit = contracts::DefaultBlockGasLimit;
}

impl sudo::Trait for Runtime {
type Event = Event;
type Proposal = Call;
}

type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
parameter_types! {
pub const SessionDuration: BlockNumber = SESSION_DURATION;
}
impl im_online::Trait for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type Call = Call;
type SubmitTransaction = SubmitTransaction;
type SessionDuration = SessionDuration;
type ReportUnresponsiveness = Offences;
}

impl offences::Trait for Runtime {
type Event = Event;
type IdentificationTuple = session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
}

impl grandpa::Trait for Runtime {
type Event = Event;
}

parameter_types! {
pub const WindowSize: BlockNumber = 101;
pub const ReportLatency: BlockNumber = 1000;
}
impl finality_tracker::Trait for Runtime {
type OnFinalizationStalled = Grandpa;
type WindowSize = WindowSize;
type ReportLatency = ReportLatency;
}

impl system::offchain::CreateTransaction<Runtime, UncheckedExtrinsic> for Runtime {
type Public = <Signature as traits::Verify>::Signer;
type Signature = Signature;
Expand Down Expand Up @@ -345,9 +345,9 @@ impl system::offchain::CreateTransaction<Runtime, UncheckedExtrinsic> for Runtim
}

parameter_types! {
pub const ExistentialDeposit: Balance = 1 * COIN;
pub const TransferFee: Balance = 1 * MICRO;
pub const CreationFee: Balance = 1 * MICRO;
pub const ExistentialDeposit: Balance = COIN;
pub const TransferFee: Balance = MICRO;
pub const CreationFee: Balance = MICRO;
}
impl balances::Trait for Runtime {
type Balance = Balance;
Expand Down
Loading

0 comments on commit a980333

Please sign in to comment.