Skip to content

Commit

Permalink
BugFix fix types used by vitalam-node (#14)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dblane-digicatapult authored Feb 14, 2022
1 parent 65ba3c5 commit 2c209b0
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
1 change: 1 addition & 0 deletions app/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
31 changes: 27 additions & 4 deletions app/keyWatcher/api.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -24,7 +30,7 @@ const apiOptions = {
parents: 'Vec<TokenId>',
children: 'Option<Vec<TokenId>>',
},
Output: {
ProcessIO: {
roles: 'BTreeMap<RoleKey, AccountId>',
metadata: 'BTreeMap<TokenMetadataKey, TokenMetadataValue>',
parent_index: 'Option<u32>',
Expand All @@ -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<Restriction>',
},
ProcessStatus: {
_enum: ['Disabled', 'Enabled'],
},
Restriction: {
_enum: ['None', 'SenderOwnsAllInputs'],
},
IsNew: 'bool',
Restrictions: 'Vec<Restriction>',
},
}

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions helm/vitalam-ipfs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions helm/vitalam-ipfs/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion helm/vitalam-ipfs/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ config:
image:
repository: ghcr.io/digicatapult/vitalam-ipfs
pullPolicy: IfNotPresent
tag: 'v1.2.4'
tag: 'v1.2.5'

storage:
storageClass: ""
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 2c209b0

Please sign in to comment.