Skip to content

Commit 4342a05

Browse files
authored
Merge pull request Perfect-Abstractions#272 from maxnorm/fix-storage-positions
review and fix storage position definitions
2 parents de1c775 + cae7031 commit 4342a05

29 files changed

Lines changed: 57 additions & 47 deletions

src/access/AccessControl/AccessControlFacet.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ contract AccessControlFacet {
5656

5757
/**
5858
* @notice storage struct for the AccessControl.
59+
* @custom:storage-location erc8042:compose.accesscontrol
5960
*/
6061
struct AccessControlStorage {
6162
mapping(address account => mapping(bytes32 role => bool hasRole)) hasRole;

src/access/AccessControlPausable/AccessControlPausableMod.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bytes32 constant ACCESS_CONTROL_STORAGE_POSITION = keccak256("compose.accesscont
4242
*/
4343
bytes32 constant PAUSABLE_STORAGE_POSITION = keccak256("compose.accesscontrol.pausable");
4444

45-
/*
45+
/**
4646
* @notice Storage struct for AccessControl (reused struct definition).
4747
* @dev Must match the struct definition in AccessControlFacet.
4848
* @custom:storage-location erc8042:compose.accesscontrol
@@ -52,7 +52,7 @@ struct AccessControlStorage {
5252
mapping(bytes32 role => bytes32 adminRole) adminRole;
5353
}
5454

55-
/*
55+
/**
5656
* @notice Storage struct for AccessControlPausable.
5757
* @custom:storage-location erc8042:compose.accesscontrol.pausable
5858
*/

src/access/AccessControlTemporal/AccessControlTemporalMod.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bytes32 constant ACCESS_CONTROL_STORAGE_POSITION = keccak256("compose.accesscont
4848
*/
4949
bytes32 constant TEMPORAL_STORAGE_POSITION = keccak256("compose.accesscontrol.temporal");
5050

51-
/*
51+
/**
5252
* @notice Storage struct for AccessControl (reused struct definition).
5353
* @dev Must match the struct definition in AccessControlFacet.
5454
* @custom:storage-location erc8042:compose.accesscontrol
@@ -58,7 +58,7 @@ struct AccessControlStorage {
5858
mapping(bytes32 role => bytes32 adminRole) adminRole;
5959
}
6060

61-
/*
61+
/**
6262
* @notice Storage struct for AccessControlTemporal.
6363
* @custom:storage-location erc8042:compose.accesscontrol.temporal
6464
*/

src/access/Owner/OwnerFacet.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ contract OwnerFacet {
1919
*/
2020
error OwnerUnauthorizedAccount();
2121

22-
bytes32 constant STORAGE_POSITION = keccak256("compose.owner");
22+
bytes32 constant STORAGE_POSITION = keccak256("erc173.owner");
2323

2424
/**
25-
* @custom:storage-location erc8042:compose.owner
25+
* @custom:storage-location erc8042:erc173.owner
2626
*/
2727
struct OwnerStorage {
2828
address owner;

src/access/Owner/OwnerMod.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ error OwnerUnauthorizedAccount();
2424
*/
2525
error OwnerAlreadyRenounced();
2626

27-
bytes32 constant STORAGE_POSITION = keccak256("compose.owner");
27+
bytes32 constant STORAGE_POSITION = keccak256("erc173.owner");
2828

2929
/**
30-
* @custom:storage-location erc8042:compose.owner
30+
* @custom:storage-location erc8042:erc173.owner
3131
*/
3232
struct OwnerStorage {
3333
address owner;

src/access/OwnerTwoSteps/OwnerTwoStepsFacet.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ contract OwnerTwoStepsFacet {
2424
*/
2525
error OwnerUnauthorizedAccount();
2626

27-
bytes32 constant OWNER_STORAGE_POSITION = keccak256("compose.owner");
27+
bytes32 constant OWNER_STORAGE_POSITION = keccak256("erc173.owner");
2828

2929
/**
30-
* @custom:storage-location erc8042:compose.owner
30+
* @custom:storage-location erc8042:erc173.owner
3131
*/
3232
struct OwnerStorage {
3333
address owner;
@@ -45,10 +45,10 @@ contract OwnerTwoStepsFacet {
4545
}
4646
}
4747

48-
bytes32 constant PENDING_OWNER_STORAGE_POSITION = keccak256("compose.owner.pending");
48+
bytes32 constant PENDING_OWNER_STORAGE_POSITION = keccak256("erc173.owner.pending");
4949

5050
/**
51-
* @custom:storage-location erc8042:compose.owner.pending
51+
* @custom:storage-location erc8042:erc173.owner.pending
5252
*/
5353
struct PendingOwnerStorage {
5454
address pendingOwner;

src/access/OwnerTwoSteps/OwnerTwoStepsMod.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ error OwnerUnauthorizedAccount();
2828
*/
2929
error OwnerAlreadyRenounced();
3030

31-
bytes32 constant OWNER_STORAGE_POSITION = keccak256("compose.owner");
31+
bytes32 constant OWNER_STORAGE_POSITION = keccak256("erc173.owner");
3232

3333
/**
34-
* @custom:storage-location erc8042:compose.owner
34+
* @custom:storage-location erc8042:erc173.owner
3535
*/
3636
struct OwnerStorage {
3737
address owner;
@@ -49,10 +49,10 @@ function getOwnerStorage() pure returns (OwnerStorage storage s) {
4949
}
5050
}
5151

52-
bytes32 constant PENDING_OWNER_STORAGE_POSITION = keccak256("compose.owner.pending");
52+
bytes32 constant PENDING_OWNER_STORAGE_POSITION = keccak256("erc173.owner.pending");
5353

5454
/**
55-
* @custom:storage-location erc8042:compose.owner.pending
55+
* @custom:storage-location erc8042:erc173.owner.pending
5656
*/
5757
struct PendingOwnerStorage {
5858
address pendingOwner;

src/diamond/DiamondMod.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function importSelectors(address _facet) view returns (bytes memory selectors) {
128128
}
129129
}
130130

131-
// Validate ABI offset == 0x20 for a single dynamic return
131+
/* Validate ABI offset == 0x20 for a single dynamic return */
132132
uint256 offset;
133133
assembly ("memory-safe") {
134134
offset := mload(add(data, 0x20))

src/diamond/DiamondUpgradeFacet.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ contract DiamondUpgradeFacet {
121121
}
122122

123123
/**
124-
* @custom:storage-location erc8042:erc8109.diamond
124+
* @custom:storage-location erc8042:erc8153.diamond
125125
*/
126126
struct DiamondStorage {
127127
mapping(bytes4 functionSelector => FacetNode) facetNodes;
@@ -228,7 +228,7 @@ contract DiamondUpgradeFacet {
228228
}
229229
}
230230

231-
// Validate ABI offset == 0x20 for a single dynamic return
231+
/* Validate ABI offset == 0x20 for a single dynamic return */
232232
uint256 offset;
233233
assembly ("memory-safe") {
234234
offset := mload(add(data, 0x20))

src/diamond/DiamondUpgradeMod.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function importSelectors(address _facet) view returns (bytes memory selectors) {
201201
}
202202
}
203203

204-
// Validate ABI offset == 0x20 for a single dynamic return
204+
/* Validate ABI offset == 0x20 for a single dynamic return */
205205
uint256 offset;
206206
assembly ("memory-safe") {
207207
offset := mload(add(data, 0x20))

0 commit comments

Comments
 (0)