mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 15:41:02 +00:00
feat: compute pallet/storage prefix hash at compile time (#1539)
Since the hash rules of this part of the `pallet_prefix/storage_prefix` are always fixed, we can put the runtime calculation into compile time. --- polkadot address: 15ouFh2SHpGbHtDPsJ6cXQfes9Cx1gEFnJJsJVqPGzBSTudr --------- Co-authored-by: Juan <juangirini@gmail.com> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -53,7 +53,7 @@ pub type ValueIndex = u32;
|
||||
/// [`Page`]s.
|
||||
///
|
||||
/// Each [`Page`] holds at most `ValuesPerNewPage` values in its `values` vector. The last page is
|
||||
/// the only one that could have less than `ValuesPerNewPage` values.
|
||||
/// the only one that could have less than `ValuesPerNewPage` values.
|
||||
/// **Iteration** happens by starting
|
||||
/// at [`first_page`][StoragePagedListMeta::first_page]/
|
||||
/// [`first_value_offset`][StoragePagedListMeta::first_value_offset] and incrementing these indices
|
||||
@@ -373,11 +373,11 @@ where
|
||||
/// that are completely useless for prefix calculation.
|
||||
struct StoragePagedListPrefix<Prefix>(PhantomData<Prefix>);
|
||||
|
||||
impl<Prefix> frame_support::storage::StoragePrefixedContainer for StoragePagedListPrefix<Prefix>
|
||||
impl<Prefix> StoragePrefixedContainer for StoragePagedListPrefix<Prefix>
|
||||
where
|
||||
Prefix: StorageInstance,
|
||||
{
|
||||
fn module_prefix() -> &'static [u8] {
|
||||
fn pallet_prefix() -> &'static [u8] {
|
||||
Prefix::pallet_prefix().as_bytes()
|
||||
}
|
||||
|
||||
@@ -386,15 +386,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<Prefix, Value, ValuesPerNewPage> frame_support::storage::StoragePrefixedContainer
|
||||
impl<Prefix, Value, ValuesPerNewPage> StoragePrefixedContainer
|
||||
for StoragePagedList<Prefix, Value, ValuesPerNewPage>
|
||||
where
|
||||
Prefix: StorageInstance,
|
||||
Value: FullCodec,
|
||||
ValuesPerNewPage: Get<u32>,
|
||||
{
|
||||
fn module_prefix() -> &'static [u8] {
|
||||
StoragePagedListPrefix::<Prefix>::module_prefix()
|
||||
fn pallet_prefix() -> &'static [u8] {
|
||||
StoragePagedListPrefix::<Prefix>::pallet_prefix()
|
||||
}
|
||||
|
||||
fn storage_prefix() -> &'static [u8] {
|
||||
|
||||
Reference in New Issue
Block a user