From 22517e8fe0bbe50cc87abd97569dcf8019df3819 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 12 Apr 2026 14:05:15 +0800 Subject: [PATCH] graph: Round BigInt cache weight up to full bytes Use ceiling division when converting bit length to bytes so values whose bit width is not a multiple of eight are not undercounted for cache accounting. --- graph/src/util/cache_weight.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graph/src/util/cache_weight.rs b/graph/src/util/cache_weight.rs index b560906fdc0..479433fd31a 100644 --- a/graph/src/util/cache_weight.rs +++ b/graph/src/util/cache_weight.rs @@ -140,7 +140,7 @@ impl CacheWeight for BigDecimal { impl CacheWeight for BigInt { fn indirect_weight(&self) -> usize { - self.bits() / 8 + (self.bits() + 7) / 8 } }