Skip to content

Commit f2ff3a5

Browse files
committed
fix: improve comments for dataset order compatibility logic
1 parent b58d068 commit f2ff3a5

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

contracts/facets/IexecPoco1Facet.sol

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,12 @@ contract IexecPoco1Facet is
126126
revert IncompatibleDatasetOrder("Requester restriction not satisfied");
127127
}
128128
// The deal's tag should include all tag bits of the dataset order.
129-
// For dataset orders: ignore bits 2, 3, and 4 (Scone, Gramine, TDX frameworks) to allow
130-
// dataset orders from Arbitrum One SGX workerpool to be consumed on Arbitrum One TDX workerpool.
131-
// Only bit 1 (TEE) is preserved from the dataset tag when checking compatibility.
132-
// Bit mask: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1
133-
// This mask clears bits 2, 3, and 4 (0b1110 = 0xE) while keeping all other bits.
129+
// For dataset orders: ignore Scone, Gramine, and TDX framework bits to allow
130+
// dataset orders from SGX workerpools to be consumed on TDX workerpools and vice versa.
131+
// Examples after masking:
134132
// Deal: 0b0101, Dataset: 0b0101 => Masked Dataset: 0b0001 => ok
135133
// Deal: 0b0101, Dataset: 0b0001 => Masked Dataset: 0b0001 => ok
136-
// Deal: 0b1001, Dataset: 0b0011 => Masked Dataset: 0b0001 => ok (TDX deal with SGX dataset)
134+
// Deal: 0b1001 (TDX), Dataset: 0b0011 (Scone) => Masked Dataset: 0b0001 => ok (cross-framework compatibility)
137135
bytes32 maskedDatasetTag = datasetOrder.tag &
138136
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1;
139137
if ((deal.tag & maskedDatasetTag) != maskedDatasetTag) {
@@ -246,11 +244,10 @@ contract IexecPoco1Facet is
246244
"iExecV5-matchOrders-0x05"
247245
);
248246
// The workerpool tag should include all tag bits of dataset, app, and requester orders.
249-
// For dataset orders: ignore bits 2, 3, and 4 (Scone, Gramine, TDX frameworks) to allow
250-
// dataset orders from Arbitrum One SGX workerpool to be consumed on Arbitrum One TDX workerpool.
251-
// Only bit 1 (TEE) is preserved from the dataset tag, all other bits are masked out (bits 2-4).
252-
// Bit mask: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1
253-
// This mask clears bits 2, 3, and 4 (0b1110 = 0xE) while keeping all other bits.
247+
// For dataset orders: ignore Scone, Gramine, and TDX framework bits to allow
248+
// dataset orders from SGX workerpools to be consumed on TDX workerpools and vice versa.
249+
// Bit positions (0-indexed): bit 0 = TEE, bit 1 = Scone, bit 2 = Gramine, bit 3 = TDX
250+
// Mask: ~(BIT_SCONE | BIT_GRAMINE | BIT_TDX) = ~0xE = 0xFFF...FF1
254251
bytes32 maskedDatasetTag = _datasetorder.tag &
255252
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1;
256253
bytes32 tag = _apporder.tag | maskedDatasetTag | _requestorder.tag;

0 commit comments

Comments
 (0)