Merge pull request #3735 from BitcoinL2-Labs/refactor/replace-deprecated-num-max-value

Refactor `u32::max_value()` with `u32::MAX`
This commit is contained in:
pavitthrap
2023-06-06 12:12:42 -04:00
committed by GitHub
8 changed files with 14 additions and 22 deletions

View File

@@ -2764,7 +2764,7 @@ mod test {
Some(StacksEpoch {
epoch_id: StacksEpochId::Epoch21,
start_height: 0,
end_height: u64::max_value(),
end_height: u64::MAX,
block_limit: ExecutionCost::max_value(),
network_epoch: PEER_VERSION_EPOCH_2_1,
})

View File

@@ -149,7 +149,7 @@ impl ClarityTestSim {
marf,
height: 0,
fork: 0,
epoch_bounds: vec![0, u64::max_value()],
epoch_bounds: vec![0, u64::MAX],
}
}
@@ -390,7 +390,7 @@ impl BurnStateDB for TestSimBurnStateDB {
.epoch_bounds
.get(epoch_begin_index + 1)
.cloned()
.unwrap_or(u64::max_value()),
.unwrap_or(u64::MAX),
epoch_id,
block_limit: ExecutionCost::max_value(),
network_epoch: PEER_VERSION_EPOCH_1_0,

View File

@@ -177,7 +177,7 @@ pub struct BlockBuilderSettings {
impl BlockBuilderSettings {
pub fn limited() -> BlockBuilderSettings {
BlockBuilderSettings {
max_miner_time_ms: u64::max_value(),
max_miner_time_ms: u64::MAX,
mempool_settings: MemPoolWalkSettings::default(),
miner_status: Arc::new(Mutex::new(MinerStatus::make_ready(0))),
}
@@ -185,7 +185,7 @@ impl BlockBuilderSettings {
pub fn max_value() -> BlockBuilderSettings {
BlockBuilderSettings {
max_miner_time_ms: u64::max_value(),
max_miner_time_ms: u64::MAX,
mempool_settings: MemPoolWalkSettings::zero(),
miner_status: Arc::new(Mutex::new(MinerStatus::make_ready(0))),
}

View File

@@ -314,7 +314,7 @@ impl MemPoolWalkSettings {
pub fn default() -> MemPoolWalkSettings {
MemPoolWalkSettings {
min_tx_fee: 1,
max_walk_time_ms: u64::max_value(),
max_walk_time_ms: u64::MAX,
consider_no_estimate_tx_prob: 5,
nonce_cache_size: 1024 * 1024,
candidate_retry_cache_size: 64 * 1024,
@@ -323,7 +323,7 @@ impl MemPoolWalkSettings {
pub fn zero() -> MemPoolWalkSettings {
MemPoolWalkSettings {
min_tx_fee: 0,
max_walk_time_ms: u64::max_value(),
max_walk_time_ms: u64::MAX,
consider_no_estimate_tx_prob: 5,
nonce_cache_size: 1024 * 1024,
candidate_retry_cache_size: 64 * 1024,

View File

@@ -148,7 +148,7 @@ impl Samples {
fn flush_sqlite(&self, tx: &SqliteTransaction, identifier: &str) {
let sql = "INSERT OR REPLACE INTO pessimistic_estimator
(estimate_key, current_value, samples) VALUES (?, ?, ?)";
let current_value = u64_to_sql(self.mean()).unwrap_or_else(|_| i64::max_value());
let current_value = u64_to_sql(self.mean()).unwrap_or_else(|_| i64::MAX);
tx.execute(
sql,
rusqlite::params![identifier, current_value, self.to_json()],

View File

@@ -1269,7 +1269,7 @@ mod tests {
assert_eq!(parse_chunk_size(b"567xf8a\r\n"), Err(Error::ChunkSize));
assert_eq!(
parse_chunk_size(b"ffffffffffffffff\r\n"),
Ok(Status::Complete((18, u64::max_value())))
Ok(Status::Complete((18, u64::MAX)))
);
assert_eq!(
parse_chunk_size(b"1ffffffffffffffff\r\n"),

View File

@@ -734,8 +734,8 @@ simulating a miner.
let sort_db_path = format!("{}/mainnet/burnchain/sortition", &argv[2]);
let chain_state_path = format!("{}/mainnet/chainstate/", &argv[2]);
let mut min_fee = u64::max_value();
let mut max_time = u64::max_value();
let mut min_fee = u64::MAX;
let mut max_time = u64::MAX;
if argv.len() >= 4 {
min_fee = argv[3].parse().expect("Could not parse min_fee");
@@ -1122,11 +1122,7 @@ simulating a miner.
let burnchain = Burnchain::regtest(&burnchain_db_path);
let first_burnchain_block_height = burnchain.first_block_height;
let first_burnchain_block_hash = burnchain.first_block_hash;
let epochs = StacksEpoch::all(
first_burnchain_block_height,
u64::max_value(),
u64::max_value(),
);
let epochs = StacksEpoch::all(first_burnchain_block_height, u64::MAX, u64::MAX);
let (mut new_sortition_db, _) = burnchain
.connect_db(
true,
@@ -1211,11 +1207,7 @@ simulating a miner.
let mut known_stacks_blocks = HashSet::new();
let mut next_arrival = 0;
let epochs = StacksEpoch::all(
first_burnchain_block_height,
u64::max_value(),
u64::max_value(),
);
let epochs = StacksEpoch::all(first_burnchain_block_height, u64::MAX, u64::MAX);
let (p2p_new_sortition_db, _) = burnchain
.connect_db(

View File

@@ -57,7 +57,7 @@ impl OutPoint {
pub fn null() -> OutPoint {
OutPoint {
txid: Default::default(),
vout: u32::max_value(),
vout: u32::MAX,
}
}