Skip to content

Commit 1ed2643

Browse files
committed
fix: clippy div_ceil and fmt in upload costs test
1 parent 87a582a commit 1ed2643

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

ant-core/tests/e2e_upload_costs.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ async fn measure_upload_cost(
102102

103103
// Estimate tx count based on mode and chunk count
104104
let tx_estimate = match mode {
105-
PaymentMode::Single => format!("~{}", (result.chunks_stored + 255) / 256),
105+
PaymentMode::Single => format!("~{}", result.chunks_stored.div_ceil(256)),
106106
PaymentMode::Merkle => {
107-
let sub_batches = (result.chunks_stored + 255) / 256;
107+
let sub_batches = result.chunks_stored.div_ceil(256);
108108
format!("{sub_batches}")
109109
}
110110
PaymentMode::Auto => format!("{:?}", result.payment_mode_used),
@@ -193,16 +193,20 @@ async fn test_upload_cost_comparison() {
193193

194194
let work_dir = TempDir::new().expect("create work dir");
195195

196-
// Sizes chosen for speed while covering key scenarios:
197-
// 10 MB -> ~3 chunks (tiny, below merkle threshold)
198-
// 50 MB -> ~13 chunks (small, below 64-chunk wave)
199-
// 200 MB -> ~54 chunks (near wave boundary)
200-
// 500 MB -> ~128 chunks (multi-wave, multi-batch merkle boundary)
196+
// Sizes covering single-wave through multi-batch merkle scenarios.
197+
// 10 MB -> ~3 chunks (tiny, below merkle threshold)
198+
// 50 MB -> ~13 chunks (small, below 64-chunk wave)
199+
// 200 MB -> ~54 chunks (near wave boundary)
200+
// 500 MB -> ~128 chunks (multi-wave, near merkle 256-leaf limit)
201+
// 2 GB -> ~512 chunks (multi-batch merkle: 2 sub-batches)
202+
// 4 GB -> ~1024 chunks (multi-batch merkle: 4 sub-batches)
201203
let sizes: Vec<(u64, &str)> = vec![
202204
(10, "10mb.bin"),
203205
(50, "50mb.bin"),
204206
(200, "200mb.bin"),
205207
(500, "500mb.bin"),
208+
(2048, "2gb.bin"),
209+
(4096, "4gb.bin"),
206210
];
207211

208212
let mut results = Vec::new();
@@ -226,8 +230,7 @@ async fn test_upload_cost_comparison() {
226230
);
227231
eprintln!(" Uploading (Single)...");
228232
let single_result =
229-
measure_upload_cost(&client, wallet, &single_path, PaymentMode::Single, *size_mb)
230-
.await;
233+
measure_upload_cost(&client, wallet, &single_path, PaymentMode::Single, *size_mb).await;
231234
eprintln!(
232235
" {} chunks, ANT: {}, Gas: {}",
233236
single_result.chunks,
@@ -246,8 +249,7 @@ async fn test_upload_cost_comparison() {
246249
);
247250
eprintln!(" Uploading (Merkle)...");
248251
let merkle_result =
249-
measure_upload_cost(&client, wallet, &merkle_path, PaymentMode::Merkle, *size_mb)
250-
.await;
252+
measure_upload_cost(&client, wallet, &merkle_path, PaymentMode::Merkle, *size_mb).await;
251253
eprintln!(
252254
" {} chunks, ANT: {}, Gas: {}",
253255
merkle_result.chunks,

0 commit comments

Comments
 (0)