Add policyServer object in compute routes.#1964
Merged
Merged
Conversation
AdriGeorge
approved these changes
Jul 10, 2025
Collaborator
|
lgtm |
Contributor
Author
|
tested locally with the steps described in ci workflow:
Signing message with _legacySignMessage
Ddo successfully validated
algorithm id: did:op:e7487c1eaa91015c833d0b0ae0b766d7a14e64dd2fd039b8708aef9775aa77e2
✔ 6.2 Publish an algorithm (create NFT + Datatoken) and set algorithm metadata (815ms)
✔ 7.1 Resolve published datasets and algorithms (30079ms)
✔ 8.1 Mint dataset and algorithm datatokens to publisher (215ms)
✔ 9.1 Fetch compute environments from provider
Free compute environment = {
id: '0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-0xe5ebf1c3e383618dc9af4c02a71a829c52feeed0e952dc4bd7c8c4fa6cab5bc7',
runningJobs: 0,
consumerAddress: '0xe08A1dAe983BC701D05E492DB80e0144f8f4b909',
platform: { architecture: 'x86_64', os: 'Ubuntu 24.04.2 LTS' },
fees: { '8996': [ [Object] ] },
storageExpiry: 604800,
maxJobDuration: 3600,
resources: [
{ id: 'cpu', total: 4, max: 4, min: 1, inUse: 0 },
{
id: 'ram',
total: 27311357952,
max: 27311357952,
min: 1000000000,
inUse: 0
},
{
id: 'disk',
total: 1000000000,
max: 1000000000,
min: 0,
inUse: 0
}
],
free: {
maxJobDuration: 60,
maxJobs: 3,
resources: [ [Object], [Object], [Object] ]
},
runningfreeJobs: 0
}
called new free compute start method...
datasets: [
{
documentId: 'did:op:9a0ada50a883e7e8af61fa313ff835ddf1416103ecf237eaa5bf9e8c5bfdc0d2',
serviceId: '1155995dda741e93afe4b1c6ced2d01734a6ec69865cc0997daf1f4db7259a36'
}
]
algorithm: {
documentId: 'did:op:e7487c1eaa91015c833d0b0ae0b766d7a14e64dd2fd039b8708aef9775aa77e2',
serviceId: 'db164c1b981e4d2974e90e61bda121512e6909c1035c908d68933ae4cfaba6b0',
meta: {
language: 'Node.js',
version: '1.0.0',
container: {
entrypoint: 'node $ALGO',
image: 'ubuntu',
tag: 'latest',
checksum: 'sha256:2d7ecc9c5e08953d586a6e50c29b91479a48f69ac1ba1f9dc0420d18a728dfc5'
}
}
}
[getNonce] Consumer: 0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e nonce: 2
signatureMessage: 3
✔ 10.1 Start a compute job using a free C2D environment (467ms)
computeStatusUrl: http://127.0.0.1:8001/api/services/compute?consumerAddress=0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e&jobId=0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-b57706b28c1af12d4426d4854c1899cd4992f0216db8f97c450d2bb34570dfc5
Current status of the compute job: [
{
owner: '0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e',
did: null,
jobId: 'b57706b28c1af12d4426d4854c1899cd4992f0216db8f97c450d2bb34570dfc5',
dateCreated: '1752572883.055',
dateFinished: null,
status: 0,
statusText: 'Job started',
results: [],
inputDID: null,
algoDID: null,
agreementId: null,
environment: '0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-0xe5ebf1c3e383618dc9af4c02a71a829c52feeed0e952dc4bd7c8c4fa6cab5bc7',
resources: [ [Object], [Object], [Object] ],
isFree: true,
algoStartTimestamp: '0',
algoStopTimestamp: '0',
metadata: null,
maxJobDuration: 60
}
]
✔ 11.1 Check compute status
[getNonce] Consumer: 0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e nonce: 3
Compute results URL: http://127.0.0.1:8001/api/services/computeResult?consumerAddress=0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e&jobId=0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-b57706b28c1af12d4426d4854c1899cd4992f0216db8f97c450d2bb34570dfc5&index=0&nonce=4&signature=0x90b854698d20f850c9532d20ab9db4c2ace4dddd22f4f90ecbcd3311980ce3f0282a2145139e9276e36185e0d433939c13a2c6d5a860934e5371a76f6732f8a51b
✔ 11.2 Get download compute results URL (10022ms)
Compute environment = {
id: '0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-0xe5ebf1c3e383618dc9af4c02a71a829c52feeed0e952dc4bd7c8c4fa6cab5bc7',
runningJobs: 0,
consumerAddress: '0xe08A1dAe983BC701D05E492DB80e0144f8f4b909',
platform: { architecture: 'x86_64', os: 'Ubuntu 24.04.2 LTS' },
fees: { '8996': [ [Object] ] },
storageExpiry: 604800,
maxJobDuration: 3600,
resources: [
{ id: 'cpu', total: 4, max: 4, min: 1, inUse: 0 },
{
id: 'ram',
total: 27311357952,
max: 27311357952,
min: 1000000000,
inUse: 0
},
{
id: 'disk',
total: 1000000000,
max: 1000000000,
min: 0,
inUse: 0
}
],
free: {
maxJobDuration: 60,
maxJobs: 3,
resources: [ [Object], [Object], [Object] ]
},
runningfreeJobs: 0
}
[getNonce] Consumer: 0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e nonce: 3
Initialize compute url: http://127.0.0.1:8001/api/services/initializeCompute
Raw response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_events: [Object],
_readableState: [ReadableState],
_writableState: [WritableState],
allowHalfOpen: true,
_maxListeners: undefined,
_eventsCount: 2,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'http://127.0.0.1:8001/api/services/initializeCompute',
status: 200,
statusText: 'OK',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
providerInitializeComputeResults = {"algorithm":{"validOrder":false,"did":"did:op:e7487c1eaa91015c833d0b0ae0b766d7a14e64dd2fd039b8708aef9775aa77e2","serviceId":"db164c1b981e4d2974e90e61bda121512e6909c1035c908d68933ae4cfaba6b0","datatoken":"0x6BbA575757A9d5aa5655c18ff7B0019c81ff9A53","chainId":8996,"consumerAddress":"0xe08A1dAe983BC701D05E492DB80e0144f8f4b909","providerFee":{"providerFeeAddress":"0xe08A1dAe983BC701D05E492DB80e0144f8f4b909","providerFeeToken":"0x2473f4F7bf40ed9310838edFCA6262C17A59DF64","providerFeeAmount":"0","providerData":"0x7b226474223a22307836426241353735373537413964356161353635356331386666374230303139633831666639413533222c226964223a2264623136346331623938316534643239373465393065363162646131323135313265363930396331303335633930386436383933336165346366616261366230227d","v":27,"r":"0xeb52919e054ff5a33471c1f94372ec8df4010b0339c634d30dab18408983f661","s":"0x308ee2f13304d4b7b07114e279735da2e128a93064bb5b432b0663bc88015ea3","validUntil":300}},"datasets":[{"validOrder":false,"did":"did:op:9a0ada50a883e7e8af61fa313ff835ddf1416103ecf237eaa5bf9e8c5bfdc0d2","serviceId":"1155995dda741e93afe4b1c6ced2d01734a6ec69865cc0997daf1f4db7259a36","datatoken":"0x8059900af885B6d508B47AF71CE2285B40543D9F","chainId":8996,"consumerAddress":"0xe08A1dAe983BC701D05E492DB80e0144f8f4b909","providerFee":{"providerFeeAddress":"0xe08A1dAe983BC701D05E492DB80e0144f8f4b909","providerFeeToken":"0x2473f4F7bf40ed9310838edFCA6262C17A59DF64","providerFeeAmount":"0","providerData":"0x7b226474223a22307838303539393030616638383542366435303842343741463731434532323835423430353433443946222c226964223a2231313535393935646461373431653933616665346231633663656432643031373334613665633639383635636330393937646166316634646237323539613336227d","v":28,"r":"0xfda0e2b1899aa43c6fedbc2ef7bb71d48f246c3567045f93f43ff4faa81ef786","s":"0x4bc10dfb52e271a1d39638472f1cd9ffaf20af8bda728805d6c68187107a7235","validUntil":300}}],"payment":{"escrowAddress":"0xE4f7c64C52085A6df2c7c2972466EEf3ba3aD081","payee":"0xe08A1dAe983BC701D05E492DB80e0144f8f4b909","chainId":8996,"minLockSeconds":4200,"token":"0x2473f4F7bf40ed9310838edFCA6262C17A59DF64","amount":"120000000000000000000"}}
No config found for given network 'undefined'
No config found for given network 'undefined'
No config found for given network 'undefined'
No config found for given network 'undefined'
No config found for given network 'undefined'
called new compute start method...
datasets: [
{
documentId: 'did:op:9a0ada50a883e7e8af61fa313ff835ddf1416103ecf237eaa5bf9e8c5bfdc0d2',
serviceId: '1155995dda741e93afe4b1c6ced2d01734a6ec69865cc0997daf1f4db7259a36',
transferTxId: '0x98dd51e60262d9621cf68dc5b6921f30e12a724004711e6a8a53a6729ac0d2e7'
}
]
algorithm: {
documentId: 'did:op:e7487c1eaa91015c833d0b0ae0b766d7a14e64dd2fd039b8708aef9775aa77e2',
serviceId: 'db164c1b981e4d2974e90e61bda121512e6909c1035c908d68933ae4cfaba6b0',
meta: {
language: 'Node.js',
version: '1.0.0',
container: {
entrypoint: 'node $ALGO',
image: 'ubuntu',
tag: 'latest',
checksum: 'sha256:2d7ecc9c5e08953d586a6e50c29b91479a48f69ac1ba1f9dc0420d18a728dfc5'
}
},
transferTxId: '0x9f1b0c9f07dba4b9af163c237121989f0cc1f84b53f94e873d9fcb546e1cd5c2'
}
[getNonce] Consumer: 0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e nonce: 3
✔ 12.1 Start a compute job using a paid C2D resources (3512ms)
computeStatusUrl: http://127.0.0.1:8001/api/services/compute?consumerAddress=0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e&jobId=0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-7cf0ac5b05c69a39fc0bd05e61bb13ac20553cc71ea1893a4e89058211c37593
Current status of the compute job: [
{
owner: '0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e',
did: null,
jobId: '7cf0ac5b05c69a39fc0bd05e61bb13ac20553cc71ea1893a4e89058211c37593',
dateCreated: '1752572896.605',
dateFinished: null,
status: 0,
statusText: 'Job started',
results: [],
inputDID: null,
algoDID: null,
agreementId: null,
environment: '0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-0xe5ebf1c3e383618dc9af4c02a71a829c52feeed0e952dc4bd7c8c4fa6cab5bc7',
resources: [ [Object], [Object], [Object] ],
isFree: false,
algoStartTimestamp: '0',
algoStopTimestamp: '0',
metadata: null,
maxJobDuration: 3600
}
]
✔ 13.1 Check compute status for paid compute job
[getNonce] Consumer: 0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e nonce: 4
Compute results URL: http://127.0.0.1:8001/api/services/computeResult?consumerAddress=0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e&jobId=0x27bb418eca824bdc1fe31a946fcc094297282bc11fb6405612b40108f5d5c5e3-7cf0ac5b05c69a39fc0bd05e61bb13ac20553cc71ea1893a4e89058211c37593&index=0&nonce=5&signature=0xc47504576e0ddeefa5fa1a3bb88760647883bae148c00a270205d026cead42b91139ccea50b1322bd00af863ca110a4daf8445fa06fbcba9761b92750561eb171b
✔ 13.2 Get download compute results URL (10022ms)
13 passing (57s)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # .
Changes proposed in this PR: