Skip to content

Conversation

@gfournierPro
Copy link
Contributor

Description

Modifies the matchOrders mechanism to ignore Scone, Gramine, and TDX framework bits (bits 1-3) in dataset order tags, enabling dataset orders from SGX workerpools to be consumed on TDX workerpools and vice versa.

Changes

Smart Contract (IexecPoco1Facet.sol)

  1. _matchOrders function:

    • Applies mask ~0xE (= 0xFFF...FF1) to dataset order tags before combining with app and request tags
    • Preserves bit 0 (TEE) and all bits ≥ 4 for future features
    • Clears bits 1, 2, 3 (Scone, Gramine, TDX)
  2. assertDatasetDealCompatibility function:

    • Applies the same masking logic when checking dataset order compatibility with existing deals
    • Ensures consistency between order matching and bulk-processing

Bit Mapping (0-indexed)

  • Bit 0: TEE (0x1)
  • Bit 1: Scone (0x2) - ignored for datasets
  • Bit 2: Gramine (0x4) - ignored for datasets
  • Bit 3: TDX (0x8) - ignored for datasets
  • Bits 4+: Available for future features

Copy link
Contributor

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 cross-framework compatibility for dataset orders by masking TEE framework bits (bits 1-3: Scone, Gramine, TDX) in dataset tags. This allows dataset orders created for SGX workerpools to be consumed on TDX workerpools and vice versa.

  • Applied bit mask ~0xE (preserving bit 0 and bits ≥4, clearing bits 1-3) to dataset tags in order matching logic
  • Extended the same masking to dataset compatibility checks for bulk processing
  • Added comprehensive test coverage for cross-framework scenarios and edge cases

Reviewed Changes

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

File Description
contracts/facets/IexecPoco1Facet.sol Implements dataset tag masking in _matchOrders and assertDatasetDealCompatibility to ignore framework-specific bits 1-3
test/byContract/IexecPoco/IexecPoco1.test.ts Adds test cases verifying cross-framework compatibility (Scone/Gramine/TDX) and proper handling of masked/unmasked bits

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const deal = await iexecPoco.viewDeal(dealId);
expect(deal.tag).to.equal(
'0x0000000000000000000000000000000000000000000000000000000000000001',
); // TEE tag only (bits 2-4 from dataset were masked out)
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Comment incorrectly states "bits 2-4" but the actual bits being masked are bits 1-3 (Scone, Gramine, TDX). Bit 0 is TEE, and bits 1, 2, 3 are the framework bits being ignored. The comment should say "bits 1-3" instead of "bits 2-4".

Suggested change
); // TEE tag only (bits 2-4 from dataset were masked out)
); // TEE tag only (bits 1-3 from dataset were masked out)

Copilot uses AI. Check for mistakes.
Comment on lines 793 to 794
it('Should match orders when dataset bits 2-4 are set but only bit 1 (TEE) is considered', async () => {
// Dataset order with bits 2, 3, 4 set: 0b1111 = 0xF
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Comment incorrectly states "bits 2-4" but should state "bits 1-3" (Scone, Gramine, TDX framework bits). This is consistent with the PR description which clearly states bits 1, 2, 3 are being masked.

Suggested change
it('Should match orders when dataset bits 2-4 are set but only bit 1 (TEE) is considered', async () => {
// Dataset order with bits 2, 3, 4 set: 0b1111 = 0xF
it('Should match orders when dataset bits 1-3 are set but only bit 1 (TEE) is considered', async () => {
// Dataset order with bits 1, 2, 3 set: 0b1111 = 0xF

Copilot uses AI. Check for mistakes.
};
await signOrder(iexecWrapper.getDomain(), tdxDatasetOrder, datasetProvider);

// Should not revert because bits 2-4 of dataset tag are ignored
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Comment incorrectly states "bits 2-4" but should state "bits 1-3" (Scone, Gramine, TDX framework bits). The masking ignores bits 1, 2, and 3, not bits 2, 3, and 4.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.38%. Comparing base (55729ad) to head (8e0ed47).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #325   +/-   ##
=======================================
  Coverage   96.37%   96.38%           
=======================================
  Files          33       33           
  Lines        1132     1134    +2     
  Branches      228      228           
=======================================
+ Hits         1091     1093    +2     
  Misses         41       41           

☔ 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.

Copy link
Contributor

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 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* - Bit 1: Scone
* - Bit 2: Gramine
* - Bit 3: TDX
* - Bit 4: GPU (0x100)
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The comment states "Bit 4: GPU (0x100)" but this is incorrect. Bit 4 (0-indexed) should be 0x10 (decimal 16), not 0x100 (decimal 256). The value 0x100 represents bit 8.

The constant TAG_BIT_4 on line 20 correctly uses 0x10, so only the comment needs to be corrected to: "- Bit 4: GPU (0x10)"

Suggested change
* - Bit 4: GPU (0x100)
* - Bit 4: GPU (0x10)

Copilot uses AI. Check for mistakes.
Base automatically changed from chore/solidity-v8 to main November 13, 2025 17:37
Comment on lines +641 to +660
{
datasetTag: TAG_TEE_SCONE,
workerpoolTag: TAG_TEE_TDX,
description: 'Scone tag (0x3) and workerpool has TDX tag (0x9)',
},
{
datasetTag: TAG_TEE_GRAMINE,
workerpoolTag: TAG_TEE_TDX,
description: 'Gramine tag (0x5) and workerpool has TDX tag (0x9)',
},
{
datasetTag: TAG_TEE_TDX,
workerpoolTag: TAG_TEE_SCONE,
description: 'TDX tag (0x9) and workerpool has Scone tag (0x3)',
},
{
datasetTag: TAG_ALL_TEE_FRAMEWORKS,
workerpoolTag: TAG_TEE,
description: 'all TEE framework bits (0xF) and workerpool has TEE only (0x1)',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

i thing there is many other case - but it's good like that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a todo thanks

.withArgs('Requester restriction not satisfied');
});

it('Should revert when tag compatibility is not satisfied', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we refer only to the deal. We should clarify that, because above we iterate over each workerpool TAG to check compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gfournierPro gfournierPro merged commit 2349970 into main Nov 14, 2025
4 checks passed
@gfournierPro gfournierPro deleted the feat/deal-with-tag branch November 14, 2025 10:33
Copilot AI mentioned this pull request Dec 18, 2025
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.

4 participants