This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds ability to use default hasher in
dev_mode
for explicit key bin…
…ding (#14164) * Initial setup * Minor update * Minor update * Addresses review comments * Addresses review comments * Updates doc * ".git/.scripts/commands/fmt/fmt.sh" * Renames file * Updates path in test --------- Co-authored-by: command-bot <>
- Loading branch information
Showing
5 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
frame/support/test/tests/pallet_ui/non_dev_mode_storage_map_explicit_key_default_hasher.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
pub use pallet::*; | ||
|
||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use frame_support::pallet_prelude::*; | ||
|
||
// The struct on which we build all of our Pallet logic. | ||
#[pallet::pallet] | ||
pub struct Pallet<T>(_); | ||
|
||
// Your Pallet's configuration trait, representing custom external types and interfaces. | ||
#[pallet::config] | ||
pub trait Config: frame_system::Config {} | ||
|
||
#[pallet::storage] | ||
type MyStorage<T: Config> = StorageValue<_, Vec<u8>>; | ||
|
||
#[pallet::storage] | ||
type MyStorageMap<T: Config> = StorageMap<Key = u32, Value = u64>; | ||
|
||
#[pallet::storage] | ||
type MyStorageDoubleMap<T: Config> = StorageDoubleMap<Key1 = u32, Key2 = u64, Value = u64>; | ||
|
||
#[pallet::storage] | ||
type MyCountedStorageMap<T: Config> = CountedStorageMap<Key = u32, Value = u64>; | ||
|
||
// Your Pallet's internal functions. | ||
impl<T: Config> Pallet<T> {} | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
.../support/test/tests/pallet_ui/non_dev_mode_storage_map_explicit_key_default_hasher.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: Invalid pallet::storage, cannot find `Hasher` generic, required for `StorageMap`. | ||
--> tests/pallet_ui/non_dev_mode_storage_map_explicit_key_default_hasher.rs:21:43 | ||
| | ||
21 | type MyStorageMap<T: Config> = StorageMap<Key = u32, Value = u64>; | ||
| ^ | ||
|
||
error[E0432]: unresolved import `pallet` | ||
--> tests/pallet_ui/non_dev_mode_storage_map_explicit_key_default_hasher.rs:3:9 | ||
| | ||
3 | pub use pallet::*; | ||
| ^^^^^^ help: a similar path exists: `test_pallet::pallet` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters