Skip to content

Conversation

Le-Caignec
Copy link
Contributor

@Le-Caignec Le-Caignec commented Sep 26, 2025

Added a new public view function isDatasetCompatibleWithDeal to verify the compatibility of a dataset order with a deal. This function includes multiple checks such as deal existence, dataset order owner signature, and restrictions on app, workerpool, and requester. Removed the Matching struct from IexecPoco1Facet and moved it to the IexecPoco1 interface.

Capture d’écran 2025-09-26 à 11 32 42

To test

  1. In one terminal:

ARBITRUM_FORK=true npx hardhat node --no-deploy

  1. In another terminal :
ARBITRUM_FORK=true npx hardhat run scripts/upgrades/deploy-and-update-some-facet.ts --network external-hardhat

Added a new public view function `isDatasetCompatibleWithDeal` to verify the compatibility of a dataset order with a deal. This function includes multiple checks such as deal existence, dataset order owner signature, and restrictions on app, workerpool, and requester. Removed the `Matching` struct from `IexecPoco1Facet` and moved it to the `IexecPoco1` interface.
@Le-Caignec Le-Caignec self-assigned this Sep 26, 2025
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.83%. Comparing base (f7c634b) to head (b98a455).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #266      +/-   ##
==========================================
+ Coverage   83.66%   84.83%   +1.17%     
==========================================
  Files          38       37       -1     
  Lines        1218     1240      +22     
  Branches      227      235       +8     
==========================================
+ Hits         1019     1052      +33     
+ Misses        199      188      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ility

Removed redundant comment in `IexecPoco1Facet` and added comprehensive tests for the new `isDatasetCompatibleWithDeal` function. The tests cover various scenarios including compatibility checks, invalid signatures, and restrictions on dataset orders.
Introduced a new script to deploy and update the IexecPocoAccessorsFacet and IexecPoco1Facet. The script handles the deployment of new facets, removal of old facets, and updates the diamond proxy accordingly. It includes checks for required deployment options and logs the process for better traceability.
Refactored tests for the `isDatasetCompatibleWithDeal` function to improve clarity and coverage. Removed the creation of an incompatible dataset order and added checks for non-existent deals and deals that already have datasets. Updated test cases to ensure accurate validation of dataset order compatibility, including scenarios for incompatible app restrictions and tags.
@Le-Caignec Le-Caignec requested review from gfournieriExec and zguesmi and removed request for gfournieriExec September 26, 2025 15:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a new dataset compatibility check feature by adding the isDatasetCompatibleWithDeal function to verify if a dataset order can be used with an existing deal. The function validates multiple compatibility criteria including deal existence, dataset order signatures, and restriction matching.

Key changes:

  • Added isDatasetCompatibleWithDeal public view function in IexecPoco1Facet
  • Moved Matching struct from facet implementation to interface for better organization
  • Updated deployment script to handle both IexecPocoAccessorsFacet and IexecPoco1Facet upgrades

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
contracts/facets/IexecPoco1Facet.sol Adds isDatasetCompatibleWithDeal function and removes Matching struct
contracts/interfaces/IexecPoco1.v8.sol Adds Matching struct and isDatasetCompatibleWithDeal function signature
test/byContract/IexecPoco/IexecPoco1.test.ts Comprehensive test suite for the new compatibility function
scripts/upgrades/deploy-and-update-some-facet.ts Updates deployment script to handle IexecPoco1Facet upgrade

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gfournieriExec
Copy link
Contributor

We should check if we want to return it false (Pierre) or if we want revert( JB)

Le-Caignec and others added 4 commits September 29, 2025 12:49
Co-authored-by: gfournieriExec <100280020+gfournieriExec@users.noreply.github.com>
Co-authored-by: gfournieriExec <100280020+gfournieriExec@users.noreply.github.com>
@Le-Caignec
Copy link
Contributor Author

Even if the spec changes, I think we should make those changes in another PR and iterate from there.

Le-Caignec and others added 5 commits September 29, 2025 17:11
Co-authored-by: Zied Guesmi <26070035+zguesmi@users.noreply.github.com>
Co-authored-by: Zied Guesmi <26070035+zguesmi@users.noreply.github.com>
Co-authored-by: Zied Guesmi <26070035+zguesmi@users.noreply.github.com>
@Le-Caignec Le-Caignec changed the title feat: implement dataset compatibility check with a deal in IexecPoco1Facet feat: implement dataset compatibility check with a deal in IexecPoco1Facet Sep 29, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

console.log('Deploying new IexecPocoAccessorsFacet...');
const iexecPocoAccessorsFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders);
const iexecPocoAccessorsFacet = await factoryDeployer.deployContract(
new IexecPocoAccessorsFacet__factory(iexecLibOrders),
Copy link
Preview

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IexecPocoAccessorsFacet__factory is instantiated twice - once assigned to iexecPocoAccessorsFacetFactory and again in the deployContract call. Use the existing iexecPocoAccessorsFacetFactory variable instead of creating a new instance.

Suggested change
new IexecPocoAccessorsFacet__factory(iexecLibOrders),
iexecPocoAccessorsFacetFactory,

Copilot uses AI. Check for mistakes.

SignatureVerifier,
IexecPocoCommon
{
contract IexecPoco1Facet is IexecPoco1, FacetBase, IexecEscrow, SignatureVerifier, IexecPocoCommon {
Copy link
Preview

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The contract declaration formatting was changed from multi-line to single-line. While this works, the multi-line format is more readable for contracts with multiple inheritance, especially when the line becomes long.

Suggested change
contract IexecPoco1Facet is IexecPoco1, FacetBase, IexecEscrow, SignatureVerifier, IexecPocoCommon {
contract IexecPoco1Facet is
IexecPoco1,
FacetBase,
IexecEscrow,
SignatureVerifier,
IexecPocoCommon
{

Copilot uses AI. Check for mistakes.

Copy link
Member

@zguesmi zguesmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!
Some minor comments but all good.

Le-Caignec and others added 2 commits September 30, 2025 15:30
Co-authored-by: Zied Guesmi <26070035+zguesmi@users.noreply.github.com>
@Le-Caignec Le-Caignec merged commit 550e707 into main Sep 30, 2025
4 checks passed
@Le-Caignec Le-Caignec deleted the feature/add-isDatasetCompatibleWithDeal-function branch September 30, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants