Skip to content

Commit 34fe70a

Browse files
authored
Merge branch 'develop' into sidecar-scripts
2 parents c871c05 + 33c64f6 commit 34fe70a

File tree

10 files changed

+78
-74
lines changed

10 files changed

+78
-74
lines changed

clarity/src/vm/types/signatures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::vm::types::{
3939

4040
type Result<R> = std::result::Result<R, CheckErrors>;
4141

42-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
42+
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Serialize, Deserialize, Hash)]
4343
pub struct AssetIdentifier {
4444
pub contract_identifier: QualifiedContractIdentifier,
4545
pub asset_name: ClarityName,

testnet/stacks-node/src/config.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::HashSet;
12
use std::convert::TryInto;
23
use std::fs;
34
use std::net::{SocketAddr, ToSocketAddrs};
@@ -44,7 +45,7 @@ pub struct ConfigFile {
4445
pub burnchain: Option<BurnchainConfigFile>,
4546
pub node: Option<NodeConfigFile>,
4647
pub ustx_balance: Option<Vec<InitialBalanceFile>>,
47-
pub events_observer: Option<Vec<EventObserverConfigFile>>,
48+
pub events_observer: Option<HashSet<EventObserverConfigFile>>,
4849
pub connection_options: Option<ConnectionOptionsFile>,
4950
pub fee_estimation: Option<FeeEstimationConfigFile>,
5051
pub miner: Option<MinerConfigFile>,
@@ -353,7 +354,7 @@ pub struct Config {
353354
pub burnchain: BurnchainConfig,
354355
pub node: NodeConfig,
355356
pub initial_balances: Vec<InitialBalance>,
356-
pub events_observers: Vec<EventObserverConfig>,
357+
pub events_observers: HashSet<EventObserverConfig>,
357358
pub connection_options: ConnectionOptions,
358359
pub miner: MinerConfig,
359360
pub estimation: FeeEstimationConfig,
@@ -979,7 +980,7 @@ impl Config {
979980

980981
let mut events_observers = match config_file.events_observer {
981982
Some(raw_observers) => {
982-
let mut observers = vec![];
983+
let mut observers = HashSet::new();
983984
for observer in raw_observers {
984985
let events_keys: Vec<EventKeyType> = observer
985986
.events_keys
@@ -989,22 +990,25 @@ impl Config {
989990

990991
let endpoint = format!("{}", observer.endpoint);
991992

992-
observers.push(EventObserverConfig {
993+
observers.insert(EventObserverConfig {
993994
endpoint,
994995
events_keys,
995996
});
996997
}
997998
observers
998999
}
999-
None => vec![],
1000+
None => HashSet::new(),
10001001
};
10011002

10021003
// check for observer config in env vars
10031004
match std::env::var("STACKS_EVENT_OBSERVER") {
1004-
Ok(val) => events_observers.push(EventObserverConfig {
1005-
endpoint: val,
1006-
events_keys: vec![EventKeyType::AnyEvent],
1007-
}),
1005+
Ok(val) => {
1006+
events_observers.insert(EventObserverConfig {
1007+
endpoint: val,
1008+
events_keys: vec![EventKeyType::AnyEvent],
1009+
});
1010+
()
1011+
}
10081012
_ => (),
10091013
};
10101014

@@ -1347,7 +1351,7 @@ impl std::default::Default for Config {
13471351
burnchain,
13481352
node,
13491353
initial_balances: vec![],
1350-
events_observers: vec![],
1354+
events_observers: HashSet::new(),
13511355
connection_options,
13521356
estimation,
13531357
miner: MinerConfig::default(),
@@ -2079,19 +2083,19 @@ impl AtlasConfigFile {
20792083
}
20802084
}
20812085

2082-
#[derive(Clone, Deserialize, Default, Debug)]
2086+
#[derive(Clone, Deserialize, Default, Debug, Hash, PartialEq, Eq, PartialOrd)]
20832087
pub struct EventObserverConfigFile {
20842088
pub endpoint: String,
20852089
pub events_keys: Vec<String>,
20862090
}
20872091

2088-
#[derive(Clone, Default, Debug)]
2092+
#[derive(Clone, Default, Debug, Hash, PartialEq, Eq, PartialOrd)]
20892093
pub struct EventObserverConfig {
20902094
pub endpoint: String,
20912095
pub events_keys: Vec<EventKeyType>,
20922096
}
20932097

2094-
#[derive(Clone, Debug)]
2098+
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd)]
20952099
pub enum EventKeyType {
20962100
SmartContractEvent((QualifiedContractIdentifier, String)),
20972101
AssetEvent(AssetIdentifier),

testnet/stacks-node/src/tests/epoch_205.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn test_exact_block_costs() {
110110
.collect();
111111

112112
test_observer::spawn();
113-
conf.events_observers.push(EventObserverConfig {
113+
conf.events_observers.insert(EventObserverConfig {
114114
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
115115
events_keys: vec![EventKeyType::AnyEvent, EventKeyType::MinedBlocks],
116116
});
@@ -336,7 +336,7 @@ fn test_dynamic_db_method_costs() {
336336
};
337337

338338
test_observer::spawn();
339-
conf.events_observers.push(EventObserverConfig {
339+
conf.events_observers.insert(EventObserverConfig {
340340
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
341341
events_keys: vec![EventKeyType::AnyEvent],
342342
});
@@ -772,7 +772,7 @@ fn test_cost_limit_switch_version205() {
772772
});
773773

774774
test_observer::spawn();
775-
conf.events_observers.push(EventObserverConfig {
775+
conf.events_observers.insert(EventObserverConfig {
776776
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
777777
events_keys: vec![EventKeyType::AnyEvent],
778778
});
@@ -920,7 +920,7 @@ fn bigger_microblock_streams_in_2_05() {
920920
&format!("large-{}", ix),
921921
&format!("
922922
;; a single one of these transactions consumes over half the runtime budget
923-
(define-constant BUFF_TO_BYTE (list
923+
(define-constant BUFF_TO_BYTE (list
924924
0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f
925925
0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f
926926
0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f
@@ -1030,7 +1030,7 @@ fn bigger_microblock_streams_in_2_05() {
10301030
conf.burnchain.pox_2_activation = Some(10_003);
10311031

10321032
test_observer::spawn();
1033-
conf.events_observers.push(EventObserverConfig {
1033+
conf.events_observers.insert(EventObserverConfig {
10341034
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
10351035
events_keys: vec![EventKeyType::AnyEvent],
10361036
});

testnet/stacks-node/src/tests/epoch_21.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn advance_to_2_1(
7272
conf.initial_balances.append(&mut initial_balances);
7373
conf.miner.block_reward_recipient = block_reward_recipient;
7474

75-
conf.events_observers.push(EventObserverConfig {
75+
conf.events_observers.insert(EventObserverConfig {
7676
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
7777
events_keys: vec![EventKeyType::AnyEvent],
7878
});
@@ -573,7 +573,7 @@ fn transition_fixes_bitcoin_rigidity() {
573573
];
574574

575575
conf.initial_balances.append(&mut initial_balances);
576-
conf.events_observers.push(EventObserverConfig {
576+
conf.events_observers.insert(EventObserverConfig {
577577
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
578578
events_keys: vec![EventKeyType::AnyEvent],
579579
});
@@ -1461,7 +1461,7 @@ fn transition_removes_pox_sunset() {
14611461

14621462
test_observer::spawn();
14631463

1464-
conf.events_observers.push(EventObserverConfig {
1464+
conf.events_observers.insert(EventObserverConfig {
14651465
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
14661466
events_keys: vec![EventKeyType::AnyEvent],
14671467
});
@@ -1775,7 +1775,7 @@ fn transition_empty_blocks() {
17751775

17761776
test_observer::spawn();
17771777

1778-
conf.events_observers.push(EventObserverConfig {
1778+
conf.events_observers.insert(EventObserverConfig {
17791779
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
17801780
events_keys: vec![EventKeyType::AnyEvent],
17811781
});
@@ -4716,7 +4716,7 @@ fn trait_invocation_cross_epoch() {
47164716
amount: 200_000_000,
47174717
}];
47184718
conf.initial_balances.append(&mut initial_balances);
4719-
conf.events_observers.push(EventObserverConfig {
4719+
conf.events_observers.insert(EventObserverConfig {
47204720
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
47214721
events_keys: vec![EventKeyType::AnyEvent],
47224722
});
@@ -4962,7 +4962,7 @@ fn test_v1_unlock_height_with_current_stackers() {
49624962

49634963
test_observer::spawn();
49644964

4965-
conf.events_observers.push(EventObserverConfig {
4965+
conf.events_observers.insert(EventObserverConfig {
49664966
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
49674967
events_keys: vec![EventKeyType::AnyEvent],
49684968
});
@@ -5224,7 +5224,7 @@ fn test_v1_unlock_height_with_delay_and_current_stackers() {
52245224

52255225
test_observer::spawn();
52265226

5227-
conf.events_observers.push(EventObserverConfig {
5227+
conf.events_observers.insert(EventObserverConfig {
52285228
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
52295229
events_keys: vec![EventKeyType::AnyEvent],
52305230
});

testnet/stacks-node/src/tests/epoch_22.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn disable_pox() {
136136

137137
test_observer::spawn();
138138

139-
conf.events_observers.push(EventObserverConfig {
139+
conf.events_observers.insert(EventObserverConfig {
140140
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
141141
events_keys: vec![EventKeyType::AnyEvent],
142142
});
@@ -666,7 +666,7 @@ fn pox_2_unlock_all() {
666666

667667
test_observer::spawn();
668668

669-
conf.events_observers.push(EventObserverConfig {
669+
conf.events_observers.insert(EventObserverConfig {
670670
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
671671
events_keys: vec![EventKeyType::AnyEvent],
672672
});

testnet/stacks-node/src/tests/epoch_23.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn trait_invocation_behavior() {
102102

103103
test_observer::spawn();
104104

105-
conf.events_observers.push(EventObserverConfig {
105+
conf.events_observers.insert(EventObserverConfig {
106106
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
107107
events_keys: vec![EventKeyType::AnyEvent],
108108
});

testnet/stacks-node/src/tests/epoch_24.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn fix_to_pox_contract() {
154154

155155
test_observer::spawn();
156156

157-
conf.events_observers.push(EventObserverConfig {
157+
conf.events_observers.insert(EventObserverConfig {
158158
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
159159
events_keys: vec![EventKeyType::AnyEvent],
160160
});
@@ -790,7 +790,7 @@ fn verify_auto_unlock_behavior() {
790790

791791
test_observer::spawn();
792792

793-
conf.events_observers.push(EventObserverConfig {
793+
conf.events_observers.insert(EventObserverConfig {
794794
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
795795
events_keys: vec![EventKeyType::AnyEvent],
796796
});

0 commit comments

Comments
 (0)