token_ERC20_extensions_ERC20Votes.sol.patch 905 B

12345678910111213141516171819
  1. --- token/ERC20/extensions/ERC20Votes.sol 2023-04-27 13:16:53.923627178 +0200
  2. +++ token/ERC20/extensions/ERC20Votes.sol 2023-04-27 13:27:00.856088231 +0200
  3. @@ -281,10 +281,11 @@
  4. /**
  5. * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
  6. */
  7. - function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {
  8. - assembly {
  9. - mstore(0, ckpts.slot)
  10. - result.slot := add(keccak256(0, 0x20), pos)
  11. - }
  12. + function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private view returns (Checkpoint storage result) {
  13. + return ckpts[pos]; // explicit (safe) for formal verification hooking
  14. + // assembly {
  15. + // mstore(0, ckpts.slot)
  16. + // result.slot := add(keccak256(0, 0x20), pos)
  17. + // }
  18. }
  19. }