Skip to content

Commit

Permalink
Revert "Revert "Multi-runtime support (centrifuge#395)""
Browse files Browse the repository at this point in the history
This reverts commit a1ba572.
  • Loading branch information
Branan Riley committed Jun 25, 2021
1 parent 7adf8f6 commit 2d0bf8a
Show file tree
Hide file tree
Showing 32 changed files with 3,083 additions and 3,165 deletions.
196 changes: 194 additions & 2 deletions Cargo.lock

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

15 changes: 11 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ members = [
"pallets/bridge-mapping",
"pallets/fees",
"pallets/anchors",
"pallets/claims",
"pallets/claims",
"pallets/crowdloan-claim",
"pallets/crowdloan-reward",
"libs/trait-crowdloan-reward",
"libs/proofs",
"runtime",
"runtime/altair",
"runtime/centrifuge",
"runtime/common",
]

[dependencies]
Expand Down Expand Up @@ -127,7 +129,10 @@ polkadot-service = {git = "https://github.com/centrifuge/polkadot", branch = "ce
polkadot-cli = {git = "https://github.com/centrifuge/polkadot", branch = "centrifuge" }

# node-specific dependencies
node-runtime = { package = "centrifuge-chain-runtime", path = "runtime" }
altair-runtime = { path = "runtime/altair" }
centrifuge-runtime = { path = "runtime/centrifuge" }
development-runtime = { path = "runtime/development" }
runtime-common = { path = "runtime/common" }
node-primitives = { git = "https://github.com/centrifuge/substrate", branch = "master" }

# benchmarking
Expand All @@ -154,5 +159,7 @@ std = [
"sp-consensus-babe/std"
]
runtime-benchmarks = [
"node-runtime/runtime-benchmarks",
"altair-runtime/runtime-benchmarks",
"centrifuge-runtime/runtime-benchmarks",
"development-runtime/runtime-benchmarks",
]
11 changes: 7 additions & 4 deletions runtime/Cargo.toml → runtime/altair/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "centrifuge-chain-runtime"
name = "altair-runtime"
version = "2.0.0"
authors = ["Centrifuge <admin@centrifuge.io>"]
edition = "2018"
Expand Down Expand Up @@ -94,9 +94,11 @@ pallet-aura = { git = "https://github.com/centrifuge/substrate", default-feature
pallet-society = { git = "https://github.com/centrifuge/substrate", default-features = false, branch = "master" }
max-encoded-len = { git = "https://github.com/centrifuge/substrate", default-features = false, features = [ "derive" ] , branch = "master" }

pallet-anchors = { path = "../pallets/anchors", default-features = false }
pallet-fees = { path = "../pallets/fees", default-features = false }
pallet-claims = { path = "../pallets/claims", default-features = false }
runtime-common = { path = "../common", default-features = false }

pallet-anchors = { path = "../../pallets/anchors", default-features = false }
pallet-fees = { path = "../../pallets/fees", default-features = false }
pallet-claims = { path = "../../pallets/claims", default-features = false }

[build-dependencies]
substrate-wasm-builder = "3.0.0"
Expand Down Expand Up @@ -169,6 +171,7 @@ std = [
"pallet-claims/std",
"pallet-sudo/std",
"pallet-society/std",
"runtime-common/std",
]
runtime-benchmarks = [
"frame-benchmarking",
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions runtime/altair/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! A set of constant values used in altair runtime
/// Money matters.
pub mod currency {
use node_primitives::Balance;
use runtime_common::*;

pub const MICRO_AIR: Balance = MICRO_CFG;
pub const MILLI_AIR: Balance = MILLI_CFG;
pub const CENTI_AIR: Balance = CENTI_CFG;
pub const AIR: Balance = CFG;
}
20 changes: 5 additions & 15 deletions runtime/src/lib.rs → runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub use pallet_timestamp::Call as TimestampCall;
pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment};
use pallet_transaction_payment_rpc_runtime_api::{FeeDetails, RuntimeDispatchInfo};
use polkadot_runtime_common::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
use sp_api::{decl_runtime_apis, impl_runtime_apis};
use sp_api::impl_runtime_apis;
use sp_core::u32_trait::{_1, _2, _3, _4};
use sp_core::OpaqueMetadata;
use sp_inherents::{CheckInherentsResult, InherentData};
Expand All @@ -49,13 +49,10 @@ pub mod constants;
/// Constant values used within the runtime.
use constants::currency::*;

mod common;
/// common types for the runtime..
pub use common::*;
/// common types for the runtime.
pub use runtime_common::*;

pub mod impls;
use frame_support::traits::Filter;
use impls::*;

// Make the WASM binary available.
#[cfg(feature = "std")]
Expand Down Expand Up @@ -222,7 +219,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees>;
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = WeightToFee;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
Expand Down Expand Up @@ -714,13 +711,6 @@ pub type Executive = frame_executive::Executive<
(),
>;

decl_runtime_apis! {
/// The API to query anchoring info.
pub trait AnchorApi {
fn get_anchor_by_id(id: Hash) -> Option<AnchorData<Hash, BlockNumber>>;
}
}

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down Expand Up @@ -821,7 +811,7 @@ impl_runtime_apis! {
}
}

impl self::AnchorApi<Block> for Runtime {
impl runtime_common::AnchorApi<Block> for Runtime {
fn get_anchor_by_id(id: Hash) -> Option<AnchorData<Hash, BlockNumber>> {
Anchor::get_anchor_by_id(id)
}
Expand Down
Loading

0 comments on commit 2d0bf8a

Please sign in to comment.