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
1 change: 1 addition & 0 deletions src/@types/C2D/C2D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export interface ComputeAlgorithm {
export interface AlgoChecksums {
files: string
container: string
serviceId?: string
}

export interface DBComputeJobPayment {
Expand Down
10 changes: 9 additions & 1 deletion src/components/core/compute/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export async function getAlgoChecksums(
): Promise<AlgoChecksums> {
const checksums: AlgoChecksums = {
files: '',
container: ''
container: '',
serviceId: algoServiceId
}
try {
const algoDDO = await new FindDdoHandler(oceanNode).findAndFormatDdo(algoDID)
Expand Down Expand Up @@ -76,6 +77,7 @@ export async function validateAlgoForDataset(
algoChecksums: {
files: string
container: string
serviceId?: string
},
ddoInstance: VersionedDDO,
datasetServiceId: string,
Expand Down Expand Up @@ -115,6 +117,12 @@ export async function validateAlgoForDataset(
const containerMatch =
algo.containerSectionChecksum === '*' ||
algo.containerSectionChecksum === algoChecksums.container
if ('serviceId' in Object.keys(algo)) {
const serviceIdMatch =
algo.serviceId === '*' || algo.serviceId === algoChecksums.serviceId
return didMatch && filesMatch && containerMatch && serviceIdMatch
}

return didMatch && filesMatch && containerMatch
})

Expand Down
1 change: 1 addition & 0 deletions src/test/integration/compute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,7 @@ describe('Compute', () => {
expect(algoChecksums.container).to.equal(
'ba8885fcc7d366f058d6c3bb0b7bfe191c5f85cb6a4ee3858895342436c23504'
)
expect(algoChecksums.serviceId).to.equal(algoDDOTest.services[0].id)
} else expect(expectedTimeoutFailure(this.test.title)).to.be.equal(wasTimeout)
})

Expand Down
Loading