Skip to content

Commit 6dc96b0

Browse files
authored
Release v1.3.0 (#974)
1 parent 9b75009 commit 6dc96b0

File tree

12 files changed

+289
-136
lines changed

12 files changed

+289
-136
lines changed

node/src/chainspec/mainnet.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,16 @@ pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
9292
properties.insert("tokenDecimals".into(), 18u32.into());
9393
properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into());
9494

95-
let endowment: Balance = 10_000_000 * UNIT;
95+
let endowment: Balance = 10_000 * UNIT;
96+
97+
let mut endowed_accounts = mainnet::get_initial_endowed_accounts().0;
98+
endowed_accounts.extend(vec![
99+
(get_account_id_from_seed::<sr25519::Public>("Alice"), endowment),
100+
(get_account_id_from_seed::<sr25519::Public>("Bob"), endowment),
101+
(get_account_id_from_seed::<sr25519::Public>("Alice//stash"), endowment),
102+
(get_account_id_from_seed::<sr25519::Public>("Bob//stash"), endowment),
103+
]);
104+
96105
Ok(ChainSpec::builder(WASM_BINARY.expect("WASM not available"), Default::default())
97106
.with_name("Local Tangle Mainnet")
98107
.with_id("local-tangle-mainnet")
@@ -102,14 +111,7 @@ pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
102111
// Initial validators
103112
vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob")],
104113
// Endowed accounts
105-
vec![
106-
(get_account_id_from_seed::<sr25519::Public>("Alice"), endowment),
107-
(get_account_id_from_seed::<sr25519::Public>("Bob"), endowment),
108-
(get_account_id_from_seed::<sr25519::Public>("Charlie"), endowment),
109-
(get_account_id_from_seed::<sr25519::Public>("Alice//stash"), endowment),
110-
(get_account_id_from_seed::<sr25519::Public>("Bob//stash"), endowment),
111-
(get_account_id_from_seed::<sr25519::Public>("Charlie//stash"), endowment),
112-
],
114+
endowed_accounts,
113115
// Sudo account
114116
get_account_id_from_seed::<sr25519::Public>("Alice"),
115117
// EVM chain ID
@@ -119,12 +121,14 @@ pub fn local_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
119121
mainnet::get_edgeware_genesis_balance_distribution(),
120122
mainnet::get_leaderboard_balance_distribution(),
121123
mainnet::get_edgeware_snapshot_distribution(),
124+
mainnet::get_polkadot_validator_distribution(),
122125
]),
123126
// Genesis investor / team distribution (pallet-balances + pallet-vesting)
124127
combine_distributions(vec![
125128
mainnet::get_team_balance_distribution(),
126-
mainnet::get_investor_balance_distribution(),
127129
mainnet::get_team_direct_vesting_distribution(),
130+
mainnet::get_investor_balance_distribution(),
131+
mainnet::get_foundation_balance_distribution(),
128132
]),
129133
Default::default(),
130134
))

pallets/multi-asset-delegation/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ pub mod pallet {
159159
#[pallet::constant]
160160
type MinDelegateAmount: Get<BalanceOf<Self>>;
161161

162-
/// The duration for which the stake is locked.
163-
#[pallet::constant]
164-
type BondDuration: Get<RoundIndex>;
165-
166162
/// The service manager that manages active services.
167163
type ServiceManager: ServiceManager<Self::AccountId, BalanceOf<Self>>;
168164

pallets/multi-asset-delegation/src/mock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ parameter_types! {
311311
pub const BlockHashCount: u64 = 250;
312312
pub const MaxLocks: u32 = 50;
313313
pub const MinOperatorBondAmount: u64 = 10_000;
314-
pub const BondDuration: u32 = 10;
314+
315315
pub PID: PalletId = PalletId(*b"PotStake");
316316

317317
pub const SlashRecipient: AccountId = AccountId32::new([1u8; 32]);
@@ -405,7 +405,7 @@ impl pallet_multi_asset_delegation::Config for Runtime {
405405
type Currency = Balances;
406406
type MinOperatorBondAmount = MinOperatorBondAmount;
407407
type SlashRecipient = SlashRecipient;
408-
type BondDuration = BondDuration;
408+
409409
type CurrencyToVote = U128CurrencyToVote;
410410
type StakingInterface = Staking;
411411
type ServiceManager = MockServiceManager;

pallets/rewards/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ parameter_types! {
324324
pub const BlockHashCount: u64 = 250;
325325
pub const MaxLocks: u32 = 50;
326326
pub const MinOperatorBondAmount: u64 = 10_000;
327-
pub const BondDuration: u32 = 10;
327+
328328
pub PID: PalletId = PalletId(*b"PotStake");
329329

330330
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]

pallets/services/src/mock.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,6 @@ parameter_types! {
484484
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
485485
pub const MinOperatorBondAmount: Balance = 1_000;
486486

487-
#[derive(Default, Copy, Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)]
488-
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
489-
pub const BondDuration: u32 = 28;
490-
491487
#[derive(Default, Copy, Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)]
492488
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
493489
pub const MaxDelegatorBlueprints: u32 = 10;
@@ -515,7 +511,6 @@ impl pallet_multi_asset_delegation::Config for Runtime {
515511
type Currency = Balances;
516512
type SlashRecipient = SlashRecipient;
517513
type MinOperatorBondAmount = MinOperatorBondAmount;
518-
type BondDuration = BondDuration;
519514
type CurrencyToVote = U128CurrencyToVote;
520515
type StakingInterface = Staking;
521516
type ServiceManager = Services;

precompiles/multi-asset-delegation/src/mock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ parameter_types! {
318318
pub const BlockHashCount: u64 = 250;
319319
pub const MaxLocks: u32 = 50;
320320
pub const MinOperatorBondAmount: u64 = 10_000;
321-
pub const BondDuration: u32 = 10;
321+
322322
pub PID: PalletId = PalletId(*b"PotStake");
323323

324324
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
@@ -384,7 +384,7 @@ impl pallet_multi_asset_delegation::Config for Runtime {
384384
type Currency = Balances;
385385
type MinOperatorBondAmount = MinOperatorBondAmount;
386386
type SlashRecipient = SlashRecipient;
387-
type BondDuration = BondDuration;
387+
388388
type CurrencyToVote = ();
389389
type StakingInterface = Staking;
390390
type ServiceManager = MockServiceManager;

precompiles/rewards/src/mock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ parameter_types! {
294294
pub const BlockHashCount: u64 = 250;
295295
pub const MaxLocks: u32 = 50;
296296
pub const MinOperatorBondAmount: u64 = 10_000;
297-
pub const BondDuration: u32 = 10;
297+
298298
pub PID: PalletId = PalletId(*b"PotStake");
299299

300300
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
@@ -317,7 +317,7 @@ impl pallet_multi_asset_delegation::Config for Runtime {
317317
type RuntimeEvent = RuntimeEvent;
318318
type Currency = Balances;
319319
type MinOperatorBondAmount = MinOperatorBondAmount;
320-
type BondDuration = BondDuration;
320+
321321
type ServiceManager = MockServiceManager;
322322
type LeaveOperatorsDelay = ConstU32<10>;
323323
type EvmRunner = MockedEvmRunner;

runtime/mainnet/src/lib.rs

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,8 @@ impl pallet_tx_pause::Config for Runtime {
10391039
}
10401040

10411041
parameter_types! {
1042-
pub const BasicDeposit: Balance = deposit(0, 100);
1043-
pub const ByteDeposit: Balance = deposit(0, 100);
1042+
pub const BasicDeposit: Balance = deposit(0, 10);
1043+
pub const ByteDeposit: Balance = deposit(0, 10);
10441044
pub const SubAccountDeposit: Balance = deposit(1, 1);
10451045
pub const MaxSubAccounts: u32 = 100;
10461046
#[derive(Serialize, Deserialize)]
@@ -1200,9 +1200,9 @@ impl pallet_proxy::Config for Runtime {
12001200
}
12011201

12021202
parameter_types! {
1203-
pub const AssetDeposit: Balance = 10 * UNIT;
1204-
pub const AssetAccountDeposit: Balance = DOLLAR;
1205-
pub const ApprovalDeposit: Balance = ExistentialDeposit::get();
1203+
pub const AssetDeposit: Balance = 0;
1204+
pub const AssetAccountDeposit: Balance = 0;
1205+
pub const ApprovalDeposit: Balance = 0;
12061206
pub const AssetsStringLimit: u32 = 50;
12071207
// set to zero since only the LST pallet is allowed to create assets
12081208
pub const MetadataDepositBase: Balance = 0;
@@ -1215,12 +1215,6 @@ pub type AssetId = u128;
12151215
#[cfg(feature = "runtime-benchmarks")]
12161216
pub type AssetId = u32;
12171217

1218-
// impl tangle_primitives::traits::NextAssetId<AssetId> for Runtime {
1219-
// fn next_asset_id() -> Option<AssetId> {
1220-
// pallet_assets::NextAssetId::<Runtime, GeneralAssetsInstance>::get()
1221-
// }
1222-
// }
1223-
12241218
ord_parameter_types! {
12251219
pub const LstPalletOrigin: sp_runtime::AccountId32 =
12261220
AccountIdConversion::<sp_runtime::AccountId32>::into_account_truncating(&LstPalletId::get());
@@ -1237,7 +1231,7 @@ impl pallet_assets::Config<LstPoolAssetsInstance> for Runtime {
12371231
// only lst pallet can create pool tokens
12381232
type CreateOrigin =
12391233
AsEnsureOriginWithArg<EnsureSignedBy<LstPalletOrigin, sp_runtime::AccountId32>>;
1240-
type ForceOrigin = frame_system::EnsureRoot<Self::AccountId>;
1234+
type ForceOrigin = EnsureRootOrHalfCouncil;
12411235
type AssetDeposit = AssetDeposit;
12421236
type AssetAccountDeposit = AssetAccountDeposit;
12431237
type MetadataDepositBase = MetadataDepositBase;
@@ -1254,39 +1248,58 @@ impl pallet_assets::Config<LstPoolAssetsInstance> for Runtime {
12541248
}
12551249

12561250
parameter_types! {
1257-
pub const MinOperatorBondAmount: Balance = 10_000;
1258-
pub const BondDuration: u32 = 10;
1259-
pub const MinDelegateAmount : Balance = 1000;
1251+
// Min operator bond amount to `join_operators`
1252+
pub const MinOperatorBondAmount: Balance = 10 * UNIT;
1253+
// Min delegate amount to `delegate`
1254+
pub const MinDelegateAmount : Balance = 10 * UNIT;
1255+
// Time delay for leaving operators, time between `schedule_leave_operators` and `execute_leave_operators`
1256+
pub const LeaveOperatorsDelay: u32 = 14;
1257+
// Time delay for reducing operator bond
1258+
pub const OperatorBondLessDelay: u32 = 14;
1259+
// Time delay for leaving delegators, time between `schedule_withdraw` and `execute_withdraw`
1260+
pub const LeaveDelegatorsDelay: u32 = 7;
1261+
// Time delay for reducing delegation bond, time between `schedule_delegator_unstake` and `execute_delegator_unstake`
1262+
pub const DelegationBondLessDelay: u32 = 7;
1263+
12601264
pub PID: PalletId = PalletId(*b"PotStake");
1265+
1266+
// Max number of blueprints a delegator can have in Fixed mode per operator
12611267
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
1262-
pub const MaxDelegatorBlueprints : u32 = 50;
1268+
pub const MaxDelegatorBlueprints : u32 = 16;
1269+
1270+
// Max number of blueprints an operator can support
12631271
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
1264-
pub const MaxOperatorBlueprints : u32 = 50;
1272+
pub const MaxOperatorBlueprints : u32 = 16;
1273+
1274+
// Max number of withdraw requests a delegator can have
12651275
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
1266-
pub const MaxWithdrawRequests: u32 = 5;
1276+
pub const MaxWithdrawRequests: u32 = 8;
1277+
1278+
// Max number of unstake requests a delegator can have
12671279
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
1268-
pub const MaxUnstakeRequests: u32 = 5;
1280+
pub const MaxUnstakeRequests: u32 = 8;
1281+
1282+
// Max number of delegations a delegator can have
12691283
#[derive(PartialEq, Eq, Clone, Copy, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
1270-
pub const MaxDelegations: u32 = 50;
1284+
pub const MaxDelegations: u32 = 64;
12711285
}
12721286

12731287
impl pallet_multi_asset_delegation::Config for Runtime {
12741288
type RuntimeEvent = RuntimeEvent;
12751289
type Currency = Balances;
12761290
type SlashRecipient = TreasuryAccount;
12771291
type MinOperatorBondAmount = MinOperatorBondAmount;
1278-
type BondDuration = BondDuration;
12791292
type CurrencyToVote = U128CurrencyToVote;
12801293
type StakingInterface = Staking;
12811294
type ServiceManager = Services;
1282-
type LeaveOperatorsDelay = ConstU32<10>;
1283-
type OperatorBondLessDelay = ConstU32<1>;
1284-
type LeaveDelegatorsDelay = ConstU32<1>;
1285-
type DelegationBondLessDelay = ConstU32<5>;
1295+
type LeaveOperatorsDelay = LeaveOperatorsDelay;
1296+
type OperatorBondLessDelay = OperatorBondLessDelay;
1297+
type LeaveDelegatorsDelay = LeaveDelegatorsDelay;
1298+
type DelegationBondLessDelay = DelegationBondLessDelay;
12861299
type MinDelegateAmount = MinDelegateAmount;
12871300
type Fungibles = Assets;
12881301
type AssetId = AssetId;
1289-
type ForceOrigin = frame_system::EnsureRoot<Self::AccountId>;
1302+
type ForceOrigin = EnsureRootOrHalfCouncil;
12901303
type PalletId = PID;
12911304
type MaxDelegatorBlueprints = MaxDelegatorBlueprints;
12921305
type MaxOperatorBlueprints = MaxOperatorBlueprints;
@@ -1301,8 +1314,9 @@ impl pallet_multi_asset_delegation::Config for Runtime {
13011314
}
13021315

13031316
parameter_types! {
1317+
// `PostUnbondingPoolsWindow` taken from polkadot runtime
13041318
pub const PostUnbondingPoolsWindow: u32 = 2;
1305-
pub const MaxMetadataLen: u32 = 2;
1319+
pub const MaxMetadataLen: u32 = 256;
13061320
pub const CheckLevel: u8 = 255;
13071321
pub const LstPalletId: PalletId = PalletId(*b"py/tnlst");
13081322
}
@@ -1326,15 +1340,15 @@ impl pallet_tangle_lst::Config for Runtime {
13261340
type Fungibles = Assets;
13271341
type AssetId = AssetId;
13281342
type PoolId = AssetId;
1329-
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
1343+
type ForceOrigin = EnsureRootOrHalfCouncil;
13301344
type MaxPointsToBalance = frame_support::traits::ConstU8<10>;
13311345
}
13321346

13331347
parameter_types! {
13341348
pub const RewardsPID: PalletId = PalletId(*b"py/tnrew");
13351349
pub const MaxDepositCap: u128 = UNIT * 100_000_000;
13361350
pub const MaxIncentiveCap: u128 = UNIT * 100_000_000;
1337-
pub const MaxApy: Perbill = Perbill::from_percent(20);
1351+
pub const MaxApy: Perbill = Perbill::from_percent(2);
13381352
pub const MinDepositCap: u128 = 0;
13391353
pub const MinIncentiveCap: u128 = 0;
13401354
}
@@ -1346,7 +1360,7 @@ impl pallet_rewards::Config for Runtime {
13461360
type PalletId = RewardsPID;
13471361
type VaultId = u32;
13481362
type DelegationManager = MultiAssetDelegation;
1349-
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
1363+
type ForceOrigin = EnsureRootOrHalfCouncil;
13501364
type MaxApy = MaxApy;
13511365
type MaxDepositCap = MaxDepositCap;
13521366
type MaxIncentiveCap = MaxIncentiveCap;

0 commit comments

Comments
 (0)