Skip to content

Commit 40051ec

Browse files
committed
Revert _extractSignatureValidator and add note
1 parent c50704e commit 40051ec

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- `SignerERC7702` is renamed as `SignerEIP7702`. Imports and inheritance must be updated to that new name and path. Behavior is unmodified.
1212
- `ERC721Holder`, `ERC1155Holder`, `ReentrancyGuard` and `ReentrancyGuardTransient` are flagged as stateless and are no longer transpiled. Developers using their upgradeable variants from `@openzeppelin/contracts-upgradeable` must update their imports to use the equivalent version available in `@openzeppelin/contracts`.
1313
- Update minimum pragma to 0.8.24 in `Votes`, `VotesExtended`, `ERC20Votes`, `Strings`, `ERC1155URIStorage`, `MessageHashUtils`, `ERC721URIStorage`, `ERC721Votes`, `ERC721Wrapper`, `ERC721Burnable`, `ERC721Consecutive`, `ERC721Enumerable`, `ERC721Pausable`, `ERC721Royalty`, `ERC721Wrapper`, `EIP712`, `ERC4626` and `ERC7739`. ([#5726](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5726))
14+
- `AccountERC7579`: Installing and uninstalling fallback modules now require the corresponding `initData` and `deInitData` arguments to be at least 4 bytes long (matching the selector to which the fallback module is registered). It now reverts with `ERC7579CannotDecodeFallbackData` instead of treating the missing bytes as `0x00`.
1415

1516
### Deprecation
1617

contracts/account/extensions/draft-AccountERC7579.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ abstract contract AccountERC7579 is Account, IERC1271, IERC7579Execution, IERC75
6868
/// @dev The account's {fallback} was called with a selector that doesn't have an installed handler.
6969
error ERC7579MissingFallbackHandler(bytes4 selector);
7070

71+
/// @dev The provided initData/deInitData for a fallback module is too short to extract a selector.
72+
error ERC7579CannotDecodeFallbackData();
73+
74+
/// @dev The provided signature is not long enough to be parsed as a module signature.
75+
error ERC7579InvalidModuleSignature();
76+
7177
/// @dev Modifier that checks if the caller is an installed module of the given type.
7278
modifier onlyModule(uint256 moduleTypeId, bytes calldata additionalContext) {
7379
_checkModule(moduleTypeId, msg.sender, additionalContext);
@@ -380,6 +386,8 @@ abstract contract AccountERC7579 is Account, IERC1271, IERC7579Execution, IERC75
380386
* https://github.com/erc7579/erc7579-implementation/blob/16138d1afd4e9711f6c1425133538837bd7787b5/src/MSAAdvanced.sol#L296[ERC7579 reference implementation].
381387
*
382388
* This is not standardized in ERC-7579 (or in any follow-up ERC). Some accounts may want to override these internal functions.
389+
*
390+
* NOTE: This function expects the signature to be at least 20 bytes long. Panics with {Panic-ARRAY_OUT_OF_BOUNDS} (0x32) otherwise.
383391
*/
384392
function _extractSignatureValidator(
385393
bytes calldata signature
@@ -399,6 +407,7 @@ abstract contract AccountERC7579 is Account, IERC1271, IERC7579Execution, IERC75
399407
function _decodeFallbackData(
400408
bytes memory data
401409
) internal pure virtual returns (bytes4 selector, bytes memory remaining) {
410+
require(data.length > 3, ERC7579CannotDecodeFallbackData());
402411
return (bytes4(data), data.slice(4));
403412
}
404413

0 commit comments

Comments
 (0)