Skip to content

Commit

Permalink
Feature/punish (paritytech#242)
Browse files Browse the repository at this point in the history
* Format code

* Add punish for staking module

* Add xaura module for handle_offline_report
  • Loading branch information
gguoss authored Jan 24, 2019
1 parent 940b0ae commit 19b5938
Show file tree
Hide file tree
Showing 13 changed files with 626 additions and 93 deletions.
24 changes: 23 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ members = [
"xrml/xaccounts",
"xrml/xsession",
"xrml/xgrandpa",
"xrml/xaura",
# xrml/xfee
"xrml/xfee/manager",
# xrml/assets
Expand Down
8 changes: 3 additions & 5 deletions cli/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use chainx_runtime::{
Runtime,
};
use chainx_runtime::{
BalancesConfig, ConsensusConfig, GenesisConfig, IndicesConfig, Params, Perbill, SessionConfig,
BalancesConfig, ConsensusConfig, GenesisConfig, IndicesConfig, Params, SessionConfig,
SudoConfig, TimestampConfig, XAccountsConfig, XAssetsConfig, XBridgeOfBTCConfig,
XFeeManagerConfig, XSpotConfig, XStakingConfig, XSystemConfig,
};
Expand Down Expand Up @@ -143,10 +143,8 @@ pub fn testnet_genesis(genesis_spec: GenesisSpec) -> GenesisConfig {
sessions_per_era: 10,
bonding_duration: 10,
current_era: 0,
current_offline_slash: 100,
offline_slash_grace: 0,
offline_slash: Perbill::from_millionths(0),
current_session_reward: 100,
penalty: 100,
funding: Default::default(),
intentions: vec![],
}),
xspot: Some(XSpotConfig {
Expand Down
4 changes: 2 additions & 2 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ srml-system = { git = "https://github.com/chainpool/substrate", default-features
srml-balances = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-timestamp = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-consensus = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-aura = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-sudo = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-indices = { git = "https://github.com/chainpool/substrate", default-features = false }

Expand All @@ -44,6 +43,7 @@ runtime-api = { path = "../runtime-api", default-features = false }
xrml-xsystem = { path = "../xrml/xsystem", default-features = false }
xrml-xaccounts = { path = "../xrml/xaccounts", default-features = false }
xrml-session = { path = "../xrml/xsession", default-features = false }
xrml-aura = { path = "../xrml/xaura", default-features = false }
xrml-grandpa = { path = "../xrml/xgrandpa", default-features = false }
# fee
xrml-fee-manager = { path = "../xrml/xfee/manager", default-features = false }
Expand Down Expand Up @@ -86,7 +86,7 @@ std = [
"srml-consensus/std",
"xrml-session/std",
"xrml-grandpa/std",
"srml-aura/std",
"xrml-aura/std",
"srml-sudo/std",
"srml-indices/std",

Expand Down
8 changes: 3 additions & 5 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ extern crate sr_std as rstd;
// substrate runtime module
#[macro_use]
extern crate srml_support;
extern crate srml_aura as aura;
extern crate srml_balances as balances;
extern crate srml_consensus as consensus;
extern crate srml_indices as indices;
extern crate srml_sudo as sudo;
extern crate srml_system as system;
extern crate srml_timestamp as timestamp;
extern crate xrml_aura as aura;
extern crate xrml_grandpa as grandpa;
extern crate xrml_session as session;
// unused
Expand Down Expand Up @@ -182,8 +182,7 @@ impl Convert<AccountId, SessionKey> for SessionKeyConversion {

impl session::Trait for Runtime {
type ConvertAccountIdToSessionKey = SessionKeyConversion;
// type OnSessionChange = (Staking, grandpa::SyncedAuthorities<Runtime>);
type OnSessionChange = grandpa::SyncedAuthorities<Runtime>;
type OnSessionChange = (XStaking, grandpa::SyncedAuthorities<Runtime>);
type Event = Event;
}

Expand All @@ -194,8 +193,7 @@ impl grandpa::Trait for Runtime {
}

impl aura::Trait for Runtime {
// type HandleReport = aura::StakingSlasher<Runtime>;
type HandleReport = ();
type HandleReport = aura::StakingSlasher<Runtime>;
}

// bridge
Expand Down
68 changes: 21 additions & 47 deletions runtime/wasm/Cargo.lock

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

Binary file not shown.
42 changes: 42 additions & 0 deletions xrml/xaura/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
name = "xrml-aura"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io> & Chainpool <chainx.org>"]

[dependencies]
hex-literal = "0.1.0"
parity-codec = { version = "2.2", default-features = false }
parity-codec-derive = { version = "2.1", default-features = false }
serde = { version = "1.0", default-features = false }
substrate-primitives = { git = "https://github.com/chainpool/substrate", default-features = false }
substrate-inherents = { git = "https://github.com/chainpool/substrate", default-features = false }
sr-std = { git = "https://github.com/chainpool/substrate", default-features = false }
sr-io = { git = "https://github.com/chainpool/substrate", default-features = false }
sr-primitives = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-support = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-system = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-consensus = { git = "https://github.com/chainpool/substrate", default-features = false }
srml-timestamp = { git = "https://github.com/chainpool/substrate", default-features = false }
xrml-mining-staking = { path = "../xmining/staking", default-features = false }

[dev-dependencies]
lazy_static = "1.0"
parking_lot = "0.7.1"

[features]
default = ["std"]
std = [
"serde/std",
"parity-codec/std",
"parity-codec-derive/std",
"substrate-primitives/std",
"sr-std/std",
"sr-io/std",
"srml-support/std",
"sr-primitives/std",
"srml-system/std",
"srml-consensus/std",
"srml-timestamp/std",
"xrml-mining-staking/std",
"substrate-inherents/std",
]
Loading

0 comments on commit 19b5938

Please sign in to comment.