Assume timestamps can fit into uint32 and tokenBalances and ethBalances can fit into uint128. The most unsafe assumption here is that tokenBalances fit into uint128, but you would be hard-pressed to find many actual tokens where this is not the case.
Then Account can take 1 storage slot instead of 2, Checkpoint can take 1 storage slot instead of 2, and Medianizer can fit tail, pendingStartTimestamp, and latestTimestamp into one storage slot.
This should dramatically reduce the gas costs of poke, possibly by up to 75% since SSTORE operations are likely the majority of the gas costs
Assume timestamps can fit into
uint32andtokenBalancesandethBalancescan fit intouint128. The most unsafe assumption here is thattokenBalancesfit intouint128, but you would be hard-pressed to find many actual tokens where this is not the case.Then Account can take 1 storage slot instead of 2, Checkpoint can take 1 storage slot instead of 2, and Medianizer can fit
tail,pendingStartTimestamp, andlatestTimestampinto one storage slot.This should dramatically reduce the gas costs of poke, possibly by up to 75% since
SSTOREoperations are likely the majority of the gas costs