Search the whole checkpoint trace if offset overflows during initial exponential search. (#3662)

This commit is contained in:
Hadrien Croubois
2022-08-30 22:59:23 +02:00
committed by GitHub
parent 71aaca2d9d
commit affe2456ea
2 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ function upperLookupRecent(${opts.historyTypeName} storage self, ${opts.keyTypeN
offset <<= 1;
}
uint256 low = offset < length ? length - offset : 0;
uint256 low = 0 < offset && offset < length ? length - offset : 0;
uint256 high = length - (offset >> 1);
uint256 pos = _upperBinaryLookup(self.${opts.checkpointFieldName}, key, low, high);