Skip to content

Commit

Permalink
chore: update subnet image and contract version
Browse files Browse the repository at this point in the history
* chore: update subnet images and config

* fix: set chain ID for subnet API

The default chain ID is now 0x55005500.

* feat: add `subnet_node_env_vars` to config

* fix: use `stacks_explorer_env_vars` for explorer

* fix: moved `CUSTOM_CHAIN_IDS` env var to subnet API

This was erroneously in the stacks API in an earlier commit.

* feat: add `subnet_api_env_vars` to devnet config

* fix: Update `DEFAULT_SUBNET_CONTRACT_ID`, use version with correct `admin`/`miner` values

* chore: update to subnet version 0.7.0

* chore: shorten the default epoch timing

Since most users will want to be testing on the latest, this proposes
getting to epoch 2.4 faster. It's in this subnet branch because the
subnet contract launches in 2.4 and the previous default takes far too
long to reach.

* chore: Update subnet image and contract version

---------

Co-authored-by: Jeff Bencin <[email protected]>
  • Loading branch information
obycode and jbencin authored Jul 12, 2023
1 parent b4fe3d4 commit 4dd0251
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 52 deletions.
16 changes: 11 additions & 5 deletions components/clarinet-cli/src/generate/project.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use clarinet_files::{
DEFAULT_BITCOIN_EXPLORER_IMAGE, DEFAULT_BITCOIN_NODE_IMAGE, DEFAULT_DERIVATION_PATH,
DEFAULT_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_FAUCET_MNEMONIC,
DEFAULT_POSTGRES_IMAGE, DEFAULT_POX2_ACTIVATION, 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_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_EPOCH_2_2, DEFAULT_EPOCH_2_3,
DEFAULT_EPOCH_2_4, DEFAULT_FAUCET_MNEMONIC, DEFAULT_POSTGRES_IMAGE, DEFAULT_POX2_ACTIVATION,
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,
};

use super::changes::{Changes, DirectoryCreation, FileCreation};
Expand Down Expand Up @@ -403,6 +403,9 @@ disable_stacks_api = false
# epoch_2_05 = {default_epoch_2_05}
# epoch_2_1 = {default_epoch_2_1}
# pox_2_activation = {default_pox2_activation}
# epoch_2_2 = {default_epoch_2_2}
# epoch_2_3 = {default_epoch_2_3}
# epoch_2_4 = {default_epoch_2_4}
# Send some stacking orders
Expand Down Expand Up @@ -444,6 +447,9 @@ btc_address = "mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7"
default_epoch_2_05 = DEFAULT_EPOCH_2_05,
default_epoch_2_1 = DEFAULT_EPOCH_2_1,
default_pox2_activation = DEFAULT_POX2_ACTIVATION,
default_epoch_2_2 = DEFAULT_EPOCH_2_2,
default_epoch_2_3 = DEFAULT_EPOCH_2_3,
default_epoch_2_4 = DEFAULT_EPOCH_2_4,
);
let name = format!("Devnet.toml");
let path = format!(
Expand Down
10 changes: 5 additions & 5 deletions components/clarinet-files/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ pub use network_manifest::{
compute_addresses, AccountConfig, DevnetConfig, DevnetConfigFile, NetworkManifest,
NetworkManifestFile, PoxStackingOrder, DEFAULT_BITCOIN_EXPLORER_IMAGE,
DEFAULT_BITCOIN_NODE_IMAGE, DEFAULT_DERIVATION_PATH, DEFAULT_DOCKER_PLATFORM,
DEFAULT_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_FAUCET_MNEMONIC,
DEFAULT_POSTGRES_IMAGE, DEFAULT_POX2_ACTIVATION, 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_EPOCH_2_0, DEFAULT_EPOCH_2_05, DEFAULT_EPOCH_2_1, DEFAULT_EPOCH_2_2, DEFAULT_EPOCH_2_3,
DEFAULT_EPOCH_2_4, DEFAULT_FAUCET_MNEMONIC, DEFAULT_POSTGRES_IMAGE, DEFAULT_POX2_ACTIVATION,
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,
};
pub use project_manifest::{ProjectManifest, ProjectManifestFile, RequirementConfig};
use serde::ser::{Serialize, SerializeMap, Serializer};
Expand Down
24 changes: 15 additions & 9 deletions components/clarinet-files/src/network_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ pub const DEFAULT_BITCOIN_EXPLORER_IMAGE: &str = "quay.io/hirosystems/bitcoin-ex
pub const DEFAULT_STACKS_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:latest";
pub const DEFAULT_STACKS_EXPLORER_IMAGE: &str = "hirosystems/explorer:latest";
pub const DEFAULT_POSTGRES_IMAGE: &str = "postgres:14";
pub const DEFAULT_SUBNET_NODE_IMAGE: &str = "hirosystems/stacks-subnets:0.5.0";
pub const DEFAULT_SUBNET_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:7.1.0-subnets.1";
pub const DEFAULT_SUBNET_NODE_IMAGE: &str = "hirosystems/stacks-subnets:0.8.0";
pub const DEFAULT_SUBNET_API_IMAGE: &str = "hirosystems/stacks-blockchain-api:7.2.0-beta.4";
pub const DEFAULT_SUBNET_CONTRACT_ID: &str =
"ST13F481SBR0R7Z6NMMH8YV2FJJYXA5JPA0AD3HP9.subnet-v1-2";
"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";
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";
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";
Expand All @@ -36,12 +36,12 @@ pub const DEFAULT_DOCKER_SOCKET: &str = "/var/run/docker.sock";
pub const DEFAULT_DOCKER_PLATFORM: &str = "linux/amd64";

pub const DEFAULT_EPOCH_2_0: u64 = 100;
pub const DEFAULT_EPOCH_2_05: u64 = 102;
pub const DEFAULT_EPOCH_2_1: u64 = 106;
pub const DEFAULT_POX2_ACTIVATION: u64 = 109;
pub const DEFAULT_EPOCH_2_2: u64 = 122;
pub const DEFAULT_EPOCH_2_3: u64 = 128;
pub const DEFAULT_EPOCH_2_4: u64 = 134;
pub const DEFAULT_EPOCH_2_05: u64 = 100;
pub const DEFAULT_EPOCH_2_1: u64 = 101;
pub const DEFAULT_POX2_ACTIVATION: u64 = 102;
pub const DEFAULT_EPOCH_2_2: u64 = 103;
pub const DEFAULT_EPOCH_2_3: u64 = 104;
pub const DEFAULT_EPOCH_2_4: u64 = 105;

#[derive(Serialize, Deserialize, Debug)]
pub struct NetworkManifestFile {
Expand Down Expand Up @@ -77,6 +77,7 @@ pub struct DevnetConfigFile {
pub stacks_node_env_vars: Option<Vec<String>>,
pub stacks_api_env_vars: Option<Vec<String>>,
pub stacks_explorer_env_vars: Option<Vec<String>>,
pub subnet_node_env_vars: Option<Vec<String>>,
pub stacks_api_port: Option<u16>,
pub stacks_api_events_port: Option<u16>,
pub bitcoin_explorer_port: Option<u16>,
Expand Down Expand Up @@ -120,6 +121,7 @@ pub struct DevnetConfigFile {
pub subnet_api_image_url: Option<String>,
pub subnet_api_port: Option<u16>,
pub subnet_api_events_port: Option<u16>,
pub subnet_api_env_vars: Option<Vec<String>>,
pub disable_subnet_api: Option<bool>,
pub docker_host: Option<String>,
pub components_host: Option<String>,
Expand Down Expand Up @@ -241,9 +243,11 @@ pub struct DevnetConfig {
pub subnet_node_events_observers: Vec<String>,
pub subnet_contract_id: String,
pub remapped_subnet_contract_id: String,
pub subnet_node_env_vars: Vec<String>,
pub subnet_api_image_url: String,
pub subnet_api_port: u16,
pub subnet_api_events_port: u16,
pub subnet_api_env_vars: Vec<String>,
pub disable_subnet_api: bool,
pub docker_host: String,
pub components_host: String,
Expand Down Expand Up @@ -870,6 +874,8 @@ impl NetworkManifest {
.stacks_explorer_env_vars
.take()
.unwrap_or(vec![]),
subnet_node_env_vars: devnet_config.subnet_node_env_vars.take().unwrap_or(vec![]),
subnet_api_env_vars: devnet_config.subnet_api_env_vars.take().unwrap_or(vec![]),
use_docker_gateway_routing: devnet_config
.use_docker_gateway_routing
.unwrap_or(false),
Expand Down
73 changes: 40 additions & 33 deletions components/stacks-network/src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,13 @@ events_keys = ["*"]
))
}

let mut env = vec![
"STACKS_LOG_PP=1".to_string(),
"STACKS_LOG_DEBUG=1".to_string(),
// "BLOCKSTACK_USE_TEST_GENESIS_CHAINSTATE=1".to_string(),
];
env.append(&mut devnet_config.subnet_node_env_vars.clone());

let config = Config {
labels: Some(labels),
image: Some(devnet_config.subnet_node_image_url.clone()),
Expand All @@ -1380,11 +1387,7 @@ events_keys = ["*"]
"start".into(),
"--config=/src/subnet-node/Subnet.toml".into(),
]),
env: Some(vec![
"STACKS_LOG_PP=1".to_string(),
"STACKS_LOG_DEBUG=1".to_string(),
// "BLOCKSTACK_USE_TEST_GENESIS_CHAINSTATE=1".to_string(),
]),
env: Some(env),
host_config: Some(HostConfig {
auto_remove: Some(true),
binds: Some(binds),
Expand Down Expand Up @@ -1626,39 +1629,43 @@ events_keys = ["*"]
let mut labels = HashMap::new();
labels.insert("project".to_string(), self.network_name.to_string());

let mut env = vec![
format!("STACKS_CORE_RPC_HOST=subnet-node.{}", self.network_name),
format!("STACKS_BLOCKCHAIN_API_DB=pg"),
format!(
"STACKS_CORE_RPC_PORT={}",
devnet_config.subnet_node_rpc_port
),
format!(
"STACKS_BLOCKCHAIN_API_PORT={}",
devnet_config.subnet_api_port
),
format!("STACKS_BLOCKCHAIN_API_HOST=0.0.0.0"),
format!(
"STACKS_CORE_EVENT_PORT={}",
devnet_config.subnet_api_events_port
),
format!("STACKS_CORE_EVENT_HOST=0.0.0.0"),
format!("STACKS_API_ENABLE_FT_METADATA=1"),
format!("PG_HOST=postgres.{}", self.network_name),
format!("PG_PORT={}", devnet_config.postgres_port),
format!("PG_USER={}", devnet_config.postgres_username),
format!("PG_PASSWORD={}", devnet_config.postgres_password),
format!("PG_DATABASE={}", devnet_config.subnet_api_postgres_database),
format!("STACKS_CHAIN_ID=0x55005500"),
format!("CUSTOM_CHAIN_IDS=testnet=0x55005500"),
format!("V2_POX_MIN_AMOUNT_USTX=90000000260"),
"NODE_ENV=development".to_string(),
];
env.append(&mut devnet_config.subnet_api_env_vars.clone());

let config = Config {
labels: Some(labels),
image: Some(devnet_config.subnet_api_image_url.clone()),
// domainname: Some(self.network_name.to_string()),
tty: None,
exposed_ports: Some(exposed_ports),
env: Some(vec![
format!("STACKS_CORE_RPC_HOST=subnet-node.{}", self.network_name),
format!("STACKS_BLOCKCHAIN_API_DB=pg"),
format!(
"STACKS_CORE_RPC_PORT={}",
devnet_config.subnet_node_rpc_port
),
format!(
"STACKS_BLOCKCHAIN_API_PORT={}",
devnet_config.subnet_api_port
),
format!("STACKS_BLOCKCHAIN_API_HOST=0.0.0.0"),
format!(
"STACKS_CORE_EVENT_PORT={}",
devnet_config.subnet_api_events_port
),
format!("STACKS_CORE_EVENT_HOST=0.0.0.0"),
format!("STACKS_API_ENABLE_FT_METADATA=1"),
format!("PG_HOST=postgres.{}", self.network_name),
format!("PG_PORT={}", devnet_config.postgres_port),
format!("PG_USER={}", devnet_config.postgres_username),
format!("PG_PASSWORD={}", devnet_config.postgres_password),
format!("PG_DATABASE={}", devnet_config.subnet_api_postgres_database),
format!("STACKS_CHAIN_ID=2147483648"),
format!("V2_POX_MIN_AMOUNT_USTX=90000000260"),
"NODE_ENV=development".to_string(),
]),
env: Some(env),
host_config: Some(HostConfig {
auto_remove: Some(true),
network_mode: Some(self.network_name.clone()),
Expand Down Expand Up @@ -1890,7 +1897,7 @@ events_keys = ["*"]
format!("NEXT_PUBLIC_DEFAULT_POLLING_INTERVAL={}", 5000),
"NODE_ENV=development".to_string(),
];
env.append(&mut devnet_config.stacks_node_env_vars.clone());
env.append(&mut devnet_config.stacks_explorer_env_vars.clone());

let config = Config {
labels: Some(labels),
Expand Down

0 comments on commit 4dd0251

Please sign in to comment.