Open code423n4 opened 3 years ago
Am not convinced that caching the
tokenSchedules[target_]
would actually save the gas of a storage read as implied by the warden
The tokenSchedules
variable is fundamentally a pointer to storage, the position is calculated via KECCAK256
of the name of the variable and then the offset is calculated using the size of the struct and further offset based on the type of variable for target
I'm guessing by saving the pointer you'd save the extra computation necessary to recompute the pointer
Will agree in principle but would like to see a POC of the gas savings
Handle
pants
Vulnerability details
In Treasury.editSchedule
We suggest to cache tokenSchedules[target_] at start and then use the cached value to save repeated access to a storage state variable.