The compiler enforces that blocks have 1 exit point. This invariant isn't checked inside for loop
.
The compiler checks that function bodies and if statements have 1 exit point:
https://github.com/vyperlang/vyper/blob/3b310d5292c4d1448e673d7b3adb223f9353260e/vyper/codegen/core.py#L1049-L1070
However, as we can see in the code the For
node isn't validated. Thus, contract like the following one compile fine:
But contracts like the following one don't compile:
The compilation fails with:
The single exit point is an invariant that is broken for for loops. This could be problematic if the later stages of the compilation relied on this invariant. However, such case wasn't discovered. As such we consider it as a confusing inconsistency.
Manual review.
Extend the validation for a single exit to contain also for
loops.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.