From de36d169bf6bd4032d44d7fce24452f3af76e913 Mon Sep 17 00:00:00 2001
From: Shaopeng Wang <spxwang@gmail.com>
Date: Fri, 26 Jun 2020 16:33:09 +1200
Subject: [PATCH] Update to Substrate rc4. (#214)

---
 auction/Cargo.toml                |  12 +-
 auction/src/mock.rs               |   1 +
 authority/Cargo.toml              |  12 +-
 authority/src/lib.rs              |  24 +--
 authority/src/mock.rs             |   3 +-
 benchmarking/Cargo.toml           |  16 +-
 benchmarking/src/lib.rs           | 312 +++++++++++++++++++-----------
 benchmarking/src/tests.rs         |   1 +
 currencies/Cargo.toml             |  14 +-
 currencies/src/mock.rs            |   1 +
 currencies/src/tests.rs           |   9 +-
 gradually-update/Cargo.toml       |  12 +-
 gradually-update/src/mock.rs      |   1 +
 gradually-update/src/tests.rs     |  38 ++--
 oracle/Cargo.toml                 |  14 +-
 oracle/rpc/Cargo.toml             |   6 +-
 oracle/rpc/runtime-api/Cargo.toml |   4 +-
 oracle/src/lib.rs                 |   4 +-
 oracle/src/mock.rs                |   3 +-
 oracle/src/tests.rs               |   4 +-
 prices/Cargo.toml                 |   6 +-
 schedule-update/Cargo.toml        |  14 +-
 schedule-update/src/mock.rs       |  12 +-
 schedule-update/src/tests.rs      |  24 +--
 tokens/Cargo.toml                 |  12 +-
 tokens/src/mock.rs                |   1 +
 traits/Cargo.toml                 |   8 +-
 utilities/Cargo.toml              |   4 +-
 vesting/Cargo.toml                |  14 +-
 vesting/src/mock.rs               |   1 +
 vesting/src/tests.rs              |   2 +-
 31 files changed, 338 insertions(+), 251 deletions(-)

diff --git a/auction/Cargo.toml b/auction/Cargo.toml
index 4acb9c1..49aa08a 100644
--- a/auction/Cargo.toml
+++ b/auction/Cargo.toml
@@ -10,17 +10,17 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
 
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
-sp-core = { version = "2.0.0-rc3", default-features = false }
+sp-core = { version = "2.0.0-rc4", default-features = false }
 
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
 
diff --git a/auction/src/mock.rs b/auction/src/mock.rs
index 5ea015b..b4b44ca 100644
--- a/auction/src/mock.rs
+++ b/auction/src/mock.rs
@@ -63,6 +63,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 
 pub struct Handler;
diff --git a/authority/Cargo.toml b/authority/Cargo.toml
index 94e45c6..bc46be4 100644
--- a/authority/Cargo.toml
+++ b/authority/Cargo.toml
@@ -10,17 +10,17 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
 
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
-sp-core = { version = "2.0.0-rc3", default-features = false }
+sp-core = { version = "2.0.0-rc4", default-features = false }
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
 
 [features]
diff --git a/authority/src/lib.rs b/authority/src/lib.rs
index f5807b3..2b0ecbd 100644
--- a/authority/src/lib.rs
+++ b/authority/src/lib.rs
@@ -5,13 +5,11 @@
 #![allow(clippy::borrowed_box)]
 
 use frame_support::{
-	decl_error,
-	decl_module,
+	decl_error, decl_module,
 	dispatch::PostDispatchInfo,
 	ensure,
 	traits::{EnsureOrigin, Get},
-	weights::{FunctionOf, GetDispatchInfo, Pays},
-	//weights::{GetDispatchInfo},
+	weights::GetDispatchInfo,
 	Parameter,
 };
 use frame_system::{self as system};
@@ -88,21 +86,13 @@ decl_module! {
 
 		const MinimumDelay: T::BlockNumber = T::MinimumDelay::get();
 
-		#[weight = FunctionOf(
-			|args: (&Box<CallOf<T>>,)| args.0.get_dispatch_info().weight + 10_000,
-			|args: (&Box<CallOf<T>>,)| args.0.get_dispatch_info().class,
-			Pays::Yes,
-		)]
+		#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
 		pub fn dispatch_root(origin, call: Box<CallOf<T>>) {
 			T::RootDispatchOrigin::try_origin(origin).map_err(|_| BadOrigin)?;
 			call.dispatch(frame_system::RawOrigin::Root.into()).map(|_| ()).map_err(|e| e.error)?;
 		}
 
-		#[weight = FunctionOf(
-			|args: (&Box<CallOf<T>>, &DelayedDispatchTime<T::BlockNumber>)| args.0.get_dispatch_info().weight + 10_000,
-			|args: (&Box<CallOf<T>>, &DelayedDispatchTime<T::BlockNumber>)| args.0.get_dispatch_info().class,
-			Pays::Yes,
-		)]
+		#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
 		pub fn schedule_dispatch_root(origin, call: Box<CallOf<T>>, when: DelayedDispatchTime<T::BlockNumber>) {
 			let now = <frame_system::Module<T>>::block_number();
 			let when_block = match when {
@@ -125,11 +115,7 @@ decl_module! {
 			let _ = T::Scheduler::schedule(frame_system::RawOrigin::Root.into(), *call, when);
 		}
 
-		#[weight = FunctionOf(
-			|args: (&Box<CallOf<T>>, &DelayedDispatchTime<T::BlockNumber>)| args.0.get_dispatch_info().weight + 10_000,
-			|args: (&Box<CallOf<T>>, &DelayedDispatchTime<T::BlockNumber>)| args.0.get_dispatch_info().class,
-			Pays::Yes,
-		)]
+		#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
 		pub fn schedule_dispatch_delayed(origin, call: Box<CallOf<T>>, when: DelayedDispatchTime<T::BlockNumber>) {
 			T::DelayedDispatchOrigin::try_origin(origin.clone()).map_err(|_| BadOrigin)?;
 
diff --git a/authority/src/mock.rs b/authority/src/mock.rs
index 7486f1a..fa05037 100644
--- a/authority/src/mock.rs
+++ b/authority/src/mock.rs
@@ -28,7 +28,7 @@ impl frame_system::Trait for Runtime {
 	type Origin = Origin;
 	type Index = u64;
 	type BlockNumber = BlockNumber;
-	type Call = ();
+	type Call = Call;
 	type Hash = H256;
 	type Hashing = ::sp_runtime::traits::BlakeTwo256;
 	type AccountId = AccountId;
@@ -48,6 +48,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 
 pub struct MockScheduler;
diff --git a/benchmarking/Cargo.toml b/benchmarking/Cargo.toml
index 93f0bfe..2e2bb0d 100644
--- a/benchmarking/Cargo.toml
+++ b/benchmarking/Cargo.toml
@@ -10,14 +10,14 @@ edition = "2018"
 [dependencies]
 paste = "0.1.16"
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-api = { version = "2.0.0-rc3", default-features = false }
-sp-runtime-interface = { version = "2.0.0-rc3", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
-frame-benchmarking = { version = "2.0.0-rc3", default-features = false }
+sp-api = { version = "2.0.0-rc4", default-features = false }
+sp-runtime-interface = { version = "2.0.0-rc4", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
+frame-benchmarking = { version = "2.0.0-rc4", default-features = false }
 
 [features]
 default = [ "std" ]
diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs
index b0c06c6..1c7b554 100644
--- a/benchmarking/src/lib.rs
+++ b/benchmarking/src/lib.rs
@@ -11,6 +11,7 @@ pub use frame_benchmarking::{
 	benchmarking, BenchmarkBatch, BenchmarkParameter, BenchmarkResults, Benchmarking, BenchmarkingSetup,
 	BenchmarkingSetupInstance,
 };
+pub use frame_support;
 pub use paste;
 #[doc(hidden)]
 pub use sp_io::storage::root as storage_root;
@@ -183,6 +184,7 @@ macro_rules! runtime_benchmarks {
 	}
 }
 
+/// Same as [`benchmarks`] but for instantiable module.
 #[macro_export]
 macro_rules! runtime_benchmarks_instance {
 	(
@@ -206,7 +208,7 @@ macro_rules! runtime_benchmarks_instance {
 }
 
 #[macro_export]
-#[allow(missing_docs)]
+#[doc(hidden)]
 macro_rules! benchmarks_iter {
 	// mutation arm:
 	(
@@ -248,7 +250,9 @@ macro_rules! benchmarks_iter {
 			{ $( $common )* }
 			( $( $names )* )
 			$name { $( $code )* }: {
-				<$pallet::Call<$runtime> as $crate::Dispatchable>::dispatch($pallet::Call::<$runtime>::$dispatch($($arg),*), $origin.into())?;
+				<
+					$pallet::Call<$runtime> as $crate::frame_support::traits::UnfilteredDispatchable
+				>::dispatch_bypass_filter($pallet::Call::<$runtime>::$dispatch($($arg),*), $origin.into())?;
 			}
 			verify $postcode
 			$( $rest )*
@@ -272,7 +276,9 @@ macro_rules! benchmarks_iter {
 			{ $( $common )* }
 			( $( $names )* )
 			$name { $( $code )* }: {
-				<$pallet::Call<$runtime, $instance> as $crate::Dispatchable>::dispatch($pallet::Call::<$runtime, $instance>::$dispatch($($arg),*), $origin.into())?;
+				<
+					$pallet::Call<$runtime, $instance> as $crate::frame_support::traits::UnfilteredDispatchable
+				>::dispatch_bypass_filter($pallet::Call::<$runtime, $instance>::$dispatch($($arg),*), $origin.into())?;
 			}
 			verify $postcode
 			$( $rest )*
@@ -300,6 +306,10 @@ macro_rules! benchmarks_iter {
 			{ $( $code )* }
 			$postcode
 		}
+
+		#[cfg(test)]
+		$crate::impl_benchmark_test!( $instance $runtime $pallet $name);
+
 		$crate::benchmarks_iter!(
 			$instance
 			$runtime
@@ -313,8 +323,6 @@ macro_rules! benchmarks_iter {
 	( $instance:ident $runtime:ident $pallet:ident { $( $common:tt )* } ( $( $names:ident )* ) ) => {
 		$crate::selected_benchmark!( $instance $runtime $pallet $( $names ),* );
 		$crate::impl_benchmark!( $instance $runtime $pallet $( $names ),* );
-		#[cfg(test)]
-		$crate::impl_benchmark_tests!( $instance $runtime $pallet $( $names ),* );
 	};
 	// add verify block to _() format
 	(
@@ -382,7 +390,7 @@ macro_rules! benchmarks_iter {
 }
 
 #[macro_export]
-#[allow(missing_docs)]
+#[doc(hidden)]
 macro_rules! benchmark_backend {
 	// parsing arms
 	($instance:ident $runtime:ident $pallet:ident $name:ident {
@@ -536,7 +544,9 @@ macro_rules! benchmark_backend {
 				)*
 				$(
 					// Prepare instance
-					let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1;
+					let $param = components.iter()
+						.find(|&c| c.0 == $crate::BenchmarkParameter::$param)
+						.unwrap().1;
 				)*
 				$(
 					let $pre_id : $pre_ty = $pre_ex;
@@ -555,7 +565,9 @@ macro_rules! benchmark_backend {
 				)*
 				$(
 					// Prepare instance
-					let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1;
+					let $param = components.iter()
+						.find(|&c| c.0 == $crate::BenchmarkParameter::$param)
+						.unwrap().1;
 				)*
 				$(
 					let $pre_id : $pre_ty = $pre_ex;
@@ -594,7 +606,9 @@ macro_rules! benchmark_backend {
 				)*
 				$(
 					// Prepare instance
-					let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1;
+					let $param = components.iter()
+						.find(|&c| c.0 == $crate::BenchmarkParameter::$param)
+						.unwrap().1;
 				)*
 				$(
 					let $pre_id : $pre_ty = $pre_ex;
@@ -613,7 +627,9 @@ macro_rules! benchmark_backend {
 				)*
 				$(
 					// Prepare instance
-					let $param = components.iter().find(|&c| c.0 == $crate::BenchmarkParameter::$param).unwrap().1;
+					let $param = components.iter()
+						.find(|&c| c.0 == $crate::BenchmarkParameter::$param)
+						.unwrap().1;
 				)*
 				$(
 					let $pre_id : $pre_ty = $pre_ex;
@@ -627,21 +643,22 @@ macro_rules! benchmark_backend {
 	}
 }
 
-/// Creates a `SelectedBenchmark` enum implementing `BenchmarkingSetup`.
-///
-/// Every variant must implement [`BenchmarkingSetup`].
-///
-/// ```nocompile
-///
-/// struct Transfer;
-/// impl BenchmarkingSetup for Transfer { ... }
-///
-/// struct SetBalance;
-/// impl BenchmarkingSetup for SetBalance { ... }
-///
-/// selected_benchmark!(Transfer, SetBalance);
-/// ```
+// Creates a `SelectedBenchmark` enum implementing `BenchmarkingSetup`.
+//
+// Every variant must implement [`BenchmarkingSetup`].
+//
+// ```nocompile
+//
+// struct Transfer;
+// impl BenchmarkingSetup for Transfer { ... }
+//
+// struct SetBalance;
+// impl BenchmarkingSetup for SetBalance { ... }
+//
+// selected_benchmark!(Transfer, SetBalance);
+// ```
 #[macro_export]
+#[doc(hidden)]
 macro_rules! selected_benchmark {
 	(
 		NO_INSTANCE $runtime:ident $pallet:ident $( $bench:ident ),*
@@ -714,12 +731,15 @@ macro_rules! selected_benchmark {
 }
 
 #[macro_export]
+#[doc(hidden)]
 macro_rules! impl_benchmark {
 	(
 		NO_INSTANCE $runtime:ident $pallet:ident $( $name:ident ),*
 	) => {
+		#[cfg(feature="runtime-benchmarks")]
 		pub struct Benchmark;
 
+		#[cfg(feature="runtime-benchmarks")]
 		impl $crate::Benchmarking<$crate::BenchmarkResults> for Benchmark {
 			fn benchmarks() -> Vec<&'static [u8]> {
 				vec![ $( stringify!($name).as_ref() ),* ]
@@ -731,6 +751,7 @@ macro_rules! impl_benchmark {
 				highest_range_values: &[u32],
 				steps: &[u32],
 				repeat: u32,
+				whitelist: &[Vec<u8>]
 			) -> Result<Vec<$crate::BenchmarkResults>, &'static str> {
 				// Map the input to the selected benchmark.
 				let extrinsic = sp_std::str::from_utf8(extrinsic)
@@ -740,6 +761,8 @@ macro_rules! impl_benchmark {
 					_ => return Err("Could not find extrinsic."),
 				};
 
+				$crate::benchmarking::set_whitelist(whitelist.to_vec());
+
 				// Warm up the DB
 				$crate::benchmarking::commit_db();
 				$crate::benchmarking::wipe_db();
@@ -786,8 +809,11 @@ macro_rules! impl_benchmark {
 
 						// Run the benchmark `repeat` times.
 						for _ in 0..repeat {
-							// Set up the externalities environment for the setup we want to benchmark.
-							let closure_to_benchmark = <SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>>::instance(&selected_benchmark, &c)?;
+							// Set up the externalities environment for the setup we want to
+							// benchmark.
+							let closure_to_benchmark = <
+								SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>
+							>::instance(&selected_benchmark, &c)?;
 
 							// Set the block number to at least 1 so events are deposited.
 							if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
@@ -798,13 +824,29 @@ macro_rules! impl_benchmark {
 							// This will enable worst case scenario for reading from the database.
 							$crate::benchmarking::commit_db();
 
+							$crate::benchmarking::reset_read_write_count();
+
 							// Time the extrinsic logic.
-							frame_support::debug::trace!(target: "benchmark", "Start Benchmark: {:?} {:?}", name, component_value);
+							frame_support::debug::trace!(
+								target: "benchmark",
+								"Start Benchmark: {:?} {:?}", name, component_value
+							);
+
 							let start_extrinsic = $crate::benchmarking::current_time();
 							closure_to_benchmark()?;
 							let finish_extrinsic = $crate::benchmarking::current_time();
 							let elapsed_extrinsic = finish_extrinsic - start_extrinsic;
-							frame_support::debug::trace!(target: "benchmark", "End Benchmark: {} ns", elapsed_extrinsic);
+
+							$crate::benchmarking::commit_db();
+							frame_support::debug::trace!(
+								target: "benchmark",
+								"End Benchmark: {} ns", elapsed_extrinsic
+							);
+							let read_write_count = $crate::benchmarking::read_write_count();
+							frame_support::debug::trace!(
+								target: "benchmark",
+								"Read/Write Count {:?}", read_write_count
+							);
 
 							// Time the storage root recalculation.
 							let start_storage_root = $crate::benchmarking::current_time();
@@ -812,7 +854,15 @@ macro_rules! impl_benchmark {
 							let finish_storage_root = $crate::benchmarking::current_time();
 							let elapsed_storage_root = finish_storage_root - start_storage_root;
 
-							results.push((c.clone(), elapsed_extrinsic, elapsed_storage_root));
+							results.push($crate::BenchmarkResults {
+								components: c.clone(),
+								extrinsic_time: elapsed_extrinsic,
+								storage_root_time: elapsed_storage_root,
+								reads: read_write_count.0,
+								repeat_reads: read_write_count.1,
+								writes: read_write_count.2,
+								repeat_writes: read_write_count.3,
+							});
 
 							// Wipe the DB back to the genesis state.
 							$crate::benchmarking::wipe_db();
@@ -826,8 +876,10 @@ macro_rules! impl_benchmark {
 	(
 		$instance:ident $runtime:ident $pallet:ident $( $name:ident ),*
 	) => {
+		#[cfg(feature="runtime-benchmarks")]
 		pub struct Benchmark;
 
+		#[cfg(feature="runtime-benchmarks")]
 		impl $crate::Benchmarking<$crate::BenchmarkResults> for Benchmark {
 			fn benchmarks() -> Vec<&'static [u8]> {
 				vec![ $( stringify!($name).as_ref() ),* ]
@@ -839,6 +891,7 @@ macro_rules! impl_benchmark {
 				highest_range_values: &[u32],
 				steps: &[u32],
 				repeat: u32,
+				whitelist: &[Vec<u8>]
 			) -> Result<Vec<$crate::BenchmarkResults>, &'static str> {
 				// Map the input to the selected benchmark.
 				let extrinsic = sp_std::str::from_utf8(extrinsic)
@@ -848,11 +901,15 @@ macro_rules! impl_benchmark {
 					_ => return Err("Could not find extrinsic."),
 				};
 
+				$crate::benchmarking::set_whitelist(whitelist.to_vec());
+
 				// Warm up the DB
 				$crate::benchmarking::commit_db();
 				$crate::benchmarking::wipe_db();
 
-				let components = <SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>>::components(&selected_benchmark);
+				let components = <
+					SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>
+				>::components(&selected_benchmark);
 				let mut results: Vec<$crate::BenchmarkResults> = Vec::new();
 
 				// Default number of steps for a component.
@@ -895,7 +952,9 @@ macro_rules! impl_benchmark {
 						// Run the benchmark `repeat` times.
 						for _ in 0..repeat {
 							// Set up the externalities environment for the setup we want to benchmark.
-							let closure_to_benchmark = <SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>>::instance(&selected_benchmark, &c)?;
+							let closure_to_benchmark = <
+								SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>
+							>::instance(&selected_benchmark, &c)?;
 
 							// Set the block number to at least 1 so events are deposited.
 							if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
@@ -906,13 +965,29 @@ macro_rules! impl_benchmark {
 							// This will enable worst case scenario for reading from the database.
 							$crate::benchmarking::commit_db();
 
+							// Reset the read/write counter so we don't count operations in the setup process.
+							$crate::benchmarking::reset_read_write_count();
+
 							// Time the extrinsic logic.
-							frame_support::debug::trace!(target: "benchmark", "Start Benchmark: {:?} {:?}", name, component_value);
+							frame_support::debug::trace!(
+								target: "benchmark",
+								"Start Benchmark: {:?} {:?}", name, component_value
+							);
 							let start_extrinsic = $crate::benchmarking::current_time();
 							closure_to_benchmark()?;
 							let finish_extrinsic = $crate::benchmarking::current_time();
 							let elapsed_extrinsic = finish_extrinsic - start_extrinsic;
-							frame_support::debug::trace!(target: "benchmark", "End Benchmark: {} ns", elapsed_extrinsic);
+
+							$crate::benchmarking::commit_db();
+							frame_support::debug::trace!(
+								target: "benchmark",
+								"End Benchmark: {} ns", elapsed_extrinsic
+							);
+							let read_write_count = $crate::benchmarking::read_write_count();
+							frame_support::debug::trace!(
+								target: "benchmark",
+								"Read/Write Count {:?}", read_write_count
+							);
 
 							// Time the storage root recalculation.
 							let start_storage_root = $crate::benchmarking::current_time();
@@ -920,7 +995,15 @@ macro_rules! impl_benchmark {
 							let finish_storage_root = $crate::benchmarking::current_time();
 							let elapsed_storage_root = finish_storage_root - start_storage_root;
 
-							results.push((c.clone(), elapsed_extrinsic, elapsed_storage_root));
+							results.push($crate::BenchmarkResults {
+								components: c.clone(),
+								extrinsic_time: elapsed_extrinsic,
+								storage_root_time: elapsed_storage_root,
+								reads: read_write_count.0,
+								repeat_reads: read_write_count.1,
+								writes: read_write_count.2,
+								repeat_writes: read_write_count.3,
+							});
 
 							// Wipe the DB back to the genesis state.
 							$crate::benchmarking::wipe_db();
@@ -933,58 +1016,65 @@ macro_rules! impl_benchmark {
 	}
 }
 
-// This creates unit tests from the main benchmark macro.
-// They run the benchmark using the `high` and `low` value for each component
+// This creates a unit test for one benchmark of the main benchmark macro.
+// It runs the benchmark using the `high` and `low` value for each component
 // and ensure that everything completes successfully.
 #[macro_export]
-macro_rules! impl_benchmark_tests {
+#[doc(hidden)]
+macro_rules! impl_benchmark_test {
 	(
 		NO_INSTANCE
 		$runtime:ident
 		$pallet:ident
-		$( $name:ident ),*
+		$name:ident
 	) => {
-		$(
-			$crate::paste::item! {
-				fn [<test_benchmark_ $name>] () -> Result<(), &'static str>
-				{
-					let selected_benchmark = SelectedBenchmark::$name;
-					let components = <SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>>::components(&selected_benchmark);
-
-					for (_, (name, low, high)) in components.iter().enumerate() {
-						// Test only the low and high value, assuming values in the middle won't break
-						for component_value in vec![low, high] {
-							// Select the max value for all the other components.
-							let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter()
-								.enumerate()
-								.map(|(_, (n, _, h))|
-									if n == name {
-										(*n, *component_value)
-									} else {
-										(*n, *h)
-									}
-								)
-								.collect();
-
-							// Set up the verification state
-							let closure_to_verify = <SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>>::verify(&selected_benchmark, &c)?;
-
-							// Set the block number to at least 1 so events are deposited.
-							if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
-								frame_system::Module::<$runtime>::set_block_number($crate::One::one());
-							}
+		$crate::paste::item! {
+			fn [<test_benchmark_ $name>] () -> Result<(), &'static str>
+			{
+				let selected_benchmark = SelectedBenchmark::$name;
+				let components = <
+					SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>
+				>::components(&selected_benchmark);
+
+				assert!(
+					components.len() != 0,
+					"You need to add components to your benchmark!",
+				);
+				for (_, (name, low, high)) in components.iter().enumerate() {
+					// Test only the low and high value, assuming values in the middle won't break
+					for component_value in vec![low, high] {
+						// Select the max value for all the other components.
+						let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter()
+							.enumerate()
+							.map(|(_, (n, _, h))|
+								if n == name {
+									(*n, *component_value)
+								} else {
+									(*n, *h)
+								}
+							)
+							.collect();
 
-							// Run verification
-							closure_to_verify()?;
+						// Set up the verification state
+						let closure_to_verify = <
+							SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>
+						>::verify(&selected_benchmark, &c)?;
 
-							// Reset the state
-							$crate::benchmarking::wipe_db();
+						// Set the block number to at least 1 so events are deposited.
+						if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
+							frame_system::Module::<$runtime>::set_block_number($crate::One::one());
 						}
+
+						// Run verification
+						closure_to_verify()?;
+
+						// Reset the state
+						$crate::benchmarking::wipe_db();
 					}
-					Ok(())
 				}
+				Ok(())
 			}
-		)*
+		}
 	};
 	(
 		$instance:ident
@@ -992,47 +1082,49 @@ macro_rules! impl_benchmark_tests {
 		$pallet:ident
 		$( $name:ident ),*
 	) => {
-		$(
-			$crate::paste::item! {
-				fn [<test_benchmark_ $name>] () -> Result<(), &'static str>
-				{
-					let selected_benchmark = SelectedBenchmark::$name;
-					let components = <SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>>::components(&selected_benchmark);
-
-					for (_, (name, low, high)) in components.iter().enumerate() {
-						// Test only the low and high value, assuming values in the middle won't break
-						for component_value in vec![low, high] {
-							// Select the max value for all the other components.
-							let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter()
-								.enumerate()
-								.map(|(_, (n, _, h))|
-									if n == name {
-										(*n, *component_value)
-									} else {
-										(*n, *h)
-									}
-								)
-								.collect();
-
-							// Set up the verification state
-							let closure_to_verify = <SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>>::verify(&selected_benchmark, &c)?;
-
-							// Set the block number to at least 1 so events are deposited.
-							if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
-								frame_system::Module::<$runtime>::set_block_number($crate::One::one());
-							}
+		$crate::paste::item! {
+			fn [<test_benchmark_ $name>] () -> Result<(), &'static str>
+			{
+				let selected_benchmark = SelectedBenchmark::$name;
+				let components = <
+					SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>
+				>::components(&selected_benchmark);
+
+				for (_, (name, low, high)) in components.iter().enumerate() {
+					// Test only the low and high value, assuming values in the middle won't break
+					for component_value in vec![low, high] {
+						// Select the max value for all the other components.
+						let c: Vec<($crate::BenchmarkParameter, u32)> = components.iter()
+							.enumerate()
+							.map(|(_, (n, _, h))|
+								if n == name {
+									(*n, *component_value)
+								} else {
+									(*n, *h)
+								}
+							)
+							.collect();
 
-							// Run verification
-							closure_to_verify()?;
+						// Set up the verification state
+						let closure_to_verify = <
+							SelectedBenchmark as $crate::BenchmarkingSetupInstance<$runtime, $instance>
+						>::verify(&selected_benchmark, &c)?;
 
-							// Reset the state
-							$crate::benchmarking::wipe_db();
+						// Set the block number to at least 1 so events are deposited.
+						if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
+							frame_system::Module::<$runtime>::set_block_number($crate::One::one());
 						}
+
+						// Run verification
+						closure_to_verify()?;
+
+						// Reset the state
+						$crate::benchmarking::wipe_db();
 					}
-					Ok(())
 				}
+				Ok(())
 			}
-		)*
+		}
 	};
 }
 
@@ -1064,7 +1156,7 @@ macro_rules! impl_benchmark_tests {
 #[macro_export]
 macro_rules! add_benchmark {
 	( $params:ident, $batches:ident, $name:literal, $( $location:tt )* ) => (
-		let (pallet, benchmark, lowest_range_values, highest_range_values, steps, repeat) = $params;
+		let (pallet, benchmark, lowest_range_values, highest_range_values, steps, repeat, whitelist) = $params;
 		if &pallet[..] == &$name[..] || &pallet[..] == &b"*"[..] {
 			if &pallet[..] == &b"*"[..] || &benchmark[..] == &b"*"[..] {
 				for benchmark in $( $location )*::Benchmark::benchmarks().into_iter() {
@@ -1075,6 +1167,7 @@ macro_rules! add_benchmark {
 							&highest_range_values[..],
 							&steps[..],
 							repeat,
+							whitelist,
 						)?,
 						pallet: $name.to_vec(),
 						benchmark: benchmark.to_vec(),
@@ -1088,6 +1181,7 @@ macro_rules! add_benchmark {
 						&highest_range_values[..],
 						&steps[..],
 						repeat,
+						whitelist,
 					)?,
 					pallet: $name.to_vec(),
 					benchmark: benchmark.clone(),
diff --git a/benchmarking/src/tests.rs b/benchmarking/src/tests.rs
index 35e4361..d1d0a6e 100644
--- a/benchmarking/src/tests.rs
+++ b/benchmarking/src/tests.rs
@@ -78,6 +78,7 @@ impl frame_system::Trait for Test {
 	type OnNewAccount = ();
 	type OnKilledAccount = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 
 impl Trait for Test {
diff --git a/currencies/Cargo.toml b/currencies/Cargo.toml
index 110ed5a..4da4e39 100644
--- a/currencies/Cargo.toml
+++ b/currencies/Cargo.toml
@@ -10,18 +10,18 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
 
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
-sp-core = { version = "2.0.0-rc3", default-features = false }
-pallet-balances = "2.0.0-rc3"
+sp-core = { version = "2.0.0-rc4", default-features = false }
+pallet-balances = "2.0.0-rc4"
 tokens = { package = "orml-tokens", path = "../tokens" }
 
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs
index 63be37c..4f7ffb3 100644
--- a/currencies/src/mock.rs
+++ b/currencies/src/mock.rs
@@ -63,6 +63,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 pub type System = system::Module<Runtime>;
 
diff --git a/currencies/src/tests.rs b/currencies/src/tests.rs
index 4e35ed7..3938335 100644
--- a/currencies/src/tests.rs
+++ b/currencies/src/tests.rs
@@ -223,10 +223,15 @@ fn update_balance_call_should_work() {
 		.one_hundred_for_alice_n_bob()
 		.build()
 		.execute_with(|| {
-			assert_ok!(Currencies::update_balance(Origin::ROOT, ALICE, NATIVE_CURRENCY_ID, -10));
+			assert_ok!(Currencies::update_balance(
+				Origin::root(),
+				ALICE,
+				NATIVE_CURRENCY_ID,
+				-10
+			));
 			assert_eq!(NativeCurrency::free_balance(&ALICE), 90);
 			assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 100);
-			assert_ok!(Currencies::update_balance(Origin::ROOT, ALICE, X_TOKEN_ID, 10));
+			assert_ok!(Currencies::update_balance(Origin::root(), ALICE, X_TOKEN_ID, 10));
 			assert_eq!(Currencies::free_balance(X_TOKEN_ID, &ALICE), 110);
 		});
 }
diff --git a/gradually-update/Cargo.toml b/gradually-update/Cargo.toml
index f891650..5f5dd69 100644
--- a/gradually-update/Cargo.toml
+++ b/gradually-update/Cargo.toml
@@ -9,12 +9,12 @@ edition = "2018"
 
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
-sp-core = { version = "2.0.0-rc3", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
+sp-core = { version = "2.0.0-rc4", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
 
 [features]
 default = ["std"]
diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs
index 2c7abd5..fecd4be 100644
--- a/gradually-update/src/mock.rs
+++ b/gradually-update/src/mock.rs
@@ -61,6 +61,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 pub type System = system::Module<Runtime>;
 
diff --git a/gradually-update/src/tests.rs b/gradually-update/src/tests.rs
index 6565a94..ea721d1 100644
--- a/gradually-update/src/tests.rs
+++ b/gradually-update/src/tests.rs
@@ -25,7 +25,7 @@ fn gradually_update_should_work() {
 			target_value: vec![9],
 			per_block: vec![1],
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 
 		let gradually_update_event = TestEvent::gradually_update(RawEvent::GraduallyUpdate(
 			update.key,
@@ -47,7 +47,7 @@ fn gradually_update_should_fail() {
 			per_block: 1u64.encode(),
 		};
 		assert_noop!(
-			GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()),
+			GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()),
 			Error::<Runtime>::InvalidPerBlockOrTargetValue
 		);
 
@@ -56,7 +56,7 @@ fn gradually_update_should_fail() {
 			target_value: 90u32.encode(),
 			per_block: 1u32.encode(),
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 
 		GraduallyUpdateModule::on_finalize(20);
 
@@ -66,12 +66,12 @@ fn gradually_update_should_fail() {
 			per_block: 1u64.encode(),
 		};
 		assert_noop!(
-			GraduallyUpdateModule::gradually_update(Origin::ROOT, new_update.clone()),
+			GraduallyUpdateModule::gradually_update(Origin::root(), new_update.clone()),
 			Error::<Runtime>::InvalidTargetValue
 		);
 
 		assert_noop!(
-			GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()),
+			GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()),
 			Error::<Runtime>::GraduallyUpdateHasExisted
 		);
 	});
@@ -87,7 +87,7 @@ fn cancel_gradually_update_should_work() {
 			target_value: vec![9],
 			per_block: vec![1],
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		let gradually_update_event = TestEvent::gradually_update(RawEvent::GraduallyUpdate(
 			update.key.clone(),
 			update.per_block,
@@ -98,7 +98,7 @@ fn cancel_gradually_update_should_work() {
 			.any(|record| record.event == gradually_update_event));
 
 		assert_ok!(GraduallyUpdateModule::cancel_gradually_update(
-			Origin::ROOT,
+			Origin::root(),
 			update.key.clone()
 		));
 		let cancel_gradually_update_event = TestEvent::gradually_update(RawEvent::CancelGraduallyUpdate(update.key));
@@ -117,14 +117,14 @@ fn cancel_gradually_update_should_fail() {
 			per_block: 1u32.encode(),
 		};
 		assert_noop!(
-			GraduallyUpdateModule::cancel_gradually_update(Origin::ROOT, update.key.clone()),
+			GraduallyUpdateModule::cancel_gradually_update(Origin::root(), update.key.clone()),
 			Error::<Runtime>::CancelGradullyUpdateNotExisted
 		);
 
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 
 		assert_ok!(GraduallyUpdateModule::cancel_gradually_update(
-			Origin::ROOT,
+			Origin::root(),
 			update.key.clone()
 		));
 	});
@@ -140,7 +140,7 @@ fn add_on_finalize_should_work() {
 			target_value: vec![30],
 			per_block: vec![1],
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		assert_eq!(storage_get(&update.key), vec![]);
 
 		GraduallyUpdateModule::on_finalize(10);
@@ -187,7 +187,7 @@ fn sub_on_finalize_should_work() {
 		};
 
 		storage_set(&update.key, &vec![30]);
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		assert_eq!(storage_get(&update.key), vec![30]);
 
 		GraduallyUpdateModule::on_finalize(10);
@@ -230,7 +230,7 @@ fn u32_should_work() {
 			target_value: 30u32.encode(),
 			per_block: 1u32.encode(),
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		assert_eq!(storage_get(&update.key), vec![]);
 		GraduallyUpdateModule::on_finalize(10);
 		assert_eq!(storage_get(&update.key), vec![10, 0, 0, 0]);
@@ -251,7 +251,7 @@ fn u128_should_work() {
 			target_value: 30u128.encode(),
 			per_block: 1u128.encode(),
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		assert_eq!(storage_get(&update.key), vec![]);
 		GraduallyUpdateModule::on_finalize(10);
 		assert_eq!(
@@ -284,7 +284,7 @@ fn permill_should_work() {
 			target_value: Permill::from_percent(30).encode(),
 			per_block: Permill::from_percent(1).encode(),
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		assert_eq!(storage_get(&update.key), vec![]);
 		GraduallyUpdateModule::on_finalize(10);
 		assert_eq!(storage_get(&update.key), vec![160, 134, 1, 0]);
@@ -305,7 +305,7 @@ fn fixedu128_should_work() {
 			target_value: FixedU128::saturating_from_rational(30, 1).encode(),
 			per_block: FixedU128::saturating_from_rational(1, 1).encode(),
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
 		assert_eq!(storage_get(&update.key), vec![]);
 		GraduallyUpdateModule::on_finalize(10);
 		assert_eq!(
@@ -350,9 +350,9 @@ fn finish_multiple_on_finalize_should_work() {
 			target_value: vec![100],
 			per_block: vec![3],
 		};
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update.clone()));
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update2.clone()));
-		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::ROOT, update3.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update2.clone()));
+		assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update3.clone()));
 
 		GraduallyUpdateModule::on_finalize(10);
 		assert_eq!(storage_get(&update.key), vec![10]);
diff --git a/oracle/Cargo.toml b/oracle/Cargo.toml
index 4485583..7bb6dea 100644
--- a/oracle/Cargo.toml
+++ b/oracle/Cargo.toml
@@ -11,19 +11,19 @@ edition = "2018"
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
 
-sp-application-crypto = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-application-crypto = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
 
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 orml-utilities = { path = "../utilities", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
-sp-core = { version = "2.0.0-rc3", default-features = false }
+sp-core = { version = "2.0.0-rc4", default-features = false }
 
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
 
diff --git a/oracle/rpc/Cargo.toml b/oracle/rpc/Cargo.toml
index 6a435f9..74d6f18 100644
--- a/oracle/rpc/Cargo.toml
+++ b/oracle/rpc/Cargo.toml
@@ -9,7 +9,7 @@ codec = { package = "parity-scale-codec", version = "1.3.0" }
 jsonrpc-core = "14.0.5"
 jsonrpc-core-client = "14.0.5"
 jsonrpc-derive = "14.0.5"
-sp-runtime = { version = "2.0.0-rc3" }
-sp-api = { version = "2.0.0-rc3" }
-sp-blockchain = { version = "2.0.0-rc3" }
+sp-runtime = { version = "2.0.0-rc4" }
+sp-api = { version = "2.0.0-rc4" }
+sp-blockchain = { version = "2.0.0-rc4" }
 orml-oracle-rpc-runtime-api = { path = "runtime-api" }
diff --git a/oracle/rpc/runtime-api/Cargo.toml b/oracle/rpc/runtime-api/Cargo.toml
index 1ccba8e..5e9c847 100644
--- a/oracle/rpc/runtime-api/Cargo.toml
+++ b/oracle/rpc/runtime-api/Cargo.toml
@@ -6,8 +6,8 @@ edition = "2018"
 
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] }
-sp-api = { default-features = false, version = "2.0.0-rc3" }
-sp-std = { default-features = false, version = "2.0.0-rc3" }
+sp-api = { default-features = false, version = "2.0.0-rc4" }
+sp-std = { default-features = false, version = "2.0.0-rc4" }
 
 [features]
 default = ["std"]
diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs
index 8871cf1..e2a0896 100644
--- a/oracle/src/lib.rs
+++ b/oracle/src/lib.rs
@@ -12,7 +12,7 @@ pub use default_combine_data::DefaultCombineData;
 use frame_support::{
 	decl_error, decl_event, decl_module, decl_storage, ensure,
 	traits::{ChangeMembers, Get, InitializeMembers, Time},
-	weights::{DispatchClass, FunctionOf, Pays},
+	weights::{DispatchClass, Pays},
 	IterableStorageMap, Parameter,
 };
 use sp_runtime::{
@@ -115,7 +115,7 @@ decl_module! {
 
 		fn deposit_event() = default;
 
-		#[weight = FunctionOf(0, DispatchClass::Operational, Pays::No)]
+		#[weight = (0, DispatchClass::Operational, Pays::No)]
 		pub fn feed_values(
 			origin,
 			values: Vec<(T::OracleKey, T::OracleValue)>,
diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs
index 05be459..d5d6cfc 100644
--- a/oracle/src/mock.rs
+++ b/oracle/src/mock.rs
@@ -39,7 +39,7 @@ parameter_types! {
 }
 impl frame_system::Trait for Test {
 	type Origin = Origin;
-	type Call = ();
+	type Call = Call;
 	type Index = u64;
 	type BlockNumber = u64;
 	type Hash = H256;
@@ -61,6 +61,7 @@ impl frame_system::Trait for Test {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 
 thread_local! {
diff --git a/oracle/src/tests.rs b/oracle/src/tests.rs
index f96a9b0..9814d0f 100644
--- a/oracle/src/tests.rs
+++ b/oracle/src/tests.rs
@@ -29,7 +29,7 @@ fn feed_values_from_session_key(
 		&OracleCall::feed_values(values.clone(), index, sig.clone()),
 	)?;
 
-	Ok(ModuleOracle::feed_values(Origin::NONE, values, index, sig))
+	Ok(ModuleOracle::feed_values(Origin::none(), values, index, sig))
 }
 
 fn feed_values(
@@ -82,7 +82,7 @@ fn should_feed_values_from_root() {
 		let account_id: AccountId = 1;
 
 		assert_ok!(ModuleOracle::feed_values(
-			Origin::ROOT,
+			Origin::root(),
 			vec![(50, 1000), (51, 900), (52, 800)],
 			0,
 			TestSignature(0, vec![])
diff --git a/prices/Cargo.toml b/prices/Cargo.toml
index 5dc9a72..bafb773 100644
--- a/prices/Cargo.toml
+++ b/prices/Cargo.toml
@@ -9,9 +9,9 @@ edition = "2018"
 
 [dependencies]
 serde = { version = "1.0.111", optional = true }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
-frame-support = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
diff --git a/schedule-update/Cargo.toml b/schedule-update/Cargo.toml
index e975d1b..b178546 100644
--- a/schedule-update/Cargo.toml
+++ b/schedule-update/Cargo.toml
@@ -10,16 +10,16 @@ edition = "2018"
 [dependencies]
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-core = { version = "2.0.0-rc3", default-features = false }
-pallet-balances = "2.0.0-rc3"
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-core = { version = "2.0.0-rc4", default-features = false }
+pallet-balances = "2.0.0-rc4"
 
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
 
diff --git a/schedule-update/src/mock.rs b/schedule-update/src/mock.rs
index 484fcde..2f3b3be 100644
--- a/schedule-update/src/mock.rs
+++ b/schedule-update/src/mock.rs
@@ -2,10 +2,7 @@
 
 #![cfg(test)]
 
-use frame_support::{
-	impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types,
-	weights::{FunctionOf, Pays},
-};
+use frame_support::{impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types};
 use sp_core::H256;
 use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill};
 
@@ -35,11 +32,7 @@ mod logger {
 		pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin {
 			fn deposit_event() = default;
 
-			#[weight = FunctionOf(
-				|args: (&u32, &Weight)| *args.1,
-				|_: (&u32, &Weight)| DispatchClass::Normal,
-				Pays::Yes,
-			)]
+			#[weight = *weight]
 			fn log(origin, i: u32, weight: Weight) {
 				ensure_root(origin)?;
 				Self::deposit_event(Event::Logged(i, weight));
@@ -113,6 +106,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 pub type System = frame_system::Module<Runtime>;
 
diff --git a/schedule-update/src/tests.rs b/schedule-update/src/tests.rs
index ba328b7..693b88a 100644
--- a/schedule-update/src/tests.rs
+++ b/schedule-update/src/tests.rs
@@ -30,7 +30,7 @@ fn schedule_dispatch_should_work() {
 		// OperationalDispatches
 		let call = Call::Balances(BalancesCall::set_balance(1, 10, 11));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(call),
 			DelayedDispatchTime::After(3)
 		));
@@ -47,7 +47,7 @@ fn schedule_dispatch_works_for_root_origin() {
 	ExtBuilder::default().build().execute_with(|| {
 		let call = Call::Balances(BalancesCall::transfer(2, 11));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(call),
 			DelayedDispatchTime::At(10)
 		));
@@ -118,7 +118,7 @@ fn cancel_delayed_dispatch_should_work() {
 			.iter()
 			.any(|record| record.event == schedule_dispatch_event));
 
-		assert_ok!(ScheduleUpdateModule::cancel_delayed_dispatch(Origin::ROOT, 4, 1));
+		assert_ok!(ScheduleUpdateModule::cancel_delayed_dispatch(Origin::root(), 4, 1));
 
 		let schedule_dispatch_event = TestEvent::schedule_update(RawEvent::CancelDelayedDispatch(1));
 		assert!(System::events()
@@ -128,7 +128,7 @@ fn cancel_delayed_dispatch_should_work() {
 		// OperationalDispatches
 		let call = Call::Balances(BalancesCall::set_balance(2, 10, 13));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(call),
 			DelayedDispatchTime::At(5)
 		));
@@ -138,7 +138,7 @@ fn cancel_delayed_dispatch_should_work() {
 			.iter()
 			.any(|record| record.event == schedule_dispatch_event));
 
-		assert_ok!(ScheduleUpdateModule::cancel_delayed_dispatch(Origin::ROOT, 5, 2));
+		assert_ok!(ScheduleUpdateModule::cancel_delayed_dispatch(Origin::root(), 5, 2));
 
 		let schedule_dispatch_event = TestEvent::schedule_update(RawEvent::CancelDelayedDispatch(2));
 		assert!(System::events()
@@ -178,7 +178,7 @@ fn cancel_delayed_dispatch_should_fail() {
 		// OperationalDispatches
 		let call = Call::Balances(BalancesCall::set_balance(2, 10, 13));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(call),
 			DelayedDispatchTime::At(5)
 		));
@@ -236,7 +236,7 @@ fn on_initialize_should_work() {
 		// OperationalDispatches
 		let call = Call::Balances(BalancesCall::set_balance(3, 10, 11));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(call),
 			DelayedDispatchTime::After(10)
 		));
@@ -248,7 +248,7 @@ fn on_initialize_should_work() {
 
 		let call = Call::Balances(BalancesCall::set_balance(3, 20, 21));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(call),
 			DelayedDispatchTime::After(12)
 		));
@@ -340,21 +340,21 @@ fn on_initialize_weight_exceed() {
 		// NormalDispatches
 		let half_max_weight_call = Call::Logger(LoggerCall::log(1, MaxScheduleDispatchWeight::get() / 2));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(half_max_weight_call),
 			DelayedDispatchTime::At(2)
 		));
 
 		let half_max_weight_call = Call::Logger(LoggerCall::log(2, MaxScheduleDispatchWeight::get() / 2));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(half_max_weight_call),
 			DelayedDispatchTime::At(2)
 		));
 
 		let half_max_weight_call = Call::Logger(LoggerCall::log(3, MaxScheduleDispatchWeight::get() / 2));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(half_max_weight_call),
 			DelayedDispatchTime::At(2)
 		));
@@ -380,7 +380,7 @@ fn execute_at_least_one_task() {
 
 		let large_weight_call = Call::Logger(LoggerCall::log(42, MaxScheduleDispatchWeight::get() + 1));
 		assert_ok!(ScheduleUpdateModule::schedule_dispatch(
-			Origin::ROOT,
+			Origin::root(),
 			Box::new(large_weight_call),
 			DelayedDispatchTime::At(2)
 		));
diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml
index 6709d9b..dd602d4 100644
--- a/tokens/Cargo.toml
+++ b/tokens/Cargo.toml
@@ -10,17 +10,17 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
 
 orml-traits = { path = "../traits", version = "0.1.3-dev", default-features = false }
 
 [dev-dependencies]
-sp-core = { version = "2.0.0-rc3", default-features = false }
+sp-core = { version = "2.0.0-rc4", default-features = false }
 
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
 
diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs
index 6a6ece8..041ab9c 100644
--- a/tokens/src/mock.rs
+++ b/tokens/src/mock.rs
@@ -61,6 +61,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 pub type System = system::Module<Runtime>;
 
diff --git a/traits/Cargo.toml b/traits/Cargo.toml
index df42fcc..58b2dd6 100644
--- a/traits/Cargo.toml
+++ b/traits/Cargo.toml
@@ -10,12 +10,12 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 num-traits = { version = "0.2.11", default-features = false }
 impl-trait-for-tuples = "0.1.3"
-frame-support = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
 
 [dev-dependencies]
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml
index 95f6a46..5d73bc2 100644
--- a/utilities/Cargo.toml
+++ b/utilities/Cargo.toml
@@ -10,8 +10,8 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
 [dev-dependencies]
 serde_json = "1.0.53"
diff --git a/vesting/Cargo.toml b/vesting/Cargo.toml
index 3b9b7b8..dc18e97 100644
--- a/vesting/Cargo.toml
+++ b/vesting/Cargo.toml
@@ -10,16 +10,16 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0.111", optional = true }
 codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false }
-sp-runtime = { version = "2.0.0-rc3", default-features = false }
-sp-io = { version = "2.0.0-rc3", default-features = false }
-sp-std = { version = "2.0.0-rc3", default-features = false }
+sp-runtime = { version = "2.0.0-rc4", default-features = false }
+sp-io = { version = "2.0.0-rc4", default-features = false }
+sp-std = { version = "2.0.0-rc4", default-features = false }
 
-frame-support = { version = "2.0.0-rc3", default-features = false }
-frame-system = { version = "2.0.0-rc3", default-features = false }
+frame-support = { version = "2.0.0-rc4", default-features = false }
+frame-system = { version = "2.0.0-rc4", default-features = false }
 
 [dev-dependencies]
-sp-core = { version = "2.0.0-rc3", default-features = false }
-pallet-balances = "2.0.0-rc3"
+sp-core = { version = "2.0.0-rc4", default-features = false }
+pallet-balances = "2.0.0-rc4"
 
 clear_on_drop = { version = "0.2.4", features = ["no_cc"] }	# https://github.com/paritytech/substrate/issues/4179
 
diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs
index fcd13e1..953f3eb 100644
--- a/vesting/src/mock.rs
+++ b/vesting/src/mock.rs
@@ -59,6 +59,7 @@ impl frame_system::Trait for Runtime {
 	type BlockExecutionWeight = ();
 	type ExtrinsicBaseWeight = ();
 	type MaximumExtrinsicWeight = ();
+	type BaseCallFilter = ();
 }
 pub type System = system::Module<Runtime>;
 
diff --git a/vesting/src/tests.rs b/vesting/src/tests.rs
index 7c905bb..ecf65b2 100644
--- a/vesting/src/tests.rs
+++ b/vesting/src/tests.rs
@@ -212,7 +212,7 @@ fn update_vesting_schedules_works() {
 			per_period: 10u64,
 		};
 		assert_ok!(Vesting::update_vesting_schedules(
-			Origin::ROOT,
+			Origin::root(),
 			BOB,
 			vec![updated_schedule]
 		));
-- 
GitLab