Skip to content

Commit

Permalink
Revamp salp(lite) with configurable multisig account (#444)
Browse files Browse the repository at this point in the history
* Revamp salp(lite) with configurable multisig account

* Add salp multisig account to spec&runtime migration

* Fix breaking test&some refact

* Revamp salp-lite to support failed-fund-continue

* more tests

* more tests

* remove CustomOnRuntimeUpgrade

Co-authored-by: Edwin Wang <lark930@gmail.com>
  • Loading branch information
yrong and ark930 authored Dec 24, 2021
1 parent c42bd08 commit 5f964a1
Show file tree
Hide file tree
Showing 11 changed files with 431 additions and 1,334 deletions.
27 changes: 25 additions & 2 deletions node/service/src/chain_spec/asgard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use asgard_runtime::{
constants::currency::DOLLARS, AccountId, AuraId, Balance, BalancesConfig, BancorConfig,
BlockNumber, CollatorSelectionConfig, CouncilConfig, DemocracyConfig, GenesisConfig,
IndicesConfig, MinterRewardConfig, ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix,
SessionConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TokensConfig, VestingConfig,
VtokenMintConfig, WASM_BINARY,
SalpConfig, SalpLiteConfig, SessionConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
TokensConfig, VestingConfig, VtokenMintConfig, WASM_BINARY,
};
use bifrost_runtime_common::constants::time::*;
use cumulus_primitives_core::ParaId;
Expand Down Expand Up @@ -81,6 +81,8 @@ pub fn asgard_genesis(
balances: Vec<(AccountId, Balance)>,
vestings: Vec<(AccountId, BlockNumber, BlockNumber, Balance)>,
tokens: Vec<(AccountId, CurrencyId, Balance)>,
salp_multisig_key: AccountId,
salp_lite_multisig_key_salp: AccountId,
) -> GenesisConfig {
GenesisConfig {
system: SystemConfig {
Expand Down Expand Up @@ -154,6 +156,8 @@ pub fn asgard_genesis(
],
},
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(2) },
salp: SalpConfig { initial_multisig_account: Some(salp_multisig_key) },
salp_lite: SalpLiteConfig { initial_multisig_account: Some(salp_lite_multisig_key_salp) },
}
}

Expand Down Expand Up @@ -183,6 +187,10 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig {
]
})
.collect();
let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();
let salp_lite_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();

asgard_genesis(
vec![(
Expand All @@ -194,6 +202,8 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig {
balances,
vestings,
tokens,
salp_multisig,
salp_lite_multisig,
)
}

Expand Down Expand Up @@ -260,6 +270,11 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
})
.collect();

let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();
let salp_lite_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();

asgard_genesis(
vec![
(
Expand All @@ -273,6 +288,8 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
balances,
vestings,
tokens,
salp_multisig,
salp_lite_multisig,
)
}

Expand Down Expand Up @@ -356,6 +373,10 @@ fn asgard_config_genesis(id: ParaId) -> GenesisConfig {
]
})
.collect();
let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();
let salp_lite_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();

asgard_genesis(
invulnerables,
Expand All @@ -364,6 +385,8 @@ fn asgard_config_genesis(id: ParaId) -> GenesisConfig {
balances,
vesting_configs.into_iter().flat_map(|vc| vc.vesting).collect(),
tokens,
salp_multisig,
salp_lite_multisig,
)
}

Expand Down
30 changes: 28 additions & 2 deletions node/service/src/chain_spec/bifrost_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ use std::{
use bifrost_kusama_runtime::{
AccountId, AuraId, Balance, BalancesConfig, BlockNumber, CollatorSelectionConfig,
CouncilConfig, CouncilMembershipConfig, DemocracyConfig, GenesisConfig, IndicesConfig,
ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix, SessionConfig, SystemConfig,
TechnicalCommitteeConfig, TechnicalMembershipConfig, TokensConfig, VestingConfig, WASM_BINARY,
ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix, SalpConfig, SalpLiteConfig, SessionConfig,
SystemConfig, TechnicalCommitteeConfig, TechnicalMembershipConfig, TokensConfig, VestingConfig,
WASM_BINARY,
};
use bifrost_runtime_common::dollar;
use cumulus_primitives_core::ParaId;
Expand Down Expand Up @@ -90,6 +91,8 @@ pub fn bifrost_genesis(
tokens: Vec<(AccountId, CurrencyId, Balance)>,
council_membership: Vec<AccountId>,
technical_committee_membership: Vec<AccountId>,
salp_multisig_key: AccountId,
salp_lite_multisig_key_salp: AccountId,
) -> GenesisConfig {
GenesisConfig {
system: SystemConfig {
Expand Down Expand Up @@ -138,6 +141,8 @@ pub fn bifrost_genesis(
vesting: VestingConfig { vesting: vestings },
tokens: TokensConfig { balances: tokens },
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(2) },
salp: SalpConfig { initial_multisig_account: Some(salp_multisig_key) },
salp_lite: SalpLiteConfig { initial_multisig_account: Some(salp_lite_multisig_key_salp) },
}
}

Expand Down Expand Up @@ -168,6 +173,12 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig {
let council_membership = vec![get_account_id_from_seed::<sr25519::Public>("Alice")];
let technical_committee_membership = vec![get_account_id_from_seed::<sr25519::Public>("Alice")];

let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();

let salp_lite_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();

bifrost_genesis(
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -179,6 +190,8 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig {
tokens,
council_membership,
technical_committee_membership,
salp_multisig,
salp_lite_multisig,
)
}

Expand Down Expand Up @@ -244,6 +257,10 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {

let council_membership = vec![get_account_id_from_seed::<sr25519::Public>("Alice")];
let technical_committee_membership = vec![get_account_id_from_seed::<sr25519::Public>("Alice")];
let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();
let salp_lite_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();

bifrost_genesis(
vec![
Expand All @@ -259,6 +276,8 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
tokens,
council_membership,
technical_committee_membership,
salp_multisig,
salp_lite_multisig,
)
}

Expand Down Expand Up @@ -358,6 +377,11 @@ fn bifrost_config_genesis(id: ParaId) -> GenesisConfig {
let vesting_configs: Vec<VestingConfig> =
config_from_json_files(exe_dir.join("res/genesis_config/vesting")).unwrap();

let salp_multisig: AccountId =
hex!["e4da05f08e89bf6c43260d96f26fffcfc7deae5b465da08669a9d008e64c2c63"].into();
let salp_lite_multisig: AccountId =
hex!["e4f78719c654cd8e8ac1375c447b7a80f9476cfe6505ea401c4b15bd6b967c93"].into();

use sp_core::sp_std::collections::btree_map::BTreeMap;
bifrost_genesis(
invulnerables,
Expand All @@ -367,6 +391,8 @@ fn bifrost_config_genesis(id: ParaId) -> GenesisConfig {
vec![], // tokens
vec![], // council membership
vec![], // technical committee membership
salp_multisig,
salp_lite_multisig,
)
}

Expand Down
Loading

0 comments on commit 5f964a1

Please sign in to comment.