Explicitly declare decl_storage! getters as functions (#3870)

* parse decl_storage getters with fn keyword

* test for get in decl_storage

* update all decl_storage! getters

* bump version

* adjust missed doc line
This commit is contained in:
Robert Habermeier
2019-10-22 03:53:58 -04:00
committed by Bastian Köcher
parent 1111d79ac1
commit 5d5e71028e
36 changed files with 190 additions and 175 deletions
@@ -44,8 +44,8 @@ mod no_instance {
pub DoubleMap: double_map u32, blake2_256(u32) => u32;
pub DoubleMap2: double_map hasher(twox_128) u32, blake2_128(u32) => u32;
pub TestGenericValue get(test_generic_value) config(): Option<T::BlockNumber>;
pub TestGenericDoubleMap get(foo2) config(test_generic_double_map):
pub TestGenericValue get(fn test_generic_value) config(): Option<T::BlockNumber>;
pub TestGenericDoubleMap get(fn foo2) config(test_generic_double_map):
double_map u32, blake2_256(T::BlockNumber) => Option<u32>;
}
}
@@ -74,8 +74,8 @@ mod instance {
pub DoubleMap: double_map u32, blake2_256(u32) => u32;
pub DoubleMap2: double_map hasher(twox_128) u32, blake2_128(u32) => u32;
pub TestGenericValue get(test_generic_value) config(): Option<T::BlockNumber>;
pub TestGenericDoubleMap get(foo2) config(test_generic_double_map):
pub TestGenericValue get(fn test_generic_value) config(): Option<T::BlockNumber>;
pub TestGenericDoubleMap get(fn foo2) config(test_generic_double_map):
double_map u32, blake2_256(T::BlockNumber) => Option<u32>;
}
add_extra_genesis {
@@ -102,7 +102,7 @@ mod module {
support::decl_storage! {
trait Store for Module<T: Trait> as Actors {
/// requirements to enter and maintain status in roles
pub Parameters get(parameters) build(|config: &GenesisConfig| {
pub Parameters get(fn parameters) build(|config: &GenesisConfig| {
if config.enable_storage_role {
let storage_params: RoleParameters<T> = Default::default();
vec![(Role::Storage, storage_params)]
@@ -112,7 +112,7 @@ mod module {
}): map Role => Option<RoleParameters<T>>;
/// the roles members can enter into
pub AvailableRoles get(available_roles) build(|config: &GenesisConfig| {
pub AvailableRoles get(fn available_roles) build(|config: &GenesisConfig| {
if config.enable_storage_role {
vec![(Role::Storage)]
} else {
@@ -121,13 +121,13 @@ mod module {
}): Vec<Role>;
/// Actors list
pub ActorAccountIds get(actor_account_ids) : Vec<T::AccountId>;
pub ActorAccountIds get(fn actor_account_ids) : Vec<T::AccountId>;
/// actor accounts associated with a role
pub AccountIdsByRole get(account_ids_by_role) : map Role => Vec<T::AccountId>;
pub AccountIdsByRole get(fn account_ids_by_role) : map Role => Vec<T::AccountId>;
/// tokens locked until given block number
pub Bondage get(bondage) : map T::AccountId => T::BlockNumber;
pub Bondage get(fn bondage) : map T::AccountId => T::BlockNumber;
/// First step before enter a role is registering intent with a new account/key.
/// This is done by sending a role_entry_request() from the new account.
@@ -135,10 +135,10 @@ mod module {
/// The account making the request will be bonded and must have
/// sufficient balance to cover the minimum stake for the role.
/// Bonding only occurs after successful entry into a role.
pub RoleEntryRequests get(role_entry_requests) : Requests<T>;
pub RoleEntryRequests get(fn role_entry_requests) : Requests<T>;
/// Entry request expires after this number of blocks
pub RequestLifeTime get(request_life_time) config(request_life_time) : u64 = 0;
pub RequestLifeTime get(fn request_life_time) config(request_life_time) : u64 = 0;
}
add_extra_genesis {
config(enable_storage_role): bool;