Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions contracts/Store.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ abstract contract Store {
mapping(address => mapping(address => uint256)) m_allowances;
// EIP-712 domain hash.
// Modified in IexecConfigurationFacet.updateDomainSeparator
bytes32 EIP712DOMAIN_SEPARATOR; // TODO rename
// Poco - Storage

bytes32 m_eip712DomainSeparator;
// Mapping an order hash to its owner. Since a smart contract cannot sign orders
// with a private key, it adds an entry to this mapping to provide presigned orders.
mapping(bytes32 => address) m_presigned;
Expand Down
4 changes: 1 addition & 3 deletions contracts/Store.v8.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ abstract contract Store {
mapping(address => mapping(address => uint256)) m_allowances;
// EIP-712 domain hash.
// Modified in IexecConfigurationFacet.updateDomainSeparator
bytes32 EIP712DOMAIN_SEPARATOR; // TODO rename
// Poco - Storage

bytes32 m_eip712DomainSeparator;
// Mapping an order hash to its owner. Since a smart contract cannot sign orders
// with a private key, it adds an entry to this mapping to provide presigned orders.
mapping(bytes32 => address) m_presigned;
Expand Down
3 changes: 1 addition & 2 deletions contracts/facets/FacetBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import "../Store.sol";
import "../interfaces/IOwnable.sol";

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

/**
* @title Base contract of all Facet contracts.
Expand Down
3 changes: 1 addition & 2 deletions contracts/facets/FacetBase.v8.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {IERC5313} from "@openzeppelin/contracts-v5/interfaces/IERC5313.sol";
import {Store} from "../Store.v8.sol";

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

/**
* @title Base contract of all Facet contracts.
Expand Down
2 changes: 1 addition & 1 deletion contracts/facets/IexecAccessorsFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ contract IexecAccessorsFacet is IexecAccessors, FacetBase {

function eip712domain_separator() external view override returns (bytes32) {
PocoStorage storage $ = getPocoStorage();
return $.EIP712DOMAIN_SEPARATOR;
return $.m_eip712DomainSeparator;
}
}
8 changes: 4 additions & 4 deletions contracts/facets/IexecConfigurationFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ contract IexecConfigurationFacet is IexecConfiguration, FacetBase {
address _v3_iexecHubAddress
) external override onlyOwner {
PocoStorage storage $ = getPocoStorage();
require($.EIP712DOMAIN_SEPARATOR == bytes32(0), "already-configured");
$.EIP712DOMAIN_SEPARATOR = _domain().hash();
require($.m_eip712DomainSeparator == bytes32(0), "already-configured");
$.m_eip712DomainSeparator = _domain().hash();

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

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

function importScore(address _worker) external override {
Expand Down
8 changes: 4 additions & 4 deletions contracts/facets/IexecEscrowTokenSwapFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,27 +165,27 @@ contract IexecEscrowTokenSwapFacet is
PocoStorage storage $ = getPocoStorage();
uint256 volume;
volume = _apporder.volume.sub(
$.m_consumed[keccak256(_toEthTypedStruct(_apporder.hash(), $.EIP712DOMAIN_SEPARATOR))]
$.m_consumed[keccak256(_toEthTypedStruct(_apporder.hash(), $.m_eip712DomainSeparator))]
);
if (_datasetorder.dataset != address(0))
volume = volume.min(
_datasetorder.volume.sub(
$.m_consumed[
keccak256(_toEthTypedStruct(_datasetorder.hash(), $.EIP712DOMAIN_SEPARATOR))
keccak256(_toEthTypedStruct(_datasetorder.hash(), $.m_eip712DomainSeparator))
]
)
);
volume = volume.min(
_workerpoolorder.volume.sub(
$.m_consumed[
keccak256(_toEthTypedStruct(_workerpoolorder.hash(), $.EIP712DOMAIN_SEPARATOR))
keccak256(_toEthTypedStruct(_workerpoolorder.hash(), $.m_eip712DomainSeparator))
]
)
);
volume = volume.min(
_requestorder.volume.sub(
$.m_consumed[
keccak256(_toEthTypedStruct(_requestorder.hash(), $.EIP712DOMAIN_SEPARATOR))
keccak256(_toEthTypedStruct(_requestorder.hash(), $.m_eip712DomainSeparator))
]
)
);
Expand Down
2 changes: 1 addition & 1 deletion contracts/facets/SignatureVerifier.v8.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract SignatureVerifier is FacetBase {
*/
function _toTypedDataHash(bytes32 structHash) internal view returns (bytes32) {
PocoStorage storage $ = getPocoStorage();
return MessageHashUtils.toTypedDataHash($.EIP712DOMAIN_SEPARATOR, structHash);
return MessageHashUtils.toTypedDataHash($.m_eip712DomainSeparator, structHash);
}

/**
Expand Down
7 changes: 0 additions & 7 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ const v8Settings = {
},
},
},
// TODO remove this to target the latest EVM version.
/**
* @dev The 0.8.20 compiler switches the default target EVM version to Shanghai.
* At this time, the iExec Bellecour blockchain does not support new OPCODES
* brought by the Shanghai fork, hence the target must be lowered.
*/
evmVersion: bellecourBaseConfig.hardfork,
};

const config: HardhatUserConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('IexecConfiguration', async () => {
async function setDomainSeparatorInStorage(domainSeparator: string) {
await setStorageAt(
proxyAddress,
getPocoStorageSlotLocation(11n), // 11 is the slot index of EIP712DOMAIN_SEPARATOR in Store
getPocoStorageSlotLocation(11n), // 11 is the slot index of m_eip712DomainSeparator in Store
domainSeparator,
);
// Double check the update of the domain separator happened
Expand Down