Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
543cb21
feat: implement dataset compatibility check in IexecPoco1Facet
Le-Caignec Sep 26, 2025
d3686d5
refactor: clean up IexecPoco1Facet and add tests for dataset compatib…
Le-Caignec Sep 26, 2025
27c6dbd
feat: deploy and update IexecPocoAccessorsFacet and IexecPoco1Facet
Le-Caignec Sep 26, 2025
1276187
test: enhance dataset compatibility tests in IexecPoco1
Le-Caignec Sep 26, 2025
69fef65
Update contracts/facets/IexecPoco1Facet.sol
Le-Caignec Sep 26, 2025
fd73a64
Update contracts/interfaces/IexecPoco1.v8.sol
Le-Caignec Sep 29, 2025
84d2490
feat: add dataset order compatibility check in IexecPoco1Facet
Le-Caignec Sep 29, 2025
0d9ff9b
refactor: remove deployment address logs for IexecPocoAccessorsFacet …
Le-Caignec Sep 29, 2025
15cc344
refactor: streamline deployment of IexecPocoAccessorsFacet in upgrade…
Le-Caignec Sep 29, 2025
481d526
refactor: remove deployment address logs and update logging for new f…
Le-Caignec Sep 29, 2025
e49ee33
Update test/byContract/IexecPoco/IexecPoco1.test.ts
Le-Caignec Sep 29, 2025
0ce1268
Update test/byContract/IexecPoco/IexecPoco1.test.ts
Le-Caignec Sep 29, 2025
263a7d8
feat: add isDatasetCompatibleWithDeal function to IexecPoco1 interfac…
Le-Caignec Sep 29, 2025
f95d6bc
test: add test for isDatasetCompatibleWithDeal function in IexecPoco1
Le-Caignec Sep 29, 2025
662ccee
feat: enhance isDatasetCompatibleWithDeal function to revert with det…
Le-Caignec Sep 29, 2025
e34696c
Update contracts/facets/IexecPoco1Facet.sol
Le-Caignec Sep 29, 2025
99b7a7b
docs: enhance documentation for isDatasetCompatibleWithDeal function …
Le-Caignec Sep 29, 2025
b9353bb
refactor: simplify isDatasetCompatibleWithDeal function logic in Iexe…
Le-Caignec Sep 29, 2025
4964b3c
Update contracts/facets/IexecPoco1Facet.sol
Le-Caignec Sep 29, 2025
df9fb9e
Update scripts/upgrades/deploy-and-update-some-facet.ts
Le-Caignec Sep 29, 2025
14f454e
Merge branch 'feature/add-isDatasetCompatibleWithDeal-function' into …
Le-Caignec Sep 29, 2025
d02ce06
refactor: update isDatasetCompatibleWithDeal function to return detai…
Le-Caignec Sep 29, 2025
b92e68d
refactor: move Matching struct from IexecPoco1 interface to IexecPoco…
Le-Caignec Sep 30, 2025
fd7434a
Merge branch 'feature/add-isDatasetCompatibleWithDeal-function' into …
Le-Caignec Sep 30, 2025
8c50d28
Update contracts/facets/IexecPoco1Facet.sol
Le-Caignec Sep 30, 2025
025f16b
Merge remote-tracking branch 'origin/main' into feature/add-isDataset…
Le-Caignec Sep 30, 2025
4fccf51
fix: clarify return value description in `isDatasetCompatibleWithDeal…
Le-Caignec Sep 30, 2025
15feec6
fix: improve return value documentation in `isDatasetCompatibleWithDe…
Le-Caignec Sep 30, 2025
5a1e932
test: refactor isDatasetCompatibleWithDeal tests for clarity and cons…
Le-Caignec Sep 30, 2025
ac9aa84
Merge branch 'main' into feature/add-isDatasetCompatibleWithDeal-func…
Le-Caignec Sep 30, 2025
b66c6bc
docs: enhance `isDatasetCompatibleWithDeal` function documentation an…
Le-Caignec Sep 30, 2025
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
23 changes: 12 additions & 11 deletions contracts/facets/IexecPoco1Facet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,36 @@ contract IexecPoco1Facet is IexecPoco1, FacetBase, IexecEscrow, SignatureVerifie
*
* @param datasetOrder The dataset order to verify
* @param dealid The deal ID to check against
* @return true if the dataset order is compatible with the deal, false otherwise
* @return result true if the dataset order is compatible with the deal, false otherwise
* @return reason the specific reason why the compatibility check failed, empty string if successful
*/
function isDatasetCompatibleWithDeal(
IexecLibOrders_v5.DatasetOrder calldata datasetOrder,
bytes32 dealid
) external view override returns (bool) {
) external view override returns (bool result, string memory reason) {
PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage();
// Check if deal exists
IexecLibCore_v5.Deal storage deal = $.m_deals[dealid];
if (deal.requester == address(0)) {
return false;
return (false, "Deal does not exist");
}
// The specified deal should not have a dataset.
if (deal.dataset.pointer != address(0)) {
return false;
return (false, "Deal already has a dataset");
}
// Check dataset order owner signature (including presign and EIP1271)
bytes32 datasetOrderHash = _toTypedDataHash(datasetOrder.hash());
address datasetOwner = IERC5313(datasetOrder.dataset).owner();
if (!_verifySignatureOrPresignature(datasetOwner, datasetOrderHash, datasetOrder.sign)) {
return false;
return (false, "Invalid dataset order signature");
}
// Check if dataset order is not fully consumed
if ($.m_consumed[datasetOrderHash] >= datasetOrder.volume) {
return false;
return (false, "Dataset order is fully consumed");
}
// Check if deal app is allowed by dataset order apprestrict (including whitelist)
if (!_isAccountAuthorizedByRestriction(datasetOrder.apprestrict, deal.app.pointer)) {
return false;
return (false, "App restriction not satisfied");
}
// Check if deal workerpool is allowed by dataset order workerpoolrestrict (including whitelist)
if (
Expand All @@ -105,17 +106,17 @@ contract IexecPoco1Facet is IexecPoco1, FacetBase, IexecEscrow, SignatureVerifie
deal.workerpool.pointer
)
) {
return false;
return (false, "Workerpool restriction not satisfied");
}
// Check if deal requester is allowed by dataset order requesterrestrict (including whitelist)
if (!_isAccountAuthorizedByRestriction(datasetOrder.requesterrestrict, deal.requester)) {
return false;
return (false, "Requester restriction not satisfied");
}
// Check if deal tag fulfills all the tag bits of the dataset order
if ((deal.tag & datasetOrder.tag) != datasetOrder.tag) {
return false;
return (false, "Tag compatibility not satisfied");
}
return true;
return (true, "");
}

/***************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IexecPoco1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ interface IexecPoco1 {
function isDatasetCompatibleWithDeal(
IexecLibOrders_v5.DatasetOrder calldata datasetOrder,
bytes32 dealid
) external view returns (bool);
) external view returns (bool result, string memory reason);
}
2 changes: 1 addition & 1 deletion contracts/interfaces/IexecPoco1.v8.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ interface IexecPoco1 {
function isDatasetCompatibleWithDeal(
IexecLibOrders_v5.DatasetOrder calldata datasetOrder,
bytes32 dealid
) external view returns (bool);
) external view returns (bool result, string memory reason);
}
223 changes: 112 additions & 111 deletions docs/solidity/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function verifyPresignatureOrSignature(address _identity, bytes32 _hash, bytes _
### isDatasetCompatibleWithDeal

```solidity
function isDatasetCompatibleWithDeal(struct IexecLibOrders_v5.DatasetOrder datasetOrder, bytes32 dealid) external view returns (bool)
function isDatasetCompatibleWithDeal(struct IexecLibOrders_v5.DatasetOrder datasetOrder, bytes32 dealid) external view returns (bool result, string reason)
```

Public view function to check if a dataset order is compatible with a deal.
Expand All @@ -94,7 +94,8 @@ This function should not be used in matchOrders as it does not check the same re

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bool | true if the dataset order is compatible with the deal, false otherwise |
| result | bool | true if the dataset order is compatible with the deal, false otherwise |
| reason | string | the specific reason why the compatibility check failed, empty string if successful |

### matchOrders

Expand Down Expand Up @@ -456,6 +457,115 @@ function groupmember_purpose() external pure returns (uint256)
function eip712domain_separator() external view returns (bytes32)
```

## IexecPocoBoostAccessorsFacet

Access to PoCo Boost tasks must be done with PoCo Classic `IexecAccessors`.

### viewDealBoost

```solidity
function viewDealBoost(bytes32 id) external view returns (struct IexecLibCore_v5.DealBoost deal)
```

Get a deal created by PoCo Boost facet.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| id | bytes32 | The ID of the deal. |

## IexecPocoBoostFacet

Works for deals with requested trust = 0.

### matchOrdersBoost

```solidity
function matchOrdersBoost(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external returns (bytes32)
```

This boost match orders is only compatible with trust <= 1.
The requester gets debited.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| appOrder | struct IexecLibOrders_v5.AppOrder | The order signed by the application developer. |
| datasetOrder | struct IexecLibOrders_v5.DatasetOrder | The order signed by the dataset provider. |
| workerpoolOrder | struct IexecLibOrders_v5.WorkerpoolOrder | The order signed by the workerpool manager. |
| requestOrder | struct IexecLibOrders_v5.RequestOrder | The order signed by the requester. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes32 | The ID of the deal. |

### sponsorMatchOrdersBoost

```solidity
function sponsorMatchOrdersBoost(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external returns (bytes32)
```

Sponsor match orders boost for a requester.
Unlike the standard `matchOrdersBoost(..)` hook where the requester pays for
the deal, this current hook makes it possible for any `msg.sender` to pay for
a third party requester.

Be aware that anyone seeing a valid request order on the network
(via an off-chain public marketplace, via a `sponsorMatchOrdersBoost(..)`
pending transaction in the mempool or by any other means) might decide
to call the standard `matchOrdersBoost(..)` hook which will result in the
requester being debited instead. Therefore, such a front run would result
in a loss of some of the requester funds deposited in the iExec account
(a loss value equivalent to the price of the deal).

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| appOrder | struct IexecLibOrders_v5.AppOrder | The app order. |
| datasetOrder | struct IexecLibOrders_v5.DatasetOrder | The dataset order. |
| workerpoolOrder | struct IexecLibOrders_v5.WorkerpoolOrder | The workerpool order. |
| requestOrder | struct IexecLibOrders_v5.RequestOrder | The requester order. |

### pushResultBoost

```solidity
function pushResultBoost(bytes32 dealId, uint256 index, bytes results, bytes resultsCallback, bytes authorizationSign, address enclaveChallenge, bytes enclaveSign) external
```

Accept results of a task computed by a worker during Boost workflow.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| dealId | bytes32 | The id of the target deal. |
| index | uint256 | The index of the target task of the deal. |
| results | bytes | The results of the task computed by the worker. |
| resultsCallback | bytes | The results of the task computed by the worker that will be forwarded as call data to the callback address set by the requester. |
| authorizationSign | bytes | The authorization signed by the scheduler. authorizing the worker to push a result. |
| enclaveChallenge | address | The enclave address which can produce enclave signature. |
| enclaveSign | bytes | The signature generated from the enclave. |

### claimBoost

```solidity
function claimBoost(bytes32 dealId, uint256 index) external
```

Claim task to get a refund if task is not completed after deadline.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| dealId | bytes32 | The ID of the deal. |
| index | uint256 | The index of the task. |

## IexecLibCore_v5

### Account
Expand Down Expand Up @@ -1651,112 +1761,3 @@ function manageWorkerpoolOrder(struct IexecLibOrders_v5.WorkerpoolOrderOperation
function manageRequestOrder(struct IexecLibOrders_v5.RequestOrderOperation _requestorderoperation) external
```

## IexecPocoBoostAccessorsFacet

Access to PoCo Boost tasks must be done with PoCo Classic `IexecAccessors`.

### viewDealBoost

```solidity
function viewDealBoost(bytes32 id) external view returns (struct IexecLibCore_v5.DealBoost deal)
```

Get a deal created by PoCo Boost facet.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| id | bytes32 | The ID of the deal. |

## IexecPocoBoostFacet

Works for deals with requested trust = 0.

### matchOrdersBoost

```solidity
function matchOrdersBoost(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external returns (bytes32)
```

This boost match orders is only compatible with trust <= 1.
The requester gets debited.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| appOrder | struct IexecLibOrders_v5.AppOrder | The order signed by the application developer. |
| datasetOrder | struct IexecLibOrders_v5.DatasetOrder | The order signed by the dataset provider. |
| workerpoolOrder | struct IexecLibOrders_v5.WorkerpoolOrder | The order signed by the workerpool manager. |
| requestOrder | struct IexecLibOrders_v5.RequestOrder | The order signed by the requester. |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |
| [0] | bytes32 | The ID of the deal. |

### sponsorMatchOrdersBoost

```solidity
function sponsorMatchOrdersBoost(struct IexecLibOrders_v5.AppOrder appOrder, struct IexecLibOrders_v5.DatasetOrder datasetOrder, struct IexecLibOrders_v5.WorkerpoolOrder workerpoolOrder, struct IexecLibOrders_v5.RequestOrder requestOrder) external returns (bytes32)
```

Sponsor match orders boost for a requester.
Unlike the standard `matchOrdersBoost(..)` hook where the requester pays for
the deal, this current hook makes it possible for any `msg.sender` to pay for
a third party requester.

Be aware that anyone seeing a valid request order on the network
(via an off-chain public marketplace, via a `sponsorMatchOrdersBoost(..)`
pending transaction in the mempool or by any other means) might decide
to call the standard `matchOrdersBoost(..)` hook which will result in the
requester being debited instead. Therefore, such a front run would result
in a loss of some of the requester funds deposited in the iExec account
(a loss value equivalent to the price of the deal).

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| appOrder | struct IexecLibOrders_v5.AppOrder | The app order. |
| datasetOrder | struct IexecLibOrders_v5.DatasetOrder | The dataset order. |
| workerpoolOrder | struct IexecLibOrders_v5.WorkerpoolOrder | The workerpool order. |
| requestOrder | struct IexecLibOrders_v5.RequestOrder | The requester order. |

### pushResultBoost

```solidity
function pushResultBoost(bytes32 dealId, uint256 index, bytes results, bytes resultsCallback, bytes authorizationSign, address enclaveChallenge, bytes enclaveSign) external
```

Accept results of a task computed by a worker during Boost workflow.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| dealId | bytes32 | The id of the target deal. |
| index | uint256 | The index of the target task of the deal. |
| results | bytes | The results of the task computed by the worker. |
| resultsCallback | bytes | The results of the task computed by the worker that will be forwarded as call data to the callback address set by the requester. |
| authorizationSign | bytes | The authorization signed by the scheduler. authorizing the worker to push a result. |
| enclaveChallenge | address | The enclave address which can produce enclave signature. |
| enclaveSign | bytes | The signature generated from the enclave. |

### claimBoost

```solidity
function claimBoost(bytes32 dealId, uint256 index) external
```

Claim task to get a refund if task is not completed after deadline.

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| dealId | bytes32 | The ID of the deal. |
| index | uint256 | The index of the task. |

Loading