Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add devnet start --default-settings #1517

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fill in more default values
  • Loading branch information
brady.ouren committed Aug 2, 2024
commit ad810e03b15c4cf22f50457a01d5ed1ef2d6e493
116 changes: 68 additions & 48 deletions components/clarinet-files/src/network_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,48 +332,57 @@ pub struct DevnetConfig {
}
impl Default for DevnetConfig {
fn default() -> Self {
let (miner_stx_address, miner_btc_address, miner_secret_key_hex) =
compute_default_addresses(DEFAULT_STACKS_MINER_MNEMONIC, DEFAULT_DERIVATION_PATH);

let (faucet_stx_address, faucet_btc_address, faucet_secret_key_hex) =
compute_default_addresses(DEFAULT_FAUCET_MNEMONIC, DEFAULT_DERIVATION_PATH);

let (subnet_stx_address, subnet_btc_address, subnet_secret_key_hex) =
compute_default_addresses(DEFAULT_SUBNET_MNEMONIC, DEFAULT_DERIVATION_PATH);

DevnetConfig {
name: "default".to_string(),
network_id: None, // Option<u16>,
orchestrator_ingestion_port: 30445,
network_id: None,
orchestrator_ingestion_port: 20445,
orchestrator_control_port: 20446,
bitcoin_node_p2p_port: 1,
bitcoin_node_rpc_port: 1,
bitcoin_node_p2p_port: 18444,
bitcoin_node_rpc_port: 18443,
bitcoin_node_username: "devnet".to_string(),
bitcoin_node_password: "devnet".to_string(),
stacks_node_p2p_port: 90,
stacks_node_rpc_port: 90,
stacks_node_wait_time_for_microblocks: 1,
stacks_node_first_attempt_time_ms: 1,
stacks_node_subsequent_attempt_time_ms: 1,
stacks_node_p2p_port: 18445,
stacks_node_rpc_port: 18445,
stacks_node_wait_time_for_microblocks: 50,
stacks_node_first_attempt_time_ms: 500,
stacks_node_subsequent_attempt_time_ms: 1_000,
stacks_node_events_observers: vec![],
stacks_node_env_vars: vec![],
stacks_api_port: 1,
stacks_api_port: 3999,
stacks_api_events_port: 1,
stacks_api_env_vars: vec![],
stacks_explorer_port: 1,
stacks_explorer_env_vars: vec![],
bitcoin_explorer_port: 1,
bitcoin_controller_block_time: 1,
bitcoin_controller_automining_disabled: false,
miner_stx_address: "".to_string(),
miner_secret_key_hex: "".to_string(),
miner_btc_address: "String".to_string(),
miner_mnemonic: "".to_string(),
miner_derivation_path: "".to_string(),
miner_coinbase_recipient: "".to_string(),
miner_wallet_name: "".to_string(),
faucet_stx_address: "".to_string(),
faucet_secret_key_hex: "".to_string(),
faucet_btc_address: "".to_string(),
faucet_mnemonic: "".to_string(),
faucet_derivation_path: "".to_string(),
working_dir: "".to_string(),
postgres_port: 1,
postgres_username: "".to_string(),
postgres_password: "".to_string(),
stacks_api_postgres_database: "stacks".to_string(),
subnet_api_postgres_database: "subnet".to_string(),
miner_stx_address: miner_stx_address.clone(),
miner_secret_key_hex,
miner_btc_address,
miner_mnemonic: DEFAULT_STACKS_MINER_MNEMONIC.to_string(),
miner_derivation_path: DEFAULT_DERIVATION_PATH.to_string(),
miner_coinbase_recipient: miner_stx_address.clone(),
miner_wallet_name: "default".to_string(),
faucet_stx_address,
faucet_secret_key_hex,
faucet_btc_address: faucet_btc_address.clone(),
faucet_mnemonic: DEFAULT_FAUCET_MNEMONIC.to_string(),
faucet_derivation_path: DEFAULT_DERIVATION_PATH.to_string(),
working_dir: ".".to_string(),
postgres_port: 5432,
postgres_username: "postgres".to_string(),
postgres_password: "postgres".to_string(),
stacks_api_postgres_database: "stacks_api".to_string(),
subnet_api_postgres_database: "subnet_api".to_string(),
pox_stacking_orders: vec![],
execute_script: vec![],
bitcoin_node_image_url: DEFAULT_BITCOIN_NODE_IMAGE.to_string(),
Expand All @@ -389,33 +398,33 @@ impl Default for DevnetConfig {
bind_containers_volumes: true,
enable_subnet_node: true,
subnet_node_image_url: DEFAULT_SUBNET_NODE_IMAGE.to_string(),
subnet_leader_stx_address: "".to_string(),
subnet_leader_secret_key_hex: "".to_string(),
subnet_leader_btc_address: "".to_string(),
subnet_leader_mnemonic: "".to_string(),
subnet_leader_derivation_path: "".to_string(),
subnet_node_p2p_port: 1,
subnet_node_rpc_port: 1,
subnet_events_ingestion_port: 1,
subnet_leader_stx_address: subnet_stx_address,
subnet_leader_secret_key_hex: subnet_secret_key_hex,
subnet_leader_btc_address: subnet_btc_address,
subnet_leader_mnemonic: DEFAULT_SUBNET_MNEMONIC.to_string(),
subnet_leader_derivation_path: DEFAULT_DERIVATION_PATH.to_string(),
subnet_node_p2p_port: 30444,
subnet_node_rpc_port: 30443,
subnet_events_ingestion_port: 30445,
subnet_node_events_observers: vec![],
subnet_contract_id: "".to_string(),
remapped_subnet_contract_id: "".to_string(),
subnet_node_env_vars: vec![],
subnet_api_image_url: DEFAULT_SUBNET_API_IMAGE.to_string(),
subnet_api_port: 1,
subnet_api_events_port: 1,
subnet_api_port: 13999,
subnet_api_events_port: 13700,
subnet_api_env_vars: vec![],
disable_subnet_api: true,
docker_host: "".to_string(),
components_host: "".to_string(),
epoch_2_0: 1,
epoch_2_05: 1,
epoch_2_1: 1,
epoch_2_2: 1,
epoch_2_3: 1,
epoch_2_4: 1,
epoch_2_5: 1,
epoch_3_0: 1,
docker_host: DEFAULT_DOCKER_SOCKET.to_string(),
components_host: "127.0.0.1".into(),
epoch_2_0: DEFAULT_EPOCH_2_0,
epoch_2_05: DEFAULT_EPOCH_2_05,
epoch_2_1: DEFAULT_EPOCH_2_1,
epoch_2_2: DEFAULT_EPOCH_2_2,
epoch_2_3: DEFAULT_EPOCH_2_3,
epoch_2_4: DEFAULT_EPOCH_2_4,
epoch_2_5: DEFAULT_EPOCH_2_5,
epoch_3_0: DEFAULT_EPOCH_3_0,
use_docker_gateway_routing: true,
docker_platform: "linux/amd64".to_string(),
}
Expand Down Expand Up @@ -1090,6 +1099,17 @@ impl NetworkManifest {
}
}

fn compute_default_addresses(
default_mnemonic: &str,
default_derivation_path: &str,
) -> (String, String, String) {
compute_addresses(
default_mnemonic,
default_derivation_path,
&(BitcoinNetwork::Regtest, StacksNetwork::Devnet),
)
}

pub fn compute_addresses(
mnemonic: &str,
derivation_path: &str,
Expand Down