move storage keys computation to primitivs (#1254)

This commit is contained in:
Svyatoslav Nikolsky
2021-12-17 13:29:51 +03:00
committed by Bastian Köcher
parent 3aff81a707
commit 22b1e456ab
16 changed files with 240 additions and 123 deletions
+9 -4
View File
@@ -95,9 +95,6 @@ pub mod weights_ext;
pub use pallet::*;
/// Name of the `PendingSwaps` storage map.
pub const PENDING_SWAPS_MAP_NAME: &str = "PendingSwaps";
// comes from #[pallet::event]
#[allow(clippy::unused_unit)]
#[frame_support::pallet]
@@ -639,7 +636,7 @@ pub mod pallet {
mod tests {
use super::*;
use crate::mock::*;
use frame_support::{assert_noop, assert_ok};
use frame_support::{assert_noop, assert_ok, storage::generator::StorageMap};
const CAN_START_BLOCK_NUMBER: u64 = 10;
const CAN_CLAIM_BLOCK_NUMBER: u64 = CAN_START_BLOCK_NUMBER + 1;
@@ -1130,4 +1127,12 @@ mod tests {
);
});
}
#[test]
fn storage_keys_computed_properly() {
assert_eq!(
PendingSwaps::<TestRuntime>::storage_map_final_key(test_swap_hash()),
bp_token_swap::storage_keys::pending_swaps_key("TokenSwap", test_swap_hash()).0,
);
}
}