Skip to content

Commit 2e84d55

Browse files
Update ERC-7779: Add enforcement to use keccak
Merged by EIP-Bot.
1 parent 034ed5b commit 2e84d55

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ERCS/erc-7779.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Account Abstraction Wallets, given the wallet-specific validation and execution
3737

3838
This spec provides a standard approach for fetching the storage base used in the delegated account together with an optional mechanism to clean up the storage.
3939

40+
Moreover, it is worth noting that this spec is not limited to [EIP-7702](./eip-7702.md) based smart accounts but smart accounts and smart contracts in general that uses a custom storage slot.
41+
4042
## Specification
4143

4244
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
@@ -61,6 +63,7 @@ interface IInteroperableDelegatedAccount {
6163
* The bytes32 array should be stored at the storage slot: keccak(keccak('InteroperableDelegatedAccount.ERC.Storage')-1) & ~0xff
6264
* This is an append-only array so newly redelegated accounts should not overwrite the storage at this slot, but just append their base to the array.
6365
* This append operation should be done during the initialization of the account.
66+
* This array should return a value of keccak hash unless using external storage.
6467
*/
6568
function accountStorageBases() external view returns (bytes32[]);
6669
@@ -84,6 +87,8 @@ interface IRedelegableDelegatedAccount {
8487

8588
Accounts MUST implement the `IInteroperableDelegatedAccount` to be compliant with the standard.
8689

90+
Accounts MUST use `keccak256()` to compute the storage bases for `accountStorageBases()`, unless using external storage contract.
91+
8792
Accounts MAY implement the `IRedelegableDelegatedAccount`.
8893

8994
### `accountId()`
@@ -98,6 +103,8 @@ Wallet A information could be extracted from `accountId()`.
98103

99104
This function returns the list of base storage slots of that account has used.
100105

106+
To comply with this standard, the account MUST use `keccak256()` to prevent collision when calculating the storage slot.
107+
101108
EIP-7702 Accounts do plan to use a custom non-zero storage slot to avoid storage collision as much as possible, however, there hasn’t been a standardized approach on how to fetch them.
102109

103110
This function provides a standardized approach for wallets and other applications to check the base storage slots of an account, and verify if the base storage slots are far enough from the newly to-be-redelegated account’s base storage slot.
@@ -186,6 +193,8 @@ This standard was specifically for Smart Accounts for EOA, but this could be app
186193

187194
5. It is worth noting that this standard is an ERC, which means that even if the ERC enforces it, the actual implementation may not be compliant with it. e.g., accounts pretending to support this standard which is not, in fact. So it is recommend to validate if the account is a know implementation that is secure and compliant with the standard.
188195

196+
6. The standard ENFORCES the storage slot to be calculated through `keccak256()` to reduce collision. The preimage of the hash could be the name/version or a combination, it is under full discretion of the account.
197+
189198
## Copyright
190199

191200
Copyright and related rights waived via [CC0](../LICENSE.md).

0 commit comments

Comments
 (0)