diff --git a/framework/dist/lisk-service-framework-1.6.1.tgz b/framework/dist/lisk-service-framework-1.6.1.tgz new file mode 100644 index 0000000000..61bb776de8 Binary files /dev/null and b/framework/dist/lisk-service-framework-1.6.1.tgz differ diff --git a/framework/package.json b/framework/package.json index a2b1dd4dde..17f83bc5a7 100644 --- a/framework/package.json +++ b/framework/package.json @@ -1,6 +1,6 @@ { "name": "lisk-service-framework", - "version": "1.6.0", + "version": "1.6.1", "description": "Lisk Service Framework", "keywords": [ "lisk", @@ -25,7 +25,7 @@ "scripts": { "release:github": "npm pack && mv lisk-service-framework-$npm_package_version.tgz ./dist/lisk-service-framework-$npm_package_version.tgz", "test:unit": "./node_modules/.bin/jest --config=tests/unit.config.js --detectOpenHandles --forceExit", - "test:functional": "./node_modules/.bin/jest --config=tests/functional.config.js --detectOpenHandles --forceExit" + "test:functional": "./node_modules/.bin/jest --config=tests/functional.config.js --detectOpenHandles --runInBand --forceExit" }, "bin": { "moleculer_client": "./bin/moleculer_client.js" diff --git a/framework/src/database/util.js b/framework/src/database/util.js index c8ee347e9b..9f81c67de8 100644 --- a/framework/src/database/util.js +++ b/framework/src/database/util.js @@ -81,7 +81,7 @@ const resolveQueryParams = params => { 'sort', 'limit', 'offset', 'propBetweens', 'andWhere', 'orWhere', 'orWhereWith', 'whereNot', 'whereIn', 'whereNotIn', 'orWhereIn', 'whereBetween', 'whereJsonSupersetOf', 'search', 'aggregate', 'distinct', 'order', 'orSearch', 'whereNull', 'whereNotNull', 'leftOuterJoin', 'rightOuterJoin', - 'innerJoin', 'groupBy', 'orderByRaw', + 'innerJoin', 'groupBy', 'orderByRaw', 'havingRaw', ]; const queryParams = Object.keys(params) .filter(key => !KNOWN_QUERY_PARAMS.includes(key)) @@ -199,6 +199,10 @@ const getTableInstance = (tableConfig, knex) => { }); } + if (params.havingRaw) { + query.having(knex.raw(params.havingRaw)); + } + if (params.aggregate) { query.sum(`${params.aggregate} as total`); } diff --git a/framework/tests/functional/database/mysql/mysql.test.js b/framework/tests/functional/database/mysql/mysql.test.js index 114bf03e68..b2b1fc11ab 100644 --- a/framework/tests/functional/database/mysql/mysql.test.js +++ b/framework/tests/functional/database/mysql/mysql.test.js @@ -80,7 +80,9 @@ describe('Test MySQL', () => { }); describe('With IMPLICIT DB transaction (auto-commit mode)', () => { - afterAll(() => blocksTable.rawQuery(`TRUNCATE ${tableName}`)); + afterEach(async () => { + await blocksTable.rawQuery(`TRUNCATE ${tableName}`); + }); it('should insert row', async () => { await blocksTable.upsert([emptyBlock]); @@ -90,6 +92,7 @@ describe('Test MySQL', () => { }); it('should get rows', async () => { + await blocksTable.upsert([emptyBlock]); const result = await blocksTable.find({ id: emptyBlock.id }, ['id']); expect(result).toBeInstanceOf(Array); expect(result.length).toBe(1); @@ -212,6 +215,7 @@ describe('Test MySQL', () => { }); it('should get row count', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); const count = await blocksTable.count(); expect(count).toBe(2); }); @@ -312,6 +316,7 @@ describe('Test MySQL', () => { }); it('should increment column value', async () => { + await blocksTable.upsert([emptyBlock]); const [currentBlock] = await blocksTable.find({ id: emptyBlock.id }, ['timestamp']); const currentTimestamp = currentBlock.timestamp; @@ -326,6 +331,7 @@ describe('Test MySQL', () => { }); it('should decrement column value', async () => { + await blocksTable.upsert([emptyBlock]); const [currentBlock] = await blocksTable.find({ id: emptyBlock.id }, ['timestamp']); const currentTimestamp = currentBlock.timestamp; @@ -340,6 +346,7 @@ describe('Test MySQL', () => { }); it('should delete row by primary key', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); const [existingBlock] = await blocksTable.find(); const existingBlockId = existingBlock[`${blocksTableSchema.primaryKey}`]; const count = await blocksTable.deleteByPrimaryKey([existingBlockId]); @@ -398,6 +405,7 @@ describe('Test MySQL', () => { }); it('should execute update method', async () => { + await blocksTable.upsert([emptyBlock]); const [retrievedBlock] = await blocksTable.find({ id: emptyBlock.id }, ['timestamp']); expect(retrievedBlock.timestamp).toBe(emptyBlock.timestamp); @@ -711,10 +719,38 @@ describe('Test MySQL', () => { expect(result).toBeInstanceOf(Array); expect(result.length).toBe(0); }); + + it('should apply HAVING clause with havingRaw', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); + + const params = { + groupBy: 'height', + havingRaw: `height < ${Math.max(emptyBlock.height, nonEmptyBlock.height)}`, + }; + + const result = await blocksTable.find(params, ['id', 'height']); + expect(result).toBeInstanceOf(Array); + expect(result.length).toBe(1); + }); + + it('should apply complex HAVING clause with havingRaw', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); + + const params = { + groupBy: 'height', + havingRaw: `SUM(height) < ${Math.max(emptyBlock.height, nonEmptyBlock.height)}`, + }; + + const result = await blocksTable.find(params, ['id', 'height']); + expect(result).toBeInstanceOf(Array); + expect(result.length).toBe(1); + }); }); describe('With EXPLICIT DB transaction (non-auto commit mode)', () => { - afterAll(() => blocksTable.rawQuery(`TRUNCATE ${tableName}`)); + afterEach(async () => { + await blocksTable.rawQuery(`TRUNCATE ${tableName}`); + }); it('should insert row', async () => { const connection = await getDBConnection(); @@ -727,6 +763,11 @@ describe('Test MySQL', () => { }); it('should get rows', async () => { + const connection = await getDBConnection(); + const trx = await startDBTransaction(connection); + await blocksTable.upsert([emptyBlock], trx); + await commitDBTransaction(trx); + const result = await blocksTable.find({ id: emptyBlock.id }, ['id']); expect(result).toBeInstanceOf(Array); expect(result.length).toBe(1); @@ -824,7 +865,7 @@ describe('Test MySQL', () => { it('should sort the rows in ascending order based on their height', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); - await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx); + await blocksTable.upsert([{ ...emptyBlock, size: 50 }, nonEmptyBlock], trx); await commitDBTransaction(trx); const result = await blocksTable.find({ sort: 'height:asc' }); @@ -836,7 +877,7 @@ describe('Test MySQL', () => { it('should sort the rows in descending order based on their height', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); - await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx); + await blocksTable.upsert([{ ...emptyBlock, size: 50 }, nonEmptyBlock], trx); await commitDBTransaction(trx); const result = await blocksTable.find({ sort: 'height:desc' }); @@ -848,7 +889,7 @@ describe('Test MySQL', () => { it('should order the rows in ascending order based on their height', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); - await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx); + await blocksTable.upsert([{ ...emptyBlock, size: 50 }, nonEmptyBlock], trx); await commitDBTransaction(trx); const result = await blocksTable.find({ order: 'height:asc' }); @@ -860,7 +901,7 @@ describe('Test MySQL', () => { it('should order the rows in descending order based on their height', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); - await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx); + await blocksTable.upsert([{ ...emptyBlock, size: 50 }, nonEmptyBlock], trx); await commitDBTransaction(trx); const result = await blocksTable.find({ order: 'height:desc' }); @@ -872,7 +913,7 @@ describe('Test MySQL', () => { it('should order the rows in ascending order based on their height using orderByRaw query', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); - await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx); + await blocksTable.upsert([{ ...emptyBlock, size: 50 }, nonEmptyBlock], trx); await commitDBTransaction(trx); const result = await blocksTable.find({ orderByRaw: ['height asc'] }); @@ -884,7 +925,7 @@ describe('Test MySQL', () => { it('should order the rows in descending order based on their height', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); - await blocksTable.upsert([{ ...emptyBlock, size: 50 }], trx); + await blocksTable.upsert([{ ...emptyBlock, size: 50 }, nonEmptyBlock], trx); await commitDBTransaction(trx); const result = await blocksTable.find({ orderByRaw: ['height desc'] }); @@ -894,6 +935,11 @@ describe('Test MySQL', () => { }); it('should get row count', async () => { + const connection = await getDBConnection(); + const trx = await startDBTransaction(connection); + await blocksTable.upsert([emptyBlock, nonEmptyBlock], trx); + await commitDBTransaction(trx); + const count = await blocksTable.count(); expect(count).toBe(2); }); @@ -944,6 +990,7 @@ describe('Test MySQL', () => { }); it('should increment column value', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); const connection = await getDBConnection(); const trx = await startDBTransaction(connection); await blocksTable.increment({ @@ -957,6 +1004,7 @@ describe('Test MySQL', () => { }); it('should decrement row by primary key', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); const connection = await getDBConnection(); const trx = await startDBTransaction(connection); const [existingBlock] = await blocksTable.find(); @@ -1065,6 +1113,7 @@ describe('Test MySQL', () => { }); it('should perform update method', async () => { + await blocksTable.upsert([emptyBlock, nonEmptyBlock]); const [retrievedBlock] = await blocksTable.find({ id: emptyBlock.id }, ['timestamp']); expect(retrievedBlock.timestamp).toBe(emptyBlock.timestamp); @@ -1319,9 +1368,49 @@ describe('Test MySQL', () => { expect(firstRow.height).toBe(nonEmptyBlock.height); expect(firstRow.id).toBe(tokenTransferTransaction.id); }); + + it('should apply HAVING clause with havingRaw', async () => { + // Insert a test record. + const connection = await getDBConnection(); + const trx = await startDBTransaction(connection); + await blocksTable.upsert([emptyBlock, nonEmptyBlock], trx); + await transactionsTable.upsert([tokenTransferTransaction], trx); + + const params = { + groupBy: 'height', + havingRaw: `height < ${Math.max(emptyBlock.height, nonEmptyBlock.height)}`, + }; + + const result = await blocksTable.find(params, ['id', 'height'], trx); + await commitDBTransaction(trx); + expect(result).toBeInstanceOf(Array); + expect(result.length).toBe(1); + }); + + it('should apply complex HAVING clause with havingRaw', async () => { + // Insert a test record. + const connection = await getDBConnection(); + const trx = await startDBTransaction(connection); + await blocksTable.upsert([emptyBlock, nonEmptyBlock], trx); + await transactionsTable.upsert([tokenTransferTransaction], trx); + + const params = { + groupBy: 'height', + havingRaw: `SUM(height) < ${Math.max(emptyBlock.height, nonEmptyBlock.height)}`, + }; + + const result = await blocksTable.find(params, ['id', 'height'], trx); + await commitDBTransaction(trx); + expect(result).toBeInstanceOf(Array); + expect(result.length).toBe(1); + }); }); describe('Transactional atomicity guarantees (non-auto commit mode)', () => { + afterEach(async () => { + await blocksTable.rawQuery(`TRUNCATE ${tableName}`); + }); + it('should perform a successful transaction commit', async () => { const connection = await getDBConnection(); const trx = await startDBTransaction(connection); diff --git a/services/blockchain-app-registry/package.json b/services/blockchain-app-registry/package.json index d3d8be424c..7858b31b79 100644 --- a/services/blockchain-app-registry/package.json +++ b/services/blockchain-app-registry/package.json @@ -33,7 +33,7 @@ }, "dependencies": { "bluebird": "^3.7.2", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "lodash": "^4.17.21", "octokit": "^2.0.4", "tar": "^6.1.11" diff --git a/services/blockchain-app-registry/yarn.lock b/services/blockchain-app-registry/yarn.lock index 63d2ee1ea0..a36c7b2f7b 100644 --- a/services/blockchain-app-registry/yarn.lock +++ b/services/blockchain-app-registry/yarn.lock @@ -3084,9 +3084,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/blockchain-connector/package.json b/services/blockchain-connector/package.json index bcf05c63d6..285dbb07a2 100644 --- a/services/blockchain-connector/package.json +++ b/services/blockchain-connector/package.json @@ -39,7 +39,7 @@ "big-json": "^3.1.0", "bluebird": "^3.7.2", "knex": "^2.4.0", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "moment": "^2.29.4", "signals": "^1.0.0", "tar": "^6.1.11" diff --git a/services/blockchain-connector/yarn.lock b/services/blockchain-connector/yarn.lock index a64aae67db..9f7bb23a00 100644 --- a/services/blockchain-connector/yarn.lock +++ b/services/blockchain-connector/yarn.lock @@ -3926,9 +3926,39 @@ lines-and-columns@^1.1.6: resolved "https://npm.lisk.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/blockchain-coordinator/package.json b/services/blockchain-coordinator/package.json index a6d9c48b6e..a64684f598 100644 --- a/services/blockchain-coordinator/package.json +++ b/services/blockchain-coordinator/package.json @@ -31,7 +31,7 @@ "dependencies": { "bluebird": "^3.7.2", "bull": "^4.8.1", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz" + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz" }, "devDependencies": { "@babel/preset-env": "^7.14.0", diff --git a/services/blockchain-coordinator/yarn.lock b/services/blockchain-coordinator/yarn.lock index cfa2f14d50..6ff47e9c0f 100644 --- a/services/blockchain-coordinator/yarn.lock +++ b/services/blockchain-coordinator/yarn.lock @@ -3482,9 +3482,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/blockchain-indexer/package.json b/services/blockchain-indexer/package.json index 6947e1f15e..54eda4b45e 100644 --- a/services/blockchain-indexer/package.json +++ b/services/blockchain-indexer/package.json @@ -38,7 +38,7 @@ "bull": "^4.8.1", "camelcase": "^6.3.0", "ioredis": "^4.28.5", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "lodash": "^4.17.21", "require-all": "^3.0.0" }, diff --git a/services/blockchain-indexer/shared/dataService/business/events.js b/services/blockchain-indexer/shared/dataService/business/events.js index 49d20d4853..097eae4c9c 100644 --- a/services/blockchain-indexer/shared/dataService/business/events.js +++ b/services/blockchain-indexer/shared/dataService/business/events.js @@ -14,7 +14,6 @@ * */ const BluebirdPromise = require('bluebird'); -const _ = require('lodash'); const { CacheLRU, @@ -100,8 +99,6 @@ const cacheEventsByBlockID = async (blockID, events) => { const deleteEventsFromCache = async (height) => eventCache.delete(height); const getEvents = async (params) => { - let queryParams = _.cloneDeep(params); - const blocksTable = await getBlocksTable(); const eventsTable = await getEventsTable(); const eventTopicsTable = await getEventTopicsTable(); @@ -112,48 +109,38 @@ const getEvents = async (params) => { }; if (params.height && typeof params.height === 'string' && params.height.includes(':')) { - queryParams = normalizeRangeParam(queryParams, 'height'); + params = normalizeRangeParam(params, 'height'); } if (params.timestamp && params.timestamp.includes(':')) { - queryParams = normalizeRangeParam(queryParams, 'timestamp'); - } - - if (params.topic) { - const { topic, ...remQueryParams } = queryParams; - queryParams = remQueryParams; - - queryParams.whereIn = { - property: 'topic', - values: topic.split(','), - }; + params = normalizeRangeParam(params, 'timestamp'); } if (params.transactionID) { - const { transactionID, ...remQueryParams } = queryParams; - queryParams = remQueryParams; + const { transactionID, ...remParams } = params; + params = remParams; if (!params.topic) { - queryParams.topic = transactionID; + params.topic = transactionID; } else { - queryParams.andWhere = { topic: transactionID }; + params.topic = `${params.topic},${transactionID}`; } } if (params.senderAddress) { - const { senderAddress, ...remQueryParams } = queryParams; - queryParams = remQueryParams; + const { senderAddress, ...remParams } = params; + params = remParams; if (!params.topic) { - queryParams.topic = senderAddress; + params.topic = senderAddress; } else { - queryParams.andWhere = { topic: senderAddress }; + params.topic = `${params.topic},${senderAddress}`; } } - if (params.blockID) { - const { blockID, ...remQueryParams } = queryParams; - queryParams = remQueryParams; + if ('blockID' in params) { + const { blockID, ...remParams } = params; + params = remParams; const [block] = await blocksTable.find({ id: blockID, limit: 1 }, ['height']); if (!block || !block.height) { @@ -173,19 +160,27 @@ const getEvents = async (params) => { throw new NotFoundException(`Invalid combination of blockID: ${blockID} and height: ${params.height}`); } } - queryParams.height = block.height; + params.height = block.height; } - const isTopicInQuery = !!params.topic || !!queryParams.topic; - - queryParams.leftOuterJoin = { - targetTable: eventsTableSchema.tableName, - leftColumn: `${eventsTableSchema.tableName}.id`, - rightColumn: `${eventTopicsTableSchema.tableName}.eventID`, - }; + if (params.topic) { + const { topic, ...remParams } = params; + params = remParams; + + const response = await eventTopicsTable.find( + { + whereIn: { property: 'topic', values: topic.split(',') }, + groupBy: 'eventID', + havingRaw: `COUNT(DISTINCT topic) = ${topic.split(',').length}`, + }, + ['eventID'], + ); + const eventIDs = response.map(entry => entry.eventID); + params.whereIn = { property: 'id', values: eventIDs }; + } - const eventsInfo = await eventTopicsTable.find( - { ...queryParams, distinct: 'eventID' }, + const eventsInfo = await eventsTable.find( + params, ['eventStr', 'height', 'index'], ); @@ -211,20 +206,8 @@ const getEvents = async (params) => { { concurrency: eventsInfo.length }, ); - let total; - const { order, sort, ...remQueryParams } = queryParams; - - if (isTopicInQuery) { - total = await eventTopicsTable.count( - { ...remQueryParams, distinct: 'eventID' }, - ['eventID'], - ); - } else { - // If params doesn't contain event_topics specific column data - // then count all rows of event table for query optimization. - const { leftOuterJoin, ...remParamsWithoutJoin } = remQueryParams; - total = await eventsTable.count(remParamsWithoutJoin, ['id']); - } + const { order, sort, ...remParamsWithoutOrderAndSort } = params; + const total = await eventsTable.count(remParamsWithoutOrderAndSort); events.meta = { count: events.data.length, diff --git a/services/blockchain-indexer/tests/unit/shared/constants/events.js b/services/blockchain-indexer/tests/unit/shared/constants/events.js index 39c0a21dcb..e6cecc505e 100644 --- a/services/blockchain-indexer/tests/unit/shared/constants/events.js +++ b/services/blockchain-indexer/tests/unit/shared/constants/events.js @@ -69,52 +69,52 @@ const mockEventTopics = [ const mockEventsForEventTopics = [ { - eventStr: '{"data":{"address":"lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp"],"height":125247,"id":"392eadd8f1703efd2b9d5fae72e272da1806fc3fb667c67e0ef71035f941710f"}', + eventStr: '{"data":{"address":"lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125247,"id":"392eadd8f1703efd2b9d5fae72e272da1806fc3fb667c67e0ef71035f941710f"}', height: 125247, index: 0, }, { - eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp"],"height":125247,"id":"180fccd1d16dd9806454e2a5f48da020aa5590df0100c72659e713ab502ca4b0"}', + eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125247,"id":"180fccd1d16dd9806454e2a5f48da020aa5590df0100c72659e713ab502ca4b0"}', height: 125247, index: 1, }, { - eventStr: '{"data":{"address":"lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c"],"height":125246,"id":"51291dcc8010176f33f2a250d00869d5c423ad053204a204ebcb4a1b5dd19bc4"}', + eventStr: '{"data":{"address":"lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125246,"id":"51291dcc8010176f33f2a250d00869d5c423ad053204a204ebcb4a1b5dd19bc4"}', height: 125246, index: 0, }, { - eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c"],"height":125246,"id":"75ae7452e1d304b846e1531c73f696d169b38926a603df4092cd4c2c924fbe75"}', + eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125246,"id":"75ae7452e1d304b846e1531c73f696d169b38926a603df4092cd4c2c924fbe75"}', height: 125246, index: 1, }, { - eventStr: '{"data":{"address":"lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg"],"height":125245,"id":"af100a3fcfc221b0c62edb60bc88a78633e17f5bda449dc43216c2dedda3f20c"}', + eventStr: '{"data":{"address":"lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125245,"id":"af100a3fcfc221b0c62edb60bc88a78633e17f5bda449dc43216c2dedda3f20c"}', height: 125245, index: 0, }, { - eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg"],"height":125245,"id":"5f31caae2e0a606a86b1425d49ab1d6543d06fe42b39b97397e9739d8ed87785"}', + eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125245,"id":"5f31caae2e0a606a86b1425d49ab1d6543d06fe42b39b97397e9739d8ed87785"}', height: 125245, index: 1, }, { - eventStr: '{"data":{"address":"lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg"],"height":125244,"id":"6d15e5798dbc1e7b43fdd9d9c66d95f181dc4349ed8821e8209aa73c28939406"}', + eventStr: '{"data":{"address":"lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125244,"id":"6d15e5798dbc1e7b43fdd9d9c66d95f181dc4349ed8821e8209aa73c28939406"}', height: 125244, index: 0, }, { - eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg"],"height":125244,"id":"0d39438acc199f647af69ecfb675775f31bf8b1dcbd3cf5f0d6fdecfb68a7910"}', + eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125244,"id":"0d39438acc199f647af69ecfb675775f31bf8b1dcbd3cf5f0d6fdecfb68a7910"}', height: 125244, index: 1, }, { - eventStr: '{"data":{"address":"lskw68y3kyus7ota9mykr726aby44mw574m8dkngu","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskw68y3kyus7ota9mykr726aby44mw574m8dkngu"],"height":125243,"id":"48131594ec7324a815f43d0e5e6122104a0c0573e97760abb53c5930ac1f481b"}', + eventStr: '{"data":{"address":"lskw68y3kyus7ota9mykr726aby44mw574m8dkngu","tokenID":"0400000000000000","amount":"94953271","result":0},"index":0,"module":"token","name":"mint","topics":["03","lskw68y3kyus7ota9mykr726aby44mw574m8dkngu","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125243,"id":"48131594ec7324a815f43d0e5e6122104a0c0573e97760abb53c5930ac1f481b"}', height: 125243, index: 0, }, { - eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskw68y3kyus7ota9mykr726aby44mw574m8dkngu"],"height":125243,"id":"8c50ade215fd89a9e351a338cd8389bec6d64babb03dbc8611d5bdd433cec181"}', + eventStr: '{"data":{"amount":"94953271","reduction":0},"index":1,"module":"dynamicReward","name":"rewardMinted","topics":["03","lskw68y3kyus7ota9mykr726aby44mw574m8dkngu","c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b"],"height":125243,"id":"8c50ade215fd89a9e351a338cd8389bec6d64babb03dbc8611d5bdd433cec181"}', height: 125243, index: 1, }, @@ -135,6 +135,7 @@ const getEventsResult = { topics: [ '03', 'lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125247, id: '392eadd8f1703efd2b9d5fae72e272da1806fc3fb667c67e0ef71035f941710f', @@ -153,6 +154,7 @@ const getEventsResult = { topics: [ '03', 'lskfonwc5wpgy5873ckejqujwp3uwvtagejrjftpp', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125247, id: '180fccd1d16dd9806454e2a5f48da020aa5590df0100c72659e713ab502ca4b0', @@ -173,6 +175,7 @@ const getEventsResult = { topics: [ '03', 'lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125246, id: '51291dcc8010176f33f2a250d00869d5c423ad053204a204ebcb4a1b5dd19bc4', @@ -191,6 +194,7 @@ const getEventsResult = { topics: [ '03', 'lskd2ohufqtv7fqtnv75ca2w23krz2692mxvj8q3c', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125246, id: '75ae7452e1d304b846e1531c73f696d169b38926a603df4092cd4c2c924fbe75', @@ -211,6 +215,7 @@ const getEventsResult = { topics: [ '03', 'lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125245, id: 'af100a3fcfc221b0c62edb60bc88a78633e17f5bda449dc43216c2dedda3f20c', @@ -229,6 +234,7 @@ const getEventsResult = { topics: [ '03', 'lskfok9nevnkj8pzh8nr6rtmrtn4zmrp9g66ygbqg', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125245, id: '5f31caae2e0a606a86b1425d49ab1d6543d06fe42b39b97397e9739d8ed87785', @@ -249,6 +255,7 @@ const getEventsResult = { topics: [ '03', 'lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125244, id: '6d15e5798dbc1e7b43fdd9d9c66d95f181dc4349ed8821e8209aa73c28939406', @@ -267,6 +274,7 @@ const getEventsResult = { topics: [ '03', 'lskbnqdbfhxefdr5q6ovtcynrbhzvhf6d9qhsyntg', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125244, id: '0d39438acc199f647af69ecfb675775f31bf8b1dcbd3cf5f0d6fdecfb68a7910', @@ -287,6 +295,7 @@ const getEventsResult = { topics: [ '03', 'lskw68y3kyus7ota9mykr726aby44mw574m8dkngu', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125243, id: '48131594ec7324a815f43d0e5e6122104a0c0573e97760abb53c5930ac1f481b', @@ -305,6 +314,7 @@ const getEventsResult = { topics: [ '03', 'lskw68y3kyus7ota9mykr726aby44mw574m8dkngu', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', ], height: 125243, id: '8c50ade215fd89a9e351a338cd8389bec6d64babb03dbc8611d5bdd433cec181', @@ -321,38 +331,16 @@ const getEventsResult = { }; const mockEventTopicsQueryParams = { - sort: 'timestamp:desc', - order: 'index:asc', - limit: 10, - offset: 0, - propBetweens: [ - { - property: 'height', - from: 1, - to: 1000, - }, - { - property: 'timestamp', - from: 1, - to: 1000000000, - }, - ], whereIn: { property: 'topic', values: [ '03', + 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', + 'lskw68y3kyus7ota9mykr726aby44mw574m8dkngu', ], }, - height: 123, - leftOuterJoin: { - targetTable: 'events', - leftColumn: 'events.id', - rightColumn: 'event_topics.eventID', - }, - andWhere: { - topic: 'lskw68y3kyus7ota9mykr726aby44mw574m8dkngu', - }, - distinct: 'eventID', + groupBy: 'eventID', + havingRaw: 'COUNT(DISTINCT topic) = 3', }; module.exports = { diff --git a/services/blockchain-indexer/tests/unit/shared/dataservice/business/events.test.js b/services/blockchain-indexer/tests/unit/shared/dataservice/business/events.test.js index 8cac013b8a..6c5438b55c 100644 --- a/services/blockchain-indexer/tests/unit/shared/dataservice/business/events.test.js +++ b/services/blockchain-indexer/tests/unit/shared/dataservice/business/events.test.js @@ -245,6 +245,7 @@ describe('getEvents', () => { blockID, topic: '03', senderAddress: 'lskw68y3kyus7ota9mykr726aby44mw574m8dkngu', + transactionID: 'c8ee3933cc841287d834f74f278ac12f145f320d0593a612e11b67b4a58cd17b', timestamp: '1:1000000000', height: '1:1000', sort: 'timestamp:desc', diff --git a/services/blockchain-indexer/yarn.lock b/services/blockchain-indexer/yarn.lock index b27c1048c0..3ada4e6e63 100644 --- a/services/blockchain-indexer/yarn.lock +++ b/services/blockchain-indexer/yarn.lock @@ -3638,9 +3638,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/export/package.json b/services/export/package.json index 81829008f8..104b044eb8 100644 --- a/services/export/package.json +++ b/services/export/package.json @@ -36,7 +36,7 @@ "bull": "^3.29.2", "exceljs": "^4.3.0", "json2csv": "^5.0.6", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "minio": "^7.0.21", "moment": "^2.29.4", "moment-range": "^4.0.2", diff --git a/services/export/yarn.lock b/services/export/yarn.lock index 62f8a8d1bf..807c670901 100644 --- a/services/export/yarn.lock +++ b/services/export/yarn.lock @@ -3158,9 +3158,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/fee-estimator/package.json b/services/fee-estimator/package.json index 0e7e004ba5..9979d16633 100644 --- a/services/fee-estimator/package.json +++ b/services/fee-estimator/package.json @@ -34,7 +34,7 @@ "@liskhq/lisk-cryptography": "4.0.0-rc.1", "@liskhq/lisk-transactions": "6.0.0-rc.1", "bluebird": "^3.7.2", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz" + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz" }, "devDependencies": { "@babel/preset-env": "^7.14.0", diff --git a/services/fee-estimator/yarn.lock b/services/fee-estimator/yarn.lock index f2be0d8f2b..6a7c5d671e 100644 --- a/services/fee-estimator/yarn.lock +++ b/services/fee-estimator/yarn.lock @@ -3611,9 +3611,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/gateway/package.json b/services/gateway/package.json index ab84aa0f03..456b443e77 100644 --- a/services/gateway/package.json +++ b/services/gateway/package.json @@ -33,7 +33,7 @@ "bluebird": "^3.7.2", "fastest-validator": "^1.10.1", "ioredis": "^4.27.1", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "moleculer": "^0.14.13", "moment": "^2.29.4", "rate-limiter-flexible": "^2.2.4", diff --git a/services/gateway/yarn.lock b/services/gateway/yarn.lock index 1b2110bc6a..ba7c824343 100644 --- a/services/gateway/yarn.lock +++ b/services/gateway/yarn.lock @@ -2728,9 +2728,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/market/package.json b/services/market/package.json index 068a9e7d60..d48643a9e0 100644 --- a/services/market/package.json +++ b/services/market/package.json @@ -32,7 +32,7 @@ "dependencies": { "bluebird": "^3.7.2", "joi": "^17.4.0", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "moment": "^2.29.4", "node-cron": "=2.0.3" }, diff --git a/services/market/yarn.lock b/services/market/yarn.lock index bf077d2a9b..d094a6448f 100644 --- a/services/market/yarn.lock +++ b/services/market/yarn.lock @@ -2768,9 +2768,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/template/package.json b/services/template/package.json index 062c712c23..e9fd864448 100644 --- a/services/template/package.json +++ b/services/template/package.json @@ -30,7 +30,7 @@ "watch": "supervisor -w . -i ./node_modules app.js" }, "dependencies": { - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "node-cron": "=2.0.3" } } diff --git a/services/template/yarn.lock b/services/template/yarn.lock index dbef9bc6ac..36a6e66f2f 100644 --- a/services/template/yarn.lock +++ b/services/template/yarn.lock @@ -1022,9 +1022,39 @@ leven@2.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" integrity sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/services/transaction-statistics/package.json b/services/transaction-statistics/package.json index 98add14528..fdd1f15e12 100644 --- a/services/transaction-statistics/package.json +++ b/services/transaction-statistics/package.json @@ -32,7 +32,7 @@ "dependencies": { "big-number": "=2.0.0", "bluebird": "^3.7.2", - "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz", + "lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz", "moment": "^2.29.4" }, "devDependencies": { diff --git a/services/transaction-statistics/yarn.lock b/services/transaction-statistics/yarn.lock index f51a5062b4..ed28f8b15e 100644 --- a/services/transaction-statistics/yarn.lock +++ b/services/transaction-statistics/yarn.lock @@ -3437,9 +3437,39 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz": - version "1.6.0" - resolved "https://github.com/LiskHQ/lisk-service/raw/b29df9637584d43ce25b89843637c46ebbcbe628/framework/dist/lisk-service-framework-1.6.0.tgz#22d99e35771f13c9e00d6a36b20dc453e83f799a" +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/c290db8943b1ad0ad7e6ec913bd43c2a3c36030e/framework/dist/lisk-service-framework-1.6.1.tgz#bf7089c595b9e1893ac55c64acf2f2163e154695" + dependencies: + "@keyv/redis" "^2.1.2" + "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" + axios "^0.21.2" + better-sqlite3 "^8.5.0" + bull "^3.29.3" + debug "^4.3.1" + fastest-validator "^1.10.1" + http-status-codes "^1.4.0" + json-colorizer "^2.2.2" + keyv "^4.0.3" + keyv-lru "^3.0.4" + knex "^2.5.1" + log4js "^6.5.2" + moleculer "^0.14.21" + moleculer-web "^0.10.4" + moment "^2.29.4" + mysql2 "^3.5.2" + nats "^1.4.12" + node-cron "^2.0.3" + prettyjson "^1.2.1" + require-all "^3.0.0" + signals "^1.0.0" + socket.io "^4.4.1" + socket.io-client "^4.0.1" + stack-trace "0.0.10" + +"lisk-service-framework@https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz": + version "1.6.1" + resolved "https://github.com/LiskHQ/lisk-service/raw/e72288dc2ee681198097c531aad9ec43edcfd86e/framework/dist/lisk-service-framework-1.6.1.tgz#730da995d0279f62f94e3285747424511537998d" dependencies: "@keyv/redis" "^2.1.2" "@log4js-node/gelf" "github:MichalTuleja/log4js-node-gelf#89d9933" diff --git a/tests/integration/api_v3/rpc/events.test.js b/tests/integration/api_v3/rpc/events.test.js index e6ab04eb1c..1ab6604afc 100644 --- a/tests/integration/api_v3/rpc/events.test.js +++ b/tests/integration/api_v3/rpc/events.test.js @@ -25,6 +25,7 @@ const { invalidParamsSchema, metaSchema, serverErrorSchema, + invalidRequestSchema, } = require('../../../schemas/rpcGenerics.schema'); const { @@ -148,10 +149,9 @@ describe('Method get.events', () => { expect(result.meta).toMap(metaSchema); }); - // TODO: Enable test after https://github.com/LiskHQ/lisk-service/issues/1873 - xit('should return server error for empty blockID', async () => { + it('should return invalid request for empty blockID', async () => { const response = await getEvents({ blockID: '' }); - expect(response).toMap(serverErrorSchema); + expect(response).toMap(invalidRequestSchema); }); it('should return invalid params for invalid block ID', async () => { @@ -530,8 +530,7 @@ describe('Method get.events', () => { expect(result.meta).toMap(metaSchema); }); - // TODO: Enable test after https://github.com/LiskHQ/lisk-service/issues/1873 - xit('should return invalid params for empty topic', async () => { + it('should return invalid params for empty topic', async () => { const response = await getEvents({ topic: '' }); expect(response).toMap(jsonRpcEnvelopeSchema); const { result } = response;