Skip to content

Commit

Permalink
feat: start mainnet deployment in shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sander2 committed Aug 30, 2021
1 parent 6aae818 commit 5996a00
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/security/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub mod pallet {

#[pallet::genesis_config]
pub struct GenesisConfig {
initial_status: StatusCode,
pub initial_status: StatusCode,
}

#[cfg(feature = "std")]
Expand Down
1 change: 1 addition & 0 deletions parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub use sp_runtime::{Perbill, Permill};
// interBTC exports
pub use btc_relay::{bitcoin, Call as RelayCall, TARGET_SPACING};
pub use module_oracle_rpc_runtime_api::BalanceWrapper;
pub use security::StatusCode;

pub use primitives::{
self, AccountId, Balance, BlockNumber, CurrencyId, Hash, Moment, Nonce, Signature, SignedFixedPoint, SignedInner,
Expand Down
20 changes: 18 additions & 2 deletions parachain/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use interbtc_runtime::{
AccountId, AuraConfig, BTCRelayConfig, Balance, CurrencyId, FeeConfig, GenesisConfig, IssueConfig,
NominationConfig, OracleConfig, ParachainInfoConfig, RedeemConfig, RefundConfig, ReplaceConfig, Signature,
SudoConfig, SystemConfig, TokensConfig, VaultRegistryConfig, BITCOIN_BLOCK_SPACING, DAYS, KSM, WASM_BINARY,
NominationConfig, OracleConfig, ParachainInfoConfig, RedeemConfig, RefundConfig, ReplaceConfig, SecurityConfig,
Signature, StatusCode, SudoConfig, SystemConfig, TokensConfig, VaultRegistryConfig, BITCOIN_BLOCK_SPACING, DAYS,
KSM, WASM_BINARY,
};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -109,6 +110,7 @@ pub fn local_config(id: ParaId) -> ChainSpec {
)],
id,
DEFAULT_BITCOIN_CONFIRMATIONS,
false,
)
},
vec![],
Expand Down Expand Up @@ -161,6 +163,7 @@ pub fn development_config(id: ParaId) -> ChainSpec {
],
id,
DEFAULT_BITCOIN_CONFIRMATIONS,
false,
)
},
Vec::new(),
Expand Down Expand Up @@ -203,6 +206,7 @@ pub fn rococo_testnet_config(id: ParaId) -> ChainSpec {
],
id,
DEFAULT_BITCOIN_CONFIRMATIONS,
false,
)
},
Vec::new(),
Expand Down Expand Up @@ -263,6 +267,7 @@ pub fn westend_testnet_config(id: ParaId) -> ChainSpec {
],
id,
DEFAULT_BITCOIN_CONFIRMATIONS,
false,
)
},
Vec::new(),
Expand All @@ -283,6 +288,7 @@ fn testnet_genesis(
authorized_oracles: Vec<(AccountId, Vec<u8>)>,
id: ParaId,
bitcoin_confirmations: u32,
start_shutdown: bool,
) -> GenesisConfig {
GenesisConfig {
system: SystemConfig {
Expand All @@ -297,6 +303,13 @@ fn testnet_genesis(
aura_ext: Default::default(),
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id },
security: SecurityConfig {
initial_status: if start_shutdown {
StatusCode::Shutdown
} else {
StatusCode::Error
},
},
sudo: SudoConfig {
// Assign network admin rights.
key: root_key.clone(),
Expand Down Expand Up @@ -491,6 +504,9 @@ fn mainnet_genesis(
aura_ext: Default::default(),
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id },
security: SecurityConfig {
initial_status: StatusCode::Shutdown,
},
sudo: SudoConfig {
// Assign network admin rights.
key: root_key.clone(),
Expand Down
1 change: 1 addition & 0 deletions standalone/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub use sp_runtime::{Perbill, Permill};
// interBTC exports
pub use btc_relay::{bitcoin, Call as RelayCall, TARGET_SPACING};
pub use module_oracle_rpc_runtime_api::BalanceWrapper;
pub use security::StatusCode;

use currency::Amount;
pub use primitives::{
Expand Down
15 changes: 13 additions & 2 deletions standalone/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use bitcoin::utils::{virtual_transaction_size, InputType, TransactionInputMetada
use hex_literal::hex;
use interbtc_runtime::{
AccountId, AuraConfig, BTCRelayConfig, CurrencyId, FeeConfig, GenesisConfig, GrandpaConfig, IssueConfig,
NominationConfig, OracleConfig, RedeemConfig, RefundConfig, ReplaceConfig, Signature, SudoConfig, SystemConfig,
TokensConfig, VaultRegistryConfig, BITCOIN_BLOCK_SPACING, DAYS, DOT, WASM_BINARY,
NominationConfig, OracleConfig, RedeemConfig, RefundConfig, ReplaceConfig, SecurityConfig, Signature, StatusCode,
SudoConfig, SystemConfig, TokensConfig, VaultRegistryConfig, BITCOIN_BLOCK_SPACING, DAYS, DOT, WASM_BINARY,
};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::crypto::UncheckedInto;
Expand Down Expand Up @@ -88,6 +88,7 @@ pub fn local_config() -> ChainSpec {
"Bob".as_bytes().to_vec(),
)],
0,
false,
)
},
vec![],
Expand Down Expand Up @@ -151,6 +152,7 @@ pub fn beta_testnet_config() -> ChainSpec {
),
],
1,
false,
)
},
Vec::new(),
Expand Down Expand Up @@ -199,6 +201,7 @@ pub fn development_config() -> ChainSpec {
),
],
1,
false,
)
},
Vec::new(),
Expand All @@ -215,6 +218,7 @@ fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
authorized_oracles: Vec<(AccountId, Vec<u8>)>,
bitcoin_confirmations: u32,
start_shutdown: bool,
) -> GenesisConfig {
GenesisConfig {
system: SystemConfig {
Expand All @@ -229,6 +233,13 @@ fn testnet_genesis(
grandpa: GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
},
security: SecurityConfig {
initial_status: if start_shutdown {
StatusCode::Shutdown
} else {
StatusCode::Error
},
},
sudo: SudoConfig {
// Assign network admin rights.
key: root_key.clone(),
Expand Down

0 comments on commit 5996a00

Please sign in to comment.