diff --git a/.github/workflows/.env b/.github/workflows/.env index 51bdbc2c2..26bf50172 100644 --- a/.github/workflows/.env +++ b/.github/workflows/.env @@ -1,4 +1,4 @@ -DAPI_BRANCH=v0.21-dev -DASHMATE_BRANCH=v0.21-dev +DAPI_BRANCH=error-codes +DASHMATE_BRANCH=error-codes #SDK_BRANCH= -TEST_SUITE_BRANCH=update-dpp +TEST_SUITE_BRANCH=error-codes diff --git a/lib/abci/errors/AbciError.js b/lib/abci/errors/AbciError.js deleted file mode 100644 index 021a5b0e4..000000000 --- a/lib/abci/errors/AbciError.js +++ /dev/null @@ -1,68 +0,0 @@ -class AbciError extends Error { - /** - * @param {number} code - * @param {string} message - * @param {Object=undefined} [data] - * @param {Object=} [tags] - */ - constructor(code, message, data = undefined, tags = {}) { - super(); - - this.name = this.constructor.name; - - this.code = code; - this.message = message; - this.data = data; - this.tags = tags; - - Error.captureStackTrace(this, this.constructor); - } - - /** - * Get message - * - * @return {string} - */ - getMessage() { - return this.message; - } - - /** - * Get error code - * - * @return {number} - */ - getCode() { - return this.code; - } - - /** - * Get data - * - * @return {Object} - */ - getData() { - return this.data; - } - - /** - * Get tags - * - * @return {Object} - */ - getTags() { - return this.tags; - } -} - -AbciError.CODES = { - INTERNAL: 1, - INVALID_ARGUMENT: 2, - NOT_FOUND: 3, - INSUFFICIENT_FUNDS: 4, - EXECUTION_TIMED_OUT: 5, - MEMORY_LIMIT_EXCEEDED: 6, - UNAVAILABLE: 7, -}; - -module.exports = AbciError; diff --git a/lib/abci/errors/InsufficientFundsError.js b/lib/abci/errors/InsufficientFundsError.js deleted file mode 100644 index c07448d2e..000000000 --- a/lib/abci/errors/InsufficientFundsError.js +++ /dev/null @@ -1,13 +0,0 @@ -const AbciError = require('./AbciError'); - -class InsufficientFundsError extends AbciError { - constructor(balance) { - super( - AbciError.CODES.INSUFFICIENT_FUNDS, - 'Not enough credits', - { balance }, - ); - } -} - -module.exports = InsufficientFundsError; diff --git a/lib/abci/errors/InternalAbciError.js b/lib/abci/errors/InternalAbciError.js deleted file mode 100644 index 737b404d6..000000000 --- a/lib/abci/errors/InternalAbciError.js +++ /dev/null @@ -1,29 +0,0 @@ -const AbciError = require('./AbciError'); - -class InternalAbciError extends AbciError { - /** - * - * @param {Error} error - * @param {Object=undefined} data - */ - constructor(error, data = undefined) { - super( - AbciError.CODES.INTERNAL, - 'Internal error', - data, - ); - - this.error = error; - } - - /** - * Get error - * - * @return {Error} - */ - getError() { - return this.error; - } -} - -module.exports = InternalAbciError; diff --git a/lib/abci/errors/InvalidArgumentAbciError.js b/lib/abci/errors/InvalidArgumentAbciError.js deleted file mode 100644 index ee3b0bfae..000000000 --- a/lib/abci/errors/InvalidArgumentAbciError.js +++ /dev/null @@ -1,18 +0,0 @@ -const AbciError = require('./AbciError'); - -class InvalidArgumentAbciError extends AbciError { - /** - * - * @param {string} message - * @param {*} data - */ - constructor(message, data = undefined) { - super( - AbciError.CODES.INVALID_ARGUMENT, - message, - data, - ); - } -} - -module.exports = InvalidArgumentAbciError; diff --git a/lib/abci/errors/NotFoundAbciError.js b/lib/abci/errors/NotFoundAbciError.js deleted file mode 100644 index 53e34cc63..000000000 --- a/lib/abci/errors/NotFoundAbciError.js +++ /dev/null @@ -1,18 +0,0 @@ -const AbciError = require('./AbciError'); - -class NotFoundAbciError extends AbciError { - /** - * - * @param {string} message - * @param {*} data - */ - constructor(message, data = undefined) { - super( - AbciError.CODES.NOT_FOUND, - message, - data, - ); - } -} - -module.exports = NotFoundAbciError; diff --git a/lib/abci/errors/UnavailableAbciError.js b/lib/abci/errors/UnavailableAbciError.js deleted file mode 100644 index cd2510f06..000000000 --- a/lib/abci/errors/UnavailableAbciError.js +++ /dev/null @@ -1,12 +0,0 @@ -const AbciError = require('./AbciError'); - -class UnavailableAbciError extends AbciError { - constructor() { - super( - AbciError.CODES.UNAVAILABLE, - 'The service is currently unavailable', - ); - } -} - -module.exports = UnavailableAbciError; diff --git a/lib/abci/errors/VerboseInternalAbciError.js b/lib/abci/errors/VerboseInternalAbciError.js deleted file mode 100644 index 6c239f844..000000000 --- a/lib/abci/errors/VerboseInternalAbciError.js +++ /dev/null @@ -1,30 +0,0 @@ -const AbciError = require('./AbciError'); - -class VerboseInternalAbciError extends AbciError { - /** - * - * @param {InternalAbciError} error - */ - constructor(error) { - const originalError = error.getError(); - - let { message } = originalError; - - if (originalError.stack) { - const [, errorPath] = originalError.stack.toString().split(/\r\n|\n/); - - message += ` ${errorPath.trim()}`; - } - - super( - error.getCode(), - message, - { - stack: originalError.stack, - data: error.getData(), - }, - ); - } -} - -module.exports = VerboseInternalAbciError; diff --git a/lib/abci/errors/wrapInErrorHandlerFactory.js b/lib/abci/errors/wrapInErrorHandlerFactory.js index e4652abe4..4a8b084d6 100644 --- a/lib/abci/errors/wrapInErrorHandlerFactory.js +++ b/lib/abci/errors/wrapInErrorHandlerFactory.js @@ -1,15 +1,8 @@ -const { - tendermint: { - abci: { - Event, - EventAttribute, - }, - }, -} = require('@dashevo/abci/types'); - -const AbciError = require('./AbciError'); -const InternalAbciError = require('./InternalAbciError'); -const VerboseInternalAbciError = require('./VerboseInternalAbciError'); +const cbor = require('cbor'); +const GrpcError = require('@dashevo/grpc-common/lib/server/error/GrpcError'); +const InternalGrpcError = require('@dashevo/grpc-common/lib/server/error/InternalGrpcError'); +const VerboseInternalGrpcError = require('@dashevo/grpc-common/lib/server/error/VerboseInternalGrpcError'); +const DPPValidationError = require('../handlers/errors/DPPValidationError'); /** * @param {BaseLogger} logger @@ -45,13 +38,20 @@ function wrapInErrorHandlerFactory(logger, isProductionEnvironment) { } catch (e) { let error = e; + if (e instanceof DPPValidationError) { + return { + code: error.getCode(), + info: cbor.encode(error.getInfo()).toString('base64'), + }; + } + // Wrap all non ABCI errors to an internal ABCI error - if (!(e instanceof AbciError)) { - error = new InternalAbciError(e); + if (!(e instanceof GrpcError)) { + error = new InternalGrpcError(e); } // Log only internal ABCI errors - if (error instanceof InternalAbciError) { + if (error instanceof InternalGrpcError) { // in consensus ABCI handlers (blockBegin, deliverTx, blockEnd, commit) // we should propagate the error upwards // to halt the Drive @@ -69,31 +69,18 @@ function wrapInErrorHandlerFactory(logger, isProductionEnvironment) { ); if (!isProductionEnvironment) { - error = new VerboseInternalAbciError(error); + error = new VerboseInternalGrpcError(error); } } - const events = []; - - const attributes = Object.entries(error.getTags()) - .map(([key, value]) => new EventAttribute({ key, value, index: true })); - - if (attributes.length > 0) { - events.push(new Event({ - type: 'error', - attributes, - })); - } + const serializedError = cbor.encode({ + message: error.getMessage(), + metadata: error.getRawMetadata(), + }); return { code: error.getCode(), - log: JSON.stringify({ - error: { - message: error.getMessage(), - data: error.getData(), - }, - }), - events, + info: serializedError.toString('base64'), }; } } diff --git a/lib/abci/handlers/deliverTxHandlerFactory.js b/lib/abci/handlers/deliverTxHandlerFactory.js index e296e8f84..fb16d23c2 100644 --- a/lib/abci/handlers/deliverTxHandlerFactory.js +++ b/lib/abci/handlers/deliverTxHandlerFactory.js @@ -13,7 +13,7 @@ const AbstractDocumentTransition = require( '@dashevo/dpp/lib/document/stateTransition/DocumentsBatchTransition/documentTransition/AbstractDocumentTransition', ); -const InvalidArgumentAbciError = require('../errors/InvalidArgumentAbciError'); +const DPPValidationError = require('./errors/DPPValidationError'); const DOCUMENT_ACTION_DESCRIPTONS = { [AbstractDocumentTransition.ACTIONS.CREATE]: 'created', @@ -80,14 +80,14 @@ function deliverTxHandlerFactory( const result = await transactionalDpp.stateTransition.validateState(stateTransition); if (!result.isValid()) { - consensusLogger.info('State transition data is invalid'); + consensusLogger.info('State transition is invalid against the state'); consensusLogger.debug({ consensusErrors: result.getErrors(), }); blockExecutionContext.incrementInvalidTxCount(); - throw new InvalidArgumentAbciError('Invalid state transition', { errors: result.getErrors() }); + throw new DPPValidationError('State transition is invalid against the state', result.getErrors()); } // Apply state transition to the state diff --git a/lib/abci/handlers/errors/DPPValidationError.js b/lib/abci/handlers/errors/DPPValidationError.js new file mode 100644 index 000000000..b5603ce56 --- /dev/null +++ b/lib/abci/handlers/errors/DPPValidationError.js @@ -0,0 +1,32 @@ +class DPPValidationError extends Error { + /** + * + * @param {string} message + * @param {AbstractConsenusError[]} errors + */ + constructor(message, errors) { + super(message); + + this.errors = errors; + } + + /** + * Get error code + * + * @returns {number} + */ + getCode() { + return this.errors[0].getCode(); + } + + /** + * Get error info + * + * @returns {Array} + */ + getInfo() { + return this.errors[0].getConstructorArguments(); + } +} + +module.exports = DPPValidationError; diff --git a/lib/abci/handlers/query/dataContractQueryHandlerFactory.js b/lib/abci/handlers/query/dataContractQueryHandlerFactory.js index 98562e803..8b84fa370 100644 --- a/lib/abci/handlers/query/dataContractQueryHandlerFactory.js +++ b/lib/abci/handlers/query/dataContractQueryHandlerFactory.js @@ -13,7 +13,7 @@ const { }, } = require('@dashevo/dapi-grpc'); -const NotFoundAbciError = require('../../errors/NotFoundAbciError'); +const NotFoundGrpcError = require('@dashevo/grpc-common/lib/server/error/NotFoundGrpcError'); /** * @@ -44,7 +44,7 @@ function dataContractQueryHandlerFactory( async function dataContractQueryHandler(params, { id }, request) { // There is no signed state (current committed block height less then 2) if (blockExecutionContext.isEmpty() || previousBlockExecutionContext.isEmpty()) { - throw new NotFoundAbciError('Data Contract not found'); + throw new NotFoundGrpcError('Data Contract not found'); } const response = createQueryResponse(GetDataContractResponse, request.prove); @@ -53,7 +53,7 @@ function dataContractQueryHandlerFactory( let dataContractBuffer; if (!dataContract && !request.prove) { - throw new NotFoundAbciError('Data Contract not found'); + throw new NotFoundGrpcError('Data Contract not found'); } else if (dataContract) { dataContractBuffer = dataContract.toBuffer(); } diff --git a/lib/abci/handlers/query/documentQueryHandlerFactory.js b/lib/abci/handlers/query/documentQueryHandlerFactory.js index d493b6191..20bb7e389 100644 --- a/lib/abci/handlers/query/documentQueryHandlerFactory.js +++ b/lib/abci/handlers/query/documentQueryHandlerFactory.js @@ -14,9 +14,9 @@ const { }, } = require('@dashevo/dapi-grpc'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const UnavailableGrpcError = require('@dashevo/grpc-common/lib/server/error/UnavailableGrpcError'); const InvalidQueryError = require('../../../document/errors/InvalidQueryError'); -const InvalidArgumentAbciError = require('../../errors/InvalidArgumentAbciError'); -const UnavailableAbciError = require('../../errors/UnavailableAbciError'); /** * @@ -77,13 +77,13 @@ function documentQueryHandlerFactory( } if (!container.has('previousBlockExecutionStoreTransactions')) { - throw new UnavailableAbciError(); + throw new UnavailableGrpcError(); } const previousBlockExecutionTransactions = container.resolve('previousBlockExecutionStoreTransactions'); const dataContractTransaction = previousBlockExecutionTransactions.getTransaction('dataContracts'); if (!dataContractTransaction.isStarted()) { - throw new UnavailableAbciError(); + throw new UnavailableGrpcError(); } const response = createQueryResponse(GetDocumentsResponse, request.prove); @@ -100,7 +100,7 @@ function documentQueryHandlerFactory( }); } catch (e) { if (e instanceof InvalidQueryError) { - throw new InvalidArgumentAbciError( + throw new InvalidArgumentGrpcError( `Invalid query: ${e.getErrors()[0].message}`, { errors: e.getErrors() }, ); diff --git a/lib/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.js b/lib/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.js index 86cda6767..18886af93 100644 --- a/lib/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.js +++ b/lib/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.js @@ -14,7 +14,7 @@ const { }, } = require('@dashevo/dapi-grpc'); -const InvalidArgumentAbciError = require('../../errors/InvalidArgumentAbciError'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); /** * @@ -50,7 +50,7 @@ function identitiesByPublicKeyHashesQueryHandlerFactory( */ async function identitiesByPublicKeyHashesQueryHandler(params, { publicKeyHashes }, request) { if (publicKeyHashes && publicKeyHashes.length > maxIdentitiesPerRequest) { - throw new InvalidArgumentAbciError( + throw new InvalidArgumentGrpcError( `Maximum number of ${maxIdentitiesPerRequest} requested items exceeded.`, { maxIdentitiesPerRequest, }, diff --git a/lib/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.js b/lib/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.js index 8cf134c08..570788706 100644 --- a/lib/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.js +++ b/lib/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.js @@ -14,7 +14,7 @@ const { }, } = require('@dashevo/dapi-grpc'); -const InvalidArgumentAbciError = require('../../errors/InvalidArgumentAbciError'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); /** * @@ -46,7 +46,7 @@ function identityIdsByPublicKeyHashesQueryHandlerFactory( */ async function identityIdsByPublicKeyHashesQueryHandler(params, { publicKeyHashes }, request) { if (publicKeyHashes && publicKeyHashes.length > maxIdentitiesPerRequest) { - throw new InvalidArgumentAbciError( + throw new InvalidArgumentGrpcError( `Maximum number of ${maxIdentitiesPerRequest} requested items exceeded.`, { maxIdentitiesPerRequest, }, diff --git a/lib/abci/handlers/query/identityQueryHandlerFactory.js b/lib/abci/handlers/query/identityQueryHandlerFactory.js index 71088bd86..001315c5d 100644 --- a/lib/abci/handlers/query/identityQueryHandlerFactory.js +++ b/lib/abci/handlers/query/identityQueryHandlerFactory.js @@ -13,7 +13,7 @@ const { }, } = require('@dashevo/dapi-grpc'); -const NotFoundAbciError = require('../../errors/NotFoundAbciError'); +const NotFoundGrpcError = require('@dashevo/grpc-common/lib/server/error/NotFoundGrpcError'); /** * @@ -44,7 +44,7 @@ function identityQueryHandlerFactory( async function identityQueryHandler(params, { id }, request) { // There is no signed state (current committed block height less then 2) if (blockExecutionContext.isEmpty() || previousBlockExecutionContext.isEmpty()) { - throw new NotFoundAbciError('Identity not found'); + throw new NotFoundGrpcError('Identity not found'); } const response = createQueryResponse(GetIdentityResponse, request.prove); @@ -53,7 +53,7 @@ function identityQueryHandlerFactory( let identityBuffer; if (!identity && !request.prove) { - throw new NotFoundAbciError('Identity not found'); + throw new NotFoundGrpcError('Identity not found'); } else if (identity) { identityBuffer = identity.toBuffer(); } diff --git a/lib/abci/handlers/query/verifyChainLockQueryHandlerFactory.js b/lib/abci/handlers/query/verifyChainLockQueryHandlerFactory.js index 199771daa..d5381472a 100644 --- a/lib/abci/handlers/query/verifyChainLockQueryHandlerFactory.js +++ b/lib/abci/handlers/query/verifyChainLockQueryHandlerFactory.js @@ -6,7 +6,7 @@ const { }, } = require('@dashevo/abci/types'); -const InvalidArgumentAbciError = require('../../errors/InvalidArgumentAbciError'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); /** * @@ -44,7 +44,7 @@ function verifyChainLockQueryHandlerFactory( 'Invalid chainLock format', ); - throw new InvalidArgumentAbciError( + throw new InvalidArgumentGrpcError( 'Invalid ChainLock format', { chainLock: data.toString('hex') }, ); } @@ -69,7 +69,7 @@ function verifyChainLockQueryHandlerFactory( if (!isVerified) { logger.debug(`Invalid chainLock for height ${chainLock.height}`); - throw new InvalidArgumentAbciError( + throw new InvalidArgumentGrpcError( 'ChainLock verification failed', chainLock.toJSON(), ); } diff --git a/lib/abci/handlers/queryHandlerFactory.js b/lib/abci/handlers/queryHandlerFactory.js index 77fd40543..e0fd07261 100644 --- a/lib/abci/handlers/queryHandlerFactory.js +++ b/lib/abci/handlers/queryHandlerFactory.js @@ -1,6 +1,6 @@ const cbor = require('cbor'); -const InvalidArgumentAbciError = require('../errors/InvalidArgumentAbciError'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); /** * @param {Object} queryHandlerRouter @@ -22,7 +22,7 @@ function queryHandlerFactory(queryHandlerRouter, sanitizeUrl) { const route = queryHandlerRouter.find('GET', sanitizeUrl(path)); if (!route) { - throw new InvalidArgumentAbciError('Invalid path', { path }); + throw new InvalidArgumentGrpcError('Invalid path', { path }); } const invalidDataMessage = 'Invalid data format: it should be cbor encoded object.'; @@ -35,11 +35,11 @@ function queryHandlerFactory(queryHandlerRouter, sanitizeUrl) { try { encodedData = decodeData ? Buffer.from(data) : cbor.decode(Buffer.from(data)); } catch (e) { - throw new InvalidArgumentAbciError(invalidDataMessage); + throw new InvalidArgumentGrpcError(invalidDataMessage); } if (encodedData === null || typeof encodedData !== 'object') { - throw new InvalidArgumentAbciError(invalidDataMessage); + throw new InvalidArgumentGrpcError(invalidDataMessage); } } diff --git a/lib/abci/handlers/stateTransition/unserializeStateTransitionFactory.js b/lib/abci/handlers/stateTransition/unserializeStateTransitionFactory.js index 79ffa4b41..853af11a1 100644 --- a/lib/abci/handlers/stateTransition/unserializeStateTransitionFactory.js +++ b/lib/abci/handlers/stateTransition/unserializeStateTransitionFactory.js @@ -1,8 +1,7 @@ const InvalidStateTransitionError = require('@dashevo/dpp/lib/stateTransition/errors/InvalidStateTransitionError'); -const BalanceIsNotEnoughError = require('@dashevo/dpp/lib/errors/BalanceIsNotEnoughError'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); -const InvalidArgumentAbciError = require('../../errors/InvalidArgumentAbciError'); -const InsufficientFundsError = require('../../errors/InsufficientFundsError'); +const DPPValidationError = require('../errors/DPPValidationError'); /** * @param {DashPlatformProtocol} dpp @@ -22,11 +21,9 @@ function unserializeStateTransitionFactory(dpp, noopLogger) { const logger = (options.logger || noopLogger); if (!stateTransitionByteArray) { - const error = new InvalidArgumentAbciError('State Transition is not specified'); - logger.info('State transition is not specified'); - throw error; + throw new InvalidArgumentGrpcError('State Transition is not specified'); } const stateTransitionSerialized = Buffer.from(stateTransitionByteArray); @@ -38,14 +35,12 @@ function unserializeStateTransitionFactory(dpp, noopLogger) { .createFromBuffer(stateTransitionSerialized); } catch (e) { if (e instanceof InvalidStateTransitionError) { - const error = new InvalidArgumentAbciError('State Transition is invalid', { errors: e.getErrors() }); - - logger.info('State transition structure is invalid'); + logger.info('Invalid state transition'); logger.debug({ consensusErrors: e.getErrors(), }); - throw error; + throw new DPPValidationError('Invalid state transition', e.getErrors()); } throw e; @@ -56,15 +51,13 @@ function unserializeStateTransitionFactory(dpp, noopLogger) { if (!result.isValid()) { const consensusErrors = result.getErrors(); - const error = new InvalidArgumentAbciError('State Transition is invalid', { errors: consensusErrors }); - - logger.info('State transition signature is invalid'); + logger.info('Invalid state transition signature'); logger.debug({ consensusErrors, }); - throw error; + throw new DPPValidationError('Invalid state transition signature', consensusErrors); } result = await dpp.stateTransition.validateFee(stateTransition); @@ -72,23 +65,13 @@ function unserializeStateTransitionFactory(dpp, noopLogger) { if (!result.isValid()) { const consensusErrors = result.getErrors(); - let error; - - if (consensusErrors.length === 1 && consensusErrors[0] instanceof BalanceIsNotEnoughError) { - error = new InsufficientFundsError(consensusErrors[0].getBalance()); - - logger.info('Insufficient funds to process state transition'); - } else { - error = new InvalidArgumentAbciError('State Transition is invalid', { errors: consensusErrors }); - - logger.info('State transition structure is invalid'); - } + logger.info('Insufficient funds to process state transition'); logger.debug({ consensusErrors, }); - throw error; + throw new DPPValidationError('Insufficient funds to process state transition', consensusErrors); } return stateTransition; diff --git a/package-lock.json b/package-lock.json index d0b68b5aa..2fae68f9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,20 +30,20 @@ "dev": true }, "@babel/core": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.0.tgz", - "integrity": "sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.4.tgz", + "integrity": "sha512-Lkcv9I4a8bgUI8LJOLM6IKv6hnz1KOju6KM1lceqVMKlKKqNRopYd2Pc9MgIurqvMJ6BooemrnJz8jlIiQIpsA==", "dev": true, "requires": { "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.0", - "@babel/helper-compilation-targets": "^7.15.0", - "@babel/helper-module-transforms": "^7.15.0", - "@babel/helpers": "^7.14.8", - "@babel/parser": "^7.15.0", - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0", + "@babel/generator": "^7.15.4", + "@babel/helper-compilation-targets": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.4", + "@babel/helpers": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -61,6 +61,15 @@ "safe-buffer": "~5.1.1" } }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -76,20 +85,20 @@ } }, "@babel/generator": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.0.tgz", - "integrity": "sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", + "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", "dev": true, "requires": { - "@babel/types": "^7.15.0", + "@babel/types": "^7.15.4", "jsesc": "^2.5.1", "source-map": "^0.5.0" } }, "@babel/helper-compilation-targets": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz", - "integrity": "sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", + "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", "dev": true, "requires": { "@babel/compat-data": "^7.15.0", @@ -107,105 +116,105 @@ } }, "@babel/helper-function-name": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz", - "integrity": "sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", + "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.14.5", - "@babel/template": "^7.14.5", - "@babel/types": "^7.14.5" + "@babel/helper-get-function-arity": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/helper-get-function-arity": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz", - "integrity": "sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", + "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-hoist-variables": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz", - "integrity": "sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", + "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-member-expression-to-functions": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.0.tgz", - "integrity": "sha512-Jq8H8U2kYiafuj2xMTPQwkTBnEEdGKpT35lJEQsRRjnG0LW3neucsaMWLgKcwu3OHKNeYugfw+Z20BXBSEs2Lg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", + "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", "dev": true, "requires": { - "@babel/types": "^7.15.0" + "@babel/types": "^7.15.4" } }, "@babel/helper-module-imports": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", - "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", + "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-module-transforms": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz", - "integrity": "sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.4.tgz", + "integrity": "sha512-9fHHSGE9zTC++KuXLZcB5FKgvlV83Ox+NLUmQTawovwlJ85+QMhk1CnVk406CQVj97LaWod6KVjl2Sfgw9Aktw==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.14.5", - "@babel/helper-replace-supers": "^7.15.0", - "@babel/helper-simple-access": "^7.14.8", - "@babel/helper-split-export-declaration": "^7.14.5", + "@babel/helper-module-imports": "^7.15.4", + "@babel/helper-replace-supers": "^7.15.4", + "@babel/helper-simple-access": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", "@babel/helper-validator-identifier": "^7.14.9", - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/helper-optimise-call-expression": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.14.5.tgz", - "integrity": "sha512-IqiLIrODUOdnPU9/F8ib1Fx2ohlgDhxnIDU7OEVi+kAbEZcyiF7BLU8W6PfvPi9LzztjS7kcbzbmL7oG8kD6VA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", + "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-replace-supers": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.0.tgz", - "integrity": "sha512-6O+eWrhx+HEra/uJnifCwhwMd6Bp5+ZfZeJwbqUTuqkhIT6YcRhiZCOOFChRypOIe0cV46kFrRBlm+t5vHCEaA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", + "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.15.0", - "@babel/helper-optimise-call-expression": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/helper-member-expression-to-functions": "^7.15.4", + "@babel/helper-optimise-call-expression": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/helper-simple-access": { - "version": "7.14.8", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz", - "integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", + "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", "dev": true, "requires": { - "@babel/types": "^7.14.8" + "@babel/types": "^7.15.4" } }, "@babel/helper-split-export-declaration": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz", - "integrity": "sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", + "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-validator-identifier": { @@ -221,14 +230,14 @@ "dev": true }, "@babel/helpers": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.3.tgz", - "integrity": "sha512-HwJiz52XaS96lX+28Tnbu31VeFSQJGOeKHJeaEPQlTl7PnlhFElWPj8tUXtqFIzeN86XxXoBr+WFAyK2PPVz6g==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", + "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", "dev": true, "requires": { - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/highlight": { @@ -295,35 +304,35 @@ } }, "@babel/parser": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.3.tgz", - "integrity": "sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.4.tgz", + "integrity": "sha512-xmzz+7fRpjrvDUj+GV7zfz/R3gSK2cOxGlazaXooxspCr539cbTXJKvBJzSVI2pPhcRGquoOtaIkKCsHQUiO3w==", "dev": true }, "@babel/template": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.14.5.tgz", - "integrity": "sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", + "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", "dev": true, "requires": { "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.14.5", - "@babel/types": "^7.14.5" + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/traverse": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.0.tgz", - "integrity": "sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", + "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", "dev": true, "requires": { "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.0", - "@babel/helper-function-name": "^7.14.5", - "@babel/helper-hoist-variables": "^7.14.5", - "@babel/helper-split-export-declaration": "^7.14.5", - "@babel/parser": "^7.15.0", - "@babel/types": "^7.15.0", + "@babel/generator": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -337,27 +346,22 @@ } }, "@babel/types": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", - "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.4.tgz", + "integrity": "sha512-0f1HJFuGmmbrKTCZtbm3cU+b/AqdEYk5toj5iQur58xkVMlS0JWaKxTBSmCXd47uiN7vbcozAupm6Mvs80GNhw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.14.9", "to-fast-properties": "^2.0.0" } }, - "@cto.af/textdecoder": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/@cto.af/textdecoder/-/textdecoder-0.0.0.tgz", - "integrity": "sha512-sJpx3F5xcVV/9jNYJQtvimo4Vfld/nD3ph+ZWtQzZ03Zo8rJC7QKQTRcIGS13Rcz80DwFNthCWMrd58vpY4ZAQ==" - }, "@dashevo/abci": { "version": "0.20.0", "resolved": "https://registry.npmjs.org/@dashevo/abci/-/abci-0.20.0.tgz", "integrity": "sha512-AfPA8ygRFnIhyK4i3VfV6T5wxFiYtYmcxdIDib+P5Qty5Nnjy0fOO8toQyFjN8JkZuOZOt3MWpr1lE9ZjAH4DQ==", "requires": { "bl": "^1.2.3", - "protobufjs": "protobufjs@github:jawid-h/protobuf.js#fix/buffer-conversion", + "protobufjs": "github:jawid-h/protobuf.js#fix/buffer-conversion", "protocol-buffers-encodings": "^1.1.0" } }, @@ -370,7 +374,7 @@ "@grpc/grpc-js": "^1.3.6", "google-protobuf": "^3.12.2", "grpc-web": "^1.2.0", - "protobufjs": "protobufjs@github:jawid-h/protobuf.js#fix/buffer-conversion" + "protobufjs": "github:jawid-h/protobuf.js#fix/buffer-conversion" } }, "@dashevo/dashcore-lib": { @@ -392,9 +396,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.19.tgz", - "integrity": "sha512-niAuZrwrjKck4+XhoCw6AAVQBENHftpXw9F4ryk66fTgYaKQ53R4FI7c9vUGGw5vQis1HKBHDR1gcYI/Bq1xvw==" + "version": "12.20.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.23.tgz", + "integrity": "sha512-FW0q7NI8UnjbKrJK8NGr6QXY69ATw9IFe6ItIo5yozPwA9DU/xkhiPddctUVyrmFXvyFYerYgQak/qu200UBDw==" }, "inherits": { "version": "2.0.1", @@ -422,9 +426,9 @@ }, "dependencies": { "@types/node": { - "version": "14.17.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.9.tgz", - "integrity": "sha512-CMjgRNsks27IDwI785YMY0KLt3co/c0cQ5foxHYv/shC2w8oOnVwz5Ubq1QG5KzrcW+AXk6gzdnxIkDnTvzu3g==" + "version": "14.17.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.14.tgz", + "integrity": "sha512-rsAj2u8Xkqfc332iXV12SqIsjVi07H479bOP4q94NAcjzmAvapumEhuVIt53koEf7JFrpjgNKjBga5Pnn/GL8A==" }, "zeromq": { "version": "6.0.0-beta.6", @@ -437,8 +441,8 @@ } }, "@dashevo/dp-services-ctl": { - "version": "github:dashevo/js-dp-services-ctl#v0.19-dev", - "from": "@dashevo/dp-services-ctl@github:dashevo/js-dp-services-ctl#v0.19-dev", + "version": "github:dashevo/js-dp-services-ctl#3976076b0018c5b4632ceda4c752fc597f27a640", + "from": "github:dashevo/js-dp-services-ctl#v0.19-dev", "dev": true, "requires": { "@dashevo/dashd-rpc": "^2.3.0", @@ -449,19 +453,19 @@ } }, "@dashevo/dpp": { - "version": "0.21.0-dev.3", - "resolved": "https://registry.npmjs.org/@dashevo/dpp/-/dpp-0.21.0-dev.3.tgz", - "integrity": "sha512-LhtwemScbTU6mwJKsVpYSZkXbGXJ73H2Zyo5bxfGnVNI1p4HAbTaMSiheG3g6OU+RV28fadq9plUPnM+lE10Ug==", + "version": "0.21.0-dev.4", + "resolved": "https://registry.npmjs.org/@dashevo/dpp/-/dpp-0.21.0-dev.4.tgz", + "integrity": "sha512-H1QP1ZdZnptYe4rztIdkohts8Y11J2izt6LDkquZR9+kfrpv4gCiWqs+UeslCY06HiaeXVjLUHwk+x7JZOvVNQ==", "requires": { "@apidevtools/json-schema-ref-parser": "^8.0.0", "@dashevo/dashcore-lib": "~0.19.25", "@dashevo/feature-flags-contract": "0.1.0", "@dashevo/re2-wasm": "~1.0.4", "ajv": "^8.6.0", - "ajv-formats": "^2.1.0", + "ajv-formats": "^2.1.1", "bignumber.js": "^9.0.1", "bs58": "^4.0.1", - "cbor": "^7.0.5", + "cbor": "^8.0.0", "json-schema-traverse": "^1.0.0", "lodash.clonedeep": "^4.5.0", "lodash.clonedeepwith": "^4.5.0", @@ -476,12 +480,11 @@ "integrity": "sha512-OnKpFX498ZcJVAEv1MRF/bNpDY0DUHSd+5MjGtSBkZ9plv+E2p6UWHK77479l59ZJWun+Ix2BsYPY7PSd+11yA==" }, "cbor": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cbor/-/cbor-7.0.6.tgz", - "integrity": "sha512-rgt2RFogHGDLFU5r0kSfyeBc+de55DwYHP73KxKsQxsR5b0CYuQPH6AnJaXByiohpLdjQqj/K0SFcOV+dXdhSA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.0.0.tgz", + "integrity": "sha512-nMmaLWbj7+bC6MsApKRIig8h+yjgNLhPLXaCelq5+C7mpWsHgIcseZSdvgexSY5uE1Q3m2uPvIDZwSdxdo7qig==", "requires": { - "@cto.af/textdecoder": "^0.0.0", - "nofilter": "^2.0.3" + "nofilter": "^3.0.2" } } } @@ -492,9 +495,9 @@ "integrity": "sha512-iCvHN3xV0tJvI7wq13bVvSiMxoh3W/VUBM7Pj0JIKdulSilVBLGyRtbVgO6Auh80Uc3AH/PqkT2iB3YiaJmVxQ==" }, "@dashevo/grpc-common": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@dashevo/grpc-common/-/grpc-common-0.4.0.tgz", - "integrity": "sha512-w1u7fQOJIEzM0XZf2UdmBaFFrjQRCUOjfZHnasJzENND1uJEOEl5kZIzTwt1ZAxf+Z+Ynif4b8Il8jWnAD6maA==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@dashevo/grpc-common/-/grpc-common-0.4.1.tgz", + "integrity": "sha512-9UQSHbNLeIPIeUnn7XBc8gMaKZiXW/jUUictsVJrECUPlS5W/hwW6gz5vNayjg59QYPQXSKy98NhVkEXh2FbbA==", "requires": { "@grpc/grpc-js": "^1.3.6", "@grpc/proto-loader": "^0.5.2", @@ -525,8 +528,8 @@ } }, "@dashevo/merk": { - "version": "git+https://github.com/dashevo/node-merk.git", - "from": "@dashevo/merk@git+https://github.com/dashevo/node-merk.git", + "version": "git+https://github.com/dashevo/node-merk.git#db502681c0711fb3c2ad8ca8512e9c8f444a21e2", + "from": "git+https://github.com/dashevo/node-merk.git", "requires": { "neon-load-or-build": "^2.2.2" } @@ -556,28 +559,6 @@ "requires": { "lodash.camelcase": "^4.3.0", "protobufjs": "^6.8.6" - }, - "dependencies": { - "protobufjs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz", - "integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": ">=13.7.0", - "long": "^4.0.0" - } - } } }, "@hapi/bourne": { @@ -761,6 +742,12 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "@types/long": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", @@ -784,9 +771,9 @@ }, "dependencies": { "sonic-boom": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.1.0.tgz", - "integrity": "sha512-x2j9LXx27EDlyZEC32gBM+scNVMdPutU7FIKV2BOTKCnPrp7bY5BsplCMQ4shYYR3IhDSIrEXoqb6GlS+z7KyQ==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.2.2.tgz", + "integrity": "sha512-tSkj2MFPpOt7VZ2IDmjcUrDlbyxUKqOQUvZBy98EdzGqaKptT3lFXWeQ1RYYGPjz597A8iG54lrGLTg4kEiAaA==", "dev": true, "requires": { "atomic-sleep": "^1.0.0" @@ -974,9 +961,9 @@ "dev": true }, "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -1447,16 +1434,16 @@ } }, "browserslist": { - "version": "4.16.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", - "integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", + "version": "4.16.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", + "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001248", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.793", + "caniuse-lite": "^1.0.30001251", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.811", "escalade": "^3.1.1", - "node-releases": "^1.1.73" + "node-releases": "^1.1.75" } }, "bs58": { @@ -1549,9 +1536,9 @@ "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==" }, "caniuse-lite": { - "version": "1.0.30001251", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz", - "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==", + "version": "1.0.30001252", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001252.tgz", + "integrity": "sha512-I56jhWDGMtdILQORdusxBOH+Nl/KgQSdDmpJezYddnAkVOmnoU8zwjTV9xAjMIYxr0iPreEAVylCGcmHCjfaOw==", "dev": true }, "cbor": { @@ -1812,9 +1799,9 @@ "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=" }, "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "create-ecdh": { "version": "4.0.4", @@ -2011,9 +1998,9 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, "denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz", + "integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==" }, "deps-sort": { "version": "2.0.1", @@ -2173,9 +2160,9 @@ } }, "electron-to-chromium": { - "version": "1.3.803", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.803.tgz", - "integrity": "sha512-tmRK9qB8Zs8eLMtTBp+w2zVS9MUe62gQQQHjYdAc5Zljam3ZIokNb+vZLPRz9RCREp6EFRwyhOFwbt1fEriQ2Q==", + "version": "1.3.829", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.829.tgz", + "integrity": "sha512-5EXDbvsaLRxS1UOfRr8Hymp3dR42bvBNPgzVuPwUFj3v66bpvDUcNwwUywQUQYn/scz26/3Sgd3fNVGQOlVwvQ==", "dev": true }, "elliptic": { @@ -2455,9 +2442,9 @@ "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==" }, "eslint-import-resolver-node": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.5.tgz", - "integrity": "sha512-XMoPKjSpXbkeJ7ZZ9icLnJMTY5Mc1kZbCakHquaFsXPpyWOwK0TK6CODO+0ca54UoM9LKOxyUNnoVZRl8TeaAg==", + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", "dev": true, "requires": { "debug": "^3.2.7", @@ -2497,26 +2484,26 @@ } }, "eslint-plugin-import": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.24.0.tgz", - "integrity": "sha512-Kc6xqT9hiYi2cgybOc0I2vC9OgAYga5o/rAFinam/yF/t5uBqxQbauNPMC6fgb640T/89P0gFoO27FOilJ/Cqg==", + "version": "2.24.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.24.2.tgz", + "integrity": "sha512-hNVtyhiEtZmpsabL4neEj+6M5DCLgpYyG9nzJY8lZQeQXEn5UPW1DpUdsMHMXsq98dbNm7nt1w9ZMSVpfJdi8Q==", "dev": true, "requires": { "array-includes": "^3.1.3", "array.prototype.flat": "^1.2.4", "debug": "^2.6.9", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.5", + "eslint-import-resolver-node": "^0.3.6", "eslint-module-utils": "^2.6.2", "find-up": "^2.0.0", "has": "^1.0.3", - "is-core-module": "^2.4.0", + "is-core-module": "^2.6.0", "minimatch": "^3.0.4", - "object.values": "^1.1.3", + "object.values": "^1.1.4", "pkg-up": "^2.0.0", "read-pkg-up": "^3.0.0", "resolve": "^1.20.0", - "tsconfig-paths": "^3.9.0" + "tsconfig-paths": "^3.11.0" }, "dependencies": { "debug": { @@ -2691,15 +2678,20 @@ "dev": true }, "fast-redact": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.0.1.tgz", - "integrity": "sha512-kYpn4Y/valC9MdrISg47tZOpYBNoTXKgT9GYXFpHN/jYFs+lFkPoisY+LcBODdKVMY96ATzvzsWv+ES/4Kmufw==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.0.2.tgz", + "integrity": "sha512-YN+CYfCVRVMUZOUPeinHNKgytM1wPI/C/UCLEi56EsY2dwwvI00kIJHJoI7pMVqGoMew8SMZ2SSfHKHULHXDsg==" }, "fast-safe-stringify": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.8.tgz", "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, + "fastify-warning": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", + "integrity": "sha512-s1EQguBw/9qtc1p/WTY4eq9WMRIACkj+HTcOIK1in4MV5aFaQC9ZCIt0dJ7pr5bIf4lPpHvAtP2ywpTNgs7hqw==" + }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -2728,9 +2720,9 @@ } }, "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", "dev": true, "requires": { "commondir": "^1.0.1", @@ -3398,9 +3390,9 @@ "dev": true }, "is-core-module": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", - "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", + "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", "requires": { "has": "^1.0.3" } @@ -3740,12 +3732,12 @@ "dev": true }, "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "dev": true, "requires": { - "minimist": "^1.2.5" + "minimist": "^1.2.0" } }, "jsonify": { @@ -4467,9 +4459,9 @@ } }, "mongodb": { - "version": "3.6.11", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.11.tgz", - "integrity": "sha512-4Y4lTFHDHZZdgMaHmojtNAlqkvddX2QQBEN0K//GzxhGwlI9tZ9R0vhbjr1Decw+TF7qK0ZLjQT292XgHRRQgw==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.7.0.tgz", + "integrity": "sha512-JOAYjT9WYeRFkIP6XtDidAr3qvpfLRJhT2iokRWWH0tgqCQr9kmSfOJBZ3Ry0E5A3EqKxVPVhN3MV8Gn03o7pA==", "requires": { "bl": "^2.2.1", "bson": "^1.1.4", @@ -4562,9 +4554,9 @@ } }, "node-abi": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.30.0.tgz", - "integrity": "sha512-g6bZh3YCKQRdwuO/tSZZYJAw622SjsRfJ2X0Iy4sSOHZ34/sPPdVBn8fev2tj7njzLwuqPw9uMtGsGkO5kIQvg==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.30.1.tgz", + "integrity": "sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w==", "requires": { "semver": "^5.4.1" }, @@ -4595,9 +4587,9 @@ } }, "node-graceful": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/node-graceful/-/node-graceful-3.0.1.tgz", - "integrity": "sha512-V1jabqH6+P+XD/b5DKSMB4f/xWQpxgpSL+d850yQ09DIAWlo59Io5MNsJQD6TKjq3Gj6hC3uJ2GomDdmsL49xw==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/node-graceful/-/node-graceful-3.1.0.tgz", + "integrity": "sha512-fGH0ijsO5ZDDY405mP6bE0eNrHQhpjDrihhaviqprP1+aJEWy7bZtzXESp3ZAo6hBTtxOFe7RfSkcqFX001gJQ==" }, "node-gyp-build": { "version": "4.2.3", @@ -4614,18 +4606,15 @@ } }, "node-releases": { - "version": "1.1.74", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", - "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==", + "version": "1.1.75", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", + "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", "dev": true }, "nofilter": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-2.0.3.tgz", - "integrity": "sha512-FbuXC+lK+GU2+63D1kC1ETiZo+Z7SIi7B+mxKTCH1byrh6WFvfBCN/wpherFz0a0bjGd7EKTst/cz0yLeNngug==", - "requires": { - "@cto.af/textdecoder": "^0.0.0" - } + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.0.3.tgz", + "integrity": "sha512-TN/MCrQmXQk5DyUJ8TGUq1Il8rv4fTsjddLmMopV006QP8DMkglmGgYfQKD5620vXLRXfr8iGI6ZZ4/ZWld2cQ==" }, "noop-logger": { "version": "0.1.1", @@ -4944,9 +4933,9 @@ } }, "optional-require": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.1.6.tgz", - "integrity": "sha512-ZO2GGh1A84LV90OAIsMDmIJ5k/f7crSjP4aJSuLudp7C7wfVOAoyWWHV8Jf3ZMHyNHwpLD/DGhzaxbbN/duF+g==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.1.7.tgz", + "integrity": "sha512-cIeRZocXsZnZYn+SevbtSqNlLbeoS4mLzuNn4fvXRMDRNhTGg0sxuKXl0FnZCtnew85LorNxIbZp5OeliILhMw==", "requires": { "require-at": "^1.0.6" } @@ -5163,12 +5152,13 @@ "dev": true }, "pino": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/pino/-/pino-6.13.0.tgz", - "integrity": "sha512-mRXSTfa34tbfrWqCIp1sUpZLqBhcoaGapoyxfEwaWwJGMpLijlRdDKIQUyvq4M3DUfFH5vEglwSw8POZYwbThA==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/pino/-/pino-6.13.1.tgz", + "integrity": "sha512-QQf67BU+cANnc/2U+wzUV20UjO5oBryWpnNyKshdLfT9BdeiXlh9wxLGmOjAuBWMYITdMs+BtJSQQNlGRNbWpA==", "requires": { "fast-redact": "^3.0.0", "fast-safe-stringify": "^2.0.8", + "fastify-warning": "^0.2.0", "flatstr": "^1.0.12", "pino-std-serializers": "^3.1.0", "quick-format-unescaped": "^4.0.3", @@ -5291,8 +5281,8 @@ "dev": true }, "protobufjs": { - "version": "github:jawid-h/protobuf.js#fix/buffer-conversion", - "from": "protobufjs@github:jawid-h/protobuf.js#fix/buffer-conversion", + "version": "github:jawid-h/protobuf.js#8b91c72dca68fd6c418078fd2358c4969425dcdc", + "from": "github:jawid-h/protobuf.js#fix/buffer-conversion", "requires": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -6290,12 +6280,13 @@ } }, "tsconfig-paths": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.10.1.tgz", - "integrity": "sha512-rETidPDgCpltxF7MjBZlAFPUHv5aHH2MymyPvh+vEyWAED4Eb/WeMbsnD/JDr4OKPOA1TssDHgIcpTN5Kh0p6Q==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.11.0.tgz", + "integrity": "sha512-7ecdYDnIdmv639mmDwslG6KQg1Z9STTz1j7Gcz0xa+nshh/gKDAHcPxRbWOsA3SPp0tXP2leTcY9Kw+NAkfZzA==", "dev": true, "requires": { - "json5": "^2.2.0", + "@types/json5": "^0.0.29", + "json5": "^1.0.1", "minimist": "^1.2.0", "strip-bom": "^3.0.0" } diff --git a/package.json b/package.json index 7f5a63cbd..1335611be 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,9 @@ "@dashevo/dashcore-lib": "~0.19.25", "@dashevo/dashd-rpc": "^2.3.0", "@dashevo/dashd-zmq": "^1.2.0", - "@dashevo/dpp": "~0.21.0-dev.3", + "@dashevo/dpp": "~0.21.0-dev.4", "@dashevo/feature-flags-contract": "~0.2.0", + "@dashevo/grpc-common": "~0.4.1", "@dashevo/merk": "git+https://github.com/dashevo/node-merk.git", "ajv": "^8.6.0", "ajv-keywords": "^5.0.0", diff --git a/test/integration/abci/handlers/queryHandlerFactory.spec.js b/test/integration/abci/handlers/queryHandlerFactory.spec.js index e95dcc86d..49718ee6d 100644 --- a/test/integration/abci/handlers/queryHandlerFactory.spec.js +++ b/test/integration/abci/handlers/queryHandlerFactory.spec.js @@ -10,11 +10,10 @@ const getDataContractFixture = require('@dashevo/dpp/lib/test/fixtures/getDataCo const getDocumentsFixture = require('@dashevo/dpp/lib/test/fixtures/getDocumentsFixture'); const getIdentityFixture = require('@dashevo/dpp/lib/test/fixtures/getIdentityFixture'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); const createTestDIContainer = require('../../../../lib/test/createTestDIContainer'); const { init: initializeHashFunction } = require('../../../../lib/rootTree/hashFunction'); -const InvalidArgumentAbciError = require('../../../../lib/abci/errors/InvalidArgumentAbciError'); - describe('queryHandlerFactory', function main() { this.timeout(90000); @@ -39,7 +38,7 @@ describe('queryHandlerFactory', function main() { }); beforeEach(async function beforeEach() { - proof = Buffer.from('843176bc004504d6baf735cf0215e9d9a3fecf1d', 'hex'); + proof = Buffer.from('GbYYWuLCU6u7nb4pdnMM1uzAeURhE7ZPxGqAbUARBsb3', 'hex'); container = await createTestDIContainer(mongoDB); @@ -156,7 +155,7 @@ describe('queryHandlerFactory', function main() { data: Buffer.alloc(0), }); } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentAbciError); + expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); expect(e.getMessage()).to.equal('Invalid path'); } }); diff --git a/test/unit/abci/errors/wrapInErrorHandlerFactory.spec.js b/test/unit/abci/errors/wrapInErrorHandlerFactory.spec.js index 9775b1bc7..c4c59580b 100644 --- a/test/unit/abci/errors/wrapInErrorHandlerFactory.spec.js +++ b/test/unit/abci/errors/wrapInErrorHandlerFactory.spec.js @@ -1,8 +1,11 @@ +const cbor = require('cbor'); +const InternalGrpcError = require('@dashevo/grpc-common/lib/server/error/InternalGrpcError'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); +const SomeConsensusError = require('@dashevo/dpp/lib/test/mocks/SomeConsensusError'); const wrapInErrorHandlerFactory = require('../../../../lib/abci/errors/wrapInErrorHandlerFactory'); - -const InternalAbciError = require('../../../../lib/abci/errors/InternalAbciError'); -const InvalidArgumentAbciError = require('../../../../lib/abci/errors/InvalidArgumentAbciError'); const LoggerMock = require('../../../../lib/test/mock/LoggerMock'); +const DPPValidationError = require('../../../../lib/abci/handlers/errors/DPPValidationError'); describe('wrapInErrorHandlerFactory', () => { let loggerMock; @@ -42,8 +45,8 @@ describe('wrapInErrorHandlerFactory', () => { it('should throw en internal error if an InternalAbciError is thrown in handler', async () => { const originError = new Error(); - const data = { sample: 'data' }; - const error = new InternalAbciError(originError, data); + const metadata = { sample: 'data' }; + const error = new InternalGrpcError(originError, metadata); methodMock.throws(error); @@ -68,13 +71,11 @@ describe('wrapInErrorHandlerFactory', () => { const response = await handler(request); expect(response).to.deep.equal({ - code: 1, - log: JSON.stringify({ - error: { - message: 'Internal error', - }, - }), - events: [], + code: GrpcErrorCodes.INTERNAL, + info: cbor.encode({ + message: 'Internal error', + metadata: undefined, + }).toString('base64'), }); }); @@ -84,7 +85,7 @@ describe('wrapInErrorHandlerFactory', () => { ); const data = { sample: 'data' }; - const error = new InternalAbciError(new Error(), data); + const error = new InternalGrpcError(new Error(), data); methodMock.throws(error); @@ -92,19 +93,16 @@ describe('wrapInErrorHandlerFactory', () => { expect(response).to.deep.equal({ code: error.getCode(), - log: JSON.stringify({ - error: { - message: error.getMessage(), - data: error.getData(), - }, - }), - events: [], + info: cbor.encode({ + message: error.getMessage(), + metadata: error.getRawMetadata(), + }).toString('base64'), }); }); it('should respond with invalid argument error if it is thrown in handler', async () => { const data = { sample: 'data' }; - const error = new InvalidArgumentAbciError('test', data); + const error = new InvalidArgumentGrpcError('test', data); methodMock.throws(error); @@ -112,13 +110,10 @@ describe('wrapInErrorHandlerFactory', () => { expect(response).to.deep.equal({ code: error.getCode(), - log: JSON.stringify({ - error: { - message: error.getMessage(), - data: error.getData(), - }, - }), - events: [], + info: cbor.encode({ + message: error.getMessage(), + metadata: error.getRawMetadata(), + }).toString('base64'), }); }); @@ -150,24 +145,35 @@ describe('wrapInErrorHandlerFactory', () => { methodMock, { respondWithInternalError: true }, ); - methodMock.throws(error); - const response = await handler(request); const [, errorPath] = error.stack.toString().split(/\r\n|\n/); expect(response).to.deep.equal({ - code: 1, - log: JSON.stringify({ - error: { - message: `${error.message} ${errorPath.trim()}`, - data: { - stack: error.stack, - data: undefined, - }, + code: GrpcErrorCodes.INTERNAL, + info: cbor.encode({ + message: `${error.message} ${errorPath.trim()}`, + metadata: { + stack: error.stack, }, - }), - events: [], + }).toString('base64'), + }); + }); + + it('should respond with error if method throws DPPValidationError', async () => { + const dppValidationError = new DPPValidationError('Some error', [new SomeConsensusError('Consensus error')]); + + methodMock.throws(dppValidationError); + + handler = wrapInErrorHandler( + methodMock, { respondWithInternalError: true }, + ); + + const response = await handler(request); + + expect(response).to.deep.equal({ + code: dppValidationError.getCode(), + info: cbor.encode(dppValidationError.getInfo()).toString('base64'), }); }); }); diff --git a/test/unit/abci/handlers/deliverTxHandlerFactory.spec.js b/test/unit/abci/handlers/deliverTxHandlerFactory.spec.js index a282bf59b..83f9dc3ff 100644 --- a/test/unit/abci/handlers/deliverTxHandlerFactory.spec.js +++ b/test/unit/abci/handlers/deliverTxHandlerFactory.spec.js @@ -14,15 +14,16 @@ const createDPPMock = require('@dashevo/dpp/lib/test/mocks/createDPPMock'); const createStateRepositoryMock = require('@dashevo/dpp/lib/test/mocks/createStateRepositoryMock'); const getDataContractFixture = require('@dashevo/dpp/lib/test/fixtures/getDataContractFixture'); const getDocumentFixture = require('@dashevo/dpp/lib/test/fixtures/getDocumentsFixture'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); +const SomeConsensusError = require('@dashevo/dpp/lib/test/mocks/SomeConsensusError'); const BlockExecutionContextMock = require('../../../../lib/test/mock/BlockExecutionContextMock'); const ValidationResult = require('../../../../lib/document/query/ValidationResult'); const deliverTxHandlerFactory = require('../../../../lib/abci/handlers/deliverTxHandlerFactory'); -const InvalidArgumentAbciError = require('../../../../lib/abci/errors/InvalidArgumentAbciError'); -const AbciError = require('../../../../lib/abci/errors/AbciError'); -const ValidationError = require('../../../../lib/document/query/errors/ValidationError'); const LoggerMock = require('../../../../lib/test/mock/LoggerMock'); +const DPPValidationError = require('../../../../lib/abci/handlers/errors/DPPValidationError'); describe('deliverTxHandlerFactory', () => { let deliverTxHandler; @@ -153,10 +154,10 @@ describe('deliverTxHandlerFactory', () => { ); }); - it('should throw InvalidArgumentAbciError if a state transition is not valid', async () => { + it('should throw DPPValidationError if a state transition is invalid against state', async () => { unserializeStateTransitionMock.resolves(dataContractCreateTransitionFixture); - const error = new ValidationError('Some error'); + const error = new SomeConsensusError('Consensus error'); const invalidResult = new ValidationResult([error]); dppMock.stateTransition.validateState.resolves(invalidResult); @@ -166,17 +167,16 @@ describe('deliverTxHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError error'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); - expect(e.getMessage()).to.equal('Invalid state transition'); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); - expect(e.getData()).to.deep.equal({ errors: [error] }); + expect(e).to.be.instanceOf(DPPValidationError); + expect(e.getCode()).to.equal(error.getCode()); + expect(e.getInfo()).to.deep.equal(['Consensus error']); expect(blockExecutionContextMock.incrementCumulativeFees).to.not.be.called(); } }); - it('should throw InvalidArgumentAbciError if a state transition structure is not valid', async () => { + it('should throw DPPValidationError if a state transition is not valid', async () => { const errorMessage = 'Invalid structure'; - const error = new InvalidArgumentAbciError(errorMessage); + const error = new InvalidArgumentGrpcError(errorMessage); unserializeStateTransitionMock.throws(error); @@ -185,9 +185,9 @@ describe('deliverTxHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError error'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); + expect(e).to.be.instanceOf(InvalidArgumentGrpcError); expect(e.getMessage()).to.equal(errorMessage); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); expect(blockExecutionContextMock.incrementCumulativeFees).to.not.be.called(); expect(dppMock.stateTransition.validate).to.not.be.called(); } diff --git a/test/unit/abci/handlers/query/dataContractQueryHandlerFactory.spec.js b/test/unit/abci/handlers/query/dataContractQueryHandlerFactory.spec.js index cc9c6701b..ee3c0c154 100644 --- a/test/unit/abci/handlers/query/dataContractQueryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/query/dataContractQueryHandlerFactory.spec.js @@ -15,11 +15,11 @@ const { const getDataContractFixture = require('@dashevo/dpp/lib/test/fixtures/getDataContractFixture'); +const NotFoundGrpcError = require('@dashevo/grpc-common/lib/server/error/NotFoundGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); +const UnavailableGrpcError = require('@dashevo/grpc-common/lib/server/error/UnavailableGrpcError'); const dataContractQueryHandlerFactory = require('../../../../../lib/abci/handlers/query/dataContractQueryHandlerFactory'); -const NotFoundAbciError = require('../../../../../lib/abci/errors/NotFoundAbciError'); -const AbciError = require('../../../../../lib/abci/errors/AbciError'); -const UnavailableAbciError = require('../../../../../lib/abci/errors/UnavailableAbciError'); const BlockExecutionContextMock = require('../../../../../lib/test/mock/BlockExecutionContextMock'); describe('dataContractQueryHandlerFactory', () => { @@ -80,7 +80,7 @@ describe('dataContractQueryHandlerFactory', () => { expect.fail('should throw NotFoundAbciError'); } catch (e) { - expect(e).to.be.an.instanceOf(NotFoundAbciError); + expect(e).to.be.an.instanceOf(NotFoundGrpcError); } }); @@ -92,7 +92,7 @@ describe('dataContractQueryHandlerFactory', () => { expect.fail('should throw NotFoundAbciError'); } catch (e) { - expect(e).to.be.an.instanceOf(NotFoundAbciError); + expect(e).to.be.an.instanceOf(NotFoundGrpcError); } }); @@ -136,22 +136,22 @@ describe('dataContractQueryHandlerFactory', () => { expect.fail('should throw NotFoundAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(NotFoundAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.NOT_FOUND); + expect(e).to.be.an.instanceof(NotFoundGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.NOT_FOUND); expect(e.message).to.equal('Data Contract not found'); expect(previousDataContractRepositoryMock.fetch).to.be.calledOnceWith(data.id); } }); it('should not proceed forward if createQueryResponse throws UnavailableAbciError', async () => { - createQueryResponseMock.throws(new UnavailableAbciError()); + createQueryResponseMock.throws(new UnavailableGrpcError()); try { await dataContractQueryHandler(params, data, {}); expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); + expect(e).to.be.an.instanceof(UnavailableGrpcError); expect(previousDataContractRepositoryMock.fetch).to.have.not.been.called(); } }); diff --git a/test/unit/abci/handlers/query/documentQueryHandlerFactory.spec.js b/test/unit/abci/handlers/query/documentQueryHandlerFactory.spec.js index 4ea1bbaab..7a8bbdabe 100644 --- a/test/unit/abci/handlers/query/documentQueryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/query/documentQueryHandlerFactory.spec.js @@ -18,12 +18,13 @@ const generateRandomIdentifier = require('@dashevo/dpp/lib/test/utils/generateRa const getDocumentsFixture = require('@dashevo/dpp/lib/test/fixtures/getDocumentsFixture'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); +const UnavailableGrpcError = require('@dashevo/grpc-common/lib/server/error/UnavailableGrpcError'); const documentQueryHandlerFactory = require('../../../../../lib/abci/handlers/query/documentQueryHandlerFactory'); const InvalidQueryError = require('../../../../../lib/document/errors/InvalidQueryError'); const ValidationError = require('../../../../../lib/document/query/errors/ValidationError'); -const InvalidArgumentAbciError = require('../../../../../lib/abci/errors/InvalidArgumentAbciError'); -const AbciError = require('../../../../../lib/abci/errors/AbciError'); -const UnavailableAbciError = require('../../../../../lib/abci/errors/UnavailableAbciError'); + const BlockExecutionContextMock = require('../../../../../lib/test/mock/BlockExecutionContextMock'); describe('documentQueryHandlerFactory', () => { @@ -188,8 +189,8 @@ describe('documentQueryHandlerFactory', () => { expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.UNAVAILABLE); + expect(e).to.be.an.instanceof(UnavailableGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.UNAVAILABLE); expect(fetchPreviousDocumentsMock).to.not.be.called(); expect(containerMock.has).to.be.calledOnceWithExactly('previousBlockExecutionStoreTransactions'); } @@ -203,8 +204,8 @@ describe('documentQueryHandlerFactory', () => { expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.UNAVAILABLE); + expect(e).to.be.an.instanceof(UnavailableGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.UNAVAILABLE); expect(fetchPreviousDocumentsMock).to.not.be.called(); expect(containerMock.resolve).to.be.calledOnceWithExactly('previousBlockExecutionStoreTransactions'); expect(previousBlockExecutionTransactionsMock.getTransaction).to.be.calledOnceWithExactly('dataContracts'); @@ -213,15 +214,15 @@ describe('documentQueryHandlerFactory', () => { }); it('should not proceed forward if createQueryResponse throws UnavailableAbciError', async () => { - createQueryResponseMock.throws(new UnavailableAbciError()); + createQueryResponseMock.throws(new UnavailableGrpcError()); try { await documentQueryHandler(params, data, {}); expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.UNAVAILABLE); + expect(e).to.be.an.instanceof(UnavailableGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.UNAVAILABLE); expect(fetchPreviousDocumentsMock).to.not.be.called(); expect(containerMock.resolve).to.be.calledOnceWithExactly('previousBlockExecutionStoreTransactions'); expect(previousBlockExecutionTransactionsMock.getTransaction).to.be.calledOnceWithExactly('dataContracts'); @@ -240,9 +241,9 @@ describe('documentQueryHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(InvalidArgumentAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); - expect(e.getData()).to.deep.equal({ errors: [error] }); + expect(e).to.be.an.instanceof(InvalidArgumentGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); + expect(e.getRawMetadata()).to.deep.equal({ errors: [error] }); expect(fetchPreviousDocumentsMock).to.be.calledOnceWith(data.contractId, data.type, options); expect(containerMock.has).to.be.calledOnceWithExactly('previousBlockExecutionStoreTransactions'); } diff --git a/test/unit/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.spec.js b/test/unit/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.spec.js index c0efdc698..97ef5fcbe 100644 --- a/test/unit/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory.spec.js @@ -16,13 +16,12 @@ const { const getIdentityFixture = require('@dashevo/dpp/lib/test/fixtures/getIdentityFixture'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); + +const UnavailableGrpcError = require('@dashevo/grpc-common/lib/server/error/UnavailableGrpcError'); const identitiesByPublicKeyHashesQueryHandlerFactory = require( '../../../../../lib/abci/handlers/query/identitiesByPublicKeyHashesQueryHandlerFactory', ); -const InvalidArgumentAbciError = require( - '../../../../../lib/abci/errors/InvalidArgumentAbciError', -); -const UnavailableAbciError = require('../../../../../lib/abci/errors/UnavailableAbciError'); const BlockExecutionContextMock = require('../../../../../lib/test/mock/BlockExecutionContextMock'); describe('identitiesByPublicKeyHashesQueryHandlerFactory', () => { @@ -174,8 +173,8 @@ describe('identitiesByPublicKeyHashesQueryHandlerFactory', () => { await identitiesByPublicKeyHashesQueryHandler(params, data, {}); expect.fail('Error was not thrown'); } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentAbciError); - expect(e.getData()).to.deep.equal({ + expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); + expect(e.getRawMetadata()).to.deep.equal({ maxIdentitiesPerRequest, }); } @@ -266,14 +265,14 @@ describe('identitiesByPublicKeyHashesQueryHandlerFactory', () => { }); it('should not proceed forward if createQueryResponse throws UnavailableAbciError', async () => { - createQueryResponseMock.throws(new UnavailableAbciError()); + createQueryResponseMock.throws(new UnavailableGrpcError()); try { await identitiesByPublicKeyHashesQueryHandler({}, {}, {}); expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); + expect(e).to.be.an.instanceof(UnavailableGrpcError); expect(previousIdentityRepositoryMock.fetch).to.have.not.been.called(); } }); diff --git a/test/unit/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.spec.js b/test/unit/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.spec.js index 5b2b57469..e3b290ced 100644 --- a/test/unit/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory.spec.js @@ -16,13 +16,12 @@ const { const generateRandomIdentifier = require('@dashevo/dpp/lib/test/utils/generateRandomIdentifier'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const UnavailableGrpcError = require('@dashevo/grpc-common/lib/server/error/UnavailableGrpcError'); const identityIdsByPublicKeyHashesQueryHandlerFactory = require( '../../../../../lib/abci/handlers/query/identityIdsByPublicKeyHashesQueryHandlerFactory', ); -const InvalidArgumentAbciError = require( - '../../../../../lib/abci/errors/InvalidArgumentAbciError', -); -const UnavailableAbciError = require('../../../../../lib/abci/errors/UnavailableAbciError'); + const BlockExecutionContextMock = require('../../../../../lib/test/mock/BlockExecutionContextMock'); describe('identityIdsByPublicKeyHashesQueryHandlerFactory', () => { @@ -151,8 +150,8 @@ describe('identityIdsByPublicKeyHashesQueryHandlerFactory', () => { await identityIdsByPublicKeyHashesQueryHandler(params, data, {}); expect.fail('Error was not thrown'); } catch (e) { - expect(e).to.be.an.instanceOf(InvalidArgumentAbciError); - expect(e.getData()).to.deep.equal({ + expect(e).to.be.an.instanceOf(InvalidArgumentGrpcError); + expect(e.getRawMetadata()).to.deep.equal({ maxIdentitiesPerRequest, }); } @@ -219,14 +218,14 @@ describe('identityIdsByPublicKeyHashesQueryHandlerFactory', () => { }); it('should not proceed forward if createQueryResponse throws UnavailableAbciError', async () => { - createQueryResponseMock.throws(new UnavailableAbciError()); + createQueryResponseMock.throws(new UnavailableGrpcError()); try { await identityIdsByPublicKeyHashesQueryHandler({}, {}, {}); expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); + expect(e).to.be.an.instanceof(UnavailableGrpcError); expect(previousPublicKeyIdentityIdRepositoryMock.fetch).to.have.not.been.called(); } }); diff --git a/test/unit/abci/handlers/query/identityQueryHandlerFactory.spec.js b/test/unit/abci/handlers/query/identityQueryHandlerFactory.spec.js index be429858a..60346ce7d 100644 --- a/test/unit/abci/handlers/query/identityQueryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/query/identityQueryHandlerFactory.spec.js @@ -15,11 +15,10 @@ const { const getIdentityFixture = require('@dashevo/dpp/lib/test/fixtures/getIdentityFixture'); +const NotFoundGrpcError = require('@dashevo/grpc-common/lib/server/error/NotFoundGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); +const UnavailableGrpcError = require('@dashevo/grpc-common/lib/server/error/UnavailableGrpcError'); const identityQueryHandlerFactory = require('../../../../../lib/abci/handlers/query/identityQueryHandlerFactory'); - -const NotFoundAbciError = require('../../../../../lib/abci/errors/NotFoundAbciError'); -const AbciError = require('../../../../../lib/abci/errors/AbciError'); -const UnavailableAbciError = require('../../../../../lib/abci/errors/UnavailableAbciError'); const BlockExecutionContextMock = require('../../../../../lib/test/mock/BlockExecutionContextMock'); describe('identityQueryHandlerFactory', () => { @@ -81,7 +80,7 @@ describe('identityQueryHandlerFactory', () => { expect.fail('should throw NotFoundAbciError'); } catch (e) { - expect(e).to.be.an.instanceOf(NotFoundAbciError); + expect(e).to.be.an.instanceOf(NotFoundGrpcError); } }); @@ -93,7 +92,7 @@ describe('identityQueryHandlerFactory', () => { expect.fail('should throw NotFoundAbciError'); } catch (e) { - expect(e).to.be.an.instanceOf(NotFoundAbciError); + expect(e).to.be.an.instanceOf(NotFoundGrpcError); } }); @@ -114,8 +113,8 @@ describe('identityQueryHandlerFactory', () => { expect.fail('should throw NotFoundAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(NotFoundAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.NOT_FOUND); + expect(e).to.be.an.instanceof(NotFoundGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.NOT_FOUND); expect(e.message).to.equal('Identity not found'); expect(previousIdentityRepositoryMock.fetch).to.be.calledOnceWith(data.id); } @@ -143,14 +142,14 @@ describe('identityQueryHandlerFactory', () => { }); it('should not proceed forward if createQueryResponse throws UnavailableAbciError', async () => { - createQueryResponseMock.throws(new UnavailableAbciError()); + createQueryResponseMock.throws(new UnavailableGrpcError()); try { await identityQueryHandler(params, data, {}); expect.fail('should throw UnavailableAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(UnavailableAbciError); + expect(e).to.be.an.instanceof(UnavailableGrpcError); expect(previousIdentityRepositoryMock.fetch).to.have.not.been.called(); } }); diff --git a/test/unit/abci/handlers/query/verifyChainLockQueryHandlerFactory.spec.js b/test/unit/abci/handlers/query/verifyChainLockQueryHandlerFactory.spec.js index 53ad43d12..df156a2eb 100644 --- a/test/unit/abci/handlers/query/verifyChainLockQueryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/query/verifyChainLockQueryHandlerFactory.spec.js @@ -6,11 +6,10 @@ const { }, } = require('@dashevo/abci/types'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const verifyChainLockQueryHandlerFactory = require('../../../../../lib/abci/handlers/query/verifyChainLockQueryHandlerFactory'); -const InvalidArgumentAbciError = require('../../../../../lib/abci/errors/InvalidArgumentAbciError'); - -const AbciError = require('../../../../../lib/abci/errors/AbciError'); const LoggerMock = require('../../../../../lib/test/mock/LoggerMock'); const BlockExecutionContextMock = require('../../../../../lib/test/mock/BlockExecutionContextMock'); @@ -94,8 +93,8 @@ describe('verifyChainLockQueryHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError'); } catch (e) { - expect(e).to.be.an.instanceof(InvalidArgumentAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); + expect(e).to.be.an.instanceof(InvalidArgumentGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); expect(e.message).to.equal('ChainLock verification failed'); } }); diff --git a/test/unit/abci/handlers/queryHandlerFactory.spec.js b/test/unit/abci/handlers/queryHandlerFactory.spec.js index 142dd66d7..3c2d45c89 100644 --- a/test/unit/abci/handlers/queryHandlerFactory.spec.js +++ b/test/unit/abci/handlers/queryHandlerFactory.spec.js @@ -1,9 +1,8 @@ const cbor = require('cbor'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); const queryHandlerFactory = require('../../../../lib/abci/handlers/queryHandlerFactory'); - -const AbciError = require('../../../../lib/abci/errors/AbciError'); -const InvalidArgumentAbciError = require('../../../../lib/abci/errors/InvalidArgumentAbciError'); const LoggerMock = require('../../../../lib/test/mock/LoggerMock'); describe('queryHandlerFactory', () => { @@ -51,8 +50,8 @@ describe('queryHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); + expect(e).to.be.instanceOf(InvalidArgumentGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); expect(sanitizeUrlMock).to.be.calledOnceWith(request.path); expect(queryHandlerRouterMock.find).to.be.calledOnceWith('GET', sanitizedUrl); @@ -72,8 +71,8 @@ describe('queryHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); + expect(e).to.be.instanceOf(InvalidArgumentGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); expect(sanitizeUrlMock).to.be.calledOnceWith(request.path); expect(queryHandlerRouterMock.find).to.be.calledOnceWith('GET', sanitizedUrl); @@ -93,8 +92,8 @@ describe('queryHandlerFactory', () => { expect.fail('should throw InvalidArgumentAbciError'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); + expect(e).to.be.instanceOf(InvalidArgumentGrpcError); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); expect(sanitizeUrlMock).to.be.calledOnceWith(request.path); expect(queryHandlerRouterMock.find).to.be.calledOnceWith('GET', sanitizedUrl); diff --git a/test/unit/abci/handlers/stateTransition/unserializeStateTransitionFactory.spec.js b/test/unit/abci/handlers/stateTransition/unserializeStateTransitionFactory.spec.js index 3f594e52b..722b8c91e 100644 --- a/test/unit/abci/handlers/stateTransition/unserializeStateTransitionFactory.spec.js +++ b/test/unit/abci/handlers/stateTransition/unserializeStateTransitionFactory.spec.js @@ -1,16 +1,17 @@ const getIdentityCreateTransitionFixture = require('@dashevo/dpp/lib/test/fixtures/getIdentityCreateTransitionFixture'); -const ConsensusError = require('@dashevo/dpp/lib/errors/ConsensusError'); +const InvalidStateTransitionTypeError = require('@dashevo/dpp/lib/errors/consensus/basic/stateTransition/InvalidStateTransitionTypeError'); const InvalidStateTransitionError = require('@dashevo/dpp/lib/stateTransition/errors/InvalidStateTransitionError'); -const BalanceNotEnoughError = require('@dashevo/dpp/lib/errors/BalanceIsNotEnoughError'); +const BalanceNotEnoughError = require('@dashevo/dpp/lib/errors/consensus/fee/BalanceIsNotEnoughError'); const ValidatorResult = require('@dashevo/dpp/lib/validation/ValidationResult'); +const InvalidArgumentGrpcError = require('@dashevo/grpc-common/lib/server/error/InvalidArgumentGrpcError'); +const GrpcErrorCodes = require('@dashevo/grpc-common/lib/server/error/GrpcErrorCodes'); +const IdentityNotFoundError = require('@dashevo/dpp/lib/errors/consensus/signature/IdentityNotFoundError'); +const getIdentityFixture = require('@dashevo/dpp/lib/test/fixtures/getIdentityFixture'); const unserializeStateTransitionFactory = require('../../../../../lib/abci/handlers/stateTransition/unserializeStateTransitionFactory'); - -const AbciError = require('../../../../../lib/abci/errors/AbciError'); -const InvalidArgumentAbciError = require('../../../../../lib/abci/errors/InvalidArgumentAbciError'); -const InsufficientFundsError = require('../../../../../lib/abci/errors/InsufficientFundsError'); const LoggerMock = require('../../../../../lib/test/mock/LoggerMock'); +const DPPValidationError = require('../../../../../lib/abci/handlers/errors/DPPValidationError'); describe('unserializeStateTransitionFactory', () => { let unserializeStateTransition; @@ -43,18 +44,18 @@ describe('unserializeStateTransitionFactory', () => { expect.fail('should throw InvalidArgumentAbciError error'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); + expect(e).to.be.instanceOf(InvalidArgumentGrpcError); expect(e.getMessage()).to.equal('State Transition is not specified'); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); + expect(e.getCode()).to.equal(GrpcErrorCodes.INVALID_ARGUMENT); expect(dppMock.stateTransition.validateFee).to.not.be.called(); } }); it('should throw InvalidArgumentAbciError if State Transition is invalid', async () => { - const consensusError = new ConsensusError('Invalid state transition'); + const dppError = new InvalidStateTransitionTypeError(-1); const error = new InvalidStateTransitionError( - [consensusError], + [dppError], stateTransitionFixture, ); @@ -65,12 +66,9 @@ describe('unserializeStateTransitionFactory', () => { expect.fail('should throw InvalidArgumentAbciError error'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); - expect(e.getMessage()).to.equal('State Transition is invalid'); - expect(e.getCode()).to.equal(AbciError.CODES.INVALID_ARGUMENT); - expect(e.getData()).to.deep.equal({ - errors: [consensusError], - }); + expect(e).to.be.instanceOf(DPPValidationError); + expect(e.getCode()).to.equal(dppError.getCode()); + expect(e.getInfo()).to.deep.equal([-1]); expect(dppMock.stateTransition.createFromBuffer).to.be.calledOnce(); expect(dppMock.stateTransition.validateFee).to.not.be.called(); @@ -95,7 +93,8 @@ describe('unserializeStateTransitionFactory', () => { it('should throw InsufficientFundsError in case if identity has not enough credits', async () => { const balance = 1000; - const error = new BalanceNotEnoughError(balance); + const fee = 1; + const error = new BalanceNotEnoughError(balance, fee); dppMock.stateTransition.validateFee.resolves( new ValidatorResult([error]), @@ -106,8 +105,9 @@ describe('unserializeStateTransitionFactory', () => { expect.fail('should throw an InsufficientFundsError'); } catch (e) { - expect(e).to.be.instanceOf(InsufficientFundsError); - expect(e.getData().balance).to.equal(balance); + expect(e).to.be.instanceOf(DPPValidationError); + expect(e.getCode()).to.equal(error.getCode()); + expect(e.getInfo()).to.deep.equal([balance, fee]); expect(dppMock.stateTransition.createFromBuffer).to.be.calledOnce(); expect(dppMock.stateTransition.validateFee).to.be.calledOnce(); @@ -115,7 +115,8 @@ describe('unserializeStateTransitionFactory', () => { }); it('should return invalid result if validateSignature failed', async () => { - const error = new Error('identity was not found'); + const identity = getIdentityFixture(); + const error = new IdentityNotFoundError(identity.getId()); dppMock.stateTransition.validateSignature.resolves( new ValidatorResult([error]), @@ -126,8 +127,9 @@ describe('unserializeStateTransitionFactory', () => { expect.fail('should throw an InsufficientFundsError'); } catch (e) { - expect(e).to.be.instanceOf(InvalidArgumentAbciError); - expect(e.getData().errors[0]).to.equal(error); + expect(e).to.be.instanceOf(DPPValidationError); + expect(e.getCode()).to.equal(error.getCode()); + expect(e.getInfo()).to.deep.equal([identity.getId()]); expect(dppMock.stateTransition.createFromBuffer).to.be.calledOnce(); expect(dppMock.stateTransition.validateFee).to.have.not.been.called(); @@ -152,7 +154,8 @@ describe('unserializeStateTransitionFactory', () => { const loggerMock = new LoggerMock(this.sinon); const balance = 1000; - const error = new BalanceNotEnoughError(balance); + const fee = 1000; + const error = new BalanceNotEnoughError(balance, fee); dppMock.stateTransition.validateFee.resolves( new ValidatorResult([error]), @@ -163,8 +166,9 @@ describe('unserializeStateTransitionFactory', () => { expect.fail('should throw an InsufficientFundsError'); } catch (e) { - expect(e).to.be.instanceOf(InsufficientFundsError); - expect(e.getData().balance).to.equal(balance); + expect(e).to.be.instanceOf(DPPValidationError); + expect(e.getCode()).to.equal(error.getCode()); + expect(e.getInfo()).to.deep.equal([balance, fee]); expect(dppMock.stateTransition.createFromBuffer).to.be.calledOnce(); expect(dppMock.stateTransition.validateFee).to.be.calledOnce();