mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 05:25:48 +00:00
Implement a proper generic resolution in decl_storage! (#2913)
* Add failing test case * move storage maps to blake2_128 (#2268) * remove default hash, introduce twox_128 and blake2 * use blake2_128 & create ext_blake2_128 * refactor code * add benchmark * factorize generator * fix * parameterizable hasher * some fix * fix * fix * fix * metadata * fix * remove debug print * map -> blake2_256 * fix test * fix test * Apply suggestions from code review Co-Authored-By: thiolliere <gui.thiolliere@gmail.com> * impl twox 128 concat (#2353) * impl twox_128_concat * comment addressed * fix * impl twox_128->64_concat * fix test * Fix compilation and cleanup some docs * Lol * Remove traits from storage types that are not generic * Get instance test almost working as wanted * Make `srml-support-test` compile again :) * Fixes test of srml-support * Fix compilation * Break some lines * Remove incorrect macro match arm * Integrates review feedback * Update documentation * Fix compilation
This commit is contained in:
@@ -179,7 +179,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
if block_number == pending_change.scheduled_at + pending_change.delay {
|
||||
<Authorities<T>>::put(&pending_change.next_authorities);
|
||||
Authorities::put(&pending_change.next_authorities);
|
||||
Self::deposit_event(
|
||||
Event::NewAuthorities(pending_change.next_authorities)
|
||||
);
|
||||
@@ -193,7 +193,7 @@ decl_module! {
|
||||
impl<T: Trait> Module<T> {
|
||||
/// Get the current set of authorities, along with their respective weights.
|
||||
pub fn grandpa_authorities() -> Vec<(AuthorityId, u64)> {
|
||||
<Authorities<T>>::get()
|
||||
Authorities::get()
|
||||
}
|
||||
|
||||
/// Schedule a change in the authorities.
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use primitives::{
|
||||
BuildStorage, DigestItem, traits::IdentityLookup, testing::{Header, UintAuthorityId}
|
||||
};
|
||||
use primitives::{DigestItem, traits::IdentityLookup, testing::{Header, UintAuthorityId}};
|
||||
use runtime_io;
|
||||
use srml_support::{impl_outer_origin, impl_outer_event};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
@@ -72,9 +70,8 @@ pub fn to_authorities(vec: Vec<(u64, u64)>) -> Vec<(AuthorityId, u64)> {
|
||||
}
|
||||
|
||||
pub fn new_test_ext(authorities: Vec<(u64, u64)>) -> runtime_io::TestExternalities<Blake2Hasher> {
|
||||
let mut t = system::GenesisConfig::<Test>::default().build_storage().unwrap().0;
|
||||
t.extend(GenesisConfig::<Test> {
|
||||
_genesis_phantom_data: Default::default(),
|
||||
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap().0;
|
||||
t.extend(GenesisConfig {
|
||||
authorities: to_authorities(authorities),
|
||||
}.build_storage().unwrap().0);
|
||||
t.into()
|
||||
|
||||
Reference in New Issue
Block a user