My contract has a lot of
uint256 constant fields that are later used for various calculations. I am close to reaching the maximum allowed contract size and I am looking for optimizations.
I see that having some fields as
uint8 instead of
uint256 reduces size of the bytecode but at the same time, knowing that for
uint8 operations need to downscale and cost more gas I don't want to trade contract bytecode size and the cost of deployment paid once for more expensive day-to-day contract function calls.
Is there any solution allowing storing smaller fields in non 256-bit slots and not paying the cost of downscaling later, during every single operation using those fields?