Repository: hyperledger/indy-vdr (language: python)

Issue:
Non-deterministic issue with the javascript wrapper in Node.js
CI keeps failing on this step: https://github.com/hyperledger/indy-vdr/actions/runs/5082667192/jobs/9145294433

With the error:

```
FAIL tests/GetAttribRequest.test.ts (21.485 s)
  ● GetAttribRequest › Submit request

    Pool timeout: Request was interrupted

      114 |     const indyVdrErrorObject = JSON.parse(nativeError.deref() as string) as IndyVdrErrorObject
      115 |
    > 116 |     throw new IndyVdrError(indyVdrErrorObject)
          |           ^
      117 |   }
      118 |
      119 |   public get nativeIndyVdr() {

      at NodeJSIndyVdr.handleError (src/NodeJSIndyVdr.ts:116:11)
      at cb (src/NodeJSIndyVdr.ts:87:16)
      at Object.<anonymous> (../node_modules/ffi-napi/lib/callback.js:66:27)
```

It happens for some functions and the amount of times it happens is different each run.

It passes here: https://github.com/hyperledger/indy-vdr/actions/runs/5044489119/jobs/9048660679

The errors seem to be thrown from the native library, with version: `v0.4.0-dev.15`.


Discussion / hints:
https://github.com/hyperledger/indy-vdr/pull/184 Seems to be the first PR where this is noticed. No changes have been made to indy-vdr for a couple of months.
We're using a live network for tests still I think. Maybe we should switch to a local network that is set-up in CI?
Here's the CI that set's it up: https://github.com/hyperledger/indy-vdr/blob/main/.github/workflows/build.yml#LL84C1-L88C97

we just have to configure the js wrapper tests to also set up the network use the local pool

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9c7878a0..cdfd3daf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -243,6 +243,15 @@ jobs:
       - name: Check types
         run: yarn check-types
 
+      - name: Run local node pool
+        run: |
+          cd ../../
+          docker build -f ci/indy-pool.dockerfile -t test_pool --build-arg pool_ip=10.0.0.2 ci
+          docker network create --subnet=10.0.0.0/8 indy-sdk-network
+          docker run -d --name indy_pool -p 9701-9708:9701-9708 --net=indy-sdk-network test_pool
+          cd wrappers/javascript
+          docker exec $(docker ps -aqf "ancestor=test_pool") cat /var/lib/indy/sandbox/pool_transactions_genesis >> genesis.txn
+
       - name: Run tests
         env:
           # binary is downloaded to root of repository
diff --git a/wrappers/javascript/.eslintrc.js b/wrappers/javascript/.eslintrc.js
index 051c7aff..cede0fd0 100644
--- a/wrappers/javascript/.eslintrc.js
+++ b/wrappers/javascript/.eslintrc.js
@@ -71,8 +71,10 @@ module.exports = {
   },
   overrides: [
     {
-      files: ['arch.js'],
-      env: { node: true },
+      files: ['arch.js', 'platform.js'],
+      env: {
+        node: true,
+      },
       rules: {
         '@typescript-eslint/no-unsafe-assignment': 'off',
         'no-console': 'off',
@@ -91,5 +93,14 @@ module.exports = {
         '@typescript-eslint/no-unsafe-call': 'off',
       },
     },
+    {
+      files: ['**.test.**'],
+      env: {
+        node: true,
+      },
+      rules: {
+        '@typescript-eslint/no-unsafe-assignment': 'off',
+      },
+    },
   ],
 }
diff --git a/wrappers/javascript/indy-vdr-nodejs/README.md b/wrappers/javascript/indy-vdr-nodejs/README.md
index 3004b48b..73cf2c71 100644
--- a/wrappers/javascript/indy-vdr-nodejs/README.md
+++ b/wrappers/javascript/indy-vdr-nodejs/README.md
@@ -33,4 +33,22 @@ const getSchemaRequest = new GetSchemaRequest({
 const schemaResponse = await pool.submitRequest(getSchemaRequest)
 ```
 
+## Testing
+
+In order to test this library, you need a local indy network running. This can be done with the following commands (from the root of the repository):
+
+```sh
+docker build -f ci/indy-pool.dockerfile -t test_pool --build-arg pool_ip=10.0.0.2 ci
+docker network create --subnet=10.0.0.0/8 indy-sdk-network
+docker run -d --name indy_pool -p 9701-9708:9701-9708 --net=indy-sdk-network test_pool
+
+# Network is now running
+
+cd wrappers/javascript
+
+docker exec $(docker ps -aqf "ancestor=test_pool") cat /var/lib/indy/sandbox/pool_transactions_genesis >> genesis.txn
+
+yarn test:local-build
+```
+
 > **Note**: If you want to use this library in a cross-platform environment you need to import methods from the `@hyperledger/indy-vdr-shared` package instead. This is a platform independent package that allows to register the native bindings. The `@hyperledger/indy-vdr-nodejs` package uses this package under the hood. See the [Indy VDR Shared README](https://github.com/hyperledger/indy-vdr/tree/main/wrappers/javascript/indy-vdr-shared/README.md) for documentation on how to use this package.
diff --git a/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js b/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js
index feea7aa9..e521f2e0 100644
--- a/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js
+++ b/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js
@@ -1,7 +1,3 @@
-/* eslint-disable @typescript-eslint/no-var-requires */
-/* eslint-disable no-console */
-/* eslint-disable @typescript-eslint/no-unsafe-assignment */
-/* eslint-disable no-undef */
 const os = require('os')
 
 // Find appropriate target architecture for retrieving the anoncreds library


Test patch:
diff --git a/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrPool.test.ts b/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrPool.test.ts
index ac8127c9..b7002d4a 100644
--- a/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrPool.test.ts
+++ b/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrPool.test.ts
@@ -1,9 +1,6 @@
-// TODO: this should be turned off at a eslint config level for tests
-/* eslint-disable @typescript-eslint/no-unsafe-assignment */
-
 import type { IndyVdrPool } from '@hyperledger/indy-vdr-nodejs'
 
-import { SOVRIN_GENESIS_TRANSACTION_BUILDER_NET } from './utils'
+import { genesisTxnPath } from './utils'
 
 import { PoolCreate } from '@hyperledger/indy-vdr-nodejs'
 
@@ -11,7 +8,7 @@ describe('IndyVdrPool', () => {
   let pool: IndyVdrPool
 
   beforeAll(() => {
-    pool = new PoolCreate({ parameters: { transactions: SOVRIN_GENESIS_TRANSACTION_BUILDER_NET } })
+    pool = new PoolCreate({ parameters: { transactions_path: genesisTxnPath } })
   })
 
   test('Get pool handle', () => {
diff --git a/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrRequest.test.ts b/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrRequest.test.ts
index 80fa3346..4bfe9055 100644
--- a/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrRequest.test.ts
+++ b/wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrRequest.test.ts
@@ -1,5 +1,3 @@
-/* eslint-disable @typescript-eslint/no-unsafe-assignment */
-
 import type { IndyVdrRequest } from '@hyperledger/indy-vdr-nodejs'
 
 import { DID, SCHEMA_ID } from './utils'
diff --git a/wrappers/javascript/indy-vdr-nodejs/tests/utils/fixtures.ts b/wrappers/javascript/indy-vdr-nodejs/tests/utils/fixtures.ts
index cc20a604..ef837c71 100644
--- a/wrappers/javascript/indy-vdr-nodejs/tests/utils/fixtures.ts
+++ b/wrappers/javascript/indy-vdr-nodejs/tests/utils/fixtures.ts
@@ -1,15 +1,8 @@
-export const SOVRIN_GENESIS_TRANSACTION_BUILDER_NET = `
-{"reqSignature":{},"txn":{"data":{"data":{"alias":"FoundationBuilder","blskey":"3gmhmqpPLqznZF3g3niodaHjbpsB6TEeE9SpgXgBnZJLmXgeRzJqTLajVwbhxrkomJFTFU4ohDC4ZRXKbUPCQywJuPAQnst8XBtCFredMECn4Z3goi1mNt5QVRdU8Ue2xMSkdLpsQMjCsNwYUsBguwXYUQnDXQXnHqRkK9qrivucQ5Z","blskey_pop":"RHWacPhUNc9JWsGNdmWYHrAvvhsow399x3ttNKKLDpz9GkxxnTKxtiZqarkx4uP5ByTwF4kM8nZddFKWuzoKizVLttALQ2Sc2BNJfRzzUZMNeQSnESkKZ7U5vE2NhUDff6pjANczrrDAXd12AjSG61QADWdg8CVciZFYtEGmKepwzP","client_ip":"35.161.146.16","client_port":"9702","node_ip":"50.112.53.5","node_port":"9701","services":["VALIDATOR"]},"dest":"GVvdyd7Y6hsBEy5yDDHjqkXgH8zW34K74RsxUiUCZDCE"},"metadata":{"from":"V5qJo72nMeF7x3ci8Zv2WP"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fe991cd590fff10f596bb6fe2362229de47d49dd50748e38b96f368152be29c7"},"ver":"1"}
-{"reqSignature":{},"txn":{"data":{"data":{"alias":"vnode1","blskey":"t5jtREu8au2dwFwtH6QWopmTGxu6qmJ3iSnk321yLgeu7mHQRXf2ZCBuez8KCAQvFZGqqAoy2FcYvDGCqQxRCz9qXKgiBtykzxjDjYu87JECwwddnktz5UabPfZmfu6EoDn4rFxvd4myPu2hksb5Z9GT6UeoEYi7Ub3yLFQ3xxaQXc","blskey_pop":"QuHB7tiuFBPQ6zPkwHfMtjzWqXJBLACtfggm7zCRHHgdva18VN4tNg7LUU2FfKGQSLZz1M7oRxhhgJkZLL19aGvaHB2MPtnBWK9Hr8LMiwi95UjX3TVXJri4EvPjQ6UUvHrjZGUFvKQphPyVTMZBJwfkpGAGhpbTQuQpEH7f56m1X5","client_ip":"206.189.143.34","client_port":"9796","node_ip":"206.189.143.34","node_port":"9797","services":["VALIDATOR"]},"dest":"9Aj2LjQ2fwszJRSdZqg53q5e6ayScmtpeZyPGgKDswT8"},"metadata":{"from":"FzAaV9Waa1DccDa72qwg13"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"5afc282bf9a7a5e3674c09ee48e54d73d129aa86aa226691b042e56ff9eaf59b"},"ver":"1"}
-{"reqSignature":{},"txn":{"data":{"data":{"alias":"xsvalidatorec2irl","blskey":"4ge1yEvjdcV6sDSqbevqPRWq72SgkZqLqfavBXC4LxnYh4QHFpHkrwzMNjpVefvhn1cgejHayXTfTE2Fhpu1grZreUajV36T6sT4BiewAisdEw59mjMxkp9teYDYLQqwPUFPgaGKDbFCUBEaNdAP4E8Q4UFiF13Qo5842pAY13mKC23","blskey_pop":"R5PoEfWvni5BKvy7EbUbwFMQrsgcuzuU1ksxfvySH6FC5jpmisvcHMdVNik6LMvAeSdt6K4sTLrqnaaQCf5aCHkeTcQRgDVR7oFYgyZCkF953m4kSwUM9QHzqWZP89C6GkBx6VPuL1RgPahuBHDJHHiK73xLaEJzzFZtZZxwoWYABH","client_ip":"52.50.114.133","client_port":"9702","node_ip":"52.209.6.196","node_port":"9701","services":["VALIDATOR"]},"dest":"DXn8PUYKZZkq8gC7CZ2PqwECzUs2bpxYiA5TWgoYARa7"},"metadata":{"from":"QuCBjYx4CbGCiMcoqQg1y"},"type":"0"},"txnMetadata":{"seqNo":3,"txnId":"1972fce7af84b7f63b7f0c00495a84425cce3b0c552008576e7996524cca04cb"},"ver":"1"}
-{"reqSignature":{},"txn":{"data":{"data":{"alias":"danube","blskey":"3Vt8fxn7xg8n8pR872cvGWNuR7STFzFSPMftX96zF6871wYVTR27aspxGSeEtx9wj8g4D3GdCxHJbQ4FsxQz6TATQswiiZfxAVNjLLUci8WSH4t1GPx9CvGXB2uzDfVnnJyhhnASxJEbvykLUBBFG3fW4tMQixujpowUADz5jHm427u","blskey_pop":"RJpXXLkjRRv9Lk8tJz8LTkhhC7RWjHQcB9CG8J8U8fXT6arTDMYc62zXtToBAmGkGu8Udsmo3Hh7mv4KB9JAf8ufGY9WsnppCVwar7zEXyBfLpCnDhvVcBAzkhRpHmqHygN24DeBu9aH6tw4uXxVJvRRGSbPtxjWa379BmfQWzXHCb","client_ip":"207.180.207.73","client_port":"9702","node_ip":"173.249.14.196","node_port":"9701","services":["VALIDATOR"]},"dest":"52muwfE7EjTGDKxiQCYWr58D8BcrgyKVjhHgRQdaLiMw"},"metadata":{"from":"VbPQNHsvoLZdaNU7fTBeFx"},"type":"0"},"txnMetadata":{"seqNo":4,"txnId":"ebf340b317c044d970fcd0ca018d8903726fa70c8d8854752cd65e29d443686c"},"ver":"1"}
-`
+import path from 'path'
 
+export const genesisTxnPath = path.join(__dirname, '../../../genesis.txn')
 export const DID = 'PqdUtwWhuX4GWRa58WSdvn'
-
 export const SCHEMA_ID = 'J6nTnUo3YLayzc2GUUctb1:2:MyName:1.0'
-
 export const CRED_DEF_ID = 'GeUpJLNXHEgTBJEy4nSjnd:3:CL:47756:default'
-
 export const REVOC_REG_DEF_ID =
   'EsUFXEDp9uqPL3tMNXhUst:4:EsUFXEDp9uqPL3tMNXhUst:3:CL:63132:Oliu.id:CL_ACCUM:6074b559-164e-458a-8532-2057d5b26946'
diff --git a/wrappers/javascript/indy-vdr-nodejs/tests/utils/initialize.ts b/wrappers/javascript/indy-vdr-nodejs/tests/utils/initialize.ts
index ca17a0ea..83dec783 100644
--- a/wrappers/javascript/indy-vdr-nodejs/tests/utils/initialize.ts
+++ b/wrappers/javascript/indy-vdr-nodejs/tests/utils/initialize.ts
@@ -1,7 +1,7 @@
 import { PoolCreate } from '@hyperledger/indy-vdr-shared'
 
-import { SOVRIN_GENESIS_TRANSACTION_BUILDER_NET } from './fixtures'
+import { genesisTxnPath } from './fixtures'
 
 export const setupPool = () => {
-  return new PoolCreate({ parameters: { transactions: SOVRIN_GENESIS_TRANSACTION_BUILDER_NET } })
+  return new PoolCreate({ parameters: { transactions_path: genesisTxnPath } })
 }