Skip to content
Snippets Groups Projects
Unverified Commit b023edf1 authored by wangjj9219's avatar wangjj9219 Committed by GitHub
Browse files

update to substrate 2.0.0 (#292)

parent d7d51920
No related branches found
No related tags found
No related merge requests found
Showing
with 211 additions and 173 deletions
......@@ -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-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
orml-traits = { path = "../traits", version = "0.2.1-dev", default-features = false }
[dev-dependencies]
sp-core = { version = "2.0.0-rc6", default-features = false }
sp-core = { version = "2.0.0", default-features = false }
clear_on_drop = { version = "0.2.4", features = ["no_cc"] } # https://github.com/paritytech/substrate/issues/4179
......
......@@ -54,7 +54,7 @@ impl frame_system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
......
......@@ -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-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
orml-traits = { path = "../traits", version = "0.2.1-dev", default-features = false }
[dev-dependencies]
sp-core = { version = "2.0.0-rc6", default-features = false }
pallet-scheduler = { version = "2.0.0-rc6" }
sp-core = { version = "2.0.0", default-features = false }
pallet-scheduler = { version = "2.0.0" }
clear_on_drop = { version = "0.2.4", features = ["no_cc"] } # https://github.com/paritytech/substrate/issues/4179
[features]
......
......@@ -43,7 +43,7 @@ impl frame_system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
......@@ -65,6 +65,7 @@ impl pallet_scheduler::Trait for Runtime {
type Call = Call;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<u128>;
type MaxScheduledPerBlock = ();
type WeightInfo = ();
}
......
......@@ -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-rc6", default-features = false }
sp-runtime-interface = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
frame-benchmarking = { version = "2.0.0-rc6", default-features = false }
sp-api = { version = "2.0.0", default-features = false }
sp-runtime-interface = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
frame-benchmarking = { version = "2.0.0", default-features = false }
[dev-dependencies]
hex-literal = "0.2.1"
......
......@@ -149,7 +149,7 @@ pub use sp_runtime::traits::Zero;
/// }
/// ```
///
/// These `verify` blocks will not execute when running your actual benchmarks!
/// These `verify` blocks will not affect your benchmark results!
///
/// You can construct benchmark tests like so:
///
......@@ -578,7 +578,11 @@ macro_rules! benchmark_backend {
]
}
fn instance(&self, components: &[($crate::BenchmarkParameter, u32)])
fn instance(
&self,
components: &[($crate::BenchmarkParameter, u32)],
verify: bool
)
-> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>
{
$(
......@@ -588,7 +592,8 @@ macro_rules! benchmark_backend {
// Prepare instance
let $param = components.iter()
.find(|&c| c.0 == $crate::BenchmarkParameter::$param)
.unwrap().1;
.ok_or("Could not find component in benchmark preparation.")?
.1;
)*
$(
let $pre_id : $pre_ty = $pre_ex;
......@@ -596,28 +601,13 @@ macro_rules! benchmark_backend {
$( $param_instancer ; )*
$( $post )*
Ok(Box::new(move || -> Result<(), &'static str> { $eval; Ok(()) }))
}
fn verify(&self, components: &[($crate::BenchmarkParameter, u32)])
-> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>
{
$(
let $common = $common_from;
)*
$(
// Prepare instance
let $param = components.iter()
.find(|&c| c.0 == $crate::BenchmarkParameter::$param)
.unwrap().1;
)*
$(
let $pre_id : $pre_ty = $pre_ex;
)*
$( $param_instancer ; )*
$( $post )*
Ok(Box::new(move || -> Result<(), &'static str> { $eval; $postcode; Ok(()) }))
Ok(Box::new(move || -> Result<(), &'static str> {
$eval;
if verify {
$postcode;
}
Ok(())
}))
}
}
};
......@@ -663,26 +653,18 @@ macro_rules! selected_benchmark {
}
}
fn instance(&self, components: &[($crate::BenchmarkParameter, u32)])
fn instance(
&self,
components: &[($crate::BenchmarkParameter, u32)],
verify: bool
)
-> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>
{
match self {
$(
Self::$bench => <
$bench as $crate::BenchmarkingSetup<$runtime $(, $bench_inst)? >
>::instance(&$bench, components),
)*
}
}
fn verify(&self, components: &[($crate::BenchmarkParameter, u32)])
-> Result<Box<dyn FnOnce() -> Result<(), &'static str>>, &'static str>
{
match self {
$(
Self::$bench => <
$bench as $crate::BenchmarkingSetup<$runtime $(, $bench_inst)? >
>::verify(&$bench, components),
>::instance(&$bench, components, verify),
)*
}
}
......@@ -719,7 +701,8 @@ macro_rules! impl_benchmark {
highest_range_values: &[u32],
steps: &[u32],
repeat: u32,
whitelist: &[$crate::TrackedStorageKey]
whitelist: &[$crate::TrackedStorageKey],
verify: bool,
) -> Result<Vec<$crate::BenchmarkResults>, &'static str> {
// Map the input to the selected benchmark.
let extrinsic = sp_std::str::from_utf8(extrinsic)
......@@ -729,6 +712,11 @@ macro_rules! impl_benchmark {
_ => return Err("Could not find extrinsic."),
};
let mut results: Vec<$crate::BenchmarkResults> = Vec::new();
if repeat == 0 {
return Ok(results);
}
// Add whitelist to DB
$crate::benchmarking::set_whitelist(whitelist.to_vec());
......@@ -739,15 +727,15 @@ macro_rules! impl_benchmark {
let components = <
SelectedBenchmark as $crate::BenchmarkingSetup<$runtime $(, $instance)?>
>::components(&selected_benchmark);
let mut results: Vec<$crate::BenchmarkResults> = Vec::new();
// Default number of steps for a component.
let mut prev_steps = 10;
let repeat_benchmark = |
repeat: u32,
c: Vec<($crate::BenchmarkParameter, u32)>,
c: &[($crate::BenchmarkParameter, u32)],
results: &mut Vec<$crate::BenchmarkResults>,
verify: bool,
| -> Result<(), &'static str> {
// Run the benchmark `repeat` times.
for _ in 0..repeat {
......@@ -755,7 +743,7 @@ macro_rules! impl_benchmark {
// benchmark.
let closure_to_benchmark = <
SelectedBenchmark as $crate::BenchmarkingSetup<$runtime $(, $instance)?>
>::instance(&selected_benchmark, &c)?;
>::instance(&selected_benchmark, c, verify)?;
// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
......@@ -769,43 +757,47 @@ macro_rules! impl_benchmark {
// 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: {:?}", c
);
let start_extrinsic = $crate::benchmarking::current_time();
closure_to_benchmark()?;
let finish_extrinsic = $crate::benchmarking::current_time();
let elapsed_extrinsic = finish_extrinsic - start_extrinsic;
// Commit the changes to get proper write count
$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();
$crate::storage_root();
let finish_storage_root = $crate::benchmarking::current_time();
let elapsed_storage_root = finish_storage_root - start_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,
});
if verify {
closure_to_benchmark()?;
} else {
// Time the extrinsic logic.
frame_support::debug::trace!(
target: "benchmark",
"Start Benchmark: {:?}", c
);
let start_extrinsic = $crate::benchmarking::current_time();
closure_to_benchmark()?;
let finish_extrinsic = $crate::benchmarking::current_time();
let elapsed_extrinsic = finish_extrinsic - start_extrinsic;
// Commit the changes to get proper write count
$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();
$crate::storage_root();
let finish_storage_root = $crate::benchmarking::current_time();
let elapsed_storage_root = finish_storage_root - start_storage_root;
results.push($crate::BenchmarkResults {
components: c.to_vec(),
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();
......@@ -815,7 +807,11 @@ macro_rules! impl_benchmark {
};
if components.is_empty() {
repeat_benchmark(repeat, Default::default(), &mut results)?;
if verify {
// If `--verify` is used, run the benchmark once to verify it would complete.
repeat_benchmark(repeat, Default::default(), &mut Vec::new(), true)?;
}
repeat_benchmark(repeat, Default::default(), &mut results, false)?;
} else {
// Select the component we will be benchmarking. Each component will be benchmarked.
for (idx, (name, low, high)) in components.iter().enumerate() {
......@@ -851,7 +847,11 @@ macro_rules! impl_benchmark {
)
.collect();
repeat_benchmark(repeat, c, &mut results)?;
if verify {
// If `--verify` is used, run the benchmark once to verify it would complete.
repeat_benchmark(1, &c, &mut Vec::new(), true)?;
}
repeat_benchmark(repeat, &c, &mut results, false)?;
}
}
}
......@@ -883,17 +883,17 @@ macro_rules! impl_benchmark_test {
let execute_benchmark = |
c: Vec<($crate::BenchmarkParameter, u32)>
| -> Result<(), &'static str> {
// Set up the verification state
// Set up the benchmark, return execution + verification function.
let closure_to_verify = <
SelectedBenchmark as $crate::BenchmarkingSetup<$runtime, _>
>::verify(&selected_benchmark, &c)?;
>::instance(&selected_benchmark, &c, true)?;
// 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(1u8.into());
}
// Run verification
// Run execution + verification
closure_to_verify()?;
// Reset the state
......@@ -935,7 +935,7 @@ macro_rules! impl_benchmark_test {
/// First create an object that holds in the input parameters for the benchmark:
///
/// ```ignore
/// let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat, &whitelist);
/// let params = (&config, &whitelist);
/// ```
///
/// The `whitelist` is a parameter you pass to control the DB read/write
......@@ -979,18 +979,29 @@ macro_rules! impl_benchmark_test {
macro_rules! add_benchmark {
( $params:ident, $batches:ident, $name:ident, $( $location:tt )* ) => (
let name_string = stringify!($name).as_bytes();
let (pallet, benchmark, lowest_range_values, highest_range_values, steps, repeat, whitelist, extra) = $params;
let (config, whitelist) = $params;
let $crate::BenchmarkConfig {
pallet,
benchmark,
lowest_range_values,
highest_range_values,
steps,
repeat,
verify,
extra,
} = config;
if &pallet[..] == &name_string[..] || &pallet[..] == &b"*"[..] {
if &pallet[..] == &b"*"[..] || &benchmark[..] == &b"*"[..] {
for benchmark in $( $location )*::Benchmark::benchmarks(extra).into_iter() {
for benchmark in $( $location )*::benchmarks(*extra).into_iter() {
$batches.push($crate::BenchmarkBatch {
results: $( $location )*::Benchmark::run_benchmark(
benchmark,
&lowest_range_values[..],
&highest_range_values[..],
&steps[..],
repeat,
*repeat,
whitelist,
*verify,
)?,
pallet: name_string.to_vec(),
benchmark: benchmark.to_vec(),
......@@ -1003,8 +1014,9 @@ macro_rules! add_benchmark {
&lowest_range_values[..],
&highest_range_values[..],
&steps[..],
repeat,
*repeat,
whitelist,
*verify
)?,
pallet: name_string.to_vec(),
benchmark: benchmark.clone(),
......
......@@ -73,7 +73,7 @@ impl frame_system::Trait for Test {
type MaximumBlockLength = ();
type AvailableBlockRatio = ();
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
......@@ -155,9 +155,12 @@ fn benchmarks_macro_works() {
let components = <SelectedBenchmark as BenchmarkingSetup<Test>>::components(&selected_benchmark);
assert_eq!(components, vec![(BenchmarkParameter::b, 1, 1000)]);
let closure =
<SelectedBenchmark as BenchmarkingSetup<Test>>::instance(&selected_benchmark, &[(BenchmarkParameter::b, 1)])
.expect("failed to create closure");
let closure = <SelectedBenchmark as BenchmarkingSetup<Test>>::instance(
&selected_benchmark,
&[(BenchmarkParameter::b, 1)],
true,
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_eq!(closure(), Ok(()));
......@@ -171,9 +174,12 @@ fn benchmarks_macro_rename_works() {
let components = <SelectedBenchmark as BenchmarkingSetup<Test>>::components(&selected_benchmark);
assert_eq!(components, vec![(BenchmarkParameter::b, 1, 1000)]);
let closure =
<SelectedBenchmark as BenchmarkingSetup<Test>>::instance(&selected_benchmark, &[(BenchmarkParameter::b, 1)])
.expect("failed to create closure");
let closure = <SelectedBenchmark as BenchmarkingSetup<Test>>::instance(
&selected_benchmark,
&[(BenchmarkParameter::b, 1)],
true,
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_ok!(closure());
......@@ -187,9 +193,12 @@ fn benchmarks_macro_works_for_non_dispatchable() {
let components = <SelectedBenchmark as BenchmarkingSetup<Test>>::components(&selected_benchmark);
assert_eq!(components, vec![(BenchmarkParameter::x, 1, 10000)]);
let closure =
<SelectedBenchmark as BenchmarkingSetup<Test>>::instance(&selected_benchmark, &[(BenchmarkParameter::x, 1)])
.expect("failed to create closure");
let closure = <SelectedBenchmark as BenchmarkingSetup<Test>>::instance(
&selected_benchmark,
&[(BenchmarkParameter::x, 1)],
true,
)
.expect("failed to create closure");
assert_eq!(closure(), Ok(()));
}
......@@ -199,12 +208,26 @@ fn benchmarks_macro_verify_works() {
// Check postcondition for benchmark `set_value` is valid.
let selected_benchmark = SelectedBenchmark::set_value;
let closure = <SelectedBenchmark as BenchmarkingSetup<Test>>::instance(
&selected_benchmark,
&[(BenchmarkParameter::b, 1)],
true,
)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_ok!(closure());
});
// Check postcondition for benchmark `bad_verify` is invalid.
let selected = SelectedBenchmark::bad_verify;
let closure =
<SelectedBenchmark as BenchmarkingSetup<Test>>::verify(&selected_benchmark, &[(BenchmarkParameter::b, 1)])
<SelectedBenchmark as BenchmarkingSetup<Test>>::instance(&selected, &[(BenchmarkParameter::x, 10000)], true)
.expect("failed to create closure");
new_test_ext().execute_with(|| {
assert_ok!(closure());
assert_err!(closure(), "You forgot to sort!");
});
}
......
......@@ -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-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
orml-traits = { path = "../traits", version = "0.2.1-dev", default-features = false }
[dev-dependencies]
sp-core = { version = "2.0.0-rc6", default-features = false }
pallet-balances = "2.0.0-rc6"
sp-core = { version = "2.0.0", default-features = false }
pallet-balances = "2.0.0"
tokens = { package = "orml-tokens", path = "../tokens" }
clear_on_drop = { version = "0.2.4", features = ["no_cc"] } # https://github.com/paritytech/substrate/issues/4179
......
......@@ -55,7 +55,7 @@ impl frame_system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
......@@ -81,6 +81,7 @@ impl pallet_balances::Trait for Runtime {
type Event = TestEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Module<Runtime>;
type MaxLocks = ();
type WeightInfo = ();
}
......
......@@ -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-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-core = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
sp-core = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
[features]
default = ["std"]
......
......@@ -53,7 +53,7 @@ impl frame_system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
......
......@@ -141,7 +141,7 @@ fn add_on_finalize_should_work() {
per_block: vec![1],
};
assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
assert_eq!(storage_get(&update.key), vec![]);
assert_eq!(storage_get(&update.key), Vec::<u8>::new());
GraduallyUpdateModule::on_finalize(10);
assert_eq!(storage_get(&update.key), vec![10]);
......@@ -231,7 +231,7 @@ fn u32_should_work() {
per_block: 1u32.encode(),
};
assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
assert_eq!(storage_get(&update.key), vec![]);
assert_eq!(storage_get(&update.key), Vec::<u8>::new());
GraduallyUpdateModule::on_finalize(10);
assert_eq!(storage_get(&update.key), vec![10, 0, 0, 0]);
GraduallyUpdateModule::on_finalize(15);
......@@ -252,7 +252,7 @@ fn u128_should_work() {
per_block: 1u128.encode(),
};
assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
assert_eq!(storage_get(&update.key), vec![]);
assert_eq!(storage_get(&update.key), Vec::<u8>::new());
GraduallyUpdateModule::on_finalize(10);
assert_eq!(
storage_get(&update.key),
......@@ -285,7 +285,7 @@ fn permill_should_work() {
per_block: Permill::from_percent(1).encode(),
};
assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
assert_eq!(storage_get(&update.key), vec![]);
assert_eq!(storage_get(&update.key), Vec::<u8>::new());
GraduallyUpdateModule::on_finalize(10);
assert_eq!(storage_get(&update.key), vec![160, 134, 1, 0]);
GraduallyUpdateModule::on_finalize(15);
......@@ -306,7 +306,7 @@ fn fixedu128_should_work() {
per_block: FixedU128::saturating_from_rational(1, 1).encode(),
};
assert_ok!(GraduallyUpdateModule::gradually_update(Origin::root(), update.clone()));
assert_eq!(storage_get(&update.key), vec![]);
assert_eq!(storage_get(&update.key), Vec::<u8>::new());
GraduallyUpdateModule::on_finalize(10);
assert_eq!(
storage_get(&update.key),
......
......@@ -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-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-application-crypto = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
orml-traits = { path = "../traits", version = "0.2.1-dev", default-features = false }
orml-utilities = { path = "../utilities", version = "0.2.1-dev", default-features = false }
[dev-dependencies]
sp-core = { version = "2.0.0-rc6", default-features = false }
sp-core = { version = "2.0.0", default-features = false }
clear_on_drop = { version = "0.2.4", features = ["no_cc"] } # https://github.com/paritytech/substrate/issues/4179
......
......@@ -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-rc6" }
sp-api = { version = "2.0.0-rc6" }
sp-blockchain = { version = "2.0.0-rc6" }
sp-runtime = { version = "2.0.0" }
sp-api = { version = "2.0.0" }
sp-blockchain = { version = "2.0.0" }
orml-oracle-rpc-runtime-api = { path = "runtime-api" }
......@@ -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-rc6" }
sp-std = { default-features = false, version = "2.0.0-rc6" }
sp-api = { default-features = false, version = "2.0.0" }
sp-std = { default-features = false, version = "2.0.0" }
[features]
default = ["std"]
......
......@@ -64,7 +64,7 @@ impl frame_system::Trait for Test {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
......
......@@ -10,15 +10,15 @@ 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-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
orml-traits = { path = "../traits", version = "0.2.1-dev", default-features = false }
[dev-dependencies]
sp-core = { version = "2.0.0-rc6", default-features = false }
sp-core = { version = "2.0.0", default-features = false }
clear_on_drop = { version = "0.2.4", features = ["no_cc"] } # https://github.com/paritytech/substrate/issues/4179
[features]
......
......@@ -54,7 +54,7 @@ impl frame_system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
......
......@@ -10,19 +10,19 @@ 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-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-io = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0", default-features = false }
frame-system = { version = "2.0.0", default-features = false }
orml-traits = { path = "../traits", version = "0.2.1-dev", default-features = false }
[dev-dependencies]
sp-core = { version = "2.0.0-rc6", default-features = false }
pallet-treasury = { version = "2.0.0-rc6" }
pallet-elections-phragmen = { version = "2.0.0-rc6" }
sp-core = { version = "2.0.0", default-features = false }
pallet-treasury = { version = "2.0.0" }
pallet-elections-phragmen = { version = "2.0.0" }
clear_on_drop = { version = "0.2.4", features = ["no_cc"] } # https://github.com/paritytech/substrate/issues/4179
......
......@@ -843,6 +843,7 @@ where
GetCurrencyId: Get<T::CurrencyId>,
{
type Moment = T::BlockNumber;
type MaxLocks = ();
fn set_lock(id: LockIdentifier, who: &T::AccountId, amount: Self::Balance, _reasons: WithdrawReasons) {
Module::<T>::set_lock(id, GetCurrencyId::get(), who, amount)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment