Skip to content

refactor: move stacks-node crate to workspace root #6254

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/actions/bitcoin-int-tests/Dockerfile.atlas-test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN ln -s /bitcoin-25.0/bin/bitcoind /bin/

ENV BITCOIND_TEST 1
WORKDIR /src/testnet/stacks-node
WORKDIR /src/stacks-node
RUN cargo test -- --test-threads 1 --ignored tests::neon_integrations::atlas_integration_test
RUN cargo test -- --test-threads 1 --ignored tests::neon_integrations::atlas_stress_integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /src/

COPY . .

WORKDIR /src/testnet/stacks-node
WORKDIR /src/stacks-node

RUN rustup component add llvm-tools-preview && \
cargo install grcov
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN cargo test --no-run --workspace && \
cargo build --workspace

ENV BITCOIND_TEST 1
RUN cd testnet/stacks-node && cargo test --release --features prod-genesis-chainstate -- --test-threads 1 --ignored neon_integrations::bitcoind_integration_test
RUN cd stacks-node && cargo test --release --features prod-genesis-chainstate -- --test-threads 1 --ignored neon_integrations::bitcoind_integration_test

RUN grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info

Expand Down
20 changes: 2 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,12 @@ secrets*
# vim
*.swp

#Docker
Docker/blockstore.ini

#Docs
api/templates/index.html
api/data

# testnets
testnet-logs/
testnet.log
testnet/index.html

# virtualenvs
.venv

# will have compiled files and executables
/target/
/testnet/helium/target/
/contrib/tools/puppet-chain/target/
/contrib/core-contract-tests/.cache/
/contrib/tools/config-docs-generator/target/
target/
contrib/tools/config-docs-generator/target/

# These are backup files generated by rustfmt
**/*.rs.bk
Expand All @@ -71,7 +56,6 @@ tarpaulin-report.html
osxcross
osxcross*.tar.xz
.DS_Store
testnet/stacks-node/target

net-test/etc/*.toml
net-test/etc/*.conf
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
"libstackerdb",
"libsigner",
"stacks-signer",
"testnet/stacks-node",
"stacks-node",
"contrib/tools/config-docs-generator"]

# Dependencies we want to keep the same between workspace members
Expand Down
2 changes: 1 addition & 1 deletion contrib/nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
(craneLib.fileset.commonCargoSources ../../stacks-common)
(craneLib.fileset.commonCargoSources ../../stackslib)
(craneLib.fileset.commonCargoSources ../../stx-genesis)
(craneLib.fileset.commonCargoSources ../../testnet/stacks-node)
(craneLib.fileset.commonCargoSources ../../stacks-node)
];
};

Expand Down
4 changes: 2 additions & 2 deletions docs/mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ to verify that it was able to find its Bitcoin UTXOs:

```bash
$ head -n 100 /path/to/your/node/logs | grep -i utxo
INFO [1630127492.031042] [testnet/stacks-node/src/run_loop/neon.rs:146] [main] Miner node: checking UTXOs at address: <redacted>
INFO [1630127492.062652] [testnet/stacks-node/src/run_loop/neon.rs:164] [main] UTXOs found - will run as a Miner node
INFO [1630127492.031042] [stacks-node/src/run_loop/neon.rs:146] [main] Miner node: checking UTXOs at address: <redacted>
INFO [1630127492.062652] [stacks-node/src/run_loop/neon.rs:164] [main] UTXOs found - will run as a Miner node
```

## Configuring Cost and Fee Estimation
Expand Down
20 changes: 10 additions & 10 deletions docs/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ Validating the config file using `stacks-node check-config`:

```
$ cargo run -r -p stacks-node --bin stacks-node check-config --config ./sample/conf/mainnet-follower-conf.toml
INFO [1661276562.220137] [testnet/stacks-node/src/main.rs:82] [main] stacks-node 0.1.0 (:, release build, linux [x86_64])
INFO [1661276562.220363] [testnet/stacks-node/src/main.rs:115] [main] Loading config at path ./sample/conf/mainnet-follower-conf.toml
INFO [1661276562.233071] [testnet/stacks-node/src/main.rs:128] [main] Valid config!
INFO [1661276562.220137] [stacks-node/src/main.rs:82] [main] stacks-node 0.1.0 (:, release build, linux [x86_64])
INFO [1661276562.220363] [stacks-node/src/main.rs:115] [main] Loading config at path ./sample/conf/mainnet-follower-conf.toml
INFO [1661276562.233071] [stacks-node/src/main.rs:128] [main] Loaded config!
```

Enabling debug logging using environment variable `STACKS_LOG_DEBUG=1`:

```
$ STACKS_LOG_DEBUG=1 cargo run -r -p stacks-node --bin stacks-node check-config --config ./sample/conf/mainnet-follower-conf.toml
INFO [1661276562.220137] [testnet/stacks-node/src/main.rs:82] [main] stacks-node 0.1.0 (tip-mine:c90476aa8a+, release build, macos [aarch64])
INFO [1661276562.220363] [testnet/stacks-node/src/main.rs:115] [main] Loading config at path ./sample/conf/mainnet-follower-conf.toml
DEBG [1661276562.222450] [testnet/stacks-node/src/main.rs:118] [main] Loaded config file: ConfigFile { burnchain: Some(BurnchainConfigFile { chain: Some("bitcoin"), burn_fee_cap: Some(1), mode: Some("mainnet"), commit_anchor_block_within: None, peer_host: Some("localhost"), peer_port: Some(8333), rpc_port: Some(8332), rpc_ssl: None, username: Some("btcuser"), password: Some("btcpass"), timeout: None, magic_bytes: None, local_mining_public_key: None, process_exit_at_block_height: None, poll_time_secs: None, satoshis_per_byte: None, leader_key_tx_estimated_size: None, block_commit_tx_estimated_size: None, rbf_fee_increment: None, max_rbf: None, epochs: None }), node: Some(NodeConfigFile { name: None, seed: None, deny_nodes: None, working_dir: Some("/Users/igor/w/stacks-work/working_dir"), rpc_bind: Some("0.0.0.0:20443"), p2p_bind: Some("0.0.0.0:20444"), p2p_address: None, data_url: None, bootstrap_node: Some("02196f005965cebe6ddc3901b7b1cc1aa7a88f305bb8c5893456b8f9a605923893@seed.mainnet.hiro.so:20444"), local_peer_seed: None, miner: Some(true), mock_mining: Some(true), mine_microblocks: None, microblock_frequency: None, max_microblocks: None, wait_time_for_microblocks: None, prometheus_bind: None, marf_cache_strategy: None, marf_defer_hashing: None, pox_sync_sample_secs: None, use_test_genesis_chainstate: None }), ustx_balance: None, events_observer: Some([EventObserverConfigFile { endpoint: "localhost:3700", events_keys: ["*"] }]), connection_options: None, fee_estimation: None, miner: None }
INFO [1661276562.233071] [testnet/stacks-node/src/main.rs:128] [main] Valid config!
INFO [1661276562.220137] [stacks-node/src/main.rs:82] [main] stacks-node 0.1.0 (tip-mine:c90476aa8a+, release build, macos [aarch64])
INFO [1661276562.220363] [stacks-node/src/main.rs:115] [main] Loading config at path ./sample/conf/mainnet-follower-conf.toml
DEBG [1661276562.222450] [stacks-node/src/main.rs:118] [main] Loaded config file: ConfigFile { burnchain: Some(BurnchainConfigFile { chain: Some("bitcoin"), burn_fee_cap: Some(1), mode: Some("mainnet"), commit_anchor_block_within: None, peer_host: Some("localhost"), peer_port: Some(8333), rpc_port: Some(8332), rpc_ssl: None, username: Some("btcuser"), password: Some("btcpass"), timeout: None, magic_bytes: None, local_mining_public_key: None, process_exit_at_block_height: None, poll_time_secs: None, satoshis_per_byte: None, leader_key_tx_estimated_size: None, block_commit_tx_estimated_size: None, rbf_fee_increment: None, max_rbf: None, epochs: None }), node: Some(NodeConfigFile { name: None, seed: None, deny_nodes: None, working_dir: Some("/Users/igor/w/stacks-work/working_dir"), rpc_bind: Some("0.0.0.0:20443"), p2p_bind: Some("0.0.0.0:20444"), p2p_address: None, data_url: None, bootstrap_node: Some("02196f005965cebe6ddc3901b7b1cc1aa7a88f305bb8c5893456b8f9a605923893@seed.mainnet.hiro.so:20444"), local_peer_seed: None, miner: Some(true), mock_mining: Some(true), mine_microblocks: None, microblock_frequency: None, max_microblocks: None, wait_time_for_microblocks: None, prometheus_bind: None, marf_cache_strategy: None, marf_defer_hashing: None, pox_sync_sample_secs: None, use_test_genesis_chainstate: None }), ustx_balance: None, events_observer: Some([EventObserverConfigFile { endpoint: "localhost:3700", events_keys: ["*"] }]), connection_options: None, fee_estimation: None, miner: None }
INFO [1661276562.233071] [stacks-node/src/main.rs:128] [main] Loaded config!
```

Enabling json logging using environment variable `STACKS_LOG_JSON=1` and feature flag `slog_json`:

```
$ STACKS_LOG_JSON=1 cargo run -F slog_json -r -p stacks-node --bin stacks-node check-config --config ./sample/conf/mainnet-follower-conf.toml
{"msg":"stacks-node 0.1.0 (tip-mine:c90476aa8a+, release build, macos [aarch64])","level":"INFO","ts":"2022-08-23T12:44:28.072462-05:00","thread":"main","line":82,"file":"testnet/stacks-node/src/main.rs"}
{"msg":"Loading config at path ./sample/conf/mainnet-follower-conf.toml","level":"INFO","ts":"2022-08-23T12:44:28.074238-05:00","thread":"main","line":115,"file":"testnet/stacks-node/src/main.rs"}
{"msg":"Valid config!","level":"INFO","ts":"2022-08-23T12:44:28.089960-05:00","thread":"main","line":128,"file":"testnet/stacks-node/src/main.rs"}
{"msg":"stacks-node 0.1.0 (tip-mine:c90476aa8a+, release build, macos [aarch64])","level":"INFO","ts":"2022-08-23T12:44:28.072462-05:00","thread":"main","line":82,"file":"stacks-node/src/main.rs"}
{"msg":"Loading config at path ./sample/conf/mainnet-follower-conf.toml","level":"INFO","ts":"2022-08-23T12:44:28.074238-05:00","thread":"main","line":115,"file":"stacks-node/src/main.rs"}
{"msg":"Valid config!","level":"INFO","ts":"2022-08-23T12:44:28.089960-05:00","thread":"main","line":128,"file":"stacks-node/src/main.rs"}
```

## Setting up the working directory
Expand Down
18 changes: 9 additions & 9 deletions testnet/stacks-node/Cargo.toml → stacks-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ pico-args = "0.5.0"
serde = "1"
serde_derive = "1"
serde_json = { version = "1.0", features = ["arbitrary_precision", "raw_value"] }
stacks = { package = "stackslib", path = "../../stackslib" }
stx-genesis = { path = "../../stx-genesis"}
stacks = { package = "stackslib", path = "../stackslib" }
stx-genesis = { path = "../stx-genesis"}
base64 = "0.12.0"
backtrace = "0.3.50"
libc = "0.2.151"
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
clarity = { path = "../../clarity" }
stacks-common = { path = "../../stacks-common" }
clarity = { path = "../clarity" }
stacks-common = { path = "../stacks-common" }
chrono = "0.4.19"
regex = "1"
libsigner = { path = "../../libsigner" }
libsigner = { path = "../libsigner" }
url = "2.1.0"
rand = { workspace = true }
hashbrown = { workspace = true }
Expand All @@ -44,10 +44,10 @@ tikv-jemallocator = {workspace = true}
warp = "0.3.5"
tokio = "1.15"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "rustls", "rustls-tls"] }
clarity = { path = "../../clarity", features = ["default", "testing"]}
stacks-common = { path = "../../stacks-common", features = ["default", "testing"] }
stacks = { package = "stackslib", path = "../../stackslib", features = ["default", "testing"] }
stacks-signer = { path = "../../stacks-signer", features = ["testing"] }
clarity = { path = "../clarity", features = ["default", "testing"]}
stacks-common = { path = "../stacks-common", features = ["default", "testing"] }
stacks = { package = "stackslib", path = "../stackslib", features = ["default", "testing"] }
stacks-signer = { path = "../stacks-signer", features = ["testing"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
mutants = "0.0.3"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion stackslib/src/net/api/gethealth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl RPCRequestHandler for RPCGetHealthRequestHandler {
let peer_max_stacks_height_opt = {
if current_epoch.epoch_id < StacksEpochId::Epoch30 {
// When the node enters Epoch 3.0, ibd is not accurate. In nakamoto it's always set to false.
// See the implementation of `RunLoop::start` in `testnet/stacks-node/src/run_loop/nakamoto.rs`,
// See the implementation of `RunLoop::start` in `stacks-node/src/run_loop/nakamoto.rs`,
// specifically the section and comment where `let ibd = false`, for details.
let ibd = infer_initial_burnchain_block_download(
&network.burnchain,
Expand Down
Loading