mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge pull request #1615 from oceanprotocol/container-checksum-fixes
Container checksum fixes
This commit is contained in:
commit
e04cd8196c
@ -262,6 +262,7 @@ async function getJobs(
|
||||
// }
|
||||
return computeJobs
|
||||
}
|
||||
|
||||
export async function getComputeJobs(
|
||||
chainIds: number[],
|
||||
accountId: string,
|
||||
@ -347,23 +348,18 @@ export async function createTrustedAlgorithmList(
|
||||
if (!selectedAssets || selectedAssets.length === 0) return []
|
||||
|
||||
for (const selectedAlgorithm of selectedAssets) {
|
||||
const sanitizedAlgorithmContainer = {
|
||||
entrypoint: selectedAlgorithm.metadata.algorithm.container.entrypoint,
|
||||
image: selectedAlgorithm.metadata.algorithm.container.image,
|
||||
tag: selectedAlgorithm.metadata.algorithm.container.tag,
|
||||
checksum: selectedAlgorithm.metadata.algorithm.container.checksum
|
||||
}
|
||||
const filesChecksum = await getFileDidInfo(
|
||||
selectedAlgorithm?.id,
|
||||
selectedAlgorithm?.services?.[0].id,
|
||||
selectedAlgorithm?.services?.[0]?.serviceEndpoint,
|
||||
true
|
||||
)
|
||||
const containerChecksum =
|
||||
selectedAlgorithm.metadata.algorithm.container.entrypoint +
|
||||
selectedAlgorithm.metadata.algorithm.container.checksum
|
||||
const trustedAlgorithm = {
|
||||
did: selectedAlgorithm.id,
|
||||
containerSectionChecksum: getHash(
|
||||
JSON.stringify(sanitizedAlgorithmContainer)
|
||||
),
|
||||
containerSectionChecksum: getHash(containerChecksum),
|
||||
filesChecksum: filesChecksum?.[0]?.checksum
|
||||
}
|
||||
trustedAlgorithms.push(trustedAlgorithm)
|
||||
|
@ -316,29 +316,7 @@ export default function Compute({
|
||||
'Data set is not orderable in combination with selected algorithm.'
|
||||
)
|
||||
|
||||
setComputeStatusText(
|
||||
getComputeFeedback(
|
||||
asset.accessDetails.baseToken?.symbol,
|
||||
asset.accessDetails.datatoken?.symbol,
|
||||
asset.metadata.type
|
||||
)[
|
||||
asset.accessDetails?.type === 'fixed'
|
||||
? 2
|
||||
: asset.accessDetails?.type === 'dynamic'
|
||||
? 1
|
||||
: 3
|
||||
]
|
||||
)
|
||||
const datasetOrderTx = await handleComputeOrder(
|
||||
web3,
|
||||
asset,
|
||||
datasetOrderPriceAndFees,
|
||||
accountId,
|
||||
hasDatatoken,
|
||||
initializedProviderResponse.datasets[0],
|
||||
computeEnv.consumerAddress
|
||||
)
|
||||
if (!datasetOrderTx) throw new Error('Failed to order dataset.')
|
||||
await initPriceAndFees()
|
||||
|
||||
setComputeStatusText(
|
||||
getComputeFeedback(
|
||||
@ -365,6 +343,30 @@ export default function Compute({
|
||||
)
|
||||
if (!algorithmOrderTx) throw new Error('Failed to order algorithm.')
|
||||
|
||||
setComputeStatusText(
|
||||
getComputeFeedback(
|
||||
asset.accessDetails.baseToken?.symbol,
|
||||
asset.accessDetails.datatoken?.symbol,
|
||||
asset.metadata.type
|
||||
)[
|
||||
asset.accessDetails?.type === 'fixed'
|
||||
? 2
|
||||
: asset.accessDetails?.type === 'dynamic'
|
||||
? 1
|
||||
: 3
|
||||
]
|
||||
)
|
||||
const datasetOrderTx = await handleComputeOrder(
|
||||
web3,
|
||||
asset,
|
||||
datasetOrderPriceAndFees,
|
||||
accountId,
|
||||
hasDatatoken,
|
||||
initializedProviderResponse.datasets[0],
|
||||
computeEnv.consumerAddress
|
||||
)
|
||||
if (!datasetOrderTx) throw new Error('Failed to order dataset.')
|
||||
|
||||
LoggerInstance.log('[compute] Starting compute job.')
|
||||
const computeAsset: ComputeAsset = {
|
||||
documentId: asset.id,
|
||||
|
@ -102,15 +102,17 @@ export interface MetadataAlgorithmContainer {
|
||||
export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
|
||||
{
|
||||
image: 'node',
|
||||
tag: 'latest',
|
||||
tag: '18.6.0', // TODO: Put this back to latest once merging the PR that fetches the container digest from docker hub via dockerhub-proxy
|
||||
entrypoint: 'node $ALGO',
|
||||
checksum: '' // TODO: how to get? Most likely needs to be fetched from DockerHub.
|
||||
checksum:
|
||||
'sha256:c60726646352202d95de70d9e8393c15f382f8c6074afc5748b7e570ccd5995f'
|
||||
},
|
||||
{
|
||||
image: 'python',
|
||||
tag: 'latest',
|
||||
tag: '3.10.5', // TODO: Put this back to latest once merging the PR that fetches the container digest from docker hub via dockerhub-proxy
|
||||
entrypoint: 'python $ALGO',
|
||||
checksum: ''
|
||||
checksum:
|
||||
'sha256:607635763e54907fd75397fedfeb83890e62a0f9b54a1d99d27d748c5d269be4'
|
||||
}
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user