mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
Hashing proc macro utils (#9875)
* hashing macro * fmt * use in easy place, and fix blake sizes * fix * Fixes, docs. Allow ident as input. * fix doc tests * update error in test (nmapkey and key are same type). * hashing crates under sp_core * Doc updates and format. * use all existing hashing functions. * return array of u8 * Update primitives/core/hashing/proc-macro/src/impls.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * ToTokeen for an array of u8 * fix * re * Improve impls * complete doc tests * fmt * fix doctest format * fix ui test (nmap key type alias) Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -34,6 +34,7 @@ bitflags = "1.3"
|
||||
impl-trait-for-tuples = "0.2.1"
|
||||
smallvec = "1.7.0"
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
sp-core-hashing-proc-macro = { version = "4.0.0-dev", path = "../../primitives/core/hashing/proc-macro" }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.3.0"
|
||||
|
||||
@@ -42,6 +42,8 @@ pub use scale_info;
|
||||
pub use serde;
|
||||
pub use sp_core::Void;
|
||||
#[doc(hidden)]
|
||||
pub use sp_core_hashing_proc_macro;
|
||||
#[doc(hidden)]
|
||||
pub use sp_io::{self, storage::root as storage_root};
|
||||
#[doc(hidden)]
|
||||
pub use sp_runtime::RuntimeDebug;
|
||||
@@ -427,9 +429,7 @@ macro_rules! parameter_types {
|
||||
/// Returns the key for this parameter type.
|
||||
#[allow(unused)]
|
||||
pub fn key() -> [u8; 16] {
|
||||
$crate::sp_io::hashing::twox_128(
|
||||
concat!(":", stringify!($name), ":").as_bytes()
|
||||
)
|
||||
$crate::sp_core_hashing_proc_macro::twox_128!(b":", $name, b":")
|
||||
}
|
||||
|
||||
/// Set the value of this parameter type in the storage.
|
||||
|
||||
@@ -4,8 +4,8 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
|
||||
10 | #[pallet::generate_storage_info]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key<frame_support::Twox64Concat, Bar>`
|
||||
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, Key<frame_support::Twox64Concat, Bar>, u32>`
|
||||
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `NMapKey<frame_support::Twox64Concat, Bar>`
|
||||
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, NMapKey<frame_support::Twox64Concat, Bar>, u32>`
|
||||
note: required by `storage_info`
|
||||
--> $DIR/storage.rs:71:2
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user