We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a4e7136 commit 409bfeeCopy full SHA for 409bfee
packages/lazy-imt/contracts/InternalLazyIMT.sol
@@ -221,9 +221,14 @@ library InternalLazyIMT {
221
uint40 numberOfLeaves = self.numberOfLeaves;
222
require(index < numberOfLeaves, "LazyIMT: leaf must exist");
223
224
+ // targetDepth = log2_floor(numberOfLeaves)
225
uint8 targetDepth = 1;
- while (uint40(2) ** uint40(targetDepth) < numberOfLeaves) {
226
- targetDepth++;
+ {
227
+ uint40 exp = 2;
228
+ while (exp < numberOfLeaves) {
229
+ exp <<= 1;
230
+ targetDepth++;
231
+ }
232
}
233
require(depth >= targetDepth, "LazyIMT: proof depth");
234
// pass depth -1 because we don't need the root value
0 commit comments