From 66509fcadb52e7d2af70e6b249497fe0c26b5b00 Mon Sep 17 00:00:00 2001 From: Andre Goncalves Date: Thu, 19 Aug 2021 15:51:26 +0100 Subject: [PATCH 1/3] fix: increase polling time for eth sync --- package.json | 2 +- src/main/blockchain/web3-service.js | 20 ++++++++--- yarn.lock | 54 +++++++++++++++++++---------- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 10df28111..10437c248 100644 --- a/package.json +++ b/package.json @@ -156,7 +156,7 @@ "url-join": "4.0.0", "walletconnect": "1.3.1", "web3": "1.5.1", - "web3-provider-engine": "15.0.4", + "web3-provider-engine": "15.0.7", "ws": "7.0.0", "zxcvbn": "4.4.2" }, diff --git a/src/main/blockchain/web3-service.js b/src/main/blockchain/web3-service.js index 3c25c8fc2..c86e6b865 100644 --- a/src/main/blockchain/web3-service.js +++ b/src/main/blockchain/web3-service.js @@ -9,6 +9,7 @@ import ProviderEngine from 'web3-provider-engine'; import WebsocketProvider from 'web3-provider-engine/subproviders/websocket'; import HookedWalletEthTxSubprovider from 'web3-provider-engine/subproviders/hooked-wallet-ethtx'; import SubscriptionSubprovider from 'web3-provider-engine/subproviders/subscriptions'; +// import FetchSubprovider from 'web3-provider-engine/subproviders/fetch'; import HWTransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import Web3SubProvider from '@ledgerhq/web3-subprovider'; import TrezorWalletSubProviderFactory from 'trezor-wallet-provider'; @@ -21,10 +22,19 @@ export const REQUEST_INTERVAL_DELAY = 500; export const SERVER_CONFIG = { infura: { 1: { url: 'wss://mainnet.infura.io/ws/v3/2e5fb5cf42714929a7f61a1617ef1ffd' }, - 3: { url: 'wss://ropsten.infura.io/ws/v3/2e5fb5cf42714929a7f61a1617ef1ffd' } + 3: { url: 'wss://ropsten.infura.io/ws/v3/39ee901210ff4dabbe18e296d9a7a366' } } }; +/* +export const SERVER_CONFIG = { + infura: { + 1: { url: 'https://ropsten.infura.io/v3/39ee901210ff4dabbe18e296d9a7a366' }, + 3: { url: 'https://ropsten.infura.io/v3/39ee901210ff4dabbe18e296d9a7a366' } + } +}; +*/ + export const SELECTED_SERVER_URL = SERVER_CONFIG[CONFIG.node][CONFIG.chainId].url; export class Web3Service extends EventEmitter { @@ -61,20 +71,20 @@ export class Web3Service extends EventEmitter { if (this.web3 && this.web3.currentProvider) { this.web3.currentProvider.stop(); } - const engine = new ProviderEngine(); + const engine = new ProviderEngine({ pollingInterval: 2000000 }); engine.addProvider(this.getWalletEthTxSubprovider()); engine.addProvider(new WebsocketProvider({ rpcUrl: SELECTED_SERVER_URL })); engine.on('error', error => { log.error('Web3Service provider error %s', error); }); - this.web3 = new Web3(engine); engine.on('start', async () => { await this.web3.eth.getBlockNumber(); }); engine.on('block', block => this.emit('block', block)); engine.start(); + this.web3 = new Web3(engine); this.web3.transactionConfirmationBlocks = 1; } @@ -82,7 +92,7 @@ export class Web3Service extends EventEmitter { if (this.web3 && this.web3.currentProvider) { this.web3.currentProvider.stop(); } - const engine = new ProviderEngine(); + const engine = new ProviderEngine({ pollingInterval: 2000000 }); this.getLedgerTransport = () => HWTransportNodeHid.create(); // ledger firmware 1.6 changed the path derivation scheme to be "44'/60'/x'/0/0" // to support legacy accounts, we will also search accounts in previous path scheme "44'/60'/0'/x" @@ -147,7 +157,7 @@ export class Web3Service extends EventEmitter { accountsQuantity, eventEmitter ); - const engine = new ProviderEngine(); + const engine = new ProviderEngine({ pollingInterval: 2000000 }); const subscriptionSubprovider = new SubscriptionSubprovider(); diff --git a/yarn.lock b/yarn.lock index a9b2595af..9dc5ff000 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15519,7 +15519,12 @@ jest@^25.1.0: import-local "^3.0.2" jest-cli "^25.4.0" -js-base64@^2.1.8, js-base64@^2.1.9: +js-base64@^2.1.8: + version "2.6.4" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" + integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== + +js-base64@^2.1.9: version "2.5.2" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.2.tgz#313b6274dda718f714d00b3330bbae6e38e90209" integrity sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ== @@ -16729,7 +16734,7 @@ lodash@4.17.19: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== -"lodash@4.6.1 || ^4.16.1", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1, lodash@^4.7.0, lodash@^4.7.14, lodash@^4.8.0, lodash@~4.17.12: +"lodash@4.6.1 || ^4.16.1", lodash@^4.0.1, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1, lodash@^4.7.0, lodash@^4.7.14, lodash@^4.8.0, lodash@~4.17.12: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -16739,6 +16744,11 @@ lodash@^4, lodash@^4.17.20: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@^4.0.0: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-driver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" @@ -17726,11 +17736,16 @@ nan@2.13.2: resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== -nan@^2.0.8, nan@^2.10.0, nan@^2.12.1, nan@^2.14.0, nan@^2.2.1: +nan@^2.0.8, nan@^2.12.1, nan@^2.14.0, nan@^2.2.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== +nan@^2.10.0: + version "2.15.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" + integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ== + nano-json-stream-parser@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" @@ -22017,9 +22032,9 @@ sanitize-html@1.20.0: xtend "^4.0.1" sass-graph@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.4.tgz#13fbd63cd1caf0908b9fd93476ad43a51d1e0b49" - integrity sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k= + version "2.2.6" + resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.6.tgz#09fda0e4287480e3e4967b72a2d133ba09b8d827" + integrity sha512-MKuEYXFSGuRSi8FZ3A7imN1CeVn9Gpw0/SFJKdL1ejXJneI9a5rwlEZrKejhEFAA3O6yr3eIyl/WuvASvlT36g== dependencies: glob "^7.0.0" lodash "^4.0.0" @@ -25562,17 +25577,17 @@ web3-provider-engine@15.0.12, web3-provider-engine@^15.0.12: xhr "^2.2.0" xtend "^4.0.1" -web3-provider-engine@15.0.4: - version "15.0.4" - resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-15.0.4.tgz#5c336bcad2274dff5218bc8db003fa4e9e464c24" - integrity sha512-Ob9oK0TUZfVC7NXkB7CQSWAiCdCD/Xnlh2zTnV8NdJR8LCrMAy2i6JedU70JHaxw59y7mM4GnsYOTTGkquFnNQ== +web3-provider-engine@15.0.7: + version "15.0.7" + resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-15.0.7.tgz#2439cdb145140660eb1007e7c6acd2d2d867b432" + integrity sha512-0NN0JTc4O/J9NFBtdqc4Ug+ujnniIBTCvauw3OlgZzfjnwr4irDU5CpviS5v33arYpC+WMnaDunad/OFrO/Wcw== dependencies: async "^2.5.0" backoff "^2.5.0" clone "^2.0.0" cross-fetch "^2.1.0" eth-block-tracker "^4.4.2" - eth-json-rpc-errors "^1.0.1" + eth-json-rpc-errors "^2.0.2" eth-json-rpc-filters "^4.1.1" eth-json-rpc-infura "^4.0.1" eth-json-rpc-middleware "^4.1.5" @@ -26452,12 +26467,13 @@ yargs-parser@^18.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs-parser@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" - integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo= +yargs-parser@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.1.tgz#7ede329c1d8cdbbe209bd25cdb990e9b1ebbb394" + integrity sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA== dependencies: camelcase "^3.0.0" + object.assign "^4.1.0" yargs-parser@^7.0.0: version "7.0.0" @@ -26573,9 +26589,9 @@ yargs@^3.19.0: y18n "^3.2.0" yargs@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" - integrity sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg= + version "7.1.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.2.tgz#63a0a5d42143879fdbb30370741374e0641d55db" + integrity sha512-ZEjj/dQYQy0Zx0lgLMLR8QuaqTihnxirir7EwUHp1Axq4e3+k8jXU5K0VLbNvedv1f4EWtBonDIZm0NUr+jCcA== dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -26589,7 +26605,7 @@ yargs@^7.0.0: string-width "^1.0.2" which-module "^1.0.0" y18n "^3.2.1" - yargs-parser "^5.0.0" + yargs-parser "^5.0.1" yargs@^8.0.2: version "8.0.2" From e3ef9c1395cc7f6962809ff2c1cb1a47414bdb4a Mon Sep 17 00:00:00 2001 From: Andre Goncalves Date: Thu, 19 Aug 2021 15:53:19 +0100 Subject: [PATCH 2/3] chore: remove test infura connections --- src/main/blockchain/web3-service.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/blockchain/web3-service.js b/src/main/blockchain/web3-service.js index c86e6b865..67901d750 100644 --- a/src/main/blockchain/web3-service.js +++ b/src/main/blockchain/web3-service.js @@ -26,15 +26,6 @@ export const SERVER_CONFIG = { } }; -/* -export const SERVER_CONFIG = { - infura: { - 1: { url: 'https://ropsten.infura.io/v3/39ee901210ff4dabbe18e296d9a7a366' }, - 3: { url: 'https://ropsten.infura.io/v3/39ee901210ff4dabbe18e296d9a7a366' } - } -}; -*/ - export const SELECTED_SERVER_URL = SERVER_CONFIG[CONFIG.node][CONFIG.chainId].url; export class Web3Service extends EventEmitter { From a41cbd58d1a428eba83629a2ba5bc5b848d6e7a7 Mon Sep 17 00:00:00 2001 From: Andre Goncalves Date: Thu, 19 Aug 2021 16:47:38 +0100 Subject: [PATCH 3/3] feat(version): bump to 1.9.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99db20a92..5adf81d35 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "selfkey-identity-wallet", "productName": "SelfKey Identity Wallet", - "version": "1.9.9", + "version": "1.9.10", "description": "The Official SelfKey Identity Wallet for Desktop", "browser": [ "chrome"