Skip to content

Commit

Permalink
feat: devnet in 2.5 by default (#1422)
Browse files Browse the repository at this point in the history
* feat: remove use_nakamoto flag

* fix: chainhook dependency, stacks-node settings, and pox cycle length

* feat: add docker image for stacks-node and stacks-signer

* feat: make epoch 2.5 the default

* feat: add an other constant for the default stacks signer image

* fix: revert default epoch change

* --wip-- [skip ci]

* chore: update pox-4

* fix: stacks-signer default image

* fix: update dockerfiles/devnet/Signer.dockerfile

Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>

* refactor: remove unused docker file

* chore: update lock file

---------

Co-authored-by: Micaiah Reid <micaiahreid@gmail.com>
  • Loading branch information
hugocaillard and MicaiahReid committed Apr 22, 2024
1 parent e2295e1 commit 664b4e8
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 318 deletions.
79 changes: 12 additions & 67 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions components/clarinet-cli/src/generate/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions components/clarinet-files/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
48 changes: 13 additions & 35 deletions components/clarinet-files/src/network_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -151,7 +148,6 @@ pub struct DevnetConfigFile {
pub epoch_3_0: Option<u64>,
pub use_docker_gateway_routing: Option<bool>,
pub docker_platform: Option<String>,
pub use_nakamoto: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions components/clarity-repl/src/repl/boot/pox-4.clar
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
1 change: 0 additions & 1 deletion components/stacks-network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
19 changes: 7 additions & 12 deletions components/stacks-network/src/chains_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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));
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions components/stacks-network/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ impl DevnetEvent {

pub fn send_status_update(
event_tx: &Sender<DevnetEvent>,
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 {
Expand Down
1 change: 0 additions & 1 deletion components/stacks-network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)?;
Expand Down
Loading

0 comments on commit 664b4e8

Please sign in to comment.