code-423n4 / 2021-08-gravitybridge-findings

1 stars 0 forks source link

Cache values #35

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

_currentValset.validators.length in functions submitLogicCall, submitBatch and updateValset are accessed multiple (4) times. It would save some gas if you cache this value in a variable and re-use it where necessary.

jkilpatr commented 2 years ago

Caching requires using a register, which we're running quite low on due to other variables and scoping. We'll see if I can make this work out.

loudoguno commented 2 years ago

reopening as per judges assessment as "primary issue" on findings sheet