Skip to content

Commit 2d9f24d

Browse files
committed
Replace 'precision' with 'resolution' across site, add negative-input validation
Fix remaining 'precision' wording in the homepage Gas Savings card and README header. Add shift/targetBits range checks in the playground so negative or zero values show an error message immediately.
1 parent 936af83 commit 2d9f24d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Staking Case: Gas Usage Reduction](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/0xferit/uint-quantization-lib/gh-badges/.badges/staking-savings.json)](test/showcase/ShowcaseGas.t.sol)
44
[![Extreme Case: Gas Usage Reduction](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/0xferit/uint-quantization-lib/gh-badges/.badges/extreme-savings.json)](test/showcase/ShowcaseGas.t.sol)
55

6-
Token amounts carry 18 decimals of precision. Timestamps fit in 40 bits but live in `uint64`. Oracle prices, counters, accumulated fees: most on-chain values use far more resolution than the application needs, and every extra storage slot costs 20,000 gas on a cold write.
6+
Token amounts carry 18 decimals of resolution. Timestamps fit in 40 bits but live in `uint64`. Oracle prices, counters, accumulated fees: most on-chain values use far more resolution than the application needs, and every extra storage slot costs 20,000 gas on a cold write.
77

88
This library quantizes `uint256` values via right-shift compression, packing more fields per storage slot and cutting gas on every write.
99

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ <h2 class="section-title sr">Why Quantization?</h2>
163163
<div class="card-grid">
164164
<div class="card sr" style="transition-delay:0.1s">
165165
<h3>Gas Savings</h3>
166-
<p>Compress values that don't need full uint256 precision so more fields fit per storage slot, cutting SSTORE/SLOAD costs.</p>
166+
<p>Compress values that don't need full uint256 resolution so more fields fit per storage slot, cutting SSTORE/SLOAD costs.</p>
167167
</div>
168168
</div>
169169
</section>

playground.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@
395395

396396
function fieldError(f) {
397397
if (!f.quantized) return '';
398+
if (f.shift < 0) return 'shift must be non-negative';
399+
if (f.targetBits < 1) return 'targetBits must be at least 1';
398400
if (f.shift + f.targetBits > 256) return 'shift + targetBits exceeds 256';
399401
if (ceilTo8(f.targetBits) >= f.bits) return 'quantized type must be smaller than original';
400402
return '';

0 commit comments

Comments
 (0)