diff --git a/Cargo.lock b/Cargo.lock index cb453229e..1b7ed295c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -670,8 +670,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chainhook-sdk" -version = "0.12.7" -source = "git+https://github.com/hirosystems/chainhook.git?branch=feat/update-pox-default-settings#5490923ea2a208e98b6bda20b5c913dd0c6194a6" +version = "0.12.8" +source = "git+https://github.com/hirosystems/chainhook.git?branch=feat/update-pox-default-settings#ec6fa6ec1ed020fc24be56be1671f3aed3bdd54c" dependencies = [ "base58 0.2.0", "base64 0.21.7", @@ -697,7 +697,7 @@ dependencies = [ "serde-hex", "serde_derive", "serde_json", - "stacks-codec 2.4.1", + "stacks-codec 2.5.1 (git+https://github.com/hirosystems/clarinet.git)", "threadpool", "tokio", ] @@ -705,7 +705,7 @@ dependencies = [ [[package]] name = "chainhook-types" version = "1.3.7" -source = "git+https://github.com/hirosystems/chainhook.git?branch=feat/update-pox-default-settings#5490923ea2a208e98b6bda20b5c913dd0c6194a6" +source = "git+https://github.com/hirosystems/chainhook.git?branch=feat/update-pox-default-settings#ec6fa6ec1ed020fc24be56be1671f3aed3bdd54c" dependencies = [ "hex", "schemars", @@ -798,7 +798,7 @@ dependencies = [ "clarity", "lazy_static", "regex", - "stacks-common 0.0.2", + "stacks-common", "walrus", "wasmtime", "wat", @@ -956,7 +956,7 @@ dependencies = [ "serde_stacker", "sha2-asm 0.5.5", "slog", - "stacks-common 0.0.2", + "stacks-common", "wasmtime", ] @@ -1028,29 +1028,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "clarity-vm" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0af203c4eea9bb753ff2798c3bcf9f3fd8ea7a24bde7222d96f82fd9beb6d165" -dependencies = [ - "hashbrown 0.14.3", - "integer-sqrt", - "lazy_static", - "rand 0.8.5", - "rand_chacha 0.3.1", - "regex", - "rusqlite", - "serde", - "serde_derive", - "serde_json", - "serde_stacker", - "sha2-asm 0.5.5", - "slog", - "stacks-common 0.0.3", - "wasmtime", -] - [[package]] name = "clipboard-win" version = "4.5.0" @@ -2892,7 +2869,7 @@ dependencies = [ "serde_derive", "serde_stacker", "sha2 0.10.6", - "stacks-common 0.0.2", + "stacks-common", ] [[package]] @@ -3613,7 +3590,7 @@ source = "git+https://github.com/stacks-network/stacks-core.git?branch=feat/clar dependencies = [ "clarity", "slog", - "stacks-common 0.0.2", + "stacks-common", ] [[package]] @@ -4865,11 +4842,9 @@ dependencies = [ [[package]] name = "stacks-codec" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5791855bf9de767f55042f1a034a2575373c6433b0965f1efac14e7215f71b" +version = "2.5.1" dependencies = [ - "clarity-vm", + "clarity", "serde", "wsts", ] @@ -4877,6 +4852,7 @@ dependencies = [ [[package]] name = "stacks-codec" version = "2.5.1" +source = "git+https://github.com/hirosystems/clarinet.git#cc0577e6514065cd3d451d010c0ad8babbc6932e" dependencies = [ "clarity", "serde", @@ -4915,37 +4891,6 @@ dependencies = [ "wsts", ] -[[package]] -name = "stacks-common" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c78cb37406e4b6a269f0b6aa0ee222922c9d30c263a43af7e005169e20edf12b" -dependencies = [ - "chrono", - "curve25519-dalek 2.0.0", - "ed25519-dalek", - "hashbrown 0.14.3", - "lazy_static", - "libc", - "nix 0.23.2", - "percent-encoding", - "rand 0.8.5", - "ripemd", - "rusqlite", - "secp256k1 0.24.3", - "serde", - "serde_derive", - "serde_json", - "sha2 0.10.6", - "sha3", - "slog", - "slog-json", - "slog-term", - "time", - "winapi 0.3.9", - "wsts", -] - [[package]] name = "stacks-devnet-js" version = "2.5.1" @@ -5051,7 +4996,7 @@ dependencies = [ "siphasher", "slog", "slog-term", - "stacks-common 0.0.2", + "stacks-common", "tikv-jemallocator", "time", "url", diff --git a/components/clarinet-cli/src/generate/project.rs b/components/clarinet-cli/src/generate/project.rs index 8d88684b2..92a4c1850 100644 --- a/components/clarinet-cli/src/generate/project.rs +++ b/components/clarinet-cli/src/generate/project.rs @@ -3,8 +3,8 @@ use clarinet_files::{ DEFAULT_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_EPOCH_2_2, DEFAULT_EPOCH_2_3, DEFAULT_EPOCH_2_4, DEFAULT_EPOCH_2_5, DEFAULT_FAUCET_MNEMONIC, DEFAULT_POSTGRES_IMAGE, DEFAULT_STACKS_API_IMAGE, DEFAULT_STACKS_EXPLORER_IMAGE, DEFAULT_STACKS_MINER_MNEMONIC, - DEFAULT_STACKS_NODE_IMAGE, DEFAULT_SUBNET_API_IMAGE, DEFAULT_SUBNET_CONTRACT_ID, - DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE, + DEFAULT_STACKS_NODE_IMAGE, DEFAULT_STACKS_SIGNER_IMAGE, DEFAULT_SUBNET_API_IMAGE, + DEFAULT_SUBNET_CONTRACT_ID, DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE, }; use super::changes::{Changes, DirectoryCreation, FileCreation}; @@ -386,6 +386,7 @@ disable_stacks_api = false # postgres_database = "postgres" # bitcoin_node_image_url = "{default_bitcoin_node_image}" # stacks_node_image_url = "{default_stacks_node_image}" +# stacks_signer_image_url = "{default_stacks_signer_image}" # stacks_api_image_url = "{default_stacks_api_image}" # stacks_explorer_image_url = "{default_stacks_explorer_image}" # bitcoin_explorer_image_url = "{default_bitcoin_explorer_image}" @@ -437,6 +438,7 @@ btc_address = "mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7" default_derivation_path = DEFAULT_DERIVATION_PATH, default_bitcoin_node_image = DEFAULT_BITCOIN_NODE_IMAGE, default_stacks_node_image = DEFAULT_STACKS_NODE_IMAGE, + default_stacks_signer_image = DEFAULT_STACKS_SIGNER_IMAGE, default_bitcoin_explorer_image = DEFAULT_BITCOIN_EXPLORER_IMAGE, default_stacks_api_image = DEFAULT_STACKS_API_IMAGE, default_stacks_explorer_image = DEFAULT_STACKS_EXPLORER_IMAGE, diff --git a/components/clarinet-files/src/lib.rs b/components/clarinet-files/src/lib.rs index 7a114dae7..87d95fbea 100644 --- a/components/clarinet-files/src/lib.rs +++ b/components/clarinet-files/src/lib.rs @@ -24,9 +24,9 @@ pub use network_manifest::{ DEFAULT_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_EPOCH_2_2, DEFAULT_EPOCH_2_3, DEFAULT_EPOCH_2_4, DEFAULT_EPOCH_2_5, DEFAULT_EPOCH_3_0, DEFAULT_FAUCET_MNEMONIC, DEFAULT_FIRST_BURN_HEADER_HEIGHT, DEFAULT_POSTGRES_IMAGE, DEFAULT_STACKS_API_IMAGE, - DEFAULT_STACKS_API_IMAGE_NAKA, DEFAULT_STACKS_EXPLORER_IMAGE, DEFAULT_STACKS_MINER_MNEMONIC, - DEFAULT_STACKS_NODE_IMAGE, DEFAULT_STACKS_NODE_IMAGE_NAKA, DEFAULT_SUBNET_API_IMAGE, - DEFAULT_SUBNET_CONTRACT_ID, DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE, + DEFAULT_STACKS_EXPLORER_IMAGE, DEFAULT_STACKS_MINER_MNEMONIC, DEFAULT_STACKS_NODE_IMAGE, + DEFAULT_STACKS_SIGNER_IMAGE, DEFAULT_SUBNET_API_IMAGE, DEFAULT_SUBNET_CONTRACT_ID, + DEFAULT_SUBNET_MNEMONIC, DEFAULT_SUBNET_NODE_IMAGE, }; pub use project_manifest::{ ProjectManifest, ProjectManifestFile, RequirementConfig, INVALID_CLARITY_VERSION, diff --git a/components/clarinet-files/src/network_manifest.rs b/components/clarinet-files/src/network_manifest.rs index 9b8295840..cfe998e51 100644 --- a/components/clarinet-files/src/network_manifest.rs +++ b/components/clarinet-files/src/network_manifest.rs @@ -14,19 +14,16 @@ use toml::value::Value; pub const DEFAULT_DERIVATION_PATH: &str = "m/44'/5757'/0'/0/0"; -pub const DEFAULT_STACKS_NODE_IMAGE: &str = "quay.io/hirosystems/stacks-node:devnet-2.4.0.0.0"; -pub const DEFAULT_STACKS_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:latest"; -// Nakamoto images overrides -pub const DEFAULT_STACKS_NODE_IMAGE_NAKA: &str = - "quay.io/hirosystems/stacks-node:devnet-with-signer-2.5"; -pub const DEFAULT_STACKS_API_IMAGE_NAKA: &str = "hirosystems/stacks-blockchain-api:7.10.0-beta.2"; +pub const DEFAULT_STACKS_NODE_IMAGE: &str = "quay.io/hirosystems/stacks-node:devnet-2.5"; +pub const DEFAULT_STACKS_SIGNER_IMAGE: &str = "quay.io/hirosystems/stacks-signer:devnet-2.5"; +pub const DEFAULT_STACKS_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:master"; pub const DEFAULT_BITCOIN_NODE_IMAGE: &str = "quay.io/hirosystems/bitcoind:26.0"; pub const DEFAULT_BITCOIN_EXPLORER_IMAGE: &str = "quay.io/hirosystems/bitcoin-explorer:devnet"; pub const DEFAULT_STACKS_EXPLORER_IMAGE: &str = "hirosystems/explorer:latest"; pub const DEFAULT_POSTGRES_IMAGE: &str = "postgres:alpine"; pub const DEFAULT_SUBNET_NODE_IMAGE: &str = "hirosystems/stacks-subnets:0.8.1"; -pub const DEFAULT_SUBNET_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:latest"; +pub const DEFAULT_SUBNET_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:master"; pub const DEFAULT_SUBNET_CONTRACT_ID: &str = "ST173JK7NZBA4BS05ZRATQH1K89YJMTGEH1Z5J52E.subnet-v3-0-1"; 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"; @@ -151,7 +148,6 @@ pub struct DevnetConfigFile { pub epoch_3_0: Option, pub use_docker_gateway_routing: Option, pub docker_platform: Option, - pub use_nakamoto: Option, } #[derive(Serialize, Deserialize, Debug)] @@ -317,7 +313,6 @@ pub struct DevnetConfig { pub epoch_3_0: u64, pub use_docker_gateway_routing: bool, pub docker_platform: String, - pub use_nakamoto: bool, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -887,34 +882,18 @@ impl NetworkManifest { .bitcoin_node_image_url .take() .unwrap_or(DEFAULT_BITCOIN_NODE_IMAGE.to_string()), - stacks_node_image_url: devnet_config.stacks_node_image_url.take().unwrap_or_else( - || { - if devnet_config.use_nakamoto.unwrap_or(false) { - DEFAULT_STACKS_NODE_IMAGE_NAKA.to_string() - } else { - DEFAULT_STACKS_NODE_IMAGE.to_string() - } - }, - ), + stacks_node_image_url: devnet_config + .stacks_node_image_url + .take() + .unwrap_or(DEFAULT_STACKS_NODE_IMAGE.to_string()), stacks_signer_image_url: devnet_config .stacks_signer_image_url .take() - .unwrap_or_else(|| { - if devnet_config.use_nakamoto.unwrap_or(false) { - DEFAULT_STACKS_NODE_IMAGE_NAKA.to_string() - } else { - DEFAULT_STACKS_NODE_IMAGE.to_string() - } - }), - stacks_api_image_url: devnet_config.stacks_api_image_url.take().unwrap_or_else( - || { - if devnet_config.use_nakamoto.unwrap_or(false) { - DEFAULT_STACKS_API_IMAGE_NAKA.to_string() - } else { - DEFAULT_STACKS_API_IMAGE.to_string() - } - }, - ), + .unwrap_or(DEFAULT_STACKS_SIGNER_IMAGE.to_string()), + stacks_api_image_url: devnet_config + .stacks_api_image_url + .take() + .unwrap_or(DEFAULT_STACKS_API_IMAGE.to_string()), postgres_image_url: devnet_config .postgres_image_url .take() @@ -986,7 +965,6 @@ impl NetworkManifest { docker_platform: devnet_config .docker_platform .unwrap_or(DEFAULT_DOCKER_PLATFORM.to_string()), - use_nakamoto: devnet_config.use_nakamoto.unwrap_or(false), }; Some(config) } else { diff --git a/components/clarity-repl/src/repl/boot/pox-4.clar b/components/clarity-repl/src/repl/boot/pox-4.clar index 9824a7193..a132c13a7 100644 --- a/components/clarity-repl/src/repl/boot/pox-4.clar +++ b/components/clarity-repl/src/repl/boot/pox-4.clar @@ -897,12 +897,12 @@ (err ERR_STACKING_INVALID_LOCK_PERIOD)) (let ((partial-amount-ustx (get stacked-amount partial-stacked)) + ;; reward-cycle must point to an existing record in reward-cycle-total-stacked + ;; infallible; getting something from partial-stacked-by-cycle succeeded so this must succeed + (existing-cycle (unwrap-panic (map-get? reward-cycle-total-stacked { reward-cycle: reward-cycle }))) ;; reward-cycle and reward-cycle-index must point to an existing record in reward-cycle-pox-address-list (existing-entry (unwrap! (map-get? reward-cycle-pox-address-list { reward-cycle: reward-cycle, index: reward-cycle-index }) (err ERR_DELEGATION_NO_REWARD_SLOT))) - ;; reward-cycle must point to an existing record in reward-cycle-total-stacked - ;; infallible; getting existing-entry succeeded so this must succeed - (existing-cycle (unwrap-panic (map-get? reward-cycle-total-stacked { reward-cycle: reward-cycle }))) (increased-entry-total (+ (get total-ustx existing-entry) partial-amount-ustx)) (increased-cycle-total (+ (get total-ustx existing-cycle) partial-amount-ustx)) (existing-signer-key (get signer existing-entry))) diff --git a/components/stacks-network/Cargo.toml b/components/stacks-network/Cargo.toml index 253080069..4d4c3f912 100644 --- a/components/stacks-network/Cargo.toml +++ b/components/stacks-network/Cargo.toml @@ -36,7 +36,6 @@ clap = { version = "4.4.8", features = ["derive"] } serde_yaml = "0.8.23" stackslib = { git = "https://github.com/stacks-network/stacks-core.git", branch="feat/clarity-wasm-next", package = "stackslib" } chainhook-sdk = { version = "0.12" } - stacks-rpc-client = { path = "../stacks-rpc-client" } clarinet-files = { path = "../clarinet-files", features = ["cli"] } clarinet-deployments = { path = "../clarinet-deployments", features = ["cli"] } diff --git a/components/stacks-network/src/chains_coordinator.rs b/components/stacks-network/src/chains_coordinator.rs index 6753e1123..e233ac444 100644 --- a/components/stacks-network/src/chains_coordinator.rs +++ b/components/stacks-network/src/chains_coordinator.rs @@ -251,9 +251,7 @@ pub async fn start_chains_coordinator( let observer_event_oper = sel.recv(&observer_event_rx); let DevnetConfig { - use_nakamoto, - enable_subnet_node, - .. + enable_subnet_node, .. } = config.devnet_config; loop { @@ -346,7 +344,6 @@ pub async fn start_chains_coordinator( send_status_update( &devnet_event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-node", Status::Green, @@ -394,7 +391,6 @@ pub async fn start_chains_coordinator( // would requires either cloning the block, or passing ownership. send_status_update( &devnet_event_tx, - use_nakamoto, enable_subnet_node, "stacks-node", Status::Green, @@ -418,14 +414,14 @@ pub async fn start_chains_coordinator( ) } else { format!( - "Stacks block #{} anchored in Bitcoin block #{} includes {} transactions", + "Stacks block #{} mined including {} transaction{}", known_tip.block.block_identifier.index, - known_tip - .block - .metadata - .bitcoin_anchor_block_identifier - .index, known_tip.block.transactions.len(), + if known_tip.block.transactions.len() <= 1 { + "" + } else { + "s" + }, ) }; let _ = devnet_event_tx.send(DevnetEvent::info(message)); @@ -467,7 +463,6 @@ pub async fn start_chains_coordinator( if tx.tx_description.contains("::commit-block") { send_status_update( &devnet_event_tx, - use_nakamoto, enable_subnet_node, "subnet-node", Status::Green, diff --git a/components/stacks-network/src/event.rs b/components/stacks-network/src/event.rs index e341d48d7..d1541e64e 100644 --- a/components/stacks-network/src/event.rs +++ b/components/stacks-network/src/event.rs @@ -72,13 +72,13 @@ impl DevnetEvent { pub fn send_status_update( event_tx: &Sender, - with_nakamoto: bool, with_subnets: bool, name: &str, status: Status, comment: &str, ) { - let signers_services = if with_nakamoto { 2 } else { 0 }; + // leaving it a variable in case we want to make it dynamic in the future + let signers_services = 2; let subnet_services = if with_subnets { 2 } else { 0 }; let order = match name { diff --git a/components/stacks-network/src/lib.rs b/components/stacks-network/src/lib.rs index 6bfa0a69d..6682df491 100644 --- a/components/stacks-network/src/lib.rs +++ b/components/stacks-network/src/lib.rs @@ -186,7 +186,6 @@ async fn do_run_devnet( ), &devnet_path, devnet_config.enable_subnet_node, - devnet_config.use_nakamoto, !devnet_config.bitcoin_controller_automining_disabled, &ctx, )?; diff --git a/components/stacks-network/src/orchestrator.rs b/components/stacks-network/src/orchestrator.rs index 7767a2b2c..d552ee96e 100644 --- a/components/stacks-network/src/orchestrator.rs +++ b/components/stacks-network/src/orchestrator.rs @@ -306,7 +306,6 @@ impl DevnetOrchestrator { let disable_bitcoin_explorer = devnet_config.disable_bitcoin_explorer; let enable_subnet_node = devnet_config.enable_subnet_node; let disable_subnet_api = devnet_config.disable_subnet_api; - let use_nakamoto = devnet_config.use_nakamoto; let _ = fs::create_dir(&devnet_config.working_dir); let _ = fs::create_dir(format!("{}/conf", devnet_config.working_dir)); @@ -319,7 +318,6 @@ impl DevnetOrchestrator { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-node", Status::Red, @@ -328,35 +326,29 @@ impl DevnetOrchestrator { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-node", Status::Red, "initializing", ); - if use_nakamoto { - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-1", - Status::Red, - "initializing", - ); - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-2", - Status::Red, - "initializing", - ); - } + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-1", + Status::Red, + "initializing", + ); + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-2", + Status::Red, + "initializing", + ); send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-api", Status::Red, @@ -364,7 +356,6 @@ impl DevnetOrchestrator { ); send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-explorer", Status::Red, @@ -372,7 +363,6 @@ impl DevnetOrchestrator { ); send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-explorer", Status::Red, @@ -382,7 +372,6 @@ impl DevnetOrchestrator { if enable_subnet_node { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "subnet-node", Status::Red, @@ -390,7 +379,6 @@ impl DevnetOrchestrator { ); send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "subnet-api", Status::Red, @@ -407,7 +395,6 @@ impl DevnetOrchestrator { let _ = event_tx.send(DevnetEvent::info("Starting bitcoin-node".to_string())); send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-node", Status::Yellow, @@ -423,7 +410,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-node", Status::Yellow, @@ -445,7 +431,6 @@ impl DevnetOrchestrator { // Start postgres send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-api", Status::Yellow, @@ -470,7 +455,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-api", Status::Yellow, @@ -488,7 +472,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-api", Status::Green, @@ -518,7 +501,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "subnet-node", Status::Yellow, @@ -545,7 +527,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "subnet-api", Status::Green, @@ -566,7 +547,6 @@ impl DevnetOrchestrator { let _ = event_tx.send(DevnetEvent::info("Starting stacks-node".to_string())); send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-node", Status::Yellow, @@ -582,7 +562,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-node", Status::Yellow, @@ -597,105 +576,96 @@ impl DevnetOrchestrator { } }; - if use_nakamoto { - // Start stacks-signer-1 - let _ = event_tx.send(DevnetEvent::info("Starting stacks-signer-1".to_string())); - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-1", - Status::Yellow, - "updating image", - ); - match self - .prepare_stacks_signer_container(boot_index, ctx, 1) - .await - { - Ok(_) => {} - Err(message) => { - let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); - self.kill(ctx, Some(&message)).await; - return Err(message); - } - }; - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-1", - Status::Yellow, - "booting", - ); - match self.boot_stacks_signer_container(1).await { - Ok(_) => {} - Err(message) => { - let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); - self.kill(ctx, Some(&message)).await; - return Err(message); - } - }; - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-1", - Status::Green, - "running", - ); + // Start stacks-signer-1 + let _ = event_tx.send(DevnetEvent::info("Starting stacks-signer-1".to_string())); + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-1", + Status::Yellow, + "updating image", + ); + match self + .prepare_stacks_signer_container(boot_index, ctx, 1) + .await + { + Ok(_) => {} + Err(message) => { + let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); + self.kill(ctx, Some(&message)).await; + return Err(message); + } + }; + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-1", + Status::Yellow, + "booting", + ); + match self.boot_stacks_signer_container(1).await { + Ok(_) => {} + Err(message) => { + let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); + self.kill(ctx, Some(&message)).await; + return Err(message); + } + }; + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-1", + Status::Green, + "running", + ); - // Start stacks-signer-2 - let _ = event_tx.send(DevnetEvent::info("Starting stacks-signer-2".to_string())); - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-2", - Status::Yellow, - "updating image", - ); - match self - .prepare_stacks_signer_container(boot_index, ctx, 2) - .await - { - Ok(_) => {} - Err(message) => { - let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); - self.kill(ctx, Some(&message)).await; - return Err(message); - } - }; - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-2", - Status::Yellow, - "booting", - ); - match self.boot_stacks_signer_container(2).await { - Ok(_) => {} - Err(message) => { - let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); - self.kill(ctx, Some(&message)).await; - return Err(message); - } - }; - send_status_update( - &event_tx, - use_nakamoto, - enable_subnet_node, - "stacks-signer-2", - Status::Green, - "running", - ); - } + // Start stacks-signer-2 + let _ = event_tx.send(DevnetEvent::info("Starting stacks-signer-2".to_string())); + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-2", + Status::Yellow, + "updating image", + ); + match self + .prepare_stacks_signer_container(boot_index, ctx, 2) + .await + { + Ok(_) => {} + Err(message) => { + let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); + self.kill(ctx, Some(&message)).await; + return Err(message); + } + }; + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-2", + Status::Yellow, + "booting", + ); + match self.boot_stacks_signer_container(2).await { + Ok(_) => {} + Err(message) => { + let _ = event_tx.send(DevnetEvent::FatalError(message.clone())); + self.kill(ctx, Some(&message)).await; + return Err(message); + } + }; + send_status_update( + &event_tx, + enable_subnet_node, + "stacks-signer-2", + Status::Green, + "running", + ); // Start stacks-explorer if !disable_stacks_explorer { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-explorer", Status::Yellow, @@ -720,7 +690,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-explorer", Status::Green, @@ -732,7 +701,6 @@ impl DevnetOrchestrator { if !disable_bitcoin_explorer { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-explorer", Status::Yellow, @@ -757,7 +725,6 @@ impl DevnetOrchestrator { }; send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-explorer", Status::Green, @@ -775,7 +742,6 @@ impl DevnetOrchestrator { Ok(false) => { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "bitcoin-node", Status::Yellow, @@ -784,7 +750,6 @@ impl DevnetOrchestrator { send_status_update( &event_tx, - use_nakamoto, enable_subnet_node, "stacks-node", Status::Yellow, @@ -1115,7 +1080,6 @@ second_attempt_time_ms = {subsequent_attempt_time_ms} block_reward_recipient = "{miner_coinbase_recipient}" wait_for_block_download = false microblock_attempt_time_ms = 10 -self_signing_seed = 1 mining_key = "19ec1c3e31d139c989a23a27eac60d1abfad5277d3ae9604242514c738258efa01" # microblock_attempt_time_ms = 15000 "#, @@ -1137,29 +1101,29 @@ amount = {} account.stx_address, account.balance )); } - if devnet_config.use_nakamoto { - stacks_conf.push_str(&format!( - r#" + + // add the 2 signers event observers + stacks_conf.push_str(&format!( + r#" [[events_observer]] endpoint = "stacks-signer-1.{}:30001" retry_count = 255 include_data_events = false events_keys = ["stackerdb", "block_proposal", "burn_blocks"] "#, - self.network_name - )); + self.network_name + )); - stacks_conf.push_str(&format!( - r#" + stacks_conf.push_str(&format!( + r#" [[events_observer]] endpoint = "stacks-signer-2.{}:30002" retry_count = 255 include_data_events = false events_keys = ["stackerdb", "block_proposal", "burn_blocks"] "#, - self.network_name - )); - } + self.network_name + )); stacks_conf.push_str(&format!( r#" @@ -1232,11 +1196,7 @@ password = "{bitcoin_node_password}" rpc_port = {orchestrator_ingestion_port} peer_port = {bitcoin_node_p2p_port} "#, - burnchain_mode = if devnet_config.use_nakamoto { - "nakamoto-neon" - } else { - "krypton" - }, + burnchain_mode = "nakamoto-neon", bitcoin_node_username = devnet_config.bitcoin_node_username, bitcoin_node_password = devnet_config.bitcoin_node_password, bitcoin_node_p2p_port = devnet_config.bitcoin_node_p2p_port, @@ -1273,18 +1233,7 @@ start_height = {epoch_2_3} [[burnchain.epochs]] epoch_name = "2.4" start_height = {epoch_2_4} -"#, - epoch_2_0 = devnet_config.epoch_2_0, - epoch_2_05 = devnet_config.epoch_2_05, - epoch_2_1 = devnet_config.epoch_2_1, - epoch_2_2 = devnet_config.epoch_2_2, - epoch_2_3 = devnet_config.epoch_2_3, - epoch_2_4 = devnet_config.epoch_2_4, - )); - if devnet_config.use_nakamoto { - stacks_conf.push_str(&format!( - r#" [[burnchain.epochs]] epoch_name = "2.5" start_height = {epoch_2_5} @@ -1293,10 +1242,15 @@ start_height = {epoch_2_5} epoch_name = "3.0" start_height = {epoch_3_0} "#, - epoch_2_5 = devnet_config.epoch_2_5, - epoch_3_0 = devnet_config.epoch_3_0, - )); - } + epoch_2_0 = devnet_config.epoch_2_0, + epoch_2_05 = devnet_config.epoch_2_05, + epoch_2_1 = devnet_config.epoch_2_1, + epoch_2_2 = devnet_config.epoch_2_2, + epoch_2_3 = devnet_config.epoch_2_3, + epoch_2_4 = devnet_config.epoch_2_4, + epoch_2_5 = devnet_config.epoch_2_5, + epoch_3_0 = devnet_config.epoch_3_0, + )); let mut stacks_conf_path = PathBuf::from(&devnet_config.working_dir); stacks_conf_path.push("conf/Stacks.toml"); diff --git a/components/stacks-network/src/ui/app.rs b/components/stacks-network/src/ui/app.rs index e55a57ed7..403f7cc19 100644 --- a/components/stacks-network/src/ui/app.rs +++ b/components/stacks-network/src/ui/app.rs @@ -17,7 +17,6 @@ pub enum BlockData { pub struct App<'a> { pub title: &'a str, pub subnet_enabled: bool, - pub nakamoto_enabled: bool, pub devnet_path: &'a str, pub should_quit: bool, pub blocks: Vec, @@ -29,12 +28,7 @@ pub struct App<'a> { } impl<'a> App<'a> { - pub fn new( - title: &'a str, - devnet_path: &'a str, - subnet_enabled: bool, - nakamoto_enabled: bool, - ) -> App<'a> { + pub fn new(title: &'a str, devnet_path: &'a str, subnet_enabled: bool) -> App<'a> { App { title, devnet_path, @@ -46,7 +40,6 @@ impl<'a> App<'a> { logs: StatefulList::with_items(vec![]), services: StatefulList::with_items(vec![]), subnet_enabled, - nakamoto_enabled, } } diff --git a/components/stacks-network/src/ui/mod.rs b/components/stacks-network/src/ui/mod.rs index 26bdd2750..74987a3fd 100644 --- a/components/stacks-network/src/ui/mod.rs +++ b/components/stacks-network/src/ui/mod.rs @@ -32,7 +32,6 @@ pub fn start_ui( orchestrator_terminated_rx: Receiver, devnet_path: &str, subnet_enabled: bool, - nakamoto_enabled: bool, automining_enabled: bool, ctx: &Context, ) -> Result<(), String> { @@ -43,7 +42,6 @@ pub fn start_ui( orchestrator_terminated_rx, devnet_path, subnet_enabled, - nakamoto_enabled, automining_enabled, ctx, ); @@ -60,7 +58,6 @@ pub fn do_start_ui( orchestrator_terminated_rx: Receiver, devnet_path: &str, subnet_enabled: bool, - nakamoto_enabled: bool, automining_enabled: bool, ctx: &Context, ) -> Result<(), String> { @@ -98,7 +95,7 @@ pub fn do_start_ui( } }); - let mut app = App::new("Clarinet", devnet_path, subnet_enabled, nakamoto_enabled); + let mut app = App::new("Clarinet", devnet_path, subnet_enabled); terminal .clear() diff --git a/components/stacks-network/src/ui/ui.rs b/components/stacks-network/src/ui/ui.rs index f2ecb3a94..981fc5d3a 100644 --- a/components/stacks-network/src/ui/ui.rs +++ b/components/stacks-network/src/ui/ui.rs @@ -25,7 +25,7 @@ pub fn draw(f: &mut Frame, app: &mut App) { .split(page_components[1]); let nb_of_services = 5; - let nb_of_signers = if app.nakamoto_enabled { 2 } else { 0 }; + let nb_of_signers = 2; let nb_of_subnet_services = if app.subnet_enabled { 2 } else { 0 }; let service_len = nb_of_services + nb_of_signers + nb_of_subnet_services + 2; diff --git a/dockerfiles/devnet/Signer.dockerfile b/dockerfiles/devnet/Signer.dockerfile new file mode 100644 index 000000000..8213fe04f --- /dev/null +++ b/dockerfiles/devnet/Signer.dockerfile @@ -0,0 +1,26 @@ +FROM rust:bookworm as builder + +ARG GIT_COMMIT +RUN test -n "$GIT_COMMIT" || (echo "GIT_COMMIT not set" && false) + +RUN echo "Building stacks-signer from commit: https://github.com/stacks-network/stacks-blockchain/commit/$GIT_COMMIT" + +RUN apt-get update && apt-get install -y libclang-dev +RUN rustup toolchain install stable + +WORKDIR /stacks +RUN git init && \ + git remote add origin https://github.com/stacks-network/stacks-blockchain.git && \ + git -c protocol.version=2 fetch --depth=1 origin "$GIT_COMMIT" && \ + git reset --hard FETCH_HEAD + +RUN cargo build --release --package stacks-signer --bin stacks-signer + +FROM debian:bookworm-slim + +COPY --from=builder /stacks/target/release/stacks-signer /bin + +RUN apt update +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /root diff --git a/dockerfiles/devnet/Stacks.dockerfile b/dockerfiles/devnet/Stacks.dockerfile index 95ac847b4..7610a8467 100644 --- a/dockerfiles/devnet/Stacks.dockerfile +++ b/dockerfiles/devnet/Stacks.dockerfile @@ -1,24 +1,26 @@ -FROM rust:stretch as build +FROM rust:bookworm as builder -ARG STACKS_NODE_VERSION="No Version Info" -ARG GIT_BRANCH='No Branch Info' -ARG GIT_COMMIT='No Commit Info' +ARG GIT_COMMIT +RUN test -n "$GIT_COMMIT" || (echo "GIT_COMMIT not set" && false) -WORKDIR /src +RUN echo "Building stacks-node from commit: https://github.com/stacks-network/stacks-blockchain/commit/$GIT_COMMIT" -COPY . . +RUN apt-get update && apt-get install -y libclang-dev +RUN rustup toolchain install stable -RUN mkdir /out +WORKDIR /stacks +RUN git init && \ + git remote add origin https://github.com/stacks-network/stacks-blockchain.git && \ + git -c protocol.version=2 fetch --depth=1 origin "$GIT_COMMIT" && \ + git reset --hard FETCH_HEAD -RUN cd testnet/stacks-node && cargo build --features monitoring_prom,slog_json --release -RUN cd testnet/puppet-chain && cargo build --release +RUN cargo build --release --package stacks-node --bin stacks-node -RUN cp target/release/stacks-node /out -RUN cp target/release/puppet-chain /out +FROM debian:bookworm-slim -FROM debian:stretch-slim +COPY --from=builder /stacks/target/release/stacks-node /bin -RUN apt update && apt install -y netcat -COPY --from=build /out/ /bin/ +RUN apt update +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -CMD ["stacks-node", "mainnet"] \ No newline at end of file +WORKDIR /root