From 7a4cff5da0c6314c6b4613fd05cfbbd40bbfe579 Mon Sep 17 00:00:00 2001 From: enrique Date: Mon, 30 Jan 2023 14:30:36 +0100 Subject: [PATCH] feat: update to support dynamic circuits location --- .env.sample | 1 + .github/workflows/testing-integration.yml | 5 +++-- README.md | 3 ++- .../nvm-compute-template-geth-localnet.yaml | 6 ++++++ .../nvm-compute-template.yaml | 6 ++++++ argo-workflows-templates/nvm-fl-template.yaml | 6 ++++++ config/from-env.js | 1 + config/nevermined.js | 1 + package.json | 4 ++-- src/compute/compute.service.ts | 4 ++++ src/info/dto/get-info.dto.ts | 1 + src/info/info.controller.ts | 2 ++ src/shared/config/config.service.ts | 2 ++ yarn.lock | 18 +++++++++--------- 14 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.env.sample b/.env.sample index a2d88b3e..b7f77968 100644 --- a/.env.sample +++ b/.env.sample @@ -21,6 +21,7 @@ IPFS_PROJECT_ID="2DAQCd37vAOT7rMZ8J2J9LnbO8N" IPFS_PROJECT_SECRET="cd6f32767707d6cd34d151b0049f444d" ENABLE_PROVENANCE=true ARTIFACTS_FOLDER=./artifacts +CIRCUITS_FOLDER=./circuits ENABLE_COMPUTE=true ARGO_HOST=http://localhost:2746/ diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index d25139e5..62f39354 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -20,17 +20,18 @@ jobs: yarn run lint - name: Check code formatting run: yarn format:check - - uses: nevermined-io/nvm-tools-actions@v0.6.0 + - uses: nevermined-io/nvm-tools-actions@v0.6.1 with: token: ${{ secrets.API_TOKEN_GITHUB }} opengsn: "true" estuary: "true" - contracts-version: "v3.0.0-rc5" node: "false" - name: Check artifacts run: | nvm-tools copy-artifacts ./artifacts ls -l artifacts + nvm-tools copy-circuits ./circuits + ls -l circuits - name: Run tests run: | export PROVIDER_KEYFILE=accounts/provider.json diff --git a/README.md b/README.md index f88e9d9e..7bc61f61 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ This will leave you with a `local.js` file within the `config` folder that will The Nevermined Node reads the following environment variables allowing the configuration of the deployment without modifying any config file: | Variable Name | Description | Example | -| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------| | **WEB3_PROVIDER_URL** | HTTP url of the web3 provider. The most popular providers are Infura & Alchemy, but anyone else can be used. The url depends on the network you want to connect. | http://mumbai.alchemy.io/v2/xxxxx | | **MARKETPLACE_URI** | HTTP url to the Marketplace API | https://marketplace-api.mumbai.public.nevermined.rocks | | **NODE_URI** | Public HTTP url where this node is exposed | https://node.mumbai.public.nevermined.rocks | @@ -80,6 +80,7 @@ The Nevermined Node reads the following environment variables allowing the confi | **AWS_S3_BUCKET_NAME** | Name of the S3 Bucket | `metadata` | | **ENABLE_PROVENANCE** | If `true` it will enable the integration with the provenance registry | `true` or `false` | | **ARTIFACTS_FOLDER** | Path where the Node will look for the Smart Contracts ABIs | A file system path. If not given it will look in the `./artifacts` folder | +| **CIRCUITS_FOLDER** | Path where the Node will look for the Circuits. | A file system path. If not given it will look in the `./circuits` folder | | **ENABLE_COMPUTE** | Enables the Nevermined's compute endpoints | `false` | | **ARGO_HOST** | HTTP url of the Argo Workflows instance we want to use for computing capabilities. Requires ENABLE_COMPUTE = true | `https://argo-workflows.instance` | | **ARGO_NAMESPACE** | Name of the Argo Workflows namespace where we will deploy the Nevermined's Compute Workflows. Requires ENABLE_COMPUTE = true | `argo` | diff --git a/argo-workflows-templates/nvm-compute-template-geth-localnet.yaml b/argo-workflows-templates/nvm-compute-template-geth-localnet.yaml index be7e9f42..4125bf49 100644 --- a/argo-workflows-templates/nvm-compute-template-geth-localnet.yaml +++ b/argo-workflows-templates/nvm-compute-template-geth-localnet.yaml @@ -37,6 +37,8 @@ spec: # value: # - name: artifacts_folder # value: + # - name: circuits_folder + # value: # - name: input_dir # value: # - name: output_dir @@ -95,6 +97,8 @@ spec: value: '{{workflow.parameters.marketplace_api_url}}' - name: ARTIFACTS_FOLDER value: '{{workflow.parameters.artifacts_folder}}' + - name: CIRCUITS_FOLDER + value: '{{workflow.parameters.circuits_folder}}' - name: BASE_PATH value: '{{workflow.parameters.volume}}' - name: INPUT_DIR @@ -172,6 +176,8 @@ spec: value: '{{workflow.parameters.marketplace_api_url}}' - name: ARTIFACTS_FOLDER value: '{{workflow.parameters.artifacts_folder}}' + - name: CIRCUITS_FOLDER + value: '{{workflow.parameters.circuits_folder}}' - name: BASE_PATH value: '{{workflow.parameters.volume}}' - name: OUTPUT_DIR diff --git a/argo-workflows-templates/nvm-compute-template.yaml b/argo-workflows-templates/nvm-compute-template.yaml index 8a17e6af..8a537969 100644 --- a/argo-workflows-templates/nvm-compute-template.yaml +++ b/argo-workflows-templates/nvm-compute-template.yaml @@ -37,6 +37,8 @@ spec: # value: # - name: artifacts_folder # value: + # - name: circuits_folder + # value: # - name: input_dir # value: # - name: output_dir @@ -95,6 +97,8 @@ spec: value: '{{workflow.parameters.marketplace_api_url}}' - name: ARTIFACTS_FOLDER value: '{{workflow.parameters.artifacts_folder}}' + - name: CIRCUITS_FOLDER + value: '{{workflow.parameters.circuits_folder}}' - name: BASE_PATH value: '{{workflow.parameters.volume}}' - name: INPUT_DIR @@ -172,6 +176,8 @@ spec: value: '{{workflow.parameters.marketplace_api_url}}' - name: ARTIFACTS_FOLDER value: '{{workflow.parameters.artifacts_folder}}' + - name: CIRCUITS_FOLDER + value: '{{workflow.parameters.circuits_folder}}' - name: BASE_PATH value: '{{workflow.parameters.volume}}' - name: OUTPUT_DIR diff --git a/argo-workflows-templates/nvm-fl-template.yaml b/argo-workflows-templates/nvm-fl-template.yaml index 96f1b838..72fadfc8 100644 --- a/argo-workflows-templates/nvm-fl-template.yaml +++ b/argo-workflows-templates/nvm-fl-template.yaml @@ -39,6 +39,8 @@ spec: # value: # - name: artifacts_folder # value: + # - name: circuits_folder + # value: # - name: input_dir # value: # - name: output_dir @@ -116,6 +118,8 @@ spec: value: '{{workflow.parameters.marketplace_api_url}}' - name: ARTIFACTS_FOLDER value: '{{workflow.parameters.artifacts_folder}}' + - name: CIRCUITS_FOLDER + value: '{{workflow.parameters.circuits_folder}}' - name: BASE_PATH value: '{{workflow.parameters.volume}}' - name: INPUT_DIR @@ -193,6 +197,8 @@ spec: value: '{{workflow.parameters.marketplace_api_url}}' - name: ARTIFACTS_FOLDER value: '{{workflow.parameters.artifacts_folder}}' + - name: CIRCUITS_FOLDER + value: '{{workflow.parameters.circuits_folder}}' - name: BASE_PATH value: '{{workflow.parameters.volume}}' - name: OUTPUT_DIR diff --git a/config/from-env.js b/config/from-env.js index ded30ca5..c8722f53 100644 --- a/config/from-env.js +++ b/config/from-env.js @@ -25,6 +25,7 @@ const keys = [ 'ESTUARY_ENDPOINT', 'ENABLE_PROVENANCE', 'ARTIFACTS_FOLDER', + 'CIRCUITS_FOLDER', 'ENABLE_COMPUTE', 'ARGO_HOST', 'ARGO_NAMESPACE', diff --git a/config/nevermined.js b/config/nevermined.js index ba084f23..c66e7e63 100644 --- a/config/nevermined.js +++ b/config/nevermined.js @@ -12,6 +12,7 @@ const configBase = { neverminedNodeAddress: process.env['NODE_ADDRESS'] || '0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0', artifactsFolder: process.env['ARTIFACTS_FOLDER'] || './artifacts', + circuitsFolder: process.env['CIRCUITS_FOLDER'] || './circuits', marketplaceAuthToken: process.env['MARKETPLACE_AUTH_TOKEN'] || 'bogus', graphHttpUri: nograph ? undefined diff --git a/package.json b/package.json index de689a93..bf0615b3 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "@nestjs/swagger": "^5.2.0", "@nestjs/typeorm": "^8.0.3", "@nevermined-io/argo-workflows-api": "^0.1.3", - "@nevermined-io/nevermined-sdk-dtp": "0.3.0-rc14", - "@nevermined-io/nevermined-sdk-js": "1.0.0-rc17", + "@nevermined-io/nevermined-sdk-dtp": "0.3.0-rc15", + "@nevermined-io/nevermined-sdk-js": "1.0.0-rc18", "@nevermined-io/passport-nevermined": "^0.1.1", "@sideway/address": "^4.1.3", "@sideway/formula": "^3.0.0", diff --git a/src/compute/compute.service.ts b/src/compute/compute.service.ts index 2d55c563..e006fac7 100644 --- a/src/compute/compute.service.ts +++ b/src/compute/compute.service.ts @@ -215,6 +215,10 @@ export class ComputeService { name: 'artifacts_folder', value: '/artifacts', }, + { + name: 'circuits_folder', + value: '/circuits', + }, { name: 'input_dir', value: 'inputs', diff --git a/src/info/dto/get-info.dto.ts b/src/info/dto/get-info.dto.ts index 5cc4c58e..6a6881c8 100644 --- a/src/info/dto/get-info.dto.ts +++ b/src/info/dto/get-info.dto.ts @@ -21,6 +21,7 @@ export class GetInfoDto { 'keeper-url': string 'provenance-enabled': boolean 'artifacts-folder': string + 'circuits-folder': string contracts: any 'external-contracts': any 'keeper-version': string diff --git a/src/info/info.controller.ts b/src/info/info.controller.ts index f4a4b621..70fc25e7 100644 --- a/src/info/info.controller.ts +++ b/src/info/info.controller.ts @@ -50,6 +50,7 @@ export class InfoController { const baby = this.config.getProviderBabyjub() const provenanceEnabled = this.config.get('ENABLE_PROVENANCE') const artifactDir = this.config.get('ARTIFACTS_FOLDER') + const circuitDir = this.config.get('CIRCUITS_FOLDER') const providerURL = new URL(this.nvmService.web3ProviderUri()) @@ -60,6 +61,7 @@ export class InfoController { 'keeper-url': `${providerURL.protocol}//${providerURL.host}`, 'provenance-enabled': provenanceEnabled, 'artifacts-folder': artifactDir, + 'circuits-folder': circuitDir, contracts: [], 'external-contracts': [], 'keeper-version': await contractHandler.getVersion('DIDRegistry', artifactDir), diff --git a/src/shared/config/config.service.ts b/src/shared/config/config.service.ts index 78f7d178..2544b847 100644 --- a/src/shared/config/config.service.ts +++ b/src/shared/config/config.service.ts @@ -64,6 +64,7 @@ const DOTENV_SCHEMA = Joi.object({ AWS_S3_BUCKET_NAME: Joi.string(), ENABLE_PROVENANCE: Joi.boolean().default(true), ARTIFACTS_FOLDER: Joi.string().default('./artifacts'), + CIRCUITS_FOLDER: Joi.string().default('./circuits'), ENABLE_COMPUTE: Joi.boolean().default(false), ARGO_HOST: Joi.string().default('http:localhost:2746/'), ARGO_NAMESPACE: Joi.string().default('argo'), @@ -97,6 +98,7 @@ type DotenvSchemaKeys = | 'AWS_S3_BUCKET_NAME' | 'ENABLE_PROVENANCE' | 'ARTIFACTS_FOLDER' + | 'CIRCUITS_FOLDER' | 'ENABLE_COMPUTE' | 'ARGO_HOST' | 'ARGO_NAMESPACE' diff --git a/yarn.lock b/yarn.lock index 2d3a127e..1e12b8ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1194,12 +1194,12 @@ dependencies: axios "^0.21.1" -"@nevermined-io/nevermined-sdk-dtp@0.3.0-rc14": - version "0.3.0-rc14" - resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-dtp/-/nevermined-sdk-dtp-0.3.0-rc14.tgz#dd977de5942da638c2310134b253e4767ab52a76" - integrity sha512-5GOxkBhpQ3LNc9hI5rRMd2BmfownbJuraNvQHgQPw2PWR4iBvZNXU/lJA9qmpeDyRFdLvSclW/Tc72bvqUgQjA== +"@nevermined-io/nevermined-sdk-dtp@0.3.0-rc15": + version "0.3.0-rc15" + resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-dtp/-/nevermined-sdk-dtp-0.3.0-rc15.tgz#483d20724f4d2323b49ecbae695e51d101fc256f" + integrity sha512-whmzhDDisOpinfMQE55cVlG1LSKPZf6tRjPhHx459/HCITdIEszpRWfqY45LUO3KhHc3yCp2sa0DqGfTABJyeQ== dependencies: - "@nevermined-io/nevermined-sdk-js" "1.0.0-rc17" + "@nevermined-io/nevermined-sdk-js" "1.0.0-rc18" circomlibjs "^0.1.1" eciesjs "^0.3.15" ffjavascript "^0.2.55" @@ -1207,10 +1207,10 @@ snarkjs "^0.4.26" web3-utils "^1.7.4" -"@nevermined-io/nevermined-sdk-js@1.0.0-rc17": - version "1.0.0-rc17" - resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-js/-/nevermined-sdk-js-1.0.0-rc17.tgz#95350f0cf247fd4a59a9294c28f92d9d0b4219a0" - integrity sha512-AP1VHxXnbaScYFRUUYS1eYyMpJbIIRTWKZdkq6LHXBgEGoZdleYCwuPBG8iaAyM2GN133drKPVYEbJFIuZcAmQ== +"@nevermined-io/nevermined-sdk-js@1.0.0-rc18": + version "1.0.0-rc18" + resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-js/-/nevermined-sdk-js-1.0.0-rc18.tgz#967431bb68f3845634a214bc245b5c39f9d4adb5" + integrity sha512-cPKyjK+tfQCpnK3rJUk50U/qPeyEL+E0A40WcYLj5l274TAA9gM01Repnp4MuBJbVEXiF/nJpufZigH2jvi+CQ== dependencies: "@nevermined-io/subgraphs" "0.5.0-rc1" assert "^2.0.0"