Skip to content

Commit

Permalink
Merge pull request #50 from hicommonwealth/drew.upgrade
Browse files Browse the repository at this point in the history
Drew.upgrade: Fix some issues, update lock files, use up-to-date node formats, new testnet
  • Loading branch information
jnaviask authored Mar 8, 2019
2 parents c5c702c + 0f8bede commit 0169415
Show file tree
Hide file tree
Showing 18 changed files with 2,712 additions and 1,361 deletions.
1,694 changes: 860 additions & 834 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
@@ -1,6 +1,6 @@
[package]
name = "edgeware"
version = "0.1.3"
version = "0.1.5"
authors = ["Commonwealth Labs <[email protected]>"]
build = "build.rs"

Expand Down
1 change: 0 additions & 1 deletion modules/edge-governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ mod tests {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type Event = Event;
}

Expand Down
1 change: 0 additions & 1 deletion modules/edge-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ mod tests {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type Event = Event;
}

Expand Down
4 changes: 4 additions & 0 deletions node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ srml-system = { git = "https://github.com/paritytech/substrate", default-feature
srml-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-treasury = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-upgrade-key = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-fees = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-finality-tracker = { git = "https://github.com/paritytech/substrate", default-features = false }
substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false }
node-primitives = { git = "https://github.com/paritytech/substrate", default-features = false }
Expand Down Expand Up @@ -63,6 +65,8 @@ std = [
"srml-timestamp/std",
"srml-treasury/std",
"srml-upgrade-key/std",
"srml-fees/std",
"srml-finality-tracker/std",
"sr-version/std",
"node-primitives/std",
"serde/std",
Expand Down
70 changes: 60 additions & 10 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// Copyright 2018 Commonwealth Labs, Inc.
// This file is part of Edgeware.

// Edgeware is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Edgeware is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Edgeware. If not, see <http://www.gnu.org/licenses/>

//! The Edgeware runtime. This can be compiled with `#[no_std]`, ready for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
Expand Down Expand Up @@ -36,7 +52,10 @@ extern crate srml_staking as staking;
extern crate srml_system as system;
extern crate srml_timestamp as timestamp;
extern crate srml_treasury as treasury;
extern crate srml_fees as fees;
extern crate srml_finality_tracker as finality_tracker;
extern crate srml_upgrade_key as upgrade_key;

extern crate node_primitives;
extern crate substrate_consensus_aura_primitives as consensus_aura;

Expand Down Expand Up @@ -82,10 +101,10 @@ pub use timestamp::BlockPeriod;
/// This runtime version.
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("edgeware"),
impl_name: create_runtime_str!("edgeware"),
impl_name: create_runtime_str!("edgeware node"),
authoring_version: 1,
spec_version: 1,
impl_version: 0,
spec_version: 2,
impl_version: 2,
apis: RUNTIME_API_VERSIONS,
};

Expand Down Expand Up @@ -123,19 +142,30 @@ impl indices::Trait for Runtime {
type Event = Event;
}

// impl balances::Trait for Runtime {
// type Balance = Balance;
// type OnFreeBalanceZero = ((Staking, Contract), Democracy);
// type OnNewAccount = Indices;
// type EnsureAccountLiquid = (Staking, Democracy);
// type Event = Event;
// }
impl balances::Trait for Runtime {
type Balance = Balance;
type OnFreeBalanceZero = ((Staking, Contract), Democracy);
type OnFreeBalanceZero = ((Staking, Contract), Session);
type OnNewAccount = Indices;
type EnsureAccountLiquid = (Staking, Democracy);
type Event = Event;
}

impl fees::Trait for Runtime {
type Event = Event;
type TransferAsset = Balances;
}

impl consensus::Trait for Runtime {
type Log = Log;
type SessionKey = SessionKey;

// the aura module handles offline-reports internally
// The Aura module handles offline-reports internally
// rather than using an explicit report system.
type InherentOfflineReport = ();
}
Expand Down Expand Up @@ -206,6 +236,10 @@ impl grandpa::Trait for Runtime {
type Event = Event;
}

impl finality_tracker::Trait for Runtime {
type OnFinalizationStalled = grandpa::SyncedAuthorities<Runtime>;
}

impl upgrade_key::Trait for Runtime {
/// The uniquitous event type.
type Event = Event;
Expand Down Expand Up @@ -244,15 +278,17 @@ construct_runtime!(
Indices: indices,
Balances: balances,
Session: session,
Staking: staking,
Staking: staking::{default, OfflineWorker},
Democracy: democracy,
Council: council::{Module, Call, Storage, Event<T>},
CouncilVoting: council_voting,
CouncilMotions: council_motions::{Module, Call, Storage, Event<T>, Origin},
CouncilSeats: council_seats::{Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config<T>, Log(), Event<T>},
Treasury: treasury,
Contract: contract::{Module, Call, Storage, Config<T>, Event<T>},
Fees: fees::{Module, Storage, Config<T>, Event<T>},
UpgradeKey: upgrade_key,
Identity: identity::{Module, Call, Storage, Config<T>, Event<T>},
Delegation: delegation::{Module, Call, Storage, Config<T>, Event<T>},
Expand All @@ -276,7 +312,7 @@ pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic<Address,
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Balances, AllModules>;
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Fees, AllModules>;

impl_runtime_apis! {
impl client_api::Core<Block> for Runtime {
Expand Down Expand Up @@ -337,7 +373,7 @@ impl_runtime_apis! {
{
for log in digest.logs.iter().filter_map(|l| match l {
Log(InternalLog::grandpa(grandpa_signal)) => Some(grandpa_signal),
_=> None
_ => None
}) {
if let Some(change) = Grandpa::scrape_digest_change(log) {
return Some(change);
Expand All @@ -346,6 +382,20 @@ impl_runtime_apis! {
None
}

fn grandpa_forced_change(digest: &DigestFor<Block>)
-> Option<(NumberFor<Block>, ScheduledChange<NumberFor<Block>>)>
{
for log in digest.logs.iter().filter_map(|l| match l {
Log(InternalLog::grandpa(grandpa_signal)) => Some(grandpa_signal),
_ => None
}) {
if let Some(change) = Grandpa::scrape_digest_forced_change(log) {
return Some(change);
}
}
None
}

fn grandpa_authorities() -> Vec<(SessionKey, u64)> {
Grandpa::grandpa_authorities()
}
Expand All @@ -356,4 +406,4 @@ impl_runtime_apis! {
Aura::slot_duration()
}
}
}
}
Loading

0 comments on commit 0169415

Please sign in to comment.