Skip to content

Commit

Permalink
merge from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hackfisher committed Dec 31, 2019
2 parents 80c6fe7 + 44e7efa commit 0174b00
Show file tree
Hide file tree
Showing 10 changed files with 519 additions and 372 deletions.
26 changes: 13 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ language: minimal
cache: cargo

branches:
only:
- master
- develop
only:
- master
- develop

env:
global:
- RUST_BACKTRACE=1
matrix:
- RUST_TOOLCHAIN=nightly TARGET=wasm
- RUST_TOOLCHAIN=nightly TARGET=native
global:
- RUST_BACKTRACE=1
matrix:
- RUST_TOOLCHAIN=nightly TARGET=wasm
- RUST_TOOLCHAIN=nightly TARGET=native

before_install:
# Check how much space we've got on this machine.
- df -h
# Check how much space we've got on this machine.
- df -h

script:
- ./ci/script.sh
- ./ci/script.sh

after_script:
# Check how much free disk space left after the build
- df -h
# Check how much free disk space left after the build
- df -h
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:toc:
:sectnums:

image:https://travis-ci.org/AurevoirXavier/darwinia.svg[Build Status (Travis CI),link=https://travis-ci.org/AurevoirXavier/darwinia]
image:https://travis-ci.org/darwinia-network/darwinia.svg[Build Status (Travis CI),link=https://travis-ci.org/darwinia-network/darwinia]
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[License,link=https://opensource.org/licenses/Apache-2.0]

== Darwinia Relay Chain
Expand Down
2 changes: 1 addition & 1 deletion node/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "node-cli"
version = "0.4.0"
version = "0.4.6"
authors = ["Darwinia Network <[email protected]>"]
description = "Darwinia node implementation in Rust."
build = "build.rs"
Expand Down
310 changes: 225 additions & 85 deletions node/cli/res/icefrog.json

Large diffs are not rendered by default.

30 changes: 2 additions & 28 deletions node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct Extensions {
pub type ChainSpec = substrate_service::ChainSpec<GenesisConfig, Extensions>;

/// IceFrog testnet generator
pub fn icefrog_fir_config() -> Result<ChainSpec, String> {
pub fn icefrog_testnet_config() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(&include_bytes!("../res/icefrog.json")[..])
}

Expand Down Expand Up @@ -308,34 +308,8 @@ pub fn development_config() -> ChainSpec {
)
}

/// Local testnet config (multivalidator Alice + Bob)
/// IceFrog local testnet config (multivalidator Alice + Bob)
pub fn local_testnet_config() -> ChainSpec {
fn local_testnet_genesis() -> GenesisConfig {
darwinia_genesis(
vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
false,
)
}

ChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
local_testnet_genesis,
vec![],
None,
None,
None,
Default::default(),
)
}

/// IceFrog testnet config (multivalidator Alice + Bob)
pub fn icefrog_testnet_config() -> ChainSpec {
fn icefrog_config_genesis() -> GenesisConfig {
darwinia_genesis(
vec![
Expand Down
2 changes: 1 addition & 1 deletion node/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl ChainSpec {
ChainSpec::Development => chain_spec::development_config(),
ChainSpec::LocalTestnet => chain_spec::local_testnet_config(),
ChainSpec::StagingTestnet => chain_spec::staging_testnet_config(),
ChainSpec::IceFrogTestnet => chain_spec::icefrog_testnet_config(),
ChainSpec::IceFrogTestnet => chain_spec::icefrog_testnet_config()?,
})
}

Expand Down
4 changes: 2 additions & 2 deletions srml/staking/src/inflation.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rstd::convert::TryInto;
use sr_primitives::{
traits::{IntegerSquareRoot, SaturatedConversion},
Perbill,
Perbill, Perquintill,
};
use substrate_primitives::U256;

Expand All @@ -20,7 +20,7 @@ pub fn compute_total_payout<T: Trait>(

let year: u32 = (living_time / MILLISECONDS_PER_YEAR + 1).saturated_into::<u32>();

let portion = Perbill::from_rational_approximation(era_duration, MILLISECONDS_PER_YEAR);
let portion = Perquintill::from_rational_approximation(era_duration, MILLISECONDS_PER_YEAR);

let maximum = portion * total_left;

Expand Down
15 changes: 7 additions & 8 deletions srml/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,14 @@ pub fn start_era(era_index: EraIndex) {
assert_eq!(Staking::current_era(), era_index);
}

// TODO

pub fn current_total_payout_for_duration(duration: u64) -> Balance {
// inflation::compute_total_payout(
// era_duration.saturated_into::<Moment>(),
// (<Module<Test>>::Time::now() - <Module<Test>>::GenesisTime::get()).saturated_into::<Moment>(),
// (<Module<Test>>::Cap::get() - Ring::total_issuance()).saturated_into::<Balance>(),
// )
// .0
unimplemented!()
inflation::compute_total_payout::<Test>(
duration.saturated_into::<Moment>(),
(Timestamp::now() - <mock::Test as Trait>::GenesisTime::get()).saturated_into::<Moment>(),
(<mock::Test as Trait>::Cap::get() - Ring::total_issuance()).saturated_into::<Balance>(),
Perbill::from_percent(50)
).0
}

pub fn reward_all_elected() {
Expand Down
Loading

0 comments on commit 0174b00

Please sign in to comment.