Skip to content

Commit

Permalink
Add 3356
Browse files Browse the repository at this point in the history
  • Loading branch information
hqwangningbo committed Nov 21, 2023
1 parent 2b5b00e commit b30d059
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 27 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 39 additions & 27 deletions node/service/src/chain_spec/bifrost_polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
use bifrost_polkadot_runtime::{
constants::currency::DOLLARS, AccountId, AssetRegistryConfig, Balance, BalancesConfig,
BlockNumber, CollatorSelectionConfig, CouncilMembershipConfig, GenesisConfig, IndicesConfig,
ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix, SalpConfig, SessionConfig, SystemConfig,
TechnicalMembershipConfig, TokensConfig, VestingConfig, WASM_BINARY,
ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix, SalpConfig, SessionConfig, SudoConfig,
SystemConfig, TechnicalMembershipConfig, TokensConfig, VestingConfig, WASM_BINARY,
};
use bifrost_runtime_common::AuraId;
use cumulus_primitives_core::ParaId;
Expand All @@ -46,7 +46,7 @@ pub fn ENDOWMENT() -> u128 {
1_000_000 * DOLLARS
}

pub const PARA_ID: u32 = 2030;
pub const PARA_ID: u32 = 3356;

fn bifrost_polkadot_properties() -> Properties {
let mut properties = sc_chain_spec::Properties::new();
Expand Down Expand Up @@ -88,6 +88,11 @@ pub fn bifrost_polkadot_genesis(
system: SystemConfig {
code: WASM_BINARY.expect("WASM binary was not build, please build it!").to_vec(),
},
sudo: SudoConfig {
key: Some(
hex!["ae80aa9d42b30abf2c67510ed2410e76f749329606d1a79354b772dc73522d35"].into(),
),
},
balances: BalancesConfig { balances },
indices: IndicesConfig { indices: vec![] },
democracy: Default::default(),
Expand Down Expand Up @@ -191,21 +196,23 @@ pub fn development_config() -> Result<ChainSpec, String> {
}

fn local_config_genesis(id: ParaId) -> GenesisConfig {
let endowed_accounts = vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
whitelisted_caller(), // Benchmarking whitelist_account
account("bechmarking_account_1", 0, 0),
let endowed_accounts: Vec<AccountId> = vec![
// get_account_id_from_seed::<sr25519::Public>("Alice"),
// get_account_id_from_seed::<sr25519::Public>("Bob"),
// get_account_id_from_seed::<sr25519::Public>("Charlie"),
// get_account_id_from_seed::<sr25519::Public>("Dave"),
// get_account_id_from_seed::<sr25519::Public>("Eve"),
// get_account_id_from_seed::<sr25519::Public>("Ferdie"),
// get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
// get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
// get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
// get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
// get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
// get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
// whitelisted_caller(), // Benchmarking whitelist_account
// account("bechmarking_account_1", 0, 0),
hex!["ae80aa9d42b30abf2c67510ed2410e76f749329606d1a79354b772dc73522d35"].into(),
hex!["7ae247b6328d6cb9d11d49d76766568070ad56bb75ba1aa42c7b7df7cf703765"].into()
];
let balances = endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT())).collect();
let vestings = endowed_accounts
Expand All @@ -217,10 +224,10 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
.iter()
.flat_map(|x| vec![(x.clone(), Token2(DOT_TOKEN_ID), ENDOWMENT() * 4_000_000)])
.collect();
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 council_membership = vec![];
let technical_committee_membership = vec![];
let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();
hex!["ae80aa9d42b30abf2c67510ed2410e76f749329606d1a79354b772dc73522d35"].into();
let currency = vec![
(Native(TokenSymbol::BNC), DOLLARS / 100, None),
(
Expand All @@ -234,10 +241,15 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig {
bifrost_polkadot_genesis(
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_from_seed::<AuraId>("Alice"),
hex!["ae80aa9d42b30abf2c67510ed2410e76f749329606d1a79354b772dc73522d35"].into(),
hex!["ae80aa9d42b30abf2c67510ed2410e76f749329606d1a79354b772dc73522d35"]
.unchecked_into(),
),
(
hex!["7ae247b6328d6cb9d11d49d76766568070ad56bb75ba1aa42c7b7df7cf703765"].into(),
hex!["7ae247b6328d6cb9d11d49d76766568070ad56bb75ba1aa42c7b7df7cf703765"]
.unchecked_into(),
),
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AuraId>("Bob")),
],
balances,
vestings,
Expand All @@ -254,14 +266,14 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::from_genesis(
"Bifrost Polkadot Local Testnet",
"bifrost_polkadot_local_testnet",
ChainType::Local,
ChainType::Live,
move || local_config_genesis(PARA_ID.into()),
vec![],
None,
TelemetryEndpoints::new(vec![(TELEMETRY_URL.into(), 0)]).ok(),
Some(DEFAULT_PROTOCOL_ID),
None,
Some(bifrost_polkadot_properties()),
RelayExtensions { relay_chain: "polkadot-local".into(), para_id: PARA_ID },
RelayExtensions { relay_chain: "polkadot".into(), para_id: PARA_ID },
))
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/bifrost-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/parityt
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
pallet-whitelist = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }

# Cumulus dependencies
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42", default-features = false }
Expand Down Expand Up @@ -197,6 +198,7 @@ std = [
"pallet-session/std",
"pallet-vesting/std",
"pallet-whitelist/std",
"pallet-sudo/std",
"bifrost-currencies/std",
"orml-traits/std",
"orml-tokens/std",
Expand Down
6 changes: 6 additions & 0 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,11 @@ parameter_types! {
pub const VoteWeightMultiplier: Balance = 3;
}

impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
}

impl bifrost_ve_minting::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MultiCurrency = Currencies;
Expand Down Expand Up @@ -1596,6 +1601,7 @@ construct_runtime! {
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 22,
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 23,
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24,
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>} = 25,

// Governance stuff
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
Expand Down

0 comments on commit b30d059

Please sign in to comment.