balancer / balancer-v3-monorepo

GNU General Public License v3.0
30 stars 7 forks source link

Check for double read from storage #669

Closed elshan-eth closed 1 month ago

elshan-eth commented 1 month ago

Sometimes we read one value from storage twice in different functions. This can be optimized.

jubeira commented 1 month ago

@elshan-eth which function is it? Are you talking about ensurePaused / ensureInitialized?

elshan-eth commented 1 month ago

There are several functions where we re-receive. I don't remember exactly, but I saw this in the code several times. It seems to me that the savings here are not worth it, so I’m thinking of closing the task. It seems that we can save no more than 500 gas and at the same time we would need to rewrite a lot of code. Seems unreasonable

I think I also saw a double read when we use ensurePaused and ensureInitialized