Skip to content

Commit e6da1b9

Browse files
authored
Merge branch 'develop' into chore/add-http-traffic-heartbeat-log
2 parents 5b43d0f + 3a434da commit e6da1b9

File tree

9 files changed

+99
-49
lines changed

9 files changed

+99
-49
lines changed

Cargo.lock

Lines changed: 2 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libsigner/Cargo.toml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,8 @@ hashbrown = { workspace = true }
2121
lazy_static = "1.4.0"
2222
libc = "0.2"
2323
libstackerdb = { path = "../libstackerdb" }
24-
prometheus = { version = "0.9", optional = true }
2524
serde = "1"
26-
serde_derive = "1"
27-
serde_stacker = "0.1"
2825
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
29-
slog-term = "2.6.0"
30-
slog-json = { version = "2.3.0", optional = true }
3126
stacks-common = { path = "../stacks-common" }
3227
stackslib = { path = "../stackslib"}
3328
thiserror = { workspace = true }
@@ -42,15 +37,8 @@ rand = { workspace = true }
4237
version = "1.0"
4338
features = ["arbitrary_precision", "unbounded_depth"]
4439

45-
[dependencies.secp256k1]
46-
version = "0.24.3"
47-
features = ["serde", "recovery"]
48-
4940
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
5041
sha2 = { version = "0.10", features = ["asm"] }
5142

5243
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), any(target_os = "windows")))'.dependencies]
5344
sha2 = { version = "0.10" }
54-
55-
[features]
56-
monitoring_prom = ["prometheus"]

libstackerdb/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ path = "./src/libstackerdb.rs"
1717

1818
[dependencies]
1919
serde = "1"
20-
serde_derive = "1"
21-
serde_stacker = "0.1"
2220
stacks-common = { path = "../stacks-common" }
2321
clarity = { path = "../clarity" }
2422

stacks-signer/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ prometheus = { version = "0.9", optional = true }
3131
rand_core = "0.6"
3232
reqwest = { version = "0.11.22", default-features = false, features = ["blocking", "json", "rustls-tls"] }
3333
serde = "1"
34-
serde_derive = "1"
35-
serde_stacker = "0.1"
3634
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
3735
slog-json = { version = "2.3.0", optional = true }
3836
slog-term = "2.6.0"
@@ -62,5 +60,5 @@ features = ["serde", "recovery"]
6260

6361
[features]
6462
default = []
65-
monitoring_prom = ["libsigner/monitoring_prom", "prometheus", "tiny_http"]
63+
monitoring_prom = ["prometheus", "tiny_http"]
6664
testing = []

stackslib/Cargo.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,15 @@ rand_core = { workspace = true }
3636
rand_chacha = { workspace = true }
3737
serde = "1"
3838
serde_derive = "1"
39-
serde_stacker = "0.1"
40-
sha3 = "0.10.1"
4139
ripemd = "0.1.1"
4240
regex = "1"
4341
mio = "0.6"
4442
lazy_static = "1.4.0"
4543
url = "2.1.0"
4644
percent-encoding = "2.1.0"
4745
prometheus = { version = "0.9", optional = true }
48-
integer-sqrt = "0.1.3"
4946
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
50-
slog-term = "2.6.0"
51-
slog-json = { version = "2.3.0", optional = true }
52-
chrono = "0.4.19"
53-
libc = "0.2.82"
47+
chrono = { version = "0.4.19", optional = true }
5448
clarity = { path = "../clarity" }
5549
stacks-common = { path = "../stacks-common" }
5650
pox-locking = { path = "../pox-locking" }
@@ -97,15 +91,16 @@ rstest = "0.17.0"
9791
rstest_reuse = "0.5.0"
9892
mutants = "0.0.3"
9993
rlimit = "0.10.2"
94+
chrono = "0.4.19"
10095

10196
[features]
10297
default = []
10398
profile-sqlite = []
10499
disable-costs = []
105100
developer-mode = ["clarity/developer-mode"]
106101
monitoring_prom = ["prometheus"]
107-
slog_json = ["slog-json", "stacks-common/slog_json", "clarity/slog_json", "pox-locking/slog_json"]
108-
testing = []
102+
slog_json = ["stacks-common/slog_json", "clarity/slog_json", "pox-locking/slog_json"]
103+
testing = ["chrono"]
109104

110105
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
111106
sha2 = { version = "0.10", features = ["asm"] }

stackslib/src/config/chain_data.rs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ pub mod tests {
722722
}
723723

724724
#[test]
725+
#[cfg(unix)]
725726
fn test_get_unconfirmed_commits() {
726727
use std::os::unix::fs::PermissionsExt;
727728
let shell_code = r#"#!/bin/bash
@@ -808,6 +809,87 @@ EOF
808809
);
809810
}
810811

812+
#[test]
813+
#[cfg(windows)]
814+
fn test_get_unconfirmed_commits() {
815+
let shell_code = r#"@echo off
816+
(
817+
echo [
818+
echo {
819+
echo "txid": "73c318be8cd272a73200b9630089d77a44342d84b2c0d81c937da714152cf402",
820+
echo "burn": 555000,
821+
echo "address": "1FCcoFSKWvNyhjazNvVdLLw8mGkGdcRMux",
822+
echo "input_txid": "ef0dbf0fc4755de5e94843a4da7c1d943571299afb15f32b76bac5d18d8668ce",
823+
echo "input_index": 3,
824+
echo "pox_addrs": [
825+
echo "0014db14133a9dbb1d0e16b60513453e48b6ff2847a9",
826+
echo "a91418c42080a1e87fd02dd3fca94c4513f9ecfe741487"
827+
echo ]
828+
echo }
829+
echo ]
830+
)
831+
"#;
832+
let path = "/tmp/test-get-unconfirmed-commits.bat";
833+
if fs::metadata(path).is_ok() {
834+
fs::remove_file(path).unwrap();
835+
}
836+
{
837+
let mut f = fs::File::create(path).unwrap();
838+
f.write_all(shell_code.as_bytes()).unwrap();
839+
}
840+
841+
let ms = MinerStats {
842+
unconfirmed_commits_helper: path.to_string(),
843+
};
844+
845+
let mut commits = ms.get_unconfirmed_commits(123, &[]).unwrap();
846+
assert_eq!(commits.len(), 1);
847+
let commit = commits.pop().unwrap();
848+
849+
assert_eq!(
850+
commit.txid,
851+
Txid::from_hex("73c318be8cd272a73200b9630089d77a44342d84b2c0d81c937da714152cf402")
852+
.unwrap()
853+
);
854+
assert_eq!(commit.burn_fee, 555000);
855+
assert_eq!(
856+
commit.apparent_sender.0,
857+
"1FCcoFSKWvNyhjazNvVdLLw8mGkGdcRMux".to_string()
858+
);
859+
assert_eq!(
860+
commit.input.0,
861+
Txid::from_hex("ef0dbf0fc4755de5e94843a4da7c1d943571299afb15f32b76bac5d18d8668ce")
862+
.unwrap()
863+
);
864+
assert_eq!(commit.input.1, 3);
865+
assert_eq!(commit.block_height, 123);
866+
867+
assert_eq!(
868+
commit.commit_outs,
869+
vec![
870+
PoxAddress::Addr20(
871+
true,
872+
PoxAddressType20::P2WPKH,
873+
[
874+
219, 20, 19, 58, 157, 187, 29, 14, 22, 182, 5, 19, 69, 62, 72, 182, 255,
875+
40, 71, 169
876+
]
877+
),
878+
PoxAddress::Standard(
879+
StacksAddress::new(
880+
20,
881+
Hash160([
882+
0x18, 0xc4, 0x20, 0x80, 0xa1, 0xe8, 0x7f, 0xd0, 0x2d, 0xd3, 0xfc, 0xa9,
883+
0x4c, 0x45, 0x13, 0xf9, 0xec, 0xfe, 0x74, 0x14
884+
])
885+
)
886+
.unwrap(),
887+
None
888+
)
889+
]
890+
);
891+
}
892+
811893
#[test]
812894
fn test_get_spend_and_win_distribution() {
813895
let active_miners_and_commits = vec![

stackslib/src/net/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2883,9 +2883,10 @@ pub mod test {
28832883
pub fn test_path(config: &TestPeerConfig) -> String {
28842884
let random = thread_rng().gen::<u64>();
28852885
let random_bytes = to_hex(&random.to_be_bytes());
2886+
let cleaned_config_test_name = config.test_name.replace("::", "_");
28862887
format!(
28872888
"/tmp/stacks-node-tests/units-test-peer/{}-{}",
2888-
&config.test_name, random_bytes
2889+
&cleaned_config_test_name, random_bytes
28892890
)
28902891
}
28912892

stackslib/src/net/tests/convergence.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,28 @@ use std::collections::{HashMap, HashSet};
2121
use clarity::vm::types::{QualifiedContractIdentifier, StandardPrincipalData};
2222
use rand::prelude::*;
2323
use rand::thread_rng;
24-
use rlimit;
2524

2625
use crate::core::PEER_VERSION_TESTNET;
2726
use crate::net::db::*;
2827
use crate::net::test::*;
2928
use crate::net::*;
3029
use crate::util_lib::test::*;
3130

31+
#[cfg(unix)]
3232
fn setup_rlimit_nofiles() {
33+
use rlimit;
3334
info!("Attempt to set nofile rlimit to 4096 (required for these tests to run)");
3435
assert!(rlimit::Resource::NOFILE.get().is_ok());
3536
let (slimit, hlimit) = rlimit::getrlimit(rlimit::Resource::NOFILE).unwrap();
3637
rlimit::setrlimit(rlimit::Resource::NOFILE, 4096.max(slimit), hlimit).unwrap();
3738
info!("Successfully set nofile rlimit to 4096");
3839
}
3940

41+
#[cfg(windows)]
42+
fn setup_rlimit_nofiles() {
43+
// rlimit empty stub, since windows hasn't a hard file descriptor limit
44+
}
45+
4046
fn stacker_db_id(i: usize) -> QualifiedContractIdentifier {
4147
QualifiedContractIdentifier::new(
4248
StandardPrincipalData::new(0x01, [i as u8; 20]).unwrap(),

testnet/stacks-node/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ regex = "1"
2525
libsigner = { path = "../../libsigner" }
2626
url = "2.1.0"
2727
rand = { workspace = true }
28-
rand_core = { workspace = true }
2928
hashbrown = { workspace = true }
3029
rusqlite = { workspace = true }
3130
async-h1 = { version = "2.3.2", optional = true }
@@ -62,7 +61,7 @@ name = "stacks-events"
6261
path = "src/stacks_events.rs"
6362

6463
[features]
65-
monitoring_prom = ["stacks/monitoring_prom", "libsigner/monitoring_prom", "stacks-signer/monitoring_prom", "async-h1", "async-std", "http-types"]
64+
monitoring_prom = ["stacks/monitoring_prom", "stacks-signer/monitoring_prom", "async-h1", "async-std", "http-types"]
6665
slog_json = ["stacks/slog_json", "stacks-common/slog_json", "clarity/slog_json"]
6766
prod-genesis-chainstate = []
6867
default = []

0 commit comments

Comments
 (0)