Skip to content

Commit

Permalink
Review #750 (#755)
Browse files Browse the repository at this point in the history
* add treasury module to identity configuration; use default idendity weights; use parameter_types macro instead of Const

* improve comments

* fmt

* increase e2e timeout
  • Loading branch information
magecnion authored Sep 2, 2024
1 parent 912f7e4 commit 61e16b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"fmt-check": "prettier ./tests --check",
"fmt": "prettier ./tests --write",
"build": "./compile_contracts.sh",
"test": "mocha -r ts-node/register -t 270000 'tests/**/*.ts'",
"test": "mocha -r ts-node/register -t 600000 'tests/**/*.ts'",
"test-sql": "FRONTIER_BACKEND_TYPE='sql' mocha -r ts-node/register 'tests/**/*.ts'"
},
"author": "",
Expand Down
21 changes: 14 additions & 7 deletions runtime/laos/src/configs/identity.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::{currency, AccountId, Balances, Runtime, RuntimeEvent, Signature};
use crate::{
currency::calculate_deposit, AccountId, Balance, Balances, Runtime, RuntimeEvent, Signature,
Treasury,
};
use frame_support::parameter_types;
use frame_system::EnsureRoot;
use parachains_common::DAYS;
use sp_core::ConstU128;

parameter_types! {
pub const MaxSubAccounts: u32 = 100;
Expand All @@ -11,6 +13,9 @@ parameter_types! {
pub const PendingUsernameExpiration: u32 = 7 * DAYS;
pub const MaxSuffixLength: u32 = 7;
pub const MaxUsernameLength: u32 = 32;
pub const BasicDeposit: Balance = calculate_deposit(1, 258);
pub const ByteDeposit: Balance = calculate_deposit(0, 1);
pub const SubAccountDeposit: Balance = calculate_deposit(0, 53);
}

type IdentityForceOrigin = EnsureRoot<AccountId>;
Expand All @@ -20,15 +25,15 @@ impl pallet_identity::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
// Add one item in storage and take 258 bytes
type BasicDeposit = ConstU128<{ currency::calculate_deposit(1, 258) }>;
type BasicDeposit = BasicDeposit;
// Does not add any item to the storage but takes 1 bytes
type ByteDeposit = ConstU128<{ currency::calculate_deposit(0, 1) }>;
type ByteDeposit = ByteDeposit;
// Add one item in storage and take 53 bytes
type SubAccountDeposit = ConstU128<{ currency::calculate_deposit(1, 53) }>;
type SubAccountDeposit = SubAccountDeposit;
type MaxSubAccounts = MaxSubAccounts;
type IdentityInformation = pallet_identity::legacy::IdentityInfo<MaxAdditionalFields>;
type MaxRegistrars = MaxRegistrars;
type Slashed = (); // TODO: Treasury;
type Slashed = Treasury;
type ForceOrigin = IdentityForceOrigin;
type RegistrarOrigin = IdentityRegistrarOrigin;
type OffchainSignature = Signature;
Expand All @@ -37,5 +42,7 @@ impl pallet_identity::Config for Runtime {
type PendingUsernameExpiration = PendingUsernameExpiration;
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = (); // moonbeam_weights::pallet_identity::WeightInfo<Runtime>;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>; // TODO is not recommended use default weights but currently there is a function within the
// benchmarks pallet code that cause a panic because it uses `Sr25519` signature type: https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/identity/src/benchmarking.rs#L608
// whereas our runtime uses `Ecdsa` signature type
}

0 comments on commit 61e16b0

Please sign in to comment.