From ffc1ac33a12989938dc1b7e24ebcd48c387dd608 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Wed, 24 Aug 2022 13:11:39 +0200 Subject: [PATCH 01/12] getting operation status from additional nodes successfully --- test/bdd/features/publish-errors.feature | 17 +- test/bdd/features/release.feature | 26 ++- test/bdd/steps/api/publish.js | 5 +- test/bdd/steps/api/resolve.js | 15 +- test/bdd/steps/common.js | 169 ++++++++++++++---- .../origintrail-test-bootstrap-config.json | 6 +- .../config/origintrail-test-node-config.json | 6 +- 7 files changed, 174 insertions(+), 70 deletions(-) diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index 00887cb448..b96f8e69d0 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -3,20 +3,21 @@ Feature: Publish errors test Given the blockchain is set up And 1 bootstrap is running -## Scenario: Node is not able to start publish on the network with valid assertion -## Given I setup 4 nodes -## When I call publish on node 1 with validAssertion -## And I wait for last publish to finalize -## And Last publish finished with status: PUBLISH_START_ERROR +# Scenario: Node is not able to start publish on the network with valid assertion +# Given I setup publish node 0 with invalid configuration +# Given I setup 3 nodes +# When I call publish on node 1 with validAssertion +# And I wait for last publish to finalize +# And Last publish finished with status: PublishStartError + ## -# Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes When I call publish on ot-node 1 directly with invalidPublishRequestBody And I wait for 15 seconds and check operationId status And Last publish finished with status: PublishValidateAssertionError - -## Scenario: Node is not able to store publish result in the local database +# +### Scenario: Node is not able to store publish result in the local database ## Given I setup 4 nodes ## When I call publish on node 1 with validAssertion ## And I wait for last publish to finalize diff --git a/test/bdd/features/release.feature b/test/bdd/features/release.feature index 7fb0dd2e20..4316361859 100644 --- a/test/bdd/features/release.feature +++ b/test/bdd/features/release.feature @@ -7,21 +7,17 @@ Feature: Release related tests Scenario: Node is able to publish on the network, expect status completed on publish result Given I setup 4 nodes When I call publish on node 1 with validAssertion - And I wait for last publish to finalize And Last publish finished with status: COMPLETED -# @release -# Scenario: Node is able to resolve assertion previously published -# Given I setup 4 nodes -# When I call publish on node 1 with validAssertion -# And I wait for last publish to finalize -# And Last publish finished with status: COMPLETED -# And I call resolve on node 1 for last published assertion -# And I wait for last resolve to finalize -# And Last resolve finished with status: COMPLETED + @release + Scenario: Node is able to resolve assertion previously published + Given I setup 4 nodes + When I call publish on node 1 with validAssertion + And Last publish finished with status: COMPLETED + And I call resolve on node 1 for last published assertion + And Last resolve finished with status: COMPLETED + And I setup 1 additional node + And I call resolve on node 5 for last published assertion +# And I wait for last resolve to finalize# + And Last resolve finished with status: COMPLETED # And Last resolve returned valid result -## And I setup 1 additional node -## And I call resolve on node 5 for last published assertion -## And I wait for last resolve to finalize -## And Last resolve finished with status: COMPLETED -## And Last resolve returned valid result diff --git a/test/bdd/steps/api/publish.js b/test/bdd/steps/api/publish.js index a9d3af9a4f..47c7804a69 100644 --- a/test/bdd/steps/api/publish.js +++ b/test/bdd/steps/api/publish.js @@ -60,9 +60,6 @@ When( nodeId: node - 1, operationId, }; - // await setTimeout(15000); - // const status = await httpApiHelper.getOperationResult(`http://localhost:${this.state.nodes[node - 1].configuration.rpcPort}`, operationId); - // console.log(JSON.stringify(status.data,null,2)); }, ); @@ -103,7 +100,7 @@ Given('I wait for last publish to finalize', { timeout: 60000 }, async () => { }); Given( - /Last publish finished with status: ([COMPLETED|FAILED|PublishValidateAssertionError]+)$/, + /Last publish finished with status: ([COMPLETED|FAILED|PublishValidateAssertionError,PUblishStartError]+)$/, { timeout: 120000 }, async function lastPublishFinished(status) { this.logger.log(`Last publish finished with status: ${status}`); diff --git a/test/bdd/steps/api/resolve.js b/test/bdd/steps/api/resolve.js index e651326ec2..4ec7b34479 100644 --- a/test/bdd/steps/api/resolve.js +++ b/test/bdd/steps/api/resolve.js @@ -12,18 +12,18 @@ When( !!this.state.lastPublishData, 'Last publish data is undefined. Publish is not finalized.', ).to.be.equal(true); - const assertionIds = [this.state.lastPublishData.result.assertion.id]; + // const assertionIds = [this.state.lastPublishData.result.assertion.id]; const result = await this.state.nodes[node - 1].client - .resolve(assertionIds) + .getResult(this.state.lastPublishData.UAL) .catch((error) => { assert.fail(`Error while trying to resolve assertion. ${error}`); }); - const operationId = result.data.operation_id; + const { operationId } = result.operation; this.state.lastResolveData = { nodeId: node - 1, operationId, - assertionIds, + result, }; }, ); @@ -82,9 +82,10 @@ Given( ).to.be.equal(true); const resolveData = this.state.lastResolveData; - expect(resolveData.result.status, 'Publish result status validation failed').to.be.equal( - status, - ); + expect( + resolveData.result.operation.status, + 'Publish result status validation failed', + ).to.be.equal(status); }, ); diff --git a/test/bdd/steps/common.js b/test/bdd/steps/common.js index 6a5fcba649..f023be407a 100644 --- a/test/bdd/steps/common.js +++ b/test/bdd/steps/common.js @@ -37,12 +37,14 @@ function forkNode(nodeConfiguration) { Given(/^I setup (\d+) node[s]*$/, { timeout: 60000 }, function nodeSetup(nodeCount, done) { this.logger.log(`I setup ${nodeCount} node${nodeCount !== 1 ? 's' : ''}`); const wallets = this.state.localBlockchain.getWallets(); + const currentNumberOfNodes = Object.keys(this.state.nodes).length; let nodesStarted = 0; for (let i = 0; i < nodeCount; i += 1) { - const wallet = wallets[i + 1]; - const managementWallet = wallets[i + 28]; - const rpcPort = 8901 + i; - const nodeName = `origintrail-test-${i}`; + const nodeIndex = currentNumberOfNodes + i; + const wallet = wallets[nodeIndex + 1]; + const managementWallet = wallets[nodeIndex + 28]; + const rpcPort = 8901 + nodeIndex; + const nodeName = `origintrail-test-${nodeIndex}`; const nodeConfiguration = JSON.parse( fs @@ -59,17 +61,18 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 60000 }, function nodeSetup(nodeCou managementWallet.address, )[0]; - nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = 9001 + i; + nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = + 9001 + nodeIndex; nodeConfiguration.modules.repository.implementation[ 'sequelize-repository' - ].config.database = `operationaldbnode${i}`; + ].config.database = `operationaldbnode${nodeIndex}`; nodeConfiguration.modules.tripleStore.implementation['ot-graphdb'].config.repository = nodeName; nodeConfiguration.modules.httpClient.implementation['express-http-client'].config.port = rpcPort; - nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${i}`; + nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${nodeIndex}`; nodeConfiguration.rpcPort = rpcPort; - nodeConfiguration.appDataPath = `data${i}`; + nodeConfiguration.appDataPath = `data${nodeIndex}`; nodeConfiguration.graphDatabase.name = nodeName; const forkedNode = forkNode(nodeConfiguration); @@ -83,7 +86,9 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 60000 }, function nodeSetup(nodeCou // eslint-disable-next-line no-loop-func forkedNode.on('message', (response) => { if (response.error) { - assert.fail(`Error while trying initialize node${i} client: ${response.error}`); + assert.fail( + `Error while trying initialize node${nodeIndex} client: ${response.error}`, + ); } else { // todo if started const client = new DkgClientHelper({ @@ -93,7 +98,7 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 60000 }, function nodeSetup(nodeCou timeout: 25, loglevel: 'trace', }); - this.state.nodes[i] = { + this.state.nodes[nodeIndex] = { client, forkedNode, configuration: nodeConfiguration, @@ -165,48 +170,69 @@ Given( for (let i = 0; i < nodeCount; i += 1) { const nodeIndex = currentNumberOfNodes + i; const wallet = wallets[nodeIndex]; + const managementWallet = wallets[nodeIndex + 28]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; - const nodeConfiguration = { - graphDatabase: { - name: nodeName, - }, - blockchain: getBlockchainConfiguration( - this.state.localBlockchain, - wallet.privateKey, - wallet.address, - ), - operationalDatabase: { - databaseName: `operationaldbnode${nodeIndex}`, - }, - rpcPort, - network: { - id: 'Devnet', - port: 9001 + nodeIndex, - bootstrap: [ - '/ip4/0.0.0.0/tcp/9000/p2p/QmWyf3dtqJnhuCpzEDTNmNFYc5tjxTrXhGcUUmGHdg2gtj', - ], - }, - }; + const nodeConfiguration = JSON.parse( + fs + .readFileSync( + path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), + ) + .toString(), + ); + // eslint-disable-next-line prefer-destructuring + nodeConfiguration.modules.blockchain = getBlockchainConfiguration( + this.state.localBlockchain, + wallet.privateKey, + wallet.address, + managementWallet.address, + )[0]; + + nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = + 9001 + nodeIndex; + nodeConfiguration.modules.repository.implementation[ + 'sequelize-repository' + ].config.database = `operationaldbnode${nodeIndex}`; + nodeConfiguration.modules.tripleStore.implementation['ot-graphdb'].config.repository = + nodeName; + nodeConfiguration.modules.httpClient.implementation['express-http-client'].config.port = + rpcPort; + nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${nodeIndex}`; + nodeConfiguration.rpcPort = rpcPort; + nodeConfiguration.appDataPath = `data${nodeIndex}`; + nodeConfiguration.graphDatabase.name = nodeName; - const forkedNode = forkNode.call(this, nodeName, nodeConfiguration); + const forkedNode = forkNode(nodeConfiguration); + + const logFileStream = fs.createWriteStream( + `${this.state.scenarionLogDir}/${nodeName}.log`, + ); + forkedNode.stdout.setEncoding('utf8'); + forkedNode.stdout.on('data', (data) => { + // Here is where the output goes + logFileStream.write(data); + }); // eslint-disable-next-line no-loop-func forkedNode.on('message', (response) => { if (response.error) { - // todo handle error + assert.fail( + `Error while trying initialize node${nodeIndex} client: ${response.error}`, + ); } else { // todo if started const client = new DkgClientHelper({ - endpoint: '127.0.0.1', + endpoint: 'http://localhost', port: rpcPort, useSSL: false, timeout: 25, + loglevel: 'trace', }); this.state.nodes[nodeIndex] = { client, forkedNode, configuration: nodeConfiguration, + nodeRpcUrl: `http://localhost:${rpcPort}`, }; } nodesStarted += 1; @@ -217,3 +243,78 @@ Given( } }, ); +Given( + /^I setup publish node (\d+) with invalid configuration/, + { timeout: 120000 }, + function setupPublishNode(nodeIndex, done) { + this.logger.log(`I setup node ${nodeIndex} with invalid configuration`); + const wallet = this.state.localBlockchain.getWallets()[nodeIndex]; + const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex + 28]; + const rpcPort = 8901 + nodeIndex; + const nodeName = `origintrail-test-${nodeIndex}`; + const nodeConfiguration = JSON.parse( + fs + .readFileSync( + path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), + ) + .toString(), + ); + // eslint-disable-next-line prefer-destructuring + nodeConfiguration.modules.blockchain = getBlockchainConfiguration( + this.state.localBlockchain, + wallet.privateKey, + wallet.address, + managementWallet.address, + )[0]; + + nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = + 9001 + nodeIndex; + nodeConfiguration.modules.repository.implementation[ + 'sequelize-repository' + ].config.database = `operationaldbnode${nodeIndex}`; + nodeConfiguration.modules.tripleStore.implementation['ot-graphdb'].config.repository = + nodeName; + nodeConfiguration.modules.httpClient.implementation['express-http-client'].config.port = + rpcPort; + nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${nodeIndex}`; + nodeConfiguration.rpcPort = rpcPort; + nodeConfiguration.appDataPath = `data${nodeIndex}`; + nodeConfiguration.graphDatabase.name = nodeName; + + nodeConfiguration.minimumAckResponses.publish = 10; + + const forkedNode = forkNode(nodeConfiguration); + + const logFileStream = fs.createWriteStream(`${this.state.scenarionLogDir}/${nodeName}.log`); + forkedNode.stdout.setEncoding('utf8'); + forkedNode.stdout.on('data', (data) => { + // Here is where the output goes + logFileStream.write(data); + }); + + // eslint-disable-next-line no-loop-func + forkedNode.on('message', (response) => { + if (response.error) { + assert.fail( + `Error while trying initialize node${nodeIndex} client: ${response.error}`, + ); + } else { + // todo if started + const client = new DkgClientHelper({ + endpoint: '127.0.0.1', + port: rpcPort, + useSSL: false, + timeout: 25, + loglevel: 'trace', + }); + this.state.nodes[nodeIndex] = { + client, + forkedNode, + configuration: nodeConfiguration, + nodeRpcUrl: `http://localhost:${rpcPort}`, + }; + } + done(); + }); + }, +); diff --git a/test/bdd/steps/config/origintrail-test-bootstrap-config.json b/test/bdd/steps/config/origintrail-test-bootstrap-config.json index 372a5919bb..2789035757 100644 --- a/test/bdd/steps/config/origintrail-test-bootstrap-config.json +++ b/test/bdd/steps/config/origintrail-test-bootstrap-config.json @@ -92,5 +92,9 @@ "name": "origintrail-test-bootstrap" }, "rpcPort": 8900, - "minimumReplicationFactor": 4 + "minimumReplicationFactor": 4, + "minimumAckResponses": { + "publish": 2, + "get": 1 + } } diff --git a/test/bdd/steps/config/origintrail-test-node-config.json b/test/bdd/steps/config/origintrail-test-node-config.json index 3d2e301744..7a1f1aa964 100644 --- a/test/bdd/steps/config/origintrail-test-node-config.json +++ b/test/bdd/steps/config/origintrail-test-node-config.json @@ -94,5 +94,9 @@ }, "rpcPort": 8901, "minimumReplicationFactor": 4, - "appDataPath": "data0" + "appDataPath": "data0", + "minimumAckResponses": { + "publish": 2, + "get": 1 + } } From 72dba373d0e404666d3ecc3d5c3ef2540d2a1110 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Thu, 25 Aug 2022 09:31:51 +0200 Subject: [PATCH 02/12] resolve testcase fixed. Added testcase for publishing with invalid config. --- test/bdd/features/publish-errors.feature | 14 ++--- test/bdd/features/release.feature | 2 +- test/bdd/steps/api/publish.js | 68 ++++++++++++------------ test/bdd/steps/common.js | 4 +- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index b96f8e69d0..fa73d0f0d3 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -3,18 +3,18 @@ Feature: Publish errors test Given the blockchain is set up And 1 bootstrap is running -# Scenario: Node is not able to start publish on the network with valid assertion -# Given I setup publish node 0 with invalid configuration -# Given I setup 3 nodes -# When I call publish on node 1 with validAssertion -# And I wait for last publish to finalize -# And Last publish finished with status: PublishStartError + Scenario: Node is not able to start publish on the network with valid assertion + Given I setup publish node 0 with invalid configuration + Given I setup 3 nodes + When I call publish on node 1 with validAssertion + # And I wait for last publish to finalize + And Last publish finished with status: PublishStartError ## Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes When I call publish on ot-node 1 directly with invalidPublishRequestBody - And I wait for 15 seconds and check operationId status + And I wait for 20 seconds and check operationId status And Last publish finished with status: PublishValidateAssertionError # ### Scenario: Node is not able to store publish result in the local database diff --git a/test/bdd/features/release.feature b/test/bdd/features/release.feature index 4316361859..4471ab673d 100644 --- a/test/bdd/features/release.feature +++ b/test/bdd/features/release.feature @@ -8,7 +8,7 @@ Feature: Release related tests Given I setup 4 nodes When I call publish on node 1 with validAssertion And Last publish finished with status: COMPLETED - +# @release Scenario: Node is able to resolve assertion previously published Given I setup 4 nodes diff --git a/test/bdd/steps/api/publish.js b/test/bdd/steps/api/publish.js index 47c7804a69..dcc992b7be 100644 --- a/test/bdd/steps/api/publish.js +++ b/test/bdd/steps/api/publish.js @@ -63,40 +63,40 @@ When( }, ); -Given('I wait for last publish to finalize', { timeout: 60000 }, async () => { - // this.logger.log('I wait for last publish to finalize'); - // expect( - // !!this.state.lastPublishData, - // 'Last publish data is undefined. Publish is not started.', - // ).to.be.equal(true); - // const publishData = this.state.lastPublishData; - // let loopForPublishResult = true; - // let retryCount = 0; - // const maxRetryCount = 2; - // while (loopForPublishResult) { - // this.logger.log( - // `Getting publish result for operation id: ${publishData.operationId} on node: ${publishData.nodeId}`, - // ); - // // const publishResult = await httpApiHelper.getOperationResult(`http://localhost:${this.state.nodes[publishData.nodeId].configuration.rpcPort}`, publishData.operationId); - // // eslint-disable-next-line no-await-in-loop - // const publishResult = await this.state.nodes[publishData.nodeId].client - // .getResult(publishData.UAL) - // .catch((error) => { - // assert.fail(`Error while trying to get publish result assertion. ${error}`); - // }); - // if (publishResult) { - // this.state.lastPublishData.result = publishResult; - // loopForPublishResult = false; - // } - // if (retryCount === maxRetryCount) { - // loopForPublishResult = true; - // assert.fail('Unable to get publish result'); - // } else { - // retryCount += 1; - // // eslint-disable-next-line no-await-in-loop - // await setTimeout(5000); - // } - // } +Given('I wait for last publish to finalize', { timeout: 60000 }, async function publishFinalize() { + this.logger.log('I wait for last publish to finalize'); + expect( + !!this.state.lastPublishData, + 'Last publish data is undefined. Publish is not started.', + ).to.be.equal(true); + const publishData = this.state.lastPublishData; + let loopForPublishResult = true; + let retryCount = 0; + const maxRetryCount = 2; + while (loopForPublishResult) { + this.logger.log( + `Getting publish result for operation id: ${publishData.operationId} on node: ${publishData.nodeId}`, + ); + // const publishResult = await httpApiHelper.getOperationResult(`http://localhost:${this.state.nodes[publishData.nodeId].configuration.rpcPort}`, publishData.operationId); + // eslint-disable-next-line no-await-in-loop + const publishResult = await this.state.nodes[publishData.nodeId].client + .getResult(publishData.UAL) + .catch((error) => { + assert.fail(`Error while trying to get publish result assertion. ${error}`); + }); + if (publishResult) { + this.state.lastPublishData.result = publishResult; + loopForPublishResult = false; + } + if (retryCount === maxRetryCount) { + loopForPublishResult = true; + assert.fail('Unable to get publish result'); + } else { + retryCount += 1; + // eslint-disable-next-line no-await-in-loop + await setTimeout(5000); + } + } }); Given( diff --git a/test/bdd/steps/common.js b/test/bdd/steps/common.js index f023be407a..362cc886ab 100644 --- a/test/bdd/steps/common.js +++ b/test/bdd/steps/common.js @@ -34,7 +34,7 @@ function forkNode(nodeConfiguration) { return forkedNode; } -Given(/^I setup (\d+) node[s]*$/, { timeout: 60000 }, function nodeSetup(nodeCount, done) { +Given(/^I setup (\d+) node[s]*$/, { timeout: 80000 }, function nodeSetup(nodeCount, done) { this.logger.log(`I setup ${nodeCount} node${nodeCount !== 1 ? 's' : ''}`); const wallets = this.state.localBlockchain.getWallets(); const currentNumberOfNodes = Object.keys(this.state.nodes).length; @@ -301,7 +301,7 @@ Given( } else { // todo if started const client = new DkgClientHelper({ - endpoint: '127.0.0.1', + endpoint: 'http://localhost', port: rpcPort, useSSL: false, timeout: 25, From 49ef573e770ceabcbe3cc8bf4cda30a406b7405c Mon Sep 17 00:00:00 2001 From: micax3000 Date: Thu, 25 Aug 2022 14:06:08 +0200 Subject: [PATCH 03/12] typo in test steps --- test/bdd/features/publish-errors.feature | 2 +- test/bdd/steps/api/publish.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index fa73d0f0d3..227347a246 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -14,7 +14,7 @@ Feature: Publish errors test Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes When I call publish on ot-node 1 directly with invalidPublishRequestBody - And I wait for 20 seconds and check operationId status + And I wait for 20 seconds and check operation status And Last publish finished with status: PublishValidateAssertionError # ### Scenario: Node is not able to store publish result in the local database diff --git a/test/bdd/steps/api/publish.js b/test/bdd/steps/api/publish.js index dcc992b7be..30cb88e804 100644 --- a/test/bdd/steps/api/publish.js +++ b/test/bdd/steps/api/publish.js @@ -122,7 +122,7 @@ Given( }, ); Given( - /I wait for (\d+) seconds and check operationId status/, + /I wait for (\d+) seconds and check operation status/, { timeout: 120000 }, async function publishWait(numberOfSeconds) { this.logger.log(`I wait for ${numberOfSeconds} seconds`); From dd566a8cbfab4536859e26d830bb41de37b20433 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Thu, 25 Aug 2022 16:36:42 +0200 Subject: [PATCH 04/12] refactor: extracted method in local-blockchain class --- test/bdd/features/publish-errors.feature | 46 +----- test/bdd/features/release.feature | 2 - test/bdd/steps/lib/local-blockchain.js | 199 ++++++----------------- 3 files changed, 60 insertions(+), 187 deletions(-) diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index 227347a246..c48a2619d2 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -3,12 +3,12 @@ Feature: Publish errors test Given the blockchain is set up And 1 bootstrap is running - Scenario: Node is not able to start publish on the network with valid assertion - Given I setup publish node 0 with invalid configuration - Given I setup 3 nodes - When I call publish on node 1 with validAssertion - # And I wait for last publish to finalize - And Last publish finished with status: PublishStartError +# Scenario: Node is not able to start publish on the network with valid assertion +# Given I setup publish node 0 with invalid configuration +# Given I setup 3 nodes +# When I call publish on node 1 with validAssertion +# # And I wait for last publish to finalize +# And Last publish finished with status: PublishStartError ## Scenario: Node is not able to validate assertion on the network @@ -16,36 +16,4 @@ Feature: Publish errors test When I call publish on ot-node 1 directly with invalidPublishRequestBody And I wait for 20 seconds and check operation status And Last publish finished with status: PublishValidateAssertionError -# -### Scenario: Node is not able to store publish result in the local database -## Given I setup 4 nodes -## When I call publish on node 1 with validAssertion -## And I wait for last publish to finalize -## And Last publish failed to store publish result with error: publishLocalStoreError -## -## Scenario: Node is not able to store publish init commands during the publish process -## Given I setup 4 nodes -## When I call publish on node 1 with validAssertion -## And I wait for last publish to finalize -## And Last publish failed to store publish init commands with error: publishStoreInitError -## -## Scenario: Node is not able to store publish request during the publish process -## Given I setup 4 nodes -## When I call publish on node 1 with validAssertion -## And I wait for last publish to finalize -## And Last publish failed to store publish request with error: publishStoreRequestError -## -## Scenario: Node is not able to find node during the publish process -## Given I setup 4 nodes -## When I call publish on node 1 with validAssertion -## And I wait for last publish to finalize -## And Last publish failed to find node with error: publishFindNodesError -## -## Scenario: Node is not able to finalized publish on the network with valid assertion -## Given I setup 4 nodes -## When I call publish on node 1 with validAssertion -## And I wait for last publish to finalize -## And Last publish failed with error: publishError -## -## -## + diff --git a/test/bdd/features/release.feature b/test/bdd/features/release.feature index 4471ab673d..b0a1d1e741 100644 --- a/test/bdd/features/release.feature +++ b/test/bdd/features/release.feature @@ -18,6 +18,4 @@ Feature: Release related tests And Last resolve finished with status: COMPLETED And I setup 1 additional node And I call resolve on node 5 for last published assertion -# And I wait for last resolve to finalize# And Last resolve finished with status: COMPLETED -# And Last resolve returned valid result diff --git a/test/bdd/steps/lib/local-blockchain.js b/test/bdd/steps/lib/local-blockchain.js index 2710dc6e12..24a59e5d0e 100644 --- a/test/bdd/steps/lib/local-blockchain.js +++ b/test/bdd/steps/lib/local-blockchain.js @@ -3,72 +3,32 @@ const Ganache = require('ganache-core'); const Web3 = require('web3'); const Wallet = require('ethereumjs-wallet').default; -const hubSource = require('dkg-evm-module/build/contracts/Hub.json'); -const assertionRegistrySource = require('dkg-evm-module/build/contracts/AssertionRegistry.json'); -const uaiRegistrySource = require('dkg-evm-module/build/contracts/UAIRegistry.json'); -const assetRegistrySource = require('dkg-evm-module/build/contracts/AssetRegistry.json'); -const erc20TokenSource = require('dkg-evm-module/build/contracts/ERC20Token.json'); -const profileStorageSource = require('dkg-evm-module/build/contracts/ProfileStorage.json'); -const profileSource = require('dkg-evm-module/build/contracts/Profile.json'); - -// const contractNames = ['hub','uaiRegistry','assertionRegistry','assetRegistry','erc20Token','profileStorage','profile']; - -const accountPrivateKeys = [ - '3cf97be6177acdd12796b387f58f84f177d0fe20d8558004e8db9a41cf90392a', - '1e60c8e9aa35064cd2eaa4c005bda2b76ef1a858feebb6c8e131c472d16f9740', - '2c26a937a1b8b20762e2e578899b98fd48b6ab2f8798cd03ccef2bee865c2c54', - 'a76e13d35326f5e06d20655d0edb2f60b8863280fabf8e3f0b1210cf0bb72eec', - 'd96876d0711ed11781efe0c04c95716c2e0acabc4eba418516d76be808a2fc54', - '6be9ea24e3c2adf0ac4c6705b445827a57c80e6fefa10df3f480da8aa2c523a4', - '6627e24e68bca3b29c548789aead92b48c0f4ce669842ff7e18ca356429b804c', - '1e3bae753e15ee5e6e2548105b53736a3db7304ac7681d00c77caca0b848b0ba', - '4bc5744a30e928d162ca580f9a034dfac7edc0415e0b9ddc2d221a155f6ec4ff', - '03c5646544ea8e47174ac98e3b97338c486860897e31333318ee62d19e5ea118', - '9fe33d5460d64c2993c687b9f2b6c3503e082388f59d0fea14142d20f805fcc5', - '843c42e809fc394e1d8647cd74edee133d5faa187933dc0fc08d302f57b6333c', - '81feca24308a669408b973dc010800d93d347db851ff9fc12ba7ec4e60846ee3', - '2fbcf9435210fed8dd47dccae453df02c0159c265dc454be8a24e4189e2a3c1b', - '5a03ebd83bf32553f00f33255154158a07020ebc2921d842a5aee2ab94370969', - '13a8fc7dac578c05cbae943f220477b2abcb9954c8cb31279fce2f864558420c', - 'd35889eb100eb5544ea3e9ddab1181e628dc8e167365dcf97112fab9ae0db906', - 'f261d13fb3fd1f3df2f5dc75b54066d354a25aa2800b90b42900fc0db794cc41', - 'a6dc4993c4a65f78ad87cf972f468fe25c1ad86f32d479f2ad27d3c8f46a6487', - '5fc5a969744f359c109b64bb41dca7e49e1086a9298c862cd0e30772908bb70c', - 'c00655521fa1326b8b1831fb74b2a5e45eca0e8e886df34e9a714ae70031c502', - 'feee5c36d8a9b1c65d9b0810f048d817d6cd01f95b12e3ae8940a769e2a6d217', - 'edf15b05b906d2582d269d81fe85ee64325fa081aafd64de32893d4d6b03f56d', - '92f6678cdb6ce485e305d5fa926d2d157745871fc7d72f0526048f8286f28247', - 'dfa44843c22ae16de69e9181e2bfe2153e36464d266e32746de82478e9674d98', - '483af28e4e11638d018a4fa02dcb454cfff8235073921aefdb5a302956c6abb0', - '8908b19e6f8ed4aabe160719cc3cb2b15aabf79cfc436ad31574eedd2432e3bc', - '6b499a1289d1945cbc232bd47da77ae10432ffb63b7f6d04b797a74f30f22c7d', - 'db908900b007ba9c384b116b6d1209d4842f37e2435d7fbd62d619643bb08e08', - 'f5346004b07b6059be546f02b72a29f055251471c700e799f96529b4338ad635', - '2aa43025590ae9e9fb3eaaa75358e3a6e1719570864c43a33926a19da979ced9', - '1aa051ed6f3c40a01cad84d2c05ae3a80d897a3f7b56a88447643fc9e67cc004', - 'c4505f045420e9c860989349d32a7716a9c6221c8bfc17e1012b06c4b926e530', - '35fbcc677cd348dafaa2c31519f458dcc9ddbb7278e38310e974787ca378a4a8', - '90505a5408c91fc59738f12c31f14a501c431160473819c4e7e9273092ebb288', - 'e2eed5df7e6f32dfb793b7324e251950a8644d409aa194de822c1e42163e947e', - '1ac1f2db31610c84f09865b308b82d6236e09acd475b4136bd86440b7aa39c41', - '77ffe9a3e5738d8fc2fa14028e5e280872f87c7dfb5df58bd21cc6f2c7ce6f72', - 'eb48615474a318cbd2e6197d01bf81d168f2d21a2a8a117bc979a887ec90d2df', - 'f1a9455826b46ca2f9f66457d8faa6f02a30e1c0f0b5b5f6769b769974a5cc5f', - 'afa420d816b8b97b5049ce4507b1c79ee26168bc4a197385cd848dd482746e2d', - '9fd7088936411d814238aa7072dc43c28e6ae7d298db37466dc6b3236191c3de', - '03199565ef8a1421b7fa73cbb4b4e6f4cb3470affcf8b18f783e192788d23519', - '27fa0a7dd2901067308dd9f2559204006712dc2809619a922a5fc3f43199a9b9', - '7ff5132877ee3ebaeed1664e3ff5abdcc7fb7cce57b74ce8ae2f0071e7132ab9', - '5bd9b42788ec465d52598e58857bae2b592c5b5cf8678693179a687317fe7928', - '7471241aa4a8d04058279da9266f44210a4ffd4d6ff16376ad3cab733cce3e8f', - '5ad0f83dadefdeefeee58d733ba35674f151dc1a1080bfafb9fb8778285f0646', - '966658dfe2cf0dfa999ef05ca3c926c5fe776ee4cbc7673bdea69d2907030357', - '440f37a3f0fe7560db8bc00200818c743a4a381b4d6b24967c31fc47d5ab831b', - '4072914e2feb382b79d5285d293902546938aa2b0e31cd6625ce59db77a6d3d4', - '7b39d2f9dcf59d87ca683d9797ac3f8c5ba7c9bc6ec4b6b5cfd27809160b64cb', - '455d135639bfaab54ffc729a873a1cea26e438600f0ef40642abbd2a91c9eae3', - 'f04349eab3a51e2e871cbfd30d2e4c9aef791ad79b90ed32e05457b40925d8b7', - '952e45854ca5470a6d0b6cb86346c0e9c4f8f3a5a459657df8c94265183b9253', +const sources = { + // eslint-disable-next-line global-require + hubSource: require('dkg-evm-module/build/contracts/Hub.json'), + // eslint-disable-next-line global-require + assertionRegistrySource: require('dkg-evm-module/build/contracts/AssertionRegistry.json'), + // eslint-disable-next-line global-require + uaiRegistrySource: require('dkg-evm-module/build/contracts/UAIRegistry.json'), + // eslint-disable-next-line global-require + assetRegistrySource: require('dkg-evm-module/build/contracts/AssetRegistry.json'), + // eslint-disable-next-line global-require + erc20TokenSource: require('dkg-evm-module/build/contracts/ERC20Token.json'), + // eslint-disable-next-line global-require + profileStorageSource: require('dkg-evm-module/build/contracts/ProfileStorage.json'), + // eslint-disable-next-line global-require + profileSource: require('dkg-evm-module/build/contracts/Profile.json'), +}; +const accountPrivateKeys = require('../api/datasets/privateKeys.json'); + +const contractNames = [ + 'hub', + 'uaiRegistry', + 'assertionRegistry', + 'assetRegistry', + 'erc20Token', + 'profileStorage', + 'profile', ]; const wallets = accountPrivateKeys.map((privateKey) => ({ @@ -131,7 +91,7 @@ class LocalBlockchain { ); this.fetchContracts(); await this.deployContracts(); - // this.logger.info('Contracts have been deployed!'); + this.logger.info('Contracts have been deployed!'); this.logger.info( `\t Hub contract address: \t\t\t\t\t${this.contracts.hub.instance._address}`, ); @@ -161,18 +121,9 @@ class LocalBlockchain { fetchContracts() { this.contracts = {}; - // TODO: pass contracts sources by their names - /* contractNames.forEach((name) => { - this.populateContractObject(name, `${name}Source`) - }) */ - - this.populateContractObject('hub', hubSource); - this.populateContractObject('uaiRegistry', uaiRegistrySource); - this.populateContractObject('assertionRegistry', assertionRegistrySource); - this.populateContractObject('assetRegistry', assetRegistrySource); - this.populateContractObject('erc20Token', erc20TokenSource); - this.populateContractObject('profileStorage', profileStorageSource); - this.populateContractObject('profile', profileSource); + contractNames.forEach((name) => { + this.populateContractObject(name, sources[`${name}Source`]); + }); } populateContractObject(contractName, source) { @@ -185,46 +136,21 @@ class LocalBlockchain { } async deployContracts() { - // this.logger.log('Deploying hubContract'); const deployingWallet = this.getWallets()[7]; - [this.contracts.hub.deploymentReceipt, this.contracts.hub.instance] = - await this._deployContract( - this.web3, - this.contracts.hub.artifact, - this.contracts.hub.data, - [], - deployingWallet.address, - ); + await this.deploy('hub', deployingWallet, []); await this.setContractAddress('Owner', deployingWallet.address, deployingWallet); - // this.logger.log('Deploying uaiRegistryContract'); - [this.contracts.uaiRegistry.deploymentReceipt, this.contracts.uaiRegistry.instance] = - await this._deployContract( - this.web3, - this.contracts.uaiRegistry.artifact, - this.contracts.uaiRegistry.data, - [this.contracts.hub.instance._address], - deployingWallet.address, - ); - + await this.deploy('uaiRegistry', deployingWallet, [this.contracts.hub.instance._address]); await this.setContractAddress( 'UAIRegistry', this.contracts.uaiRegistry.instance._address, deployingWallet, ); - // this.logger.log('Deploying Assertion Registry Contract'); - [ - this.contracts.assertionRegistry.deploymentReceipt, - this.contracts.assertionRegistry.instance, - ] = await this._deployContract( - this.web3, - this.contracts.assertionRegistry.artifact, - this.contracts.assertionRegistry.data, - [this.contracts.hub.instance._address], - deployingWallet.address, - ); + await this.deploy('assertionRegistry', deployingWallet, [ + this.contracts.hub.instance._address, + ]); await this.setContractAddress( 'AssertionRegistry', @@ -232,15 +158,7 @@ class LocalBlockchain { deployingWallet, ); - // this.logger.log('Deploying Asset Registry Contract'); - [this.contracts.assetRegistry.deploymentReceipt, this.contracts.assetRegistry.instance] = - await this._deployContract( - this.web3, - this.contracts.assetRegistry.artifact, - this.contracts.assetRegistry.data, - [this.contracts.hub.instance._address], - deployingWallet.address, - ); + await this.deploy('assetRegistry', deployingWallet, [this.contracts.hub.instance._address]); await this.setContractAddress( 'AssetRegistry', @@ -254,31 +172,16 @@ class LocalBlockchain { ); // this.logger.log('Deploying profileStorageContract'); - [this.contracts.profileStorage.deploymentReceipt, this.contracts.profileStorage.instance] = - await this._deployContract( - this.web3, - this.contracts.profileStorage.artifact, - this.contracts.profileStorage.data, - [this.contracts.hub.instance._address], - deployingWallet.address, - ); + await this.deploy('profileStorage', deployingWallet, [ + this.contracts.hub.instance._address, + ]); await this.setContractAddress( 'ProfileStorage', this.contracts.profileStorage.instance._address, deployingWallet, ); - // await this.contracts.profileStorage.instance.methods.setupRole() - - // this.logger.log('Deploying Token contract'); - [this.contracts.erc20Token.deploymentReceipt, this.contracts.erc20Token.instance] = - await this._deployContract( - this.web3, - this.contracts.erc20Token.artifact, - this.contracts.erc20Token.data, - [this.contracts.hub.instance._address], - deployingWallet.address, - ); + await this.deploy('erc20Token', deployingWallet, [this.contracts.hub.instance._address]); await this.setContractAddress( 'Token', @@ -287,15 +190,8 @@ class LocalBlockchain { ); await this.setupRole(this.contracts.erc20Token, deployingWallet.address); - // this.logger.log('Deploying Profile contract'); - [this.contracts.profile.deploymentReceipt, this.contracts.profile.instance] = - await this._deployContract( - this.web3, - this.contracts.profile.artifact, - this.contracts.profile.data, - [this.contracts.hub.instance._address], - deployingWallet.address, - ); + await this.deploy('profile', deployingWallet, [this.contracts.hub.instance._address]); + await this.setContractAddress( 'Profile', this.contracts.profile.instance._address, @@ -313,6 +209,17 @@ class LocalBlockchain { this.initialized = true; } + async deploy(contractName, deployingWallet, constructorArgs) { + [this.contracts[contractName].deploymentReceipt, this.contracts[contractName].instance] = + await this._deployContract( + this.web3, + this.contracts[contractName].artifact, + this.contracts[contractName].data, + constructorArgs, + deployingWallet.address, + ); + } + async _deployContract(web3, contract, contractData, constructorArguments, deployerAddress) { let deploymentReceipt; let contractInstance; From fddc5d98314a64dc21b91c2c8761d4d9f214b851 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Thu, 25 Aug 2022 16:41:58 +0200 Subject: [PATCH 05/12] exctracted ganache keys to separate file --- test/bdd/steps/api/datasets/privateKeys.json | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/bdd/steps/api/datasets/privateKeys.json diff --git a/test/bdd/steps/api/datasets/privateKeys.json b/test/bdd/steps/api/datasets/privateKeys.json new file mode 100644 index 0000000000..7b52bb9809 --- /dev/null +++ b/test/bdd/steps/api/datasets/privateKeys.json @@ -0,0 +1,57 @@ +[ +"3cf97be6177acdd12796b387f58f84f177d0fe20d8558004e8db9a41cf90392a", +"1e60c8e9aa35064cd2eaa4c005bda2b76ef1a858feebb6c8e131c472d16f9740", +"2c26a937a1b8b20762e2e578899b98fd48b6ab2f8798cd03ccef2bee865c2c54", +"a76e13d35326f5e06d20655d0edb2f60b8863280fabf8e3f0b1210cf0bb72eec", +"d96876d0711ed11781efe0c04c95716c2e0acabc4eba418516d76be808a2fc54", +"6be9ea24e3c2adf0ac4c6705b445827a57c80e6fefa10df3f480da8aa2c523a4", +"6627e24e68bca3b29c548789aead92b48c0f4ce669842ff7e18ca356429b804c", +"1e3bae753e15ee5e6e2548105b53736a3db7304ac7681d00c77caca0b848b0ba", +"4bc5744a30e928d162ca580f9a034dfac7edc0415e0b9ddc2d221a155f6ec4ff", +"03c5646544ea8e47174ac98e3b97338c486860897e31333318ee62d19e5ea118", +"9fe33d5460d64c2993c687b9f2b6c3503e082388f59d0fea14142d20f805fcc5", +"843c42e809fc394e1d8647cd74edee133d5faa187933dc0fc08d302f57b6333c", +"81feca24308a669408b973dc010800d93d347db851ff9fc12ba7ec4e60846ee3", +"2fbcf9435210fed8dd47dccae453df02c0159c265dc454be8a24e4189e2a3c1b", +"5a03ebd83bf32553f00f33255154158a07020ebc2921d842a5aee2ab94370969", +"13a8fc7dac578c05cbae943f220477b2abcb9954c8cb31279fce2f864558420c", +"d35889eb100eb5544ea3e9ddab1181e628dc8e167365dcf97112fab9ae0db906", +"f261d13fb3fd1f3df2f5dc75b54066d354a25aa2800b90b42900fc0db794cc41", +"a6dc4993c4a65f78ad87cf972f468fe25c1ad86f32d479f2ad27d3c8f46a6487", +"5fc5a969744f359c109b64bb41dca7e49e1086a9298c862cd0e30772908bb70c", +"c00655521fa1326b8b1831fb74b2a5e45eca0e8e886df34e9a714ae70031c502", +"feee5c36d8a9b1c65d9b0810f048d817d6cd01f95b12e3ae8940a769e2a6d217", +"edf15b05b906d2582d269d81fe85ee64325fa081aafd64de32893d4d6b03f56d", +"92f6678cdb6ce485e305d5fa926d2d157745871fc7d72f0526048f8286f28247", +"dfa44843c22ae16de69e9181e2bfe2153e36464d266e32746de82478e9674d98", +"483af28e4e11638d018a4fa02dcb454cfff8235073921aefdb5a302956c6abb0", +"8908b19e6f8ed4aabe160719cc3cb2b15aabf79cfc436ad31574eedd2432e3bc", +"6b499a1289d1945cbc232bd47da77ae10432ffb63b7f6d04b797a74f30f22c7d", +"db908900b007ba9c384b116b6d1209d4842f37e2435d7fbd62d619643bb08e08", +"f5346004b07b6059be546f02b72a29f055251471c700e799f96529b4338ad635", +"2aa43025590ae9e9fb3eaaa75358e3a6e1719570864c43a33926a19da979ced9", +"1aa051ed6f3c40a01cad84d2c05ae3a80d897a3f7b56a88447643fc9e67cc004", +"c4505f045420e9c860989349d32a7716a9c6221c8bfc17e1012b06c4b926e530", +"35fbcc677cd348dafaa2c31519f458dcc9ddbb7278e38310e974787ca378a4a8", +"90505a5408c91fc59738f12c31f14a501c431160473819c4e7e9273092ebb288", +"e2eed5df7e6f32dfb793b7324e251950a8644d409aa194de822c1e42163e947e", +"1ac1f2db31610c84f09865b308b82d6236e09acd475b4136bd86440b7aa39c41", +"77ffe9a3e5738d8fc2fa14028e5e280872f87c7dfb5df58bd21cc6f2c7ce6f72", +"eb48615474a318cbd2e6197d01bf81d168f2d21a2a8a117bc979a887ec90d2df", +"f1a9455826b46ca2f9f66457d8faa6f02a30e1c0f0b5b5f6769b769974a5cc5f", +"afa420d816b8b97b5049ce4507b1c79ee26168bc4a197385cd848dd482746e2d", +"9fd7088936411d814238aa7072dc43c28e6ae7d298db37466dc6b3236191c3de", +"03199565ef8a1421b7fa73cbb4b4e6f4cb3470affcf8b18f783e192788d23519", +"27fa0a7dd2901067308dd9f2559204006712dc2809619a922a5fc3f43199a9b9", +"7ff5132877ee3ebaeed1664e3ff5abdcc7fb7cce57b74ce8ae2f0071e7132ab9", +"5bd9b42788ec465d52598e58857bae2b592c5b5cf8678693179a687317fe7928", +"7471241aa4a8d04058279da9266f44210a4ffd4d6ff16376ad3cab733cce3e8f", +"5ad0f83dadefdeefeee58d733ba35674f151dc1a1080bfafb9fb8778285f0646", +"966658dfe2cf0dfa999ef05ca3c926c5fe776ee4cbc7673bdea69d2907030357", +"440f37a3f0fe7560db8bc00200818c743a4a381b4d6b24967c31fc47d5ab831b", +"4072914e2feb382b79d5285d293902546938aa2b0e31cd6625ce59db77a6d3d4", +"7b39d2f9dcf59d87ca683d9797ac3f8c5ba7c9bc6ec4b6b5cfd27809160b64cb", +"455d135639bfaab54ffc729a873a1cea26e438600f0ef40642abbd2a91c9eae3", +"f04349eab3a51e2e871cbfd30d2e4c9aef791ad79b90ed32e05457b40925d8b7", +"952e45854ca5470a6d0b6cb86346c0e9c4f8f3a5a459657df8c94265183b9253" +] \ No newline at end of file From ea7d499eab14223c55a23fd2a85b3307cd90ed90 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Thu, 25 Aug 2022 23:34:42 +0200 Subject: [PATCH 06/12] checking if all tests will be run now --- .github/workflows/TEST-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TEST-release.yml b/.github/workflows/TEST-release.yml index 051b941664..7d430d592a 100644 --- a/.github/workflows/TEST-release.yml +++ b/.github/workflows/TEST-release.yml @@ -42,7 +42,7 @@ jobs: - run: sudo chmod -R 777 $ARTIFACTS_DIR - run: mkdir -p $CUCUMBER_ARTIFACTS_DIR - run: sudo chmod -R 777 $CUCUMBER_ARTIFACTS_DIR - - run: npm run test:bdd:release; + - run: npm run test:bdd; - uses: actions/upload-artifact@v2 if: ${{ always() }} with: From 2a17fb37632bc8472db1f42139f95425c4420b68 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Fri, 26 Aug 2022 11:07:50 +0200 Subject: [PATCH 07/12] refactor: extracted configuration setup functio --- test/bdd/steps/common.js | 163 +++++++++++++++++++++++---------------- 1 file changed, 95 insertions(+), 68 deletions(-) diff --git a/test/bdd/steps/common.js b/test/bdd/steps/common.js index 362cc886ab..d7e024b27d 100644 --- a/test/bdd/steps/common.js +++ b/test/bdd/steps/common.js @@ -1,4 +1,5 @@ const { Given } = require('@cucumber/cucumber'); +const DeepExtend = require('deep-extend'); const { expect, assert } = require('chai'); const { fork } = require('child_process'); const fs = require('fs'); @@ -34,6 +35,63 @@ function forkNode(nodeConfiguration) { return forkedNode; } +function createNodeConfiguration(wallet, managementWallet, nodeIndex, nodeName, rpcPort) { + return { + modules: { + blockchain: getBlockchainConfiguration( + this.state.localBlockchain, + wallet.privateKey, + wallet.address, + managementWallet.address, + )[0], + network: { + implementation: { + 'libp2p-service': { + config: { + port: 9001 + nodeIndex, + }, + }, + }, + }, + repository: { + implementation: { + 'sequelize-repository': { + config: { + database: `operationaldbnode${nodeIndex}`, + }, + }, + }, + }, + tripleStore: { + implementation: { + 'ot-graphdb': { + config: { + repository: nodeName, + }, + }, + }, + }, + httpClient: { + implementation: { + 'express-http-client': { + config: { + port: rpcPort, + }, + }, + }, + }, + }, + operationalDatabase: { + databaseName: `operationaldbnode${nodeIndex}`, + }, + rpcPort, + appDataPath: `data${nodeIndex}`, + graphDatabase: { + name: nodeName, + }, + }; +} + Given(/^I setup (\d+) node[s]*$/, { timeout: 80000 }, function nodeSetup(nodeCount, done) { this.logger.log(`I setup ${nodeCount} node${nodeCount !== 1 ? 's' : ''}`); const wallets = this.state.localBlockchain.getWallets(); @@ -46,35 +104,26 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 80000 }, function nodeSetup(nodeCou const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; - const nodeConfiguration = JSON.parse( + const defaultConfiguration = JSON.parse( fs .readFileSync( path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), ) .toString(), ); - // eslint-disable-next-line prefer-destructuring - nodeConfiguration.modules.blockchain = getBlockchainConfiguration( - this.state.localBlockchain, - wallet.privateKey, - wallet.address, - managementWallet.address, - )[0]; - - nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = - 9001 + nodeIndex; - nodeConfiguration.modules.repository.implementation[ - 'sequelize-repository' - ].config.database = `operationaldbnode${nodeIndex}`; - nodeConfiguration.modules.tripleStore.implementation['ot-graphdb'].config.repository = - nodeName; - nodeConfiguration.modules.httpClient.implementation['express-http-client'].config.port = - rpcPort; - nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${nodeIndex}`; - nodeConfiguration.rpcPort = rpcPort; - nodeConfiguration.appDataPath = `data${nodeIndex}`; - nodeConfiguration.graphDatabase.name = nodeName; + // eslint-disable-next-line prefer-destructuring + const nodeConfiguration = DeepExtend( + defaultConfiguration, + createNodeConfiguration.call( + this, + wallet, + managementWallet, + nodeIndex, + nodeName, + rpcPort, + ), + ); const forkedNode = forkNode(nodeConfiguration); const logFileStream = fs.createWriteStream(`${this.state.scenarionLogDir}/${nodeName}.log`); @@ -173,35 +222,24 @@ Given( const managementWallet = wallets[nodeIndex + 28]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; - const nodeConfiguration = JSON.parse( + const defaultConfiguration = JSON.parse( fs .readFileSync( path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), ) .toString(), ); - // eslint-disable-next-line prefer-destructuring - nodeConfiguration.modules.blockchain = getBlockchainConfiguration( - this.state.localBlockchain, - wallet.privateKey, - wallet.address, - managementWallet.address, - )[0]; - - nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = - 9001 + nodeIndex; - nodeConfiguration.modules.repository.implementation[ - 'sequelize-repository' - ].config.database = `operationaldbnode${nodeIndex}`; - nodeConfiguration.modules.tripleStore.implementation['ot-graphdb'].config.repository = - nodeName; - nodeConfiguration.modules.httpClient.implementation['express-http-client'].config.port = - rpcPort; - nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${nodeIndex}`; - nodeConfiguration.rpcPort = rpcPort; - nodeConfiguration.appDataPath = `data${nodeIndex}`; - nodeConfiguration.graphDatabase.name = nodeName; - + const nodeConfiguration = DeepExtend( + defaultConfiguration, + createNodeConfiguration.call( + this, + wallet, + managementWallet, + nodeIndex, + nodeName, + rpcPort, + ), + ); const forkedNode = forkNode(nodeConfiguration); const logFileStream = fs.createWriteStream( @@ -252,7 +290,7 @@ Given( const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex + 28]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; - const nodeConfiguration = JSON.parse( + const defaultConfiguration = JSON.parse( fs .readFileSync( path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), @@ -260,29 +298,18 @@ Given( .toString(), ); // eslint-disable-next-line prefer-destructuring - nodeConfiguration.modules.blockchain = getBlockchainConfiguration( - this.state.localBlockchain, - wallet.privateKey, - wallet.address, - managementWallet.address, - )[0]; - - nodeConfiguration.modules.network.implementation['libp2p-service'].config.port = - 9001 + nodeIndex; - nodeConfiguration.modules.repository.implementation[ - 'sequelize-repository' - ].config.database = `operationaldbnode${nodeIndex}`; - nodeConfiguration.modules.tripleStore.implementation['ot-graphdb'].config.repository = - nodeName; - nodeConfiguration.modules.httpClient.implementation['express-http-client'].config.port = - rpcPort; - nodeConfiguration.operationalDatabase.databaseName = `operationaldbnode${nodeIndex}`; - nodeConfiguration.rpcPort = rpcPort; - nodeConfiguration.appDataPath = `data${nodeIndex}`; - nodeConfiguration.graphDatabase.name = nodeName; - + const nodeConfiguration = DeepExtend( + defaultConfiguration, + createNodeConfiguration.call( + this, + wallet, + managementWallet, + nodeIndex, + nodeName, + rpcPort, + ), + ); nodeConfiguration.minimumAckResponses.publish = 10; - const forkedNode = forkNode(nodeConfiguration); const logFileStream = fs.createWriteStream(`${this.state.scenarionLogDir}/${nodeName}.log`); From d010b709dbd1bb8ef58b60b6546ea25fe1f3e324 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Mon, 29 Aug 2022 09:17:28 +0200 Subject: [PATCH 08/12] waiting for operation to finaliza uses for now --- test/bdd/features/publish-errors.feature | 8 ++--- test/bdd/steps/api/publish.js | 39 +++++++++++------------- test/bdd/steps/common.js | 20 ++++++------ test/bdd/steps/lib/local-blockchain.js | 2 +- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index c48a2619d2..a59f140600 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -3,17 +3,17 @@ Feature: Publish errors test Given the blockchain is set up And 1 bootstrap is running -# Scenario: Node is not able to start publish on the network with valid assertion -# Given I setup publish node 0 with invalid configuration +#TODO: needs to be investigated; publish completes even with invalid configuration +# Scenario: Node is not able to publish on a node with invalid configuration +# Given I setup publish node 1 with invalid configuration # Given I setup 3 nodes # When I call publish on node 1 with validAssertion -# # And I wait for last publish to finalize # And Last publish finished with status: PublishStartError ## Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes When I call publish on ot-node 1 directly with invalidPublishRequestBody - And I wait for 20 seconds and check operation status + And I wait for last publish to finalize And Last publish finished with status: PublishValidateAssertionError diff --git a/test/bdd/steps/api/publish.js b/test/bdd/steps/api/publish.js index 30cb88e804..4e7093589c 100644 --- a/test/bdd/steps/api/publish.js +++ b/test/bdd/steps/api/publish.js @@ -7,9 +7,9 @@ const HttpApiHelper = require('../../../utilities/http-api-helper'); When( /^I call publish on node (\d+) with ([^"]*)/, - { timeout: 60000 }, + { timeout: 120000 }, async function publish(node, assertionName) { - this.logger.log('I call publish route successfully'); + this.logger.log(`I call publish route on node ${node}`); expect( !!assertions[assertionName], `Assertion with name: ${assertionName} not found!`, @@ -17,7 +17,7 @@ When( const { evmOperationalWalletPublicKey, evmOperationalWalletPrivateKey } = this.state.nodes[node - 1].configuration.modules.blockchain.implementation.ganache .config; - const hubContract = this.state.localBlockchain.uaiRegistryContractAddress(); + const hubContract = this.state.localBlockchain.getHubAddress(); const assertion = assertions[assertionName]; const result = await this.state.nodes[node - 1].client .publish( @@ -63,45 +63,42 @@ When( }, ); -Given('I wait for last publish to finalize', { timeout: 60000 }, async function publishFinalize() { +Given('I wait for last publish to finalize', { timeout: 80000 }, async function publishFinalize() { this.logger.log('I wait for last publish to finalize'); expect( !!this.state.lastPublishData, 'Last publish data is undefined. Publish is not started.', ).to.be.equal(true); const publishData = this.state.lastPublishData; - let loopForPublishResult = true; let retryCount = 0; - const maxRetryCount = 2; - while (loopForPublishResult) { + const maxRetryCount = 5; + const httpApiHelper = new HttpApiHelper(); + for (retryCount = 0; retryCount < maxRetryCount; retryCount += 1) { this.logger.log( `Getting publish result for operation id: ${publishData.operationId} on node: ${publishData.nodeId}`, ); // const publishResult = await httpApiHelper.getOperationResult(`http://localhost:${this.state.nodes[publishData.nodeId].configuration.rpcPort}`, publishData.operationId); // eslint-disable-next-line no-await-in-loop - const publishResult = await this.state.nodes[publishData.nodeId].client - .getResult(publishData.UAL) - .catch((error) => { - assert.fail(`Error while trying to get publish result assertion. ${error}`); - }); - if (publishResult) { + const publishResult = await httpApiHelper.getOperationResult( + this.state.nodes[publishData.nodeId].nodeRpcUrl, + publishData.operationId, + ); + this.logger.log(`Operation status: ${publishResult.data.status}`); + if (['COMPLETED', 'FAILED'].includes(publishResult.data.status)) { this.state.lastPublishData.result = publishResult; - loopForPublishResult = false; + break; } - if (retryCount === maxRetryCount) { - loopForPublishResult = true; + if (retryCount === maxRetryCount - 1) { assert.fail('Unable to get publish result'); - } else { - retryCount += 1; - // eslint-disable-next-line no-await-in-loop - await setTimeout(5000); } + // eslint-disable-next-line no-await-in-loop + await setTimeout(4000); } }); Given( /Last publish finished with status: ([COMPLETED|FAILED|PublishValidateAssertionError,PUblishStartError]+)$/, - { timeout: 120000 }, + { timeout: 60000 }, async function lastPublishFinished(status) { this.logger.log(`Last publish finished with status: ${status}`); expect( diff --git a/test/bdd/steps/common.js b/test/bdd/steps/common.js index d7e024b27d..8b62b5da9c 100644 --- a/test/bdd/steps/common.js +++ b/test/bdd/steps/common.js @@ -18,7 +18,7 @@ function getBlockchainConfiguration(localBlockchain, privateKey, publicKey, mana blockchainTitle: 'ganache', networkId: 'ganache::testnet', rpcEndpoints: ['http://localhost:7545'], - hubContractAddress: localBlockchain.uaiRegistryContractAddress(), + hubContractAddress: localBlockchain.getHubAddress(), evmOperationalWalletPublicKey: publicKey, evmOperationalWalletPrivateKey: privateKey, evmManagementWalletPublicKey: managementKey, @@ -99,7 +99,7 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 80000 }, function nodeSetup(nodeCou let nodesStarted = 0; for (let i = 0; i < nodeCount; i += 1) { const nodeIndex = currentNumberOfNodes + i; - const wallet = wallets[nodeIndex + 1]; + const wallet = wallets[nodeIndex]; const managementWallet = wallets[nodeIndex + 28]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; @@ -210,7 +210,7 @@ Given( Given( /^I setup (\d+) additional node[s]*$/, - { timeout: 120000 }, + { timeout: 60000 }, function setupAdditionalNode(nodeCount, done) { this.logger.log(`I setup ${nodeCount} additional node${nodeCount !== 1 ? 's' : ''}`); const wallets = this.state.localBlockchain.getWallets(); @@ -286,10 +286,10 @@ Given( { timeout: 120000 }, function setupPublishNode(nodeIndex, done) { this.logger.log(`I setup node ${nodeIndex} with invalid configuration`); - const wallet = this.state.localBlockchain.getWallets()[nodeIndex]; - const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex + 28]; - const rpcPort = 8901 + nodeIndex; - const nodeName = `origintrail-test-${nodeIndex}`; + const wallet = this.state.localBlockchain.getWallets()[nodeIndex - 1]; + const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex - 1 + 28]; + const rpcPort = 8901 + nodeIndex - 1; + const nodeName = `origintrail-test-${nodeIndex - 1}`; const defaultConfiguration = JSON.parse( fs .readFileSync( @@ -304,7 +304,7 @@ Given( this, wallet, managementWallet, - nodeIndex, + nodeIndex - 1, nodeName, rpcPort, ), @@ -323,7 +323,7 @@ Given( forkedNode.on('message', (response) => { if (response.error) { assert.fail( - `Error while trying initialize node${nodeIndex} client: ${response.error}`, + `Error while trying initialize node${nodeIndex - 1} client: ${response.error}`, ); } else { // todo if started @@ -334,7 +334,7 @@ Given( timeout: 25, loglevel: 'trace', }); - this.state.nodes[nodeIndex] = { + this.state.nodes[nodeIndex - 1] = { client, forkedNode, configuration: nodeConfiguration, diff --git a/test/bdd/steps/lib/local-blockchain.js b/test/bdd/steps/lib/local-blockchain.js index 24a59e5d0e..0c55c4c899 100644 --- a/test/bdd/steps/lib/local-blockchain.js +++ b/test/bdd/steps/lib/local-blockchain.js @@ -272,7 +272,7 @@ class LocalBlockchain { .on('error', (error) => this.logger.error('Unable to setup role. Error: ', error)); } - uaiRegistryContractAddress() { + getHubAddress() { return this.contracts.hub.instance._address; } From c3b52f24fc4dfb832a584c0e401f58e6280ffa13 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Mon, 29 Aug 2022 09:45:27 +0200 Subject: [PATCH 09/12] resolve changed to gge result in tests --- test/bdd/features/release.feature | 10 +++++----- test/bdd/steps/api/resolve.js | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/bdd/features/release.feature b/test/bdd/features/release.feature index b0a1d1e741..7625af0555 100644 --- a/test/bdd/features/release.feature +++ b/test/bdd/features/release.feature @@ -10,12 +10,12 @@ Feature: Release related tests And Last publish finished with status: COMPLETED # @release - Scenario: Node is able to resolve assertion previously published + Scenario: Node is able to get result of the operation previously published Given I setup 4 nodes When I call publish on node 1 with validAssertion And Last publish finished with status: COMPLETED - And I call resolve on node 1 for last published assertion - And Last resolve finished with status: COMPLETED + And I get operation result from node 1 for last published assertion + And Last operation finished with status: COMPLETED And I setup 1 additional node - And I call resolve on node 5 for last published assertion - And Last resolve finished with status: COMPLETED + And I get operation result from node 5 for last published assertion + And Last operation finished with status: COMPLETED diff --git a/test/bdd/steps/api/resolve.js b/test/bdd/steps/api/resolve.js index 4ec7b34479..cbe1e9a688 100644 --- a/test/bdd/steps/api/resolve.js +++ b/test/bdd/steps/api/resolve.js @@ -4,10 +4,10 @@ const { setTimeout } = require('timers/promises'); const sortedStringify = require('json-stable-stringify'); When( - /^I call resolve on node (\d+) for last published assertion/, + /^I get operation result from node (\d+) for last published assertion/, { timeout: 120000 }, async function resolveCall(node) { - this.logger.log('I call resolve route successfully'); + this.logger.log('I call get result for the last operation'); expect( !!this.state.lastPublishData, 'Last publish data is undefined. Publish is not finalized.', @@ -68,17 +68,17 @@ Given( ); Given( - /Last resolve finished with status: ([COMPLETED|FAILED]+)$/, + /Last operation finished with status: ([COMPLETED|FAILED]+)$/, { timeout: 120000 }, async function lastResolveFinishedCall(status) { - this.logger.log(`Last resolve finished with status: ${status}`); + this.logger.log(`Last get result finished with status: ${status}`); expect( !!this.state.lastResolveData, - 'Last resolve data is undefined. Resolve is not started.', + 'Last get result data is undefined. Get result not started.', ).to.be.equal(true); expect( !!this.state.lastResolveData.result, - 'Last resolve data result is undefined. Resolve is not finished.', + 'Last get result data result is undefined. Get result is not finished.', ).to.be.equal(true); const resolveData = this.state.lastResolveData; From 0f7bf1bc8a0dbaf9bd807b2dea16b33512a4d2b3 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Mon, 29 Aug 2022 11:11:15 +0200 Subject: [PATCH 10/12] added test tags --- package.json | 1 + test/bdd/features/publish-errors.feature | 12 ++++++---- test/bdd/features/release.feature | 2 +- test/bdd/steps/api/resolve.js | 30 ++++++++++++++---------- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 5b816e9fe8..aefebb0f7b 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "test:bdd": "cucumber-js --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/", "test:unit": "nyc --all mocha --exit $(find test/unit -name '*.js')", "test:bdd:release": "cucumber-js --tags=@release --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/", + "test:bdd:publish-errors": "cucumber-js --tags=@publish-errors --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/", "lint": "eslint ." }, "repository": { diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index a59f140600..32e5fc6c1c 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -4,13 +4,15 @@ Feature: Publish errors test And 1 bootstrap is running #TODO: needs to be investigated; publish completes even with invalid configuration -# Scenario: Node is not able to publish on a node with invalid configuration -# Given I setup publish node 1 with invalid configuration -# Given I setup 3 nodes -# When I call publish on node 1 with validAssertion -# And Last publish finished with status: PublishStartError + @publish-errors + Scenario: Node is not able to publish on a node with invalid configuration + Given I setup publish node 1 with invalid configuration + Given I setup 3 nodes + When I call publish on node 1 with validAssertion + And Last publish finished with status: PublishStartError ## + @publish-errors Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes When I call publish on ot-node 1 directly with invalidPublishRequestBody diff --git a/test/bdd/features/release.feature b/test/bdd/features/release.feature index 7625af0555..1b9bb604e8 100644 --- a/test/bdd/features/release.feature +++ b/test/bdd/features/release.feature @@ -8,7 +8,7 @@ Feature: Release related tests Given I setup 4 nodes When I call publish on node 1 with validAssertion And Last publish finished with status: COMPLETED -# + @release Scenario: Node is able to get result of the operation previously published Given I setup 4 nodes diff --git a/test/bdd/steps/api/resolve.js b/test/bdd/steps/api/resolve.js index cbe1e9a688..dbd74ad950 100644 --- a/test/bdd/steps/api/resolve.js +++ b/test/bdd/steps/api/resolve.js @@ -13,18 +13,24 @@ When( 'Last publish data is undefined. Publish is not finalized.', ).to.be.equal(true); // const assertionIds = [this.state.lastPublishData.result.assertion.id]; - const result = await this.state.nodes[node - 1].client - .getResult(this.state.lastPublishData.UAL) - .catch((error) => { - assert.fail(`Error while trying to resolve assertion. ${error}`); - }); - const { operationId } = result.operation; - this.state.lastResolveData = { - nodeId: node - 1, - operationId, - result, - }; + // TODO: CALLING GET RESULT WITH WRONG UAL RETURNS UNDEFINED RESULT, IT SHOULD PROBABLY RETURN A FAILED RESULT MESSAGE OR SOMETHING LIKE THAT + try { + const result = await this.state.nodes[node - 1].client + .getResult(this.state.lastPublishData.UAL) + .catch((error) => { + assert.fail(`Error while trying to resolve assertion. ${error}`); + }); + const { operationId } = result.operation; + + this.state.lastResolveData = { + nodeId: node - 1, + operationId, + result, + }; + } catch (e) { + this.logger.log(`Error while getting operation result: ${e}`); + } }, ); @@ -77,7 +83,7 @@ Given( 'Last get result data is undefined. Get result not started.', ).to.be.equal(true); expect( - !!this.state.lastResolveData.result, + !!this.state.lastResolveData.result.operation, 'Last get result data result is undefined. Get result is not finished.', ).to.be.equal(true); From 4af411b03ce3208ee25b3e6a3ae2c592aef18109 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Tue, 30 Aug 2022 12:35:49 +0200 Subject: [PATCH 11/12] default node configurations are outside of bdd test steps. workflow yml file name changed --- .../{TEST-release.yml => TEST-bdd.yml} | 4 +- package-lock.json | 124 ++++++++++++++++++ test/bdd/features/publish-errors.feature | 12 +- test/bdd/steps/common.js | 38 +----- 4 files changed, 138 insertions(+), 40 deletions(-) rename .github/workflows/{TEST-release.yml => TEST-bdd.yml} (97%) diff --git a/.github/workflows/TEST-release.yml b/.github/workflows/TEST-bdd.yml similarity index 97% rename from .github/workflows/TEST-release.yml rename to .github/workflows/TEST-bdd.yml index 7d430d592a..a57ff68747 100644 --- a/.github/workflows/TEST-release.yml +++ b/.github/workflows/TEST-bdd.yml @@ -1,4 +1,4 @@ -name: TEST-release +name: TEST-bdd #todo this test should be execute when opening PR to prerelease/release branches on: [pull_request] @@ -9,7 +9,7 @@ env: REPOSITORY_PASSWORD: password jobs: - test-release: + test-bdd: #todo think about locking the version - version should be the same as the one in official documentation runs-on: ubuntu-latest services: diff --git a/package-lock.json b/package-lock.json index a0f4e3bdf8..6884740fed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19251,6 +19251,8 @@ }, "node_modules/ganache/node_modules/@trufflesuite/bigint-buffer": { "version": "1.1.10", + "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", + "integrity": "sha512-pYIQC5EcMmID74t26GCC67946mgTJFiLXOT/BYozgrd4UEY2JHEGLhWi9cMiQCt5BSqFEvKkCHNnoj82SRjiEw==", "hasInstallScript": true, "inBundle": true, "license": "Apache-2.0", @@ -19263,6 +19265,8 @@ }, "node_modules/ganache/node_modules/@trufflesuite/bigint-buffer/node_modules/node-gyp-build": { "version": "4.4.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", + "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", "inBundle": true, "license": "MIT", "bin": { @@ -19273,6 +19277,8 @@ }, "node_modules/ganache/node_modules/@types/bn.js": { "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", "inBundle": true, "license": "MIT", "dependencies": { @@ -19281,21 +19287,29 @@ }, "node_modules/ganache/node_modules/@types/lru-cache": { "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/@types/node": { "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", + "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/@types/seedrandom": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.1.tgz", + "integrity": "sha512-giB9gzDeiCeloIXDgzFBCgjj1k4WxcDrZtGl6h1IqmUPlxF+Nx8Ve+96QCyDZ/HseB/uvDsKbpib9hU5cU53pw==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/base64-js": { "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "funding": [ { "type": "github", @@ -19315,11 +19329,15 @@ }, "node_modules/ganache/node_modules/brorand": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/buffer": { "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", @@ -19355,6 +19373,8 @@ }, "node_modules/ganache/node_modules/catering": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", + "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", "inBundle": true, "license": "MIT", "dependencies": { @@ -19366,6 +19386,8 @@ }, "node_modules/ganache/node_modules/elliptic": { "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "inBundle": true, "license": "MIT", "dependencies": { @@ -19380,11 +19402,15 @@ }, "node_modules/ganache/node_modules/elliptic/node_modules/bn.js": { "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/emittery": { "version": "0.10.0", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", + "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", "inBundle": true, "license": "MIT", "engines": { @@ -19396,6 +19422,8 @@ }, "node_modules/ganache/node_modules/hash.js": { "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "inBundle": true, "license": "MIT", "dependencies": { @@ -19405,6 +19433,8 @@ }, "node_modules/ganache/node_modules/hmac-drbg": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "inBundle": true, "license": "MIT", "dependencies": { @@ -19415,6 +19445,8 @@ }, "node_modules/ganache/node_modules/ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", @@ -19434,11 +19466,15 @@ }, "node_modules/ganache/node_modules/inherits": { "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "inBundle": true, "license": "ISC" }, "node_modules/ganache/node_modules/is-buffer": { "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "funding": [ { "type": "github", @@ -19461,6 +19497,8 @@ }, "node_modules/ganache/node_modules/keccak": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", + "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -19474,6 +19512,8 @@ }, "node_modules/ganache/node_modules/leveldown": { "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -19488,6 +19528,8 @@ }, "node_modules/ganache/node_modules/leveldown/node_modules/abstract-leveldown": { "version": "7.2.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "inBundle": true, "license": "MIT", "dependencies": { @@ -19504,6 +19546,8 @@ }, "node_modules/ganache/node_modules/leveldown/node_modules/level-concat-iterator": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "inBundle": true, "license": "MIT", "dependencies": { @@ -19515,6 +19559,8 @@ }, "node_modules/ganache/node_modules/leveldown/node_modules/level-supports": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "inBundle": true, "license": "MIT", "engines": { @@ -19523,26 +19569,36 @@ }, "node_modules/ganache/node_modules/minimalistic-assert": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "inBundle": true, "license": "ISC" }, "node_modules/ganache/node_modules/minimalistic-crypto-utils": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/napi-macros": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/node-addon-api": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/node-gyp-build": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", "inBundle": true, "license": "MIT", "bin": { @@ -19553,6 +19609,8 @@ }, "node_modules/ganache/node_modules/queue-microtask": { "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "funding": [ { "type": "github", @@ -19572,11 +19630,15 @@ }, "node_modules/ganache/node_modules/queue-tick": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", + "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==", "inBundle": true, "license": "MIT" }, "node_modules/ganache/node_modules/secp256k1": { "version": "4.0.2", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", + "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -38647,6 +38709,8 @@ "dependencies": { "@trufflesuite/bigint-buffer": { "version": "1.1.10", + "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.10.tgz", + "integrity": "sha512-pYIQC5EcMmID74t26GCC67946mgTJFiLXOT/BYozgrd4UEY2JHEGLhWi9cMiQCt5BSqFEvKkCHNnoj82SRjiEw==", "bundled": true, "requires": { "node-gyp-build": "4.4.0" @@ -38654,12 +38718,16 @@ "dependencies": { "node-gyp-build": { "version": "4.4.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.4.0.tgz", + "integrity": "sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==", "bundled": true } } }, "@types/bn.js": { "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", "bundled": true, "requires": { "@types/node": "*" @@ -38667,26 +38735,38 @@ }, "@types/lru-cache": { "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==", "bundled": true }, "@types/node": { "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", + "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==", "bundled": true }, "@types/seedrandom": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.1.tgz", + "integrity": "sha512-giB9gzDeiCeloIXDgzFBCgjj1k4WxcDrZtGl6h1IqmUPlxF+Nx8Ve+96QCyDZ/HseB/uvDsKbpib9hU5cU53pw==", "bundled": true }, "base64-js": { "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "bundled": true }, "brorand": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "bundled": true }, "buffer": { "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "bundled": true, "requires": { "base64-js": "^1.3.1", @@ -38702,6 +38782,8 @@ }, "catering": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", + "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", "bundled": true, "requires": { "queue-tick": "^1.0.0" @@ -38709,6 +38791,8 @@ }, "elliptic": { "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "bundled": true, "requires": { "bn.js": "^4.11.9", @@ -38722,16 +38806,22 @@ "dependencies": { "bn.js": { "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "bundled": true } } }, "emittery": { "version": "0.10.0", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", + "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==", "bundled": true }, "hash.js": { "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "bundled": true, "requires": { "inherits": "^2.0.3", @@ -38740,6 +38830,8 @@ }, "hmac-drbg": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "bundled": true, "requires": { "hash.js": "^1.0.3", @@ -38749,18 +38841,26 @@ }, "ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "bundled": true }, "inherits": { "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "bundled": true }, "is-buffer": { "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "bundled": true }, "keccak": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", + "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", "bundled": true, "requires": { "node-addon-api": "^2.0.0", @@ -38769,6 +38869,8 @@ }, "leveldown": { "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", "bundled": true, "requires": { "abstract-leveldown": "^7.2.0", @@ -38778,6 +38880,8 @@ "dependencies": { "abstract-leveldown": { "version": "7.2.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", "bundled": true, "requires": { "buffer": "^6.0.3", @@ -38790,6 +38894,8 @@ }, "level-concat-iterator": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", "bundled": true, "requires": { "catering": "^2.1.0" @@ -38797,40 +38903,58 @@ }, "level-supports": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==", "bundled": true } } }, "minimalistic-assert": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "bundled": true }, "minimalistic-crypto-utils": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", "bundled": true }, "napi-macros": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==", "bundled": true }, "node-addon-api": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "bundled": true }, "node-gyp-build": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==", "bundled": true }, "queue-microtask": { "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "bundled": true }, "queue-tick": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", + "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==", "bundled": true }, "secp256k1": { "version": "4.0.2", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", + "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", "bundled": true, "requires": { "elliptic": "^6.5.2", diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index 32e5fc6c1c..7ac8d8f531 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -4,12 +4,12 @@ Feature: Publish errors test And 1 bootstrap is running #TODO: needs to be investigated; publish completes even with invalid configuration - @publish-errors - Scenario: Node is not able to publish on a node with invalid configuration - Given I setup publish node 1 with invalid configuration - Given I setup 3 nodes - When I call publish on node 1 with validAssertion - And Last publish finished with status: PublishStartError +# @publish-errors +# Scenario: Node is not able to publish on a node with invalid configuration +# Given I setup publish node 1 with invalid configuration +# Given I setup 3 nodes +# When I call publish on node 1 with validAssertion +# And Last publish finished with status: PublishStartError ## @publish-errors diff --git a/test/bdd/steps/common.js b/test/bdd/steps/common.js index 8b62b5da9c..470aaa64fc 100644 --- a/test/bdd/steps/common.js +++ b/test/bdd/steps/common.js @@ -3,11 +3,11 @@ const DeepExtend = require('deep-extend'); const { expect, assert } = require('chai'); const { fork } = require('child_process'); const fs = require('fs'); -const path = require('path'); const DkgClientHelper = require('../../utilities/dkg-client-helper'); -const PATH_TO_CONFIGS = './config/'; const otNodeProcessPath = './test/bdd/steps/lib/ot-node-process.js'; +const defaultConfiguration = require(`./config/origintrail-test-node-config.json`); +const bootstrapNodeConfiguration = require(`./config/origintrail-test-bootstrap-config.json`); function getBlockchainConfiguration(localBlockchain, privateKey, publicKey, managementKey) { return [ { @@ -104,16 +104,8 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 80000 }, function nodeSetup(nodeCou const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; - const defaultConfiguration = JSON.parse( - fs - .readFileSync( - path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), - ) - .toString(), - ); - - // eslint-disable-next-line prefer-destructuring const nodeConfiguration = DeepExtend( + {}, defaultConfiguration, createNodeConfiguration.call( this, @@ -170,11 +162,6 @@ Given( expect(nodeCount).to.be.equal(1); // Currently not supported more. this.logger.log('Initializing bootstrap node'); const nodeName = 'origintrail-test-bootstrap'; - const bootstrapNodeConfiguration = JSON.parse( - fs - .readFileSync(path.join(__dirname, `${PATH_TO_CONFIGS}${nodeName}-config.json`)) - .toString(), - ); const forkedNode = forkNode(bootstrapNodeConfiguration); const logFileStream = fs.createWriteStream(`${this.state.scenarionLogDir}/${nodeName}.log`); @@ -222,14 +209,8 @@ Given( const managementWallet = wallets[nodeIndex + 28]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; - const defaultConfiguration = JSON.parse( - fs - .readFileSync( - path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), - ) - .toString(), - ); const nodeConfiguration = DeepExtend( + {}, defaultConfiguration, createNodeConfiguration.call( this, @@ -290,21 +271,14 @@ Given( const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex - 1 + 28]; const rpcPort = 8901 + nodeIndex - 1; const nodeName = `origintrail-test-${nodeIndex - 1}`; - const defaultConfiguration = JSON.parse( - fs - .readFileSync( - path.join(__dirname, `${PATH_TO_CONFIGS}origintrail-test-node-config.json`), - ) - .toString(), - ); - // eslint-disable-next-line prefer-destructuring const nodeConfiguration = DeepExtend( + {}, defaultConfiguration, createNodeConfiguration.call( this, wallet, managementWallet, - nodeIndex - 1, + nodeIndex, nodeName, rpcPort, ), From ffc0757988a26f0180edf4ca1d9642c29e5c2ee3 Mon Sep 17 00:00:00 2001 From: micax3000 Date: Tue, 30 Aug 2022 15:12:30 +0200 Subject: [PATCH 12/12] test wallets fix --- test/bdd/features/publish-errors.feature | 1 - test/bdd/steps/api/publish.js | 5 +++-- test/bdd/steps/common.js | 15 ++++++++------- .../config/origintrail-test-bootstrap-config.json | 4 ++-- .../config/origintrail-test-node-config.json | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/test/bdd/features/publish-errors.feature b/test/bdd/features/publish-errors.feature index 7ac8d8f531..1dea630a26 100644 --- a/test/bdd/features/publish-errors.feature +++ b/test/bdd/features/publish-errors.feature @@ -11,7 +11,6 @@ Feature: Publish errors test # When I call publish on node 1 with validAssertion # And Last publish finished with status: PublishStartError -## @publish-errors Scenario: Node is not able to validate assertion on the network Given I setup 4 nodes diff --git a/test/bdd/steps/api/publish.js b/test/bdd/steps/api/publish.js index 4e7093589c..f84a404ac3 100644 --- a/test/bdd/steps/api/publish.js +++ b/test/bdd/steps/api/publish.js @@ -45,6 +45,7 @@ When( /^I call publish on ot-node (\d+) directly with ([^"]*)/, { timeout: 60000 }, async function publish(node, requestName) { + this.logger.log(`I call publish on ot-node ${node} directly`); expect( !!requests[requestName], `Request body with name: ${requestName} not found!`, @@ -92,12 +93,12 @@ Given('I wait for last publish to finalize', { timeout: 80000 }, async function assert.fail('Unable to get publish result'); } // eslint-disable-next-line no-await-in-loop - await setTimeout(4000); + await setTimeout(5000); } }); Given( - /Last publish finished with status: ([COMPLETED|FAILED|PublishValidateAssertionError,PUblishStartError]+)$/, + /Last publish finished with status: ([COMPLETED|FAILED|PublishValidateAssertionError,PublishStartError]+)$/, { timeout: 60000 }, async function lastPublishFinished(status) { this.logger.log(`Last publish finished with status: ${status}`); diff --git a/test/bdd/steps/common.js b/test/bdd/steps/common.js index 470aaa64fc..f7dc79fa16 100644 --- a/test/bdd/steps/common.js +++ b/test/bdd/steps/common.js @@ -22,6 +22,7 @@ function getBlockchainConfiguration(localBlockchain, privateKey, publicKey, mana evmOperationalWalletPublicKey: publicKey, evmOperationalWalletPrivateKey: privateKey, evmManagementWalletPublicKey: managementKey, + evmManagementPublicKey: managementKey, }, }, }, @@ -99,8 +100,8 @@ Given(/^I setup (\d+) node[s]*$/, { timeout: 80000 }, function nodeSetup(nodeCou let nodesStarted = 0; for (let i = 0; i < nodeCount; i += 1) { const nodeIndex = currentNumberOfNodes + i; - const wallet = wallets[nodeIndex]; - const managementWallet = wallets[nodeIndex + 28]; + const wallet = wallets[nodeIndex + 1]; + const managementWallet = wallets[nodeIndex + 1 + 27]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; @@ -205,8 +206,8 @@ Given( let nodesStarted = 0; for (let i = 0; i < nodeCount; i += 1) { const nodeIndex = currentNumberOfNodes + i; - const wallet = wallets[nodeIndex]; - const managementWallet = wallets[nodeIndex + 28]; + const wallet = wallets[nodeIndex + 1]; + const managementWallet = wallets[nodeIndex + 1 + 27]; const rpcPort = 8901 + nodeIndex; const nodeName = `origintrail-test-${nodeIndex}`; const nodeConfiguration = DeepExtend( @@ -267,8 +268,8 @@ Given( { timeout: 120000 }, function setupPublishNode(nodeIndex, done) { this.logger.log(`I setup node ${nodeIndex} with invalid configuration`); - const wallet = this.state.localBlockchain.getWallets()[nodeIndex - 1]; - const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex - 1 + 28]; + const wallet = this.state.localBlockchain.getWallets()[nodeIndex]; + const managementWallet = this.state.localBlockchain.getWallets()[nodeIndex + 27]; const rpcPort = 8901 + nodeIndex - 1; const nodeName = `origintrail-test-${nodeIndex - 1}`; const nodeConfiguration = DeepExtend( @@ -278,7 +279,7 @@ Given( this, wallet, managementWallet, - nodeIndex, + nodeIndex - 1, nodeName, rpcPort, ), diff --git a/test/bdd/steps/config/origintrail-test-bootstrap-config.json b/test/bdd/steps/config/origintrail-test-bootstrap-config.json index 2789035757..268346d1b0 100644 --- a/test/bdd/steps/config/origintrail-test-bootstrap-config.json +++ b/test/bdd/steps/config/origintrail-test-bootstrap-config.json @@ -13,8 +13,8 @@ "hubContractAddress": "0x378ec78F621E2C8Aeff345b39334c38B0Bb7b96F", "evmOperationalWalletPublicKey": "0x1152b7ea23b7b9890ce2e9abf95119038d7644e0", "evmOperationalWalletPrivateKey": "3cf97be6177acdd12796b387f58f84f177d0fe20d8558004e8db9a41cf90392a", - "evmManagementWalletPublicKey": "0x20bd8f91585bebf91ae96c897c38429ebc2291c7", - "evmManagementPublicKey": "0x20bd8f91585bebf91ae96c897c38429ebc2291c7" + "evmManagementWalletPublicKey": "0x76014481ed80a4bb57eba8f279d0d2489db5d136", + "evmManagementPublicKey": "0x76014481ed80a4bb57eba8f279d0d2489db5d136" } } } diff --git a/test/bdd/steps/config/origintrail-test-node-config.json b/test/bdd/steps/config/origintrail-test-node-config.json index 7a1f1aa964..35211d1c06 100644 --- a/test/bdd/steps/config/origintrail-test-node-config.json +++ b/test/bdd/steps/config/origintrail-test-node-config.json @@ -13,8 +13,8 @@ "hubContractAddress": "0x378ec78F621E2C8Aeff345b39334c38B0Bb7b96F", "evmOperationalWalletPublicKey": "0x19ad96f87f8e1c13e99a98d8174e00f5a7c82df1", "evmOperationalWalletPrivateKey": "1e60c8e9aa35064cd2eaa4c005bda2b76ef1a858feebb6c8e131c472d16f9740", - "evmManagementWalletPublicKey": "0x1de33ab36099f60c6a41a1b8f71939428773b169", - "evmManagementPublicKey" : "0x1de33ab36099f60c6a41a1b8f71939428773b169" + "evmManagementWalletPublicKey": "0xc96dfe1017168f5b5e2518df8048b7b6da9f7bd1", + "evmManagementPublicKey" : "0xc96dfe1017168f5b5e2518df8048b7b6da9f7bd1" } } }