Implement extra suggestions from audit review of 4.9 (#4224)

This commit is contained in:
Ernesto García
2023-05-09 18:19:35 +02:00
committed by GitHub
parent 832c352c7d
commit 34d926dd7e
4 changed files with 16 additions and 8 deletions

View File

@ -55,7 +55,7 @@ function lowerLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} k
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key.
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.
*/
function upperLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} key) internal view returns (${opts.valueTypeName}) {
uint256 len = self.${opts.checkpointFieldName}.length;
@ -64,7 +64,7 @@ function upperLookup(${opts.historyTypeName} storage self, ${opts.keyTypeName} k
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key.
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero if there is none.
*
* NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high keys).
*/