Skip to content

Commit 66a65da

Browse files
authored
feat: Blueprint Manager Updates (#986)
1 parent c095438 commit 66a65da

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

node/src/blueprint_service.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ pub fn create_blueprint_manager_service<P: AsRef<Path>>(
1313
rpc_port: u16,
1414
data_dir: P,
1515
local_keystore: Arc<LocalKeystore>,
16+
test_mode: bool,
1617
) -> Result<BlueprintManagerHandle, ServiceError> {
18+
let data_dir = data_dir.as_ref().to_path_buf();
19+
let base_dir = data_dir.parent().ok_or_else(|| {
20+
ServiceError::Application("Failed to get parent directory for keystore".into())
21+
})?;
1722
let config = BlueprintManagerConfig {
1823
gadget_config: None,
19-
keystore_uri: data_dir.as_ref().display().to_string(),
20-
data_dir: data_dir.as_ref().to_path_buf(),
24+
keystore_uri: base_dir.join("keystore").to_path_buf().to_string_lossy().into(),
25+
data_dir,
2126
verbose: 2,
2227
pretty: false,
2328
instance_id: None,
24-
test_mode: false,
29+
test_mode,
2530
};
2631
let mut env = BlueprintEnvironment::default();
2732

node/src/manual_seal.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
527527
let config_data_path = config.data_path.clone();
528528
#[cfg(feature = "blueprint-manager")]
529529
let rpc_port = config.rpc_port;
530+
#[cfg(feature = "blueprint-manager")]
531+
let chain_type = config.chain_spec.chain_type();
530532
let params = sc_service::SpawnTasksParams {
531533
network: network.clone(),
532534
client: client.clone(),
@@ -625,10 +627,12 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
625627
#[cfg(feature = "blueprint-manager")]
626628
{
627629
log::info!("Blueprint Manager is enabled.");
630+
let test_mode = chain_type == ChainType::Development || chain_type == ChainType::Local;
628631
let bp_mngr = crate::blueprint_service::create_blueprint_manager_service(
629632
rpc_port,
630633
config_data_path.join("blueprints"),
631634
keystore_container.local_keystore(),
635+
test_mode,
632636
)?;
633637

634638
task_manager
@@ -689,10 +693,12 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
689693
#[cfg(feature = "blueprint-manager")]
690694
{
691695
log::info!("Blueprint Manager is enabled.");
696+
let test_mode = chain_type == ChainType::Development || chain_type == ChainType::Local;
692697
let bp_mngr = crate::blueprint_service::create_blueprint_manager_service(
693698
rpc_port,
694699
config_data_path.join("blueprints"),
695700
keystore_container.local_keystore(),
701+
test_mode,
696702
)?;
697703

698704
task_manager

node/src/service.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
530530
let config_data_path = config.data_path.clone();
531531
#[cfg(feature = "blueprint-manager")]
532532
let rpc_port = config.rpc_port;
533+
#[cfg(feature = "blueprint-manager")]
534+
let chain_type = config.chain_spec.chain_type();
533535
let params = sc_service::SpawnTasksParams {
534536
network: network.clone(),
535537
client: client.clone(),
@@ -653,10 +655,12 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
653655

654656
#[cfg(feature = "blueprint-manager")]
655657
{
658+
let test_mode = chain_type == ChainType::Development || chain_type == ChainType::Local;
656659
let bp_mngr = crate::blueprint_service::create_blueprint_manager_service(
657660
rpc_port,
658661
config_data_path.join("blueprints"),
659662
keystore_container.local_keystore(),
663+
test_mode,
660664
)?;
661665

662666
task_manager

0 commit comments

Comments
 (0)