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
|
return computeJobs
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getComputeJobs(
|
export async function getComputeJobs(
|
||||||
chainIds: number[],
|
chainIds: number[],
|
||||||
accountId: string,
|
accountId: string,
|
||||||
@ -347,23 +348,18 @@ export async function createTrustedAlgorithmList(
|
|||||||
if (!selectedAssets || selectedAssets.length === 0) return []
|
if (!selectedAssets || selectedAssets.length === 0) return []
|
||||||
|
|
||||||
for (const selectedAlgorithm of selectedAssets) {
|
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(
|
const filesChecksum = await getFileDidInfo(
|
||||||
selectedAlgorithm?.id,
|
selectedAlgorithm?.id,
|
||||||
selectedAlgorithm?.services?.[0].id,
|
selectedAlgorithm?.services?.[0].id,
|
||||||
selectedAlgorithm?.services?.[0]?.serviceEndpoint,
|
selectedAlgorithm?.services?.[0]?.serviceEndpoint,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
const containerChecksum =
|
||||||
|
selectedAlgorithm.metadata.algorithm.container.entrypoint +
|
||||||
|
selectedAlgorithm.metadata.algorithm.container.checksum
|
||||||
const trustedAlgorithm = {
|
const trustedAlgorithm = {
|
||||||
did: selectedAlgorithm.id,
|
did: selectedAlgorithm.id,
|
||||||
containerSectionChecksum: getHash(
|
containerSectionChecksum: getHash(containerChecksum),
|
||||||
JSON.stringify(sanitizedAlgorithmContainer)
|
|
||||||
),
|
|
||||||
filesChecksum: filesChecksum?.[0]?.checksum
|
filesChecksum: filesChecksum?.[0]?.checksum
|
||||||
}
|
}
|
||||||
trustedAlgorithms.push(trustedAlgorithm)
|
trustedAlgorithms.push(trustedAlgorithm)
|
||||||
|
@ -316,29 +316,7 @@ export default function Compute({
|
|||||||
'Data set is not orderable in combination with selected algorithm.'
|
'Data set is not orderable in combination with selected algorithm.'
|
||||||
)
|
)
|
||||||
|
|
||||||
setComputeStatusText(
|
await initPriceAndFees()
|
||||||
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.')
|
|
||||||
|
|
||||||
setComputeStatusText(
|
setComputeStatusText(
|
||||||
getComputeFeedback(
|
getComputeFeedback(
|
||||||
@ -365,6 +343,30 @@ export default function Compute({
|
|||||||
)
|
)
|
||||||
if (!algorithmOrderTx) throw new Error('Failed to order algorithm.')
|
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.')
|
LoggerInstance.log('[compute] Starting compute job.')
|
||||||
const computeAsset: ComputeAsset = {
|
const computeAsset: ComputeAsset = {
|
||||||
documentId: asset.id,
|
documentId: asset.id,
|
||||||
|
@ -102,15 +102,17 @@ export interface MetadataAlgorithmContainer {
|
|||||||
export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
|
export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
|
||||||
{
|
{
|
||||||
image: 'node',
|
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',
|
entrypoint: 'node $ALGO',
|
||||||
checksum: '' // TODO: how to get? Most likely needs to be fetched from DockerHub.
|
checksum:
|
||||||
|
'sha256:c60726646352202d95de70d9e8393c15f382f8c6074afc5748b7e570ccd5995f'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
image: 'python',
|
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',
|
entrypoint: 'python $ALGO',
|
||||||
checksum: ''
|
checksum:
|
||||||
|
'sha256:607635763e54907fd75397fedfeb83890e62a0f9b54a1d99d27d748c5d269be4'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user