From 2c209b07bd9e6b4bb26cc2932199ec50bb7d8fa5 Mon Sep 17 00:00:00 2001 From: David Blane <32327139+dblane-digicatapult@users.noreply.github.com> Date: Mon, 14 Feb 2022 14:50:05 +0000 Subject: [PATCH] BugFix fix types used by vitalam-node (#14) * fixes a bug where we were not using the correct types that vitalam-node uses * added ipfsLogLevel to statefulSet * updated README * fixed docker-compose to use newer version of vitalam-node for tests --- README.md | 1 + app/env.js | 1 + app/keyWatcher/api.js | 31 +++++++++++++++++--- docker-compose.yaml | 2 +- helm/vitalam-ipfs/Chart.yaml | 4 +-- helm/vitalam-ipfs/templates/statefulset.yaml | 5 ++++ helm/vitalam-ipfs/values.yaml | 2 +- package-lock.json | 4 +-- package.json | 2 +- 9 files changed, 41 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d99de79..6a2e7d7 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,4 @@ Manages a go-ipfs instance maintaining the private network swarm key based on th | IPFS_LOG_LEVEL | N | `info` | Log level of the go-ipfs child process | | METADATA_KEY_LENGTH | N | `32` | Metadata key length in the substrate node | | METADATA_VALUE_LITERAL_LENGTH | N | `32` | Metadata literal value length limit in the substrate node | +| PROCESS_IDENTIFIER_LENGTH | N | `32` | Process ID Length | diff --git a/app/env.js b/app/env.js index 773f070..2e39295 100644 --- a/app/env.js +++ b/app/env.js @@ -32,6 +32,7 @@ const vars = envalid.cleanEnv( IPFS_LOG_LEVEL: envalid.str({ default: 'info', devDefault: 'debug' }), METADATA_KEY_LENGTH: envalid.num({ default: 32 }), METADATA_VALUE_LITERAL_LENGTH: envalid.num({ default: 32 }), + PROCESS_IDENTIFIER_LENGTH: envalid.num({ default: 32 }), }, { strict: true, diff --git a/app/keyWatcher/api.js b/app/keyWatcher/api.js index 394425d..f3f9252 100644 --- a/app/keyWatcher/api.js +++ b/app/keyWatcher/api.js @@ -1,5 +1,11 @@ const { ApiPromise, WsProvider } = require('@polkadot/api') -const { NODE_HOST, NODE_PORT, METADATA_KEY_LENGTH, METADATA_VALUE_LITERAL_LENGTH } = require('../env') +const { + NODE_HOST, + NODE_PORT, + METADATA_KEY_LENGTH, + METADATA_VALUE_LITERAL_LENGTH, + PROCESS_IDENTIFIER_LENGTH, +} = require('../env') const provider = new WsProvider(`ws://${NODE_HOST}:${NODE_PORT}`) const apiOptions = { @@ -24,7 +30,7 @@ const apiOptions = { parents: 'Vec', children: 'Option>', }, - Output: { + ProcessIO: { roles: 'BTreeMap', metadata: 'BTreeMap', parent_index: 'Option', @@ -34,13 +40,30 @@ const apiOptions = { File: 'Hash', Literal: `[u8; ${METADATA_VALUE_LITERAL_LENGTH}]`, TokenId: 'TokenId', - None: null, + None: 'null', }, }, Role: { - // order must match node as values are referenced by index. First entry is default. _enum: ['Owner', 'Customer', 'AdditiveManufacturer', 'Laboratory', 'Buyer', 'Supplier', 'Reviewer'], }, + ProcessIdentifier: `[u8; ${PROCESS_IDENTIFIER_LENGTH}]`, + ProcessVersion: 'u32', + ProcessId: { + id: 'ProcessIdentifier', + version: 'ProcessVersion', + }, + Process: { + status: 'ProcessStatus', + restrictions: 'Vec', + }, + ProcessStatus: { + _enum: ['Disabled', 'Enabled'], + }, + Restriction: { + _enum: ['None', 'SenderOwnsAllInputs'], + }, + IsNew: 'bool', + Restrictions: 'Vec', }, } diff --git a/docker-compose.yaml b/docker-compose.yaml index dc9e9b8..6ce6c15 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ version: '3' services: vitalam-node: - image: ghcr.io/digicatapult/vitalam-node:v2.7.0 + image: ghcr.io/digicatapult/vitalam-node:v2.9.3 command: --base-path /data/ --dev diff --git a/helm/vitalam-ipfs/Chart.yaml b/helm/vitalam-ipfs/Chart.yaml index 3a8eca4..e275aeb 100644 --- a/helm/vitalam-ipfs/Chart.yaml +++ b/helm/vitalam-ipfs/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: vitalam-ipfs -appVersion: '1.2.4' +appVersion: '1.2.5' description: A Helm chart for vitalam-ipfs -version: '1.2.4' +version: '1.2.5' type: application dependencies: - name: vitalam-node diff --git a/helm/vitalam-ipfs/templates/statefulset.yaml b/helm/vitalam-ipfs/templates/statefulset.yaml index f5b7faf..0a60887 100644 --- a/helm/vitalam-ipfs/templates/statefulset.yaml +++ b/helm/vitalam-ipfs/templates/statefulset.yaml @@ -76,6 +76,11 @@ spec: configMapKeyRef: name: {{ include "vitalam-ipfs.fullname" . }}-config key: ipfsArgs + - name: IPFS_LOG_LEVEL + valueFrom: + configMapKeyRef: + name: {{ include "vitalam-ipfs.fullname" . }}-config + key: ipfsLogLevel - name: IPFS_PATH value: {{ .Values.config.ipfsDataPath }} volumeMounts: diff --git a/helm/vitalam-ipfs/values.yaml b/helm/vitalam-ipfs/values.yaml index 128bc1d..4640fd8 100644 --- a/helm/vitalam-ipfs/values.yaml +++ b/helm/vitalam-ipfs/values.yaml @@ -17,7 +17,7 @@ config: image: repository: ghcr.io/digicatapult/vitalam-ipfs pullPolicy: IfNotPresent - tag: 'v1.2.4' + tag: 'v1.2.5' storage: storageClass: "" diff --git a/package-lock.json b/package-lock.json index ad0f126..8ff0710 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@digicatapult/vitalam-ipfs", - "version": "1.2.4", + "version": "1.2.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@digicatapult/vitalam-ipfs", - "version": "1.2.4", + "version": "1.2.5", "license": "Apache-2.0", "dependencies": { "@polkadot/api": "^5.9.1", diff --git a/package.json b/package.json index d953bb2..8479fc0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@digicatapult/vitalam-ipfs", - "version": "1.2.4", + "version": "1.2.5", "description": "Service for WASP", "main": "app/index.js", "scripts": {