Skip to content

Commit b173aef

Browse files
authored
feat: Target latest EVM version (#239)
2 parents dffdcc1 + e1d26e7 commit b173aef

File tree

10 files changed

+15
-28
lines changed

10 files changed

+15
-28
lines changed

contracts/Store.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ abstract contract Store {
7070
mapping(address => mapping(address => uint256)) m_allowances;
7171
// EIP-712 domain hash.
7272
// Modified in IexecConfigurationFacet.updateDomainSeparator
73-
bytes32 EIP712DOMAIN_SEPARATOR; // TODO rename
74-
// Poco - Storage
75-
73+
bytes32 m_eip712DomainSeparator;
7674
// Mapping an order hash to its owner. Since a smart contract cannot sign orders
7775
// with a private key, it adds an entry to this mapping to provide presigned orders.
7876
mapping(bytes32 => address) m_presigned;

contracts/Store.v8.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ abstract contract Store {
6464
mapping(address => mapping(address => uint256)) m_allowances;
6565
// EIP-712 domain hash.
6666
// Modified in IexecConfigurationFacet.updateDomainSeparator
67-
bytes32 EIP712DOMAIN_SEPARATOR; // TODO rename
68-
// Poco - Storage
69-
67+
bytes32 m_eip712DomainSeparator;
7068
// Mapping an order hash to its owner. Since a smart contract cannot sign orders
7169
// with a private key, it adds an entry to this mapping to provide presigned orders.
7270
mapping(bytes32 => address) m_presigned;

contracts/facets/FacetBase.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import "../Store.sol";
77
import "../interfaces/IOwnable.sol";
88

99
// Functions that were declared in ERC1538Store are re-declared here.
10-
// TODO clean this (use LibDiamond)
11-
// - All calls to `owner()` should use `LibDiamond.contractOwner()`.
10+
// TODO use LibDiamond.contractOwner() when migrating all contracts to v8.
1211

1312
/**
1413
* @title Base contract of all Facet contracts.

contracts/facets/FacetBase.v8.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import {IERC5313} from "@openzeppelin/contracts-v5/interfaces/IERC5313.sol";
77
import {Store} from "../Store.v8.sol";
88

99
// Functions that were declared in ERC1538Store are re-declared here.
10-
// TODO clean this (use LibDiamond)
11-
// - All calls to `owner()` should use `LibDiamond.contractOwner()`.
10+
// TODO use LibDiamond.contractOwner() when migrating all contracts to v8.
1211

1312
/**
1413
* @title Base contract of all Facet contracts.

contracts/facets/IexecAccessorsFacet.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,6 @@ contract IexecAccessorsFacet is IexecAccessors, FacetBase {
170170

171171
function eip712domain_separator() external view override returns (bytes32) {
172172
PocoStorage storage $ = getPocoStorage();
173-
return $.EIP712DOMAIN_SEPARATOR;
173+
return $.m_eip712DomainSeparator;
174174
}
175175
}

contracts/facets/IexecConfigurationFacet.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ contract IexecConfigurationFacet is IexecConfiguration, FacetBase {
2525
address _v3_iexecHubAddress
2626
) external override onlyOwner {
2727
PocoStorage storage $ = getPocoStorage();
28-
require($.EIP712DOMAIN_SEPARATOR == bytes32(0), "already-configured");
29-
$.EIP712DOMAIN_SEPARATOR = _domain().hash();
28+
require($.m_eip712DomainSeparator == bytes32(0), "already-configured");
29+
$.m_eip712DomainSeparator = _domain().hash();
3030

3131
$.m_baseToken = IERC20(_token);
3232
$.m_name = _name;
@@ -45,8 +45,8 @@ contract IexecConfigurationFacet is IexecConfiguration, FacetBase {
4545

4646
function updateDomainSeparator() external override {
4747
PocoStorage storage $ = getPocoStorage();
48-
require($.EIP712DOMAIN_SEPARATOR != bytes32(0), "not-configured");
49-
$.EIP712DOMAIN_SEPARATOR = _domain().hash();
48+
require($.m_eip712DomainSeparator != bytes32(0), "not-configured");
49+
$.m_eip712DomainSeparator = _domain().hash();
5050
}
5151

5252
function importScore(address _worker) external override {

contracts/facets/IexecEscrowTokenSwapFacet.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,27 +165,27 @@ contract IexecEscrowTokenSwapFacet is
165165
PocoStorage storage $ = getPocoStorage();
166166
uint256 volume;
167167
volume = _apporder.volume.sub(
168-
$.m_consumed[keccak256(_toEthTypedStruct(_apporder.hash(), $.EIP712DOMAIN_SEPARATOR))]
168+
$.m_consumed[keccak256(_toEthTypedStruct(_apporder.hash(), $.m_eip712DomainSeparator))]
169169
);
170170
if (_datasetorder.dataset != address(0))
171171
volume = volume.min(
172172
_datasetorder.volume.sub(
173173
$.m_consumed[
174-
keccak256(_toEthTypedStruct(_datasetorder.hash(), $.EIP712DOMAIN_SEPARATOR))
174+
keccak256(_toEthTypedStruct(_datasetorder.hash(), $.m_eip712DomainSeparator))
175175
]
176176
)
177177
);
178178
volume = volume.min(
179179
_workerpoolorder.volume.sub(
180180
$.m_consumed[
181-
keccak256(_toEthTypedStruct(_workerpoolorder.hash(), $.EIP712DOMAIN_SEPARATOR))
181+
keccak256(_toEthTypedStruct(_workerpoolorder.hash(), $.m_eip712DomainSeparator))
182182
]
183183
)
184184
);
185185
volume = volume.min(
186186
_requestorder.volume.sub(
187187
$.m_consumed[
188-
keccak256(_toEthTypedStruct(_requestorder.hash(), $.EIP712DOMAIN_SEPARATOR))
188+
keccak256(_toEthTypedStruct(_requestorder.hash(), $.m_eip712DomainSeparator))
189189
]
190190
)
191191
);

contracts/facets/SignatureVerifier.v8.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract SignatureVerifier is FacetBase {
1818
*/
1919
function _toTypedDataHash(bytes32 structHash) internal view returns (bytes32) {
2020
PocoStorage storage $ = getPocoStorage();
21-
return MessageHashUtils.toTypedDataHash($.EIP712DOMAIN_SEPARATOR, structHash);
21+
return MessageHashUtils.toTypedDataHash($.m_eip712DomainSeparator, structHash);
2222
}
2323

2424
/**

hardhat.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@ const v8Settings = {
7171
},
7272
},
7373
},
74-
// TODO remove this to target the latest EVM version.
75-
/**
76-
* @dev The 0.8.20 compiler switches the default target EVM version to Shanghai.
77-
* At this time, the iExec Bellecour blockchain does not support new OPCODES
78-
* brought by the Shanghai fork, hence the target must be lowered.
79-
*/
80-
evmVersion: bellecourBaseConfig.hardfork,
8174
};
8275

8376
const config: HardhatUserConfig = {

test/byContract/IexecConfiguration/IexecConfiguration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ describe('IexecConfiguration', async () => {
205205
async function setDomainSeparatorInStorage(domainSeparator: string) {
206206
await setStorageAt(
207207
proxyAddress,
208-
getPocoStorageSlotLocation(11n), // 11 is the slot index of EIP712DOMAIN_SEPARATOR in Store
208+
getPocoStorageSlotLocation(11n), // 11 is the slot index of m_eip712DomainSeparator in Store
209209
domainSeparator,
210210
);
211211
// Double check the update of the domain separator happened

0 commit comments

Comments
 (0)