Skip to content

Commit 9f8c6de

Browse files
authored
chore: revert storage change (#55)
## Summary So it'd make the migration easy. For more details, please refer to natspec. ## Detail ### Changeset * reverted one change from the [previous PR](#54) ### Checklist - [x] Did you add new tests and confirm all tests pass? (`yarn test`) - [x] Did you update relevant docs? (docs are found in the `docs` folder) - [x] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [x] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [x] Did you run lint (`yarn lint`) and fix any issues? - [x] Did you run formatter (`yarn format:check`) and fix any issues (`yarn format:write`)? ## Testing * test has also been reverted ## Documentation * see natspec
1 parent 194a8e9 commit 9f8c6de

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/msca/6900/v0.7/libs/WalletStorageV1Lib.sol

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ import {ExecutionDetail, PermittedExternalCall, PluginDetail} from "../common/St
2323

2424
/// @dev The same storage will be used for v1.x.y of MSCAs.
2525
library WalletStorageV1Lib {
26-
// @notice On 12/16/2024, storage was aligned to 256 as a potential optimization in anticipation of gas schedule
27-
// changes following the Verkle state tree migration. This adjustment accounts for scenarios where groups
28-
// of 256 storage slots may become warm simultaneously and will only apply to newly deployed accounts.
29-
// For more details, please refer to https://eips.ethereum.org/EIPS/eip-7201.
30-
// Old value: 0xc6a0cc20c824c4eecc4b0fbb7fb297d07492a7bd12c83d4fa4d27b4249f9bfc8, which is calculated by
31-
// keccak256(abi.encode(uint256(keccak256(abi.encode("circle.msca.v1.storage"))) - 1));
32-
// New value:
33-
// 1. id = "circle.msca.v1.storage"
34-
// 2. keccak256(abi.encode(uint256(keccak256(id)) - 1)) & ~bytes32(uint256(0xff))
35-
bytes32 internal constant WALLET_STORAGE_SLOT = 0x1f5beaddce7d7c52c0db456127db41c33d65f252d3a09b925e817276761a6a00;
26+
// @notice When we initially calculated the storage slot, EIP-7201 was still under active discussion,
27+
// so we didn’t fully adopt the storage alignment proposed by the EIP, which reduces gas costs
28+
// for subsequent operations, as a single cold storage access warms all 256 slots within the group.
29+
// To avoid introducing breaking changes and the complexity of migration, we chose not to make changes midway.
30+
// For v2 accounts, which will feature a different storage layout, we will adopt EIP-7201.
31+
// keccak256(abi.encode(uint256(keccak256(abi.encode("circle.msca.v1.storage"))) - 1))
32+
bytes32 internal constant WALLET_STORAGE_SLOT = 0xc6a0cc20c824c4eecc4b0fbb7fb297d07492a7bd12c83d4fa4d27b4249f9bfc8;
3633

3734
struct Layout {
3835
// installed plugin addresses for quick query

test/msca/6900/v0.7/WalletStorageV1Lib.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ contract WalletStorageV1LibTest is TestUtils {
4747
}
4848

4949
function testWalletStorageSlot() public pure {
50-
bytes32 hash = keccak256(abi.encode(uint256(keccak256("circle.msca.v1.storage")) - 1));
51-
bytes32 alignedHash = hash & ~bytes32(uint256(0xff));
52-
assertEq(alignedHash, 0x1f5beaddce7d7c52c0db456127db41c33d65f252d3a09b925e817276761a6a00);
50+
bytes32 hash = keccak256(abi.encode(uint256(keccak256(abi.encode("circle.msca.v1.storage"))) - 1));
51+
assertEq(hash, 0xc6a0cc20c824c4eecc4b0fbb7fb297d07492a7bd12c83d4fa4d27b4249f9bfc8);
5352
}
5453

5554
// this test is very similar to AddressDLLLibTest, but under the context of plugin and wallet

0 commit comments

Comments
 (0)