Use a for loop instead of a while loop in LockupTranched #879
Labels
effort: low
Easy or tiny task that takes less than a day.
priority: 2
We will do our best to deal with this.
type: perf
Change that improves performance.
work: clear
Sense-categorize-respond. The relationship between cause and effect is clear.
All else being equal, a for loop is better than a while loop in a blockchain context. This is due to the risk of overflowing the block's gas limit. With a for loop, this risk is completely mitigated.
It is possible to turn the following while loop into a for loop:
https://github.com/sablier-labs/v2-core/blob/76e29fee33befaeb54a82473c28cf182e6f8855d/src/SablierV2LockupTranched.sol#L200-L207
Like so:
The text was updated successfully, but these errors were encountered: