Explicitly note that existing AccountIdConversion is truncating and add fallible try_into... (#10719)

* note truncating, add fallible try_into

* fmt

* migrate all to `truncating`

* typo

* uno mas

* Update primitives/runtime/src/traits.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* check the bytes before and after are sensible

* fmt

* Update lib.rs

* Update primitives/runtime/src/traits.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2022-05-17 17:12:02 -04:00
committed by GitHub
parent 558daec697
commit 27f08fec3a
9 changed files with 87 additions and 24 deletions
+2 -2
View File
@@ -2018,14 +2018,14 @@ impl<T: Config> Pallet<T> {
/// Create the main, bonded account of a pool with the given id.
pub fn create_bonded_account(id: PoolId) -> T::AccountId {
T::PalletId::get().into_sub_account((AccountType::Bonded, id))
T::PalletId::get().into_sub_account_truncating((AccountType::Bonded, id))
}
/// Create the reward account of a pool with the given id.
pub fn create_reward_account(id: PoolId) -> T::AccountId {
// NOTE: in order to have a distinction in the test account id type (u128), we put
// account_type first so it does not get truncated out.
T::PalletId::get().into_sub_account((AccountType::Reward, id))
T::PalletId::get().into_sub_account_truncating((AccountType::Reward, id))
}
/// Get the member with their associated bonded and reward pool.