Skip to content

Commit af78d2d

Browse files
authored
fix: default devnet stacker (#1602)
1 parent 0bdb379 commit af78d2d

File tree

3 files changed

+47
-13
lines changed

3 files changed

+47
-13
lines changed

components/clarinet-cli/src/generate/project.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use clarinet_files::{
22
DEFAULT_BITCOIN_EXPLORER_IMAGE, DEFAULT_BITCOIN_NODE_IMAGE, DEFAULT_DERIVATION_PATH,
33
DEFAULT_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_EPOCH_2_2, DEFAULT_EPOCH_2_3,
44
DEFAULT_EPOCH_2_4, DEFAULT_EPOCH_2_5, DEFAULT_EPOCH_3_0, DEFAULT_FAUCET_MNEMONIC,
5-
DEFAULT_POSTGRES_IMAGE, DEFAULT_STACKS_API_IMAGE, DEFAULT_STACKS_EXPLORER_IMAGE,
6-
DEFAULT_STACKS_MINER_MNEMONIC, DEFAULT_STACKS_NODE_IMAGE, DEFAULT_STACKS_SIGNER_IMAGE,
7-
DEFAULT_SUBNET_API_IMAGE, DEFAULT_SUBNET_CONTRACT_ID, DEFAULT_SUBNET_MNEMONIC,
8-
DEFAULT_SUBNET_NODE_IMAGE,
5+
DEFAULT_POSTGRES_IMAGE, DEFAULT_STACKER_MNEMONIC, DEFAULT_STACKS_API_IMAGE,
6+
DEFAULT_STACKS_EXPLORER_IMAGE, DEFAULT_STACKS_MINER_MNEMONIC, DEFAULT_STACKS_NODE_IMAGE,
7+
DEFAULT_STACKS_SIGNER_IMAGE, DEFAULT_SUBNET_API_IMAGE, DEFAULT_SUBNET_CONTRACT_ID,
8+
DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE,
99
};
1010

1111
use super::changes::{Changes, DirectoryCreation, FileCreation};
@@ -308,6 +308,8 @@ disable_stacks_api = false
308308
# miner_derivation_path = "{default_derivation_path}"
309309
# faucet_mnemonic = "{default_stacks_faucet_mnemonic}"
310310
# faucet_derivation_path = "{default_derivation_path}"
311+
# stacker_mnemonic = "{default_stacks_stacker_mnemonic}"
312+
# stacker_derivation_path = "{default_derivation_path}"
311313
# orchestrator_port = 20445
312314
# bitcoin_node_p2p_port = 18444
313315
# bitcoin_node_rpc_port = 18443
@@ -392,6 +394,7 @@ btc_address = "mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7"
392394
default_subnet_api_image = DEFAULT_SUBNET_API_IMAGE,
393395
default_stacks_miner_mnemonic = DEFAULT_STACKS_MINER_MNEMONIC,
394396
default_stacks_faucet_mnemonic = DEFAULT_FAUCET_MNEMONIC,
397+
default_stacks_stacker_mnemonic = DEFAULT_STACKER_MNEMONIC,
395398
);
396399
let name = "settings/Devnet.toml".into();
397400
self.changes

components/clarinet-files/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub use network_manifest::{
2222
DEFAULT_BITCOIN_NODE_IMAGE, DEFAULT_DERIVATION_PATH, DEFAULT_DOCKER_PLATFORM,
2323
DEFAULT_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_EPOCH_2_2, DEFAULT_EPOCH_2_3,
2424
DEFAULT_EPOCH_2_4, DEFAULT_EPOCH_2_5, DEFAULT_EPOCH_3_0, DEFAULT_FAUCET_MNEMONIC,
25-
DEFAULT_FIRST_BURN_HEADER_HEIGHT, DEFAULT_POSTGRES_IMAGE, DEFAULT_STACKS_API_IMAGE,
26-
DEFAULT_STACKS_EXPLORER_IMAGE, DEFAULT_STACKS_MINER_MNEMONIC, DEFAULT_STACKS_NODE_IMAGE,
27-
DEFAULT_STACKS_SIGNER_IMAGE, DEFAULT_SUBNET_API_IMAGE, DEFAULT_SUBNET_CONTRACT_ID,
28-
DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE,
25+
DEFAULT_FIRST_BURN_HEADER_HEIGHT, DEFAULT_POSTGRES_IMAGE, DEFAULT_STACKER_MNEMONIC,
26+
DEFAULT_STACKS_API_IMAGE, DEFAULT_STACKS_EXPLORER_IMAGE, DEFAULT_STACKS_MINER_MNEMONIC,
27+
DEFAULT_STACKS_NODE_IMAGE, DEFAULT_STACKS_SIGNER_IMAGE, DEFAULT_SUBNET_API_IMAGE,
28+
DEFAULT_SUBNET_CONTRACT_ID, DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE,
2929
};
3030
pub use project_manifest::{
3131
ProjectManifest, ProjectManifestFile, RequirementConfig, INVALID_CLARITY_VERSION,

components/clarinet-files/src/network_manifest.rs

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub const DEFAULT_SUBNET_CONTRACT_ID: &str =
2929
"ST173JK7NZBA4BS05ZRATQH1K89YJMTGEH1Z5J52E.subnet-v3-0-1";
3030
pub const DEFAULT_STACKS_MINER_MNEMONIC: &str = "fragile loan twenty basic net assault jazz absorb diet talk art shock innocent float punch travel gadget embrace caught blossom hockey surround initial reduce";
3131
pub const DEFAULT_FAUCET_MNEMONIC: &str = "shadow private easily thought say logic fault paddle word top book during ignore notable orange flight clock image wealth health outside kitten belt reform";
32+
pub const DEFAULT_STACKER_MNEMONIC: &str = "empty lens any direct brother then drop fury rule pole win claim scissors list rescue horn rent inform relief jump sword weekend half legend";
3233
pub const DEFAULT_SUBNET_MNEMONIC: &str = "twice kind fence tip hidden tilt action fragile skin nothing glory cousin green tomorrow spring wrist shed math olympic multiply hip blue scout claw";
3334
#[cfg(unix)]
3435
pub const DEFAULT_DOCKER_SOCKET: &str = "unix:///var/run/docker.sock";
@@ -139,6 +140,8 @@ pub struct DevnetConfigFile {
139140
pub miner_wallet_name: Option<String>,
140141
pub faucet_mnemonic: Option<String>,
141142
pub faucet_derivation_path: Option<String>,
143+
pub stacker_mnemonic: Option<String>,
144+
pub stacker_derivation_path: Option<String>,
142145
pub bitcoin_controller_block_time: Option<u32>,
143146
pub bitcoin_controller_automining_disabled: Option<bool>,
144147
pub pre_nakamoto_mock_signing: Option<bool>,
@@ -305,6 +308,8 @@ pub struct DevnetConfig {
305308
pub faucet_btc_address: String,
306309
pub faucet_mnemonic: String,
307310
pub faucet_derivation_path: String,
311+
pub stacker_mnemonic: String,
312+
pub stacker_derivation_path: String,
308313
pub pre_nakamoto_mock_signing: bool,
309314
pub working_dir: String,
310315
pub postgres_port: u16,
@@ -840,15 +845,39 @@ impl NetworkManifest {
840845
));
841846
}
842847

848+
let stacker_mnemonic = devnet_config
849+
.stacker_mnemonic
850+
.take()
851+
.unwrap_or(DEFAULT_STACKER_MNEMONIC.to_string());
852+
let stacker_derivation_path = devnet_config
853+
.stacker_derivation_path
854+
.take()
855+
.unwrap_or(DEFAULT_DERIVATION_PATH.to_string());
856+
let (stx_address, btc_address, _) =
857+
compute_addresses(&stacker_mnemonic, &stacker_derivation_path, networks);
858+
859+
accounts.insert(
860+
"stacker".to_string(),
861+
AccountConfig {
862+
label: "stacker".to_string(),
863+
mnemonic: stacker_mnemonic.clone(),
864+
derivation: stacker_derivation_path.clone(),
865+
balance: 100_000_000_000_000,
866+
stx_address,
867+
btc_address,
868+
is_mainnet: false,
869+
},
870+
);
871+
843872
let mut stacking_orders = vec![];
844873
let mut add_default_stacking_order = true;
845874
// for stacking orders, we validate that wallet names match one of the provided accounts
846875
if let Some(mut val) = devnet_config.pox_stacking_orders {
847876
for (i, stacking_order) in val.iter().enumerate() {
848877
let wallet_name = &stacking_order.wallet;
849878

850-
// if the project already set a stacking order for the deployer, do not override it
851-
if wallet_name == "deployer" {
879+
// if the project already set a stacking order for the stacker, do not override it
880+
if wallet_name == "stacker" {
852881
add_default_stacking_order = false;
853882
}
854883

@@ -868,14 +897,14 @@ impl NetworkManifest {
868897
if add_default_stacking_order {
869898
if let Some((_, account_config)) = accounts
870899
.iter()
871-
.find(|(account_name, _)| *account_name == "deployer")
900+
.find(|(account_name, _)| *account_name == "stacker")
872901
{
873902
stacking_orders.push(PoxStackingOrder {
874903
auto_extend: Some(true),
875904
duration: 10,
876905
start_at_cycle: 1,
877-
wallet: "deployer".into(),
878-
slots: 6,
906+
wallet: "stacker".into(),
907+
slots: 10,
879908
btc_address: account_config.btc_address.clone(),
880909
})
881910
}
@@ -935,6 +964,8 @@ impl NetworkManifest {
935964
faucet_mnemonic,
936965
faucet_secret_key_hex,
937966
faucet_derivation_path,
967+
stacker_mnemonic,
968+
stacker_derivation_path,
938969
working_dir: devnet_config
939970
.working_dir
940971
.take()

0 commit comments

Comments
 (0)