Problem
The Testimonial struct uses uint256 for timestamp, burning storage for no reason. To put that in perspective:
| Type |
Max timestamp stores until |
Size |
uint32 |
February 7, 2106 |
4 bytes |
uint64 |
July 21, 584,554,051,223 AD |
8 bytes |
uint256 |
~year 3.67 × 10⁶⁹ (post heat-death of universe) |
32 bytes |
We're paying for uint256 when uint64 already covers timestamps half a trillion years into the future. Because of this the struct unnecessarily occupies 7 storage slots instead of 6.
Fix
- Change
timestamp from uint256 → uint64 in VouchMe.sol
- Reorder struct fields so
timestamp (8 bytes) + receiver (20 bytes) + verified (1 byte) pack cleanly into one 32-byte slot
- Update
VouchMe.json, VouchMe.ts, and factory files to match the new ABI
No frontend logic changes needed ethers.js maps uint64 to bigint exactly as it did for uint256.
Why it matters
Tighter packing = fewer storage slots = less gas on every write, and the savings compound on array-heavy operations:
- Basic testimonial creation: ~6% cheaper
- Large-scale deletion: ~9.8% cheaper (444k gas saved)
- Fuzz array management (mean over 256 runs): ~14.5% cheaper (652k gas saved)
Problem
The
Testimonialstruct usesuint256fortimestamp, burning storage for no reason. To put that in perspective:uint32uint64uint256We're paying for
uint256whenuint64already covers timestamps half a trillion years into the future. Because of this the struct unnecessarily occupies 7 storage slots instead of 6.Fix
timestampfromuint256→uint64inVouchMe.soltimestamp(8 bytes) +receiver(20 bytes) +verified(1 byte) pack cleanly into one 32-byte slotVouchMe.json,VouchMe.ts, and factory files to match the new ABINo frontend logic changes needed
ethers.jsmapsuint64tobigintexactly as it did foruint256.Why it matters
Tighter packing = fewer storage slots = less gas on every write, and the savings compound on array-heavy operations: