Various changes to code clarity (Fix N-07) (#5317)

Co-authored-by: Ernesto García <ernestognw@gmail.com>
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
This commit is contained in:
Hadrien Croubois
2024-11-27 21:25:30 +01:00
committed by GitHub
parent fdf7012d3b
commit 653963beb2
5 changed files with 27 additions and 22 deletions

View File

@ -7,6 +7,10 @@ import {Nonces} from "./Nonces.sol";
* @dev Alternative to {Nonces}, that supports key-ed nonces.
*
* Follows the https://eips.ethereum.org/EIPS/eip-4337#semi-abstracted-nonce-support[ERC-4337's semi-abstracted nonce system].
*
* NOTE: This contract inherits from {Nonces} and reuses its storage for the first nonce key (i.e. `0`). This
* makes upgrading from {Nonces} to {NoncesKeyed} safe when using their upgradeable versions (e.g. `NoncesKeyedUpgradeable`).
* Doing so will NOT reset the current state of nonces, avoiding replay attacks where a nonce is reused after the upgrade.
*/
abstract contract NoncesKeyed is Nonces {
mapping(address owner => mapping(uint192 key => uint64)) private _nonces;