Skip to content

Commit c240216

Browse files
committed
chore: use MAX instead of max_value() for numeric types, #3682
1 parent 33c05d1 commit c240216

File tree

9 files changed

+74
-74
lines changed

9 files changed

+74
-74
lines changed

stackslib/src/chainstate/coordinator/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4854,7 +4854,7 @@ fn test_epoch_verify_active_pox_contract() {
48544854
let _r = std::fs::remove_dir_all(path);
48554855

48564856
let pox_v1_unlock_ht = 12;
4857-
let pox_v2_unlock_ht = u32::max_value();
4857+
let pox_v2_unlock_ht = u32::MAX;
48584858
let sunset_ht = 8000;
48594859
let pox_consts = Some(PoxConstants::new(
48604860
6,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ fn bitcoind_integration(segwit_flag: bool) {
141141
conf.burnchain.password = Some("secret".to_string());
142142
conf.burnchain.local_mining_public_key = Some("04ee0b1602eb18fef7986887a7e8769a30c9df981d33c8380d255edef003abdcd243a0eb74afdf6740e6c423e62aec631519a24cf5b1d62bf8a3e06ddc695dcb77".to_string());
143143

144-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
145-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
144+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
145+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
146146
conf.miner.segwit = segwit_flag;
147147

148148
conf.initial_balances.push(InitialBalance {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,8 @@ fn bigger_microblock_streams_in_2_05() {
982982
conf.node.max_microblocks = 65536;
983983
conf.burnchain.max_rbf = 1000000;
984984

985-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
986-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
985+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
986+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
987987

988988
conf.burnchain.epochs = Some(vec![
989989
StacksEpoch {

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ fn advance_to_2_1(
9797
4 * prepare_phase_len / 5,
9898
5,
9999
15,
100-
u64::max_value() - 2,
101-
u64::max_value() - 1,
102-
u32::max_value(),
100+
u64::MAX - 2,
101+
u64::MAX - 1,
102+
u32::MAX,
103103
u32::MAX,
104104
u32::MAX,
105105
));
@@ -600,7 +600,7 @@ fn transition_fixes_bitcoin_rigidity() {
600600
15,
601601
(16 * reward_cycle_len - 1).into(),
602602
(17 * reward_cycle_len).into(),
603-
u32::max_value(),
603+
u32::MAX,
604604
u32::MAX,
605605
u32::MAX,
606606
);
@@ -1042,8 +1042,8 @@ fn transition_adds_get_pox_addr_recipients() {
10421042
4 * prepare_phase_len / 5,
10431043
1,
10441044
1,
1045-
u64::max_value() - 2,
1046-
u64::max_value() - 1,
1045+
u64::MAX - 2,
1046+
u64::MAX - 1,
10471047
v1_unlock_height,
10481048
u32::MAX,
10491049
u32::MAX,
@@ -1806,8 +1806,8 @@ fn transition_empty_blocks() {
18061806
4 * prepare_phase_len / 5,
18071807
5,
18081808
15,
1809-
u64::max_value() - 2,
1810-
u64::max_value() - 1,
1809+
u64::MAX - 2,
1810+
u64::MAX - 1,
18111811
(epoch_2_1 + 1) as u32,
18121812
u32::MAX,
18131813
u32::MAX,
@@ -4752,7 +4752,7 @@ fn trait_invocation_cross_epoch() {
47524752
15,
47534753
(16 * reward_cycle_len - 1).into(),
47544754
(17 * reward_cycle_len).into(),
4755-
u32::max_value(),
4755+
u32::MAX,
47564756
u32::MAX,
47574757
u32::MAX,
47584758
);
@@ -4969,8 +4969,8 @@ fn test_v1_unlock_height_with_current_stackers() {
49694969
conf.node.wait_time_for_blocks = 1_000;
49704970
conf.miner.wait_for_block_download = false;
49714971

4972-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
4973-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
4972+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
4973+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
49744974

49754975
test_observer::spawn();
49764976

@@ -4995,8 +4995,8 @@ fn test_v1_unlock_height_with_current_stackers() {
49954995
4 * prepare_phase_len / 5,
49964996
5,
49974997
15,
4998-
u64::max_value() - 2,
4999-
u64::max_value() - 1,
4998+
u64::MAX - 2,
4999+
u64::MAX - 1,
50005000
v1_unlock_height as u32,
50015001
u32::MAX,
50025002
u32::MAX,
@@ -5233,8 +5233,8 @@ fn test_v1_unlock_height_with_delay_and_current_stackers() {
52335233
conf.node.wait_time_for_blocks = 1_000;
52345234
conf.miner.wait_for_block_download = false;
52355235

5236-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
5237-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
5236+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
5237+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
52385238

52395239
test_observer::spawn();
52405240

@@ -5259,8 +5259,8 @@ fn test_v1_unlock_height_with_delay_and_current_stackers() {
52595259
4 * prepare_phase_len / 5,
52605260
5,
52615261
15,
5262-
u64::max_value() - 2,
5263-
u64::max_value() - 1,
5262+
u64::MAX - 2,
5263+
u64::MAX - 1,
52645264
v1_unlock_height as u32,
52655265
u32::MAX,
52665266
u32::MAX,

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ fn disable_pox() {
130130
conf.node.wait_time_for_blocks = 1_000;
131131
conf.miner.wait_for_block_download = false;
132132

133-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
134-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
133+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
134+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
135135

136136
test_observer::spawn();
137137

@@ -160,8 +160,8 @@ fn disable_pox() {
160160
4 * prepare_phase_len / 5,
161161
5,
162162
15,
163-
u64::max_value() - 2,
164-
u64::max_value() - 1,
163+
u64::MAX - 2,
164+
u64::MAX - 1,
165165
v1_unlock_height as u32,
166166
epoch_2_2 as u32 + 1,
167167
u32::MAX,
@@ -662,8 +662,8 @@ fn pox_2_unlock_all() {
662662
conf.node.wait_time_for_blocks = 1_000;
663663
conf.miner.wait_for_block_download = false;
664664

665-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
666-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
665+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
666+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
667667

668668
test_observer::spawn();
669669

@@ -692,8 +692,8 @@ fn pox_2_unlock_all() {
692692
4 * prepare_phase_len / 5,
693693
5,
694694
15,
695-
u64::max_value() - 2,
696-
u64::max_value() - 1,
695+
u64::MAX - 2,
696+
u64::MAX - 1,
697697
v1_unlock_height as u32,
698698
epoch_2_2 as u32 + 1,
699699
u32::MAX,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ fn trait_invocation_behavior() {
9696
conf.node.wait_time_for_blocks = 1_000;
9797
conf.miner.wait_for_block_download = false;
9898

99-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
100-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
99+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
100+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
101101

102102
test_observer::spawn();
103103

@@ -128,8 +128,8 @@ fn trait_invocation_behavior() {
128128
4 * prepare_phase_len / 5,
129129
5,
130130
15,
131-
u64::max_value() - 2,
132-
u64::max_value() - 1,
131+
u64::MAX - 2,
132+
u64::MAX - 1,
133133
v1_unlock_height as u32,
134134
epoch_2_2 as u32 + 1,
135135
u32::MAX,

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ fn fix_to_pox_contract() {
148148
conf.node.wait_time_for_blocks = 1_000;
149149
conf.miner.wait_for_block_download = false;
150150

151-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
152-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
151+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
152+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
153153

154154
test_observer::spawn();
155155

@@ -182,8 +182,8 @@ fn fix_to_pox_contract() {
182182
4 * prepare_phase_len / 5,
183183
5,
184184
15,
185-
u64::max_value() - 2,
186-
u64::max_value() - 1,
185+
u64::MAX - 2,
186+
u64::MAX - 1,
187187
v1_unlock_height as u32,
188188
epoch_2_2 as u32 + 1,
189189
pox_3_activation_height as u32,
@@ -786,8 +786,8 @@ fn verify_auto_unlock_behavior() {
786786
conf.node.wait_time_for_blocks = 1_000;
787787
conf.miner.wait_for_block_download = false;
788788

789-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
790-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
789+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
790+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
791791

792792
test_observer::spawn();
793793

@@ -820,8 +820,8 @@ fn verify_auto_unlock_behavior() {
820820
4 * prepare_phase_len / 5,
821821
5,
822822
15,
823-
u64::max_value() - 2,
824-
u64::max_value() - 1,
823+
u64::MAX - 2,
824+
u64::MAX - 1,
825825
v1_unlock_height as u32,
826826
epoch_2_2 as u32 + 1,
827827
pox_3_activation_height as u32,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ fn integration_test_get_info() {
181181
});
182182

183183
conf.burnchain.commit_anchor_block_within = 5000;
184-
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
185-
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
184+
conf.miner.first_attempt_time_ms = i64::MAX as u64;
185+
conf.miner.subsequent_attempt_time_ms = i64::MAX as u64;
186186

187187
let num_rounds = 5;
188188

0 commit comments

Comments
 (0)