Skip to content

Commit

Permalink
Merge pull request #39 from darwinia-network/master
Browse files Browse the repository at this point in the history
Merge from master to poc1-final
  • Loading branch information
sekisamu authored Jul 8, 2019
2 parents 2fb68f3 + 9ecacad commit 60b7239
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 40 deletions.
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Request an environment that provides sudo (that goes with larger containers)
# and a minimal language environment.
sudo: true
language: minimal

cache: cargo

branches:
only:
- master

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

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

script:
- ./ci/script.sh

after_script:
# 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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/darwinia-network/darwinia.svg?branch=master)](https://travis-ci.org/darwinia-network/darwinia/builds)


# Darwinia Relay Chain

Expand Down
28 changes: 28 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -eux

# Install rustup and the specified rust toolchain.
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$RUST_TOOLCHAIN -y

# Load cargo environment. Specifically, put cargo into PATH.
source ~/.cargo/env

rustc --version
rustup --version
cargo --version

case $TARGET in
"native")
sudo apt-get -y update
sudo apt-get install -y cmake pkg-config libssl-dev

cargo test --all --locked "$@"
;;

"wasm")
# Install prerequisites and build all wasm projects
./init.sh
./build.sh --locked "$@"
;;
esac
2 changes: 1 addition & 1 deletion node/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runtime_primitives = { package = "sr-primitives", git = 'https://github.com/pari
runtime_support = { package = "srml-support", git = 'https://github.com/paritytech/substrate.git' }
balances = { package = "srml-balances",git = 'https://github.com/paritytech/substrate.git' }
session = { package = "srml-session", git = 'https://github.com/paritytech/substrate.git' }
staking = { package = "srml-staking", git = 'https://github.com/paritytech/substrate.git' }
staking = { package = "evo-staking", path = '../../srml/staking' }
system = { package = "srml-system", git = 'https://github.com/paritytech/substrate.git' }
timestamp = { package = "srml-timestamp", git = 'https://github.com/paritytech/substrate.git' }
treasury = { package = "srml-treasury", git = 'https://github.com/paritytech/substrate.git' }
Expand Down
50 changes: 16 additions & 34 deletions node/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

pub use substrate_executor::NativeExecutor;
use substrate_executor::native_executor_instance;
pub use node_runtime::{SessionsPerEra, BondingDuration, ErasPerEpoch, CAP};

// Declare an instance of the native executor named `Executor`. Include the wasm binary as the
// equivalent wasm code.
Expand Down Expand Up @@ -54,7 +55,7 @@ mod tests {
use system::{EventRecord, Phase};
use node_runtime::{Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances,
BuildStorage, GenesisConfig, BalancesConfig, SessionConfig, StakingConfig, System,
SystemConfig, GrandpaConfig, IndicesConfig, Event, SessionKeys};
SystemConfig, GrandpaConfig, IndicesConfig, KtonConfig, Event, SessionKeys};
use wabt;
use primitives::map;

Expand Down Expand Up @@ -361,6 +362,18 @@ mod tests {
creation_fee: 0,
vesting: vec![],
}),
kton: Some(KtonConfig {
balances: vec![
(alice(), 111),
(bob(), 100),
(charlie(), 100_000_000),
(dave(), 111),
(eve(), 101),
(ferdie(), 100),
],
vesting: vec![],
sys_acc: ferdie(),
}),
session: Some(SessionConfig {
validators: vec![AccountKeyring::One.into(), AccountKeyring::Two.into(), three],
keys: vec![
Expand All @@ -371,6 +384,8 @@ mod tests {
}),
staking: Some(StakingConfig {
current_era: 0,
current_era_total_reward: 1,
epoch_index: 0,
stakers: vec![
(dave(), alice(), 111, staking::StakerStatus::Validator),
(eve(), bob(), 100, staking::StakerStatus::Validator),
Expand All @@ -384,10 +399,7 @@ mod tests {
offline_slash_grace: 0,
invulnerables: vec![alice(), bob(), charlie()],
}),
democracy: Some(Default::default()),
council_seats: Some(Default::default()),
timestamp: Some(Default::default()),
treasury: Some(Default::default()),
contracts: Some(Default::default()),
sudo: Some(Default::default()),
grandpa: Some(GrandpaConfig {
Expand Down Expand Up @@ -582,21 +594,6 @@ mod tests {
event: Event::system(system::Event::ExtrinsicSuccess),
topics: vec![],
},
EventRecord {
phase: Phase::Finalization,
event: Event::treasury(treasury::RawEvent::Spending(0)),
topics: vec![],
},
EventRecord {
phase: Phase::Finalization,
event: Event::treasury(treasury::RawEvent::Burnt(0)),
topics: vec![],
},
EventRecord {
phase: Phase::Finalization,
event: Event::treasury(treasury::RawEvent::Rollover(0)),
topics: vec![],
},
]);
});

Expand Down Expand Up @@ -654,21 +651,6 @@ mod tests {
event: Event::system(system::Event::ExtrinsicSuccess),
topics: vec![],
},
EventRecord {
phase: Phase::Finalization,
event: Event::treasury(treasury::RawEvent::Spending(0)),
topics: vec![],
},
EventRecord {
phase: Phase::Finalization,
event: Event::treasury(treasury::RawEvent::Burnt(0)),
topics: vec![],
},
EventRecord {
phase: Phase::Finalization,
event: Event::treasury(treasury::RawEvent::Rollover(0)),
topics: vec![],
},
]);
});
}
Expand Down
2 changes: 1 addition & 1 deletion srml/token/kton/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ decl_event!(


decl_storage! {
trait Store for Module<T: Trait> as KtonBalances {
trait Store for Module<T: Trait> as Kton {

pub DepositLedger get(deposit_ledger): map T::AccountId => Option<Deposit<CurrencyOf<T>, T::Moment>>;

Expand Down
7 changes: 7 additions & 0 deletions srml/token/ring/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ impl system::Trait for Runtime {
type Header = Header;
type Event = ();
}

impl timestamp::Trait for Runtime {
type Moment = u64;
type OnTimestampSet = ();
}

impl Trait for Runtime {
type Balance = u64;
type OnFreeBalanceZero = ();
Expand Down Expand Up @@ -129,4 +135,5 @@ impl ExtBuilder {
}

pub type System = system::Module<Runtime>;
pub type Timestamp = timestamp::Module<Runtime>;
pub type Balances = Module<Runtime>;
2 changes: 1 addition & 1 deletion srml/try/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ decl_module! {
list.push(value);
<List<T>>::insert(1, list);
} else {
list.remove(value);
list.remove(value as usize);
}

}
Expand Down
4 changes: 2 additions & 2 deletions srml/try/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ fn check_default_value() {
#[test]
fn check_delete() {
with_externalities(&mut new_test_ext(), || {
Try::update_list(1);
Try::update_list(1, true);
assert_eq!(Try::list(1), vec![1]);
Try::update_list(2);
Try::update_list(2, true);
assert_eq!(Try::list(1), vec![1, 2]);
});
}

0 comments on commit 60b7239

Please sign in to comment.