From 5a9c1fae09562a0e7d7dbe864bb14a7b0a7b07e2 Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 2 Jun 2020 19:05:43 -0500 Subject: [PATCH] Fabo/update polkadot 2 (#881) * update polkadot * reorder polkadot reinit * reconnect less frequently * changelog * changelog --- changes/fabo_update-polkadot-2 | 2 + .../polkadot-node-subscription.js | 4 +- package.json | 2 +- yarn.lock | 179 +++++++++--------- 4 files changed, 98 insertions(+), 89 deletions(-) create mode 100644 changes/fabo_update-polkadot-2 diff --git a/changes/fabo_update-polkadot-2 b/changes/fabo_update-polkadot-2 new file mode 100644 index 0000000000..80a7c0d296 --- /dev/null +++ b/changes/fabo_update-polkadot-2 @@ -0,0 +1,2 @@ +[Fixed] Update Polkadot dependency @faboweb +[Changed] Reconnect Polkadot API right away to prevent race condition @faboweb \ No newline at end of file diff --git a/lib/block-listeners/polkadot-node-subscription.js b/lib/block-listeners/polkadot-node-subscription.js index b94eaeb77d..3d3f8dcb65 100644 --- a/lib/block-listeners/polkadot-node-subscription.js +++ b/lib/block-listeners/polkadot-node-subscription.js @@ -16,7 +16,7 @@ const { spawn } = require('child_process') const POLLING_INTERVAL = 1000 // const NEW_BLOCK_DELAY = 2000 -const DISCONNECTION_INTERVAL = 1000 * 60 * 60 // used to disconnect from API to free memory +const DISCONNECTION_INTERVAL = 1000 * 60 * 60 * 6 // used to disconnect from API to free memory // This class polls for new blocks // Used for listening to events, such as new blocks. @@ -72,7 +72,7 @@ class PolkadotNodeSubscription { ) this.api.disconnect() this.api = undefined - this.subscribeForNewBlock() + await this.initPolkadotRPC() } }) } diff --git a/package.json b/package.json index d3ff265135..dff6f62bcb 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "license": "ISC", "dependencies": { "@hapi/joi": "^17.1.1", - "@polkadot/api": "^1.16.1", + "@polkadot/api": "^1.17.2", "@sentry/node": "^5.15.5", "apollo-datasource-rest": "^0.9.2", "apollo-server": "^2.14.1", diff --git a/yarn.lock b/yarn.lock index 8debeb2954..92e8fb3bc1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -322,6 +322,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/runtime@^7.10.2": + version "7.10.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.2.tgz#d103f21f2602497d38348a32e008637d506db839" + integrity sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/runtime@^7.9.2", "@babel/runtime@^7.9.6": version "7.9.6" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.6.tgz#a9102eb5cadedf3f31d08a9ecf294af7827ea29f" @@ -629,121 +636,121 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@polkadot/api-derive@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-1.16.1.tgz#a0560d1788fff69a1f7cdd209f40b3e37e7263b0" - integrity sha512-SLH/Wq5sIMQ9zFbQKdmB7Ne/jXMRgaA8TZ5rj0n0dp0yOqadEiJHZC5lx9hm5kR4u/DCuZc7aOFHYwd33N64qA== - dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/api" "1.16.1" - "@polkadot/rpc-core" "1.16.1" - "@polkadot/rpc-provider" "1.16.1" - "@polkadot/types" "1.16.1" - "@polkadot/util" "^2.11.1" - "@polkadot/util-crypto" "^2.11.1" +"@polkadot/api-derive@1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-1.17.2.tgz#3fe84c32db26190a368fc3f5b9a8cbcb1ab1b7d0" + integrity sha512-Jt+jF2z+kdIHnP7IpraQyXLa0ALBhzhDcfe5aFq1FQznAoUVkOhenvUXtz/WavRLDPYQJ/S6JEedBglV8CQwwg== + dependencies: + "@babel/runtime" "^7.10.2" + "@polkadot/api" "1.17.2" + "@polkadot/rpc-core" "1.17.2" + "@polkadot/rpc-provider" "1.17.2" + "@polkadot/types" "1.17.2" + "@polkadot/util" "^2.12.2" + "@polkadot/util-crypto" "^2.12.2" bn.js "^5.1.2" memoizee "^0.4.14" rxjs "^6.5.5" -"@polkadot/api@1.16.1", "@polkadot/api@^1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-1.16.1.tgz#a0ff0e7307bae71a202a2e3be818ecce81f96c51" - integrity sha512-wNEi/9wD+5hSt7zm/dKErkJqkuHFFBJAB3vy4ZCOVQRQ6IkxVJ0OMg/7Q2xIEYxz962VmT/DDhwqOb4JBKW5qw== - dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/api-derive" "1.16.1" - "@polkadot/keyring" "^2.11.1" - "@polkadot/metadata" "1.16.1" - "@polkadot/rpc-core" "1.16.1" - "@polkadot/rpc-provider" "1.16.1" - "@polkadot/types" "1.16.1" - "@polkadot/types-known" "1.16.1" - "@polkadot/util" "^2.11.1" - "@polkadot/util-crypto" "^2.11.1" +"@polkadot/api@1.17.2", "@polkadot/api@^1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-1.17.2.tgz#c6fb641bdb4e58e29cc55413cf7cb3a4cedc44b4" + integrity sha512-P/MWfanRa+DgMWUIFRt9n5GZe2BzTrfSqio4f+2XSbDDK3wF11y3TILCSSRDv6gWSFiq043owyj3I70pINKqug== + dependencies: + "@babel/runtime" "^7.10.2" + "@polkadot/api-derive" "1.17.2" + "@polkadot/keyring" "^2.12.2" + "@polkadot/metadata" "1.17.2" + "@polkadot/rpc-core" "1.17.2" + "@polkadot/rpc-provider" "1.17.2" + "@polkadot/types" "1.17.2" + "@polkadot/types-known" "1.17.2" + "@polkadot/util" "^2.12.2" + "@polkadot/util-crypto" "^2.12.2" bn.js "^5.1.2" eventemitter3 "^4.0.4" rxjs "^6.5.5" -"@polkadot/keyring@^2.11.1": - version "2.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-2.11.1.tgz#4f3fb9f7d3cda7de743899a819cac85a0db9fc6b" - integrity sha512-nIeEiX0w7FmPJsuoAsEpDBRfy7QAgj+NTiY67mZoEDHAOJ6E9Bf6PubR24k1wzV57/0gmNEbd5FNZdI+tLSKdw== +"@polkadot/keyring@^2.12.2": + version "2.12.2" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-2.12.2.tgz#4a62d2f2f5cbf8e8df843ec365195b6fa5e6d4df" + integrity sha512-1X5OJWtbB0vu3fEg7eKJ4fj2qqTxhrwRPeJaGNW1iJliM+YBfwB2TDtog1VNiSRgLC/07Qqrjgn/I+EBABihMA== dependencies: "@babel/runtime" "^7.9.6" - "@polkadot/util" "2.11.1" - "@polkadot/util-crypto" "2.11.1" - -"@polkadot/metadata@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-1.16.1.tgz#ed96227ec046e53a4a9e0ad21a9d582daa4b07fa" - integrity sha512-qQ13JoDCt5jgV6WwKs/8zj41t9kBWGCArixs0lNzVaqYf3igSsvA+p7H6t9K8yvSpWzK7rzQuzvMwnq3prlMWg== - dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/types" "1.16.1" - "@polkadot/types-known" "1.16.1" - "@polkadot/util" "^2.11.1" - "@polkadot/util-crypto" "^2.11.1" + "@polkadot/util" "2.12.2" + "@polkadot/util-crypto" "2.12.2" + +"@polkadot/metadata@1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-1.17.2.tgz#839d4efd6c468f3f8dd0e30e7f17f2edfb45199a" + integrity sha512-Ikse1VdzIZuwSGRLKf12NSRXLRzzZ7y5l9C7POSMkxQkkWHq2/CMIKY9H193AztVGRbAdL69FqFEbYwobYqq+Q== + dependencies: + "@babel/runtime" "^7.10.2" + "@polkadot/types" "1.17.2" + "@polkadot/types-known" "1.17.2" + "@polkadot/util" "^2.12.2" + "@polkadot/util-crypto" "^2.12.2" bn.js "^5.1.2" -"@polkadot/rpc-core@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-1.16.1.tgz#be1a7e04e74092dd0c10b0ad22f8a92cd0e49aa8" - integrity sha512-DjPZOTWOPzNy0/gzrcMVWzOcYmxXvFwoGsZjRo4eD+5l+A5Zwd+3fDy6zuafVmHxRW0pcwMpbk1KmnEwyLhUtg== +"@polkadot/rpc-core@1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-1.17.2.tgz#cd9901b11672b6e657d0fe2c8c7a69d8a1e1822a" + integrity sha512-Wm6LkeAmRnboJ2mhqgwZ4RGnkUH3VS6mWIveaGCIdkLEfaB53Nz4xCQCzkbwg9x9R02UtPs5+a5VU1loGz8nOQ== dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/metadata" "1.16.1" - "@polkadot/rpc-provider" "1.16.1" - "@polkadot/types" "1.16.1" - "@polkadot/util" "^2.11.1" + "@babel/runtime" "^7.10.2" + "@polkadot/metadata" "1.17.2" + "@polkadot/rpc-provider" "1.17.2" + "@polkadot/types" "1.17.2" + "@polkadot/util" "^2.12.2" memoizee "^0.4.14" rxjs "^6.5.5" -"@polkadot/rpc-provider@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-1.16.1.tgz#7709ea14851a8c6f0ee35cfaeb8217f722cf5b68" - integrity sha512-qhqI3kfzetusollFhnsgpio6kvM8f/tMB5gROYXj5Oq2t9FcM03BzOWzqXRcBvUUQwQS1qp8eZzTYVVSf3CqnA== +"@polkadot/rpc-provider@1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-1.17.2.tgz#0f153586fcb07b163d1e93cb9aec0ed2aace3a1f" + integrity sha512-FhcfCJNY8TGV/cSxt3UDWXsSGAmEgeJPZgaadmzjbeh89mRCRRoti/K5r9UQc7uiGG31YRRlzievr56yp/BVLA== dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/metadata" "1.16.1" - "@polkadot/types" "1.16.1" - "@polkadot/util" "^2.11.1" - "@polkadot/util-crypto" "^2.11.1" + "@babel/runtime" "^7.10.2" + "@polkadot/metadata" "1.17.2" + "@polkadot/types" "1.17.2" + "@polkadot/util" "^2.12.2" + "@polkadot/util-crypto" "^2.12.2" bn.js "^5.1.2" eventemitter3 "^4.0.4" isomorphic-fetch "^2.2.1" websocket "^1.0.31" -"@polkadot/types-known@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-1.16.1.tgz#748c07c7b613e01c69fd780c71aab8583eecef63" - integrity sha512-rcANtjwGPTt3ZWVrwGtRk5UJYHTjqAvHL2JRNWn7hcedYbYWFoioCMloeIwCZgi3KZmPWeerNHHrz1SzMyF8HA== +"@polkadot/types-known@1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-1.17.2.tgz#10eb06a5d0e218305d30b32cc33ab0c97d09bb69" + integrity sha512-7MvyyLvu9R8ZGBpogJgy9zkseQiAKQqPDCPbzheuT5mYQGVJ0wXlED1Z43XC9eubvMdnK/ALJOxLeDEFVWt2Bw== dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/types" "1.16.1" - "@polkadot/util" "^2.11.1" + "@babel/runtime" "^7.10.2" + "@polkadot/types" "1.17.2" + "@polkadot/util" "^2.12.2" bn.js "^5.1.2" -"@polkadot/types@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-1.16.1.tgz#6f43abdaa8c037bd6f06a7dcf6e7e4ae0fcbc716" - integrity sha512-Z3RhHwV8YGG/wf5L7KeiFGt5NoAz4nS8hwIFgfMlTfPbb2obkuHEd6tEcsziwquqj5dnxM5sAfVFarInsyqD+A== +"@polkadot/types@1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-1.17.2.tgz#c6231cc35ea361729b8693ab982c55277f9c72c1" + integrity sha512-SnipP5d1zJZt0BuUadPEhCFvE9Uw5Zb6wjBsv64Libi9gCV/+IR2nxJziaqzKunheVq5Q9NF72jxYzP/X21j+A== dependencies: - "@babel/runtime" "^7.9.6" - "@polkadot/metadata" "1.16.1" - "@polkadot/util" "^2.11.1" - "@polkadot/util-crypto" "^2.11.1" + "@babel/runtime" "^7.10.2" + "@polkadot/metadata" "1.17.2" + "@polkadot/util" "^2.12.2" + "@polkadot/util-crypto" "^2.12.2" "@types/bn.js" "^4.11.6" bn.js "^5.1.2" memoizee "^0.4.14" rxjs "^6.5.5" -"@polkadot/util-crypto@2.11.1", "@polkadot/util-crypto@^2.11.1": - version "2.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-2.11.1.tgz#38bdca3b521127f82fbbfa84d6eb3716f6ebefb3" - integrity sha512-5LqSdjckKMOrdsGudeRKl2ybO0KS8n0HFTQ/zXTSUmXEOYrjlr6/XbwdJloSRwaJJvEeQcXlGrT9N4J7VousqQ== +"@polkadot/util-crypto@2.12.2", "@polkadot/util-crypto@^2.12.2": + version "2.12.2" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-2.12.2.tgz#3585eba50818ca39050d9355bbcdd1cf94bc2483" + integrity sha512-iqhQPQhRfn0Ry78bs5TleMW+Wz8Lod03gbr3ZLSc3MG0nlOyKusHcMRJD0PH1709HFFA47DeqlR4LMFKs/JPxg== dependencies: "@babel/runtime" "^7.9.6" - "@polkadot/util" "2.11.1" + "@polkadot/util" "2.12.2" "@polkadot/wasm-crypto" "^1.2.1" base-x "^3.0.8" bip39 "^3.0.2" @@ -756,10 +763,10 @@ tweetnacl "^1.0.3" xxhashjs "^0.2.2" -"@polkadot/util@2.11.1", "@polkadot/util@^2.11.1": - version "2.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-2.11.1.tgz#be41aa56c4969e4efef755b3a648f2ee7af93ab3" - integrity sha512-JW09nmznZcM8KLfQISUQHu47/uq9mZwMfvDD/FSPVCOWBhYbwfjQknrwvslvhaJmBk/EvQsOS9hbE0/I4EoZAg== +"@polkadot/util@2.12.2", "@polkadot/util@^2.12.2": + version "2.12.2" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-2.12.2.tgz#2f0d126fdcaba00c05c69fb4cdb406574eb9b08f" + integrity sha512-ixXc9NR5pvllYL3BCwcBcwoqZag2XaWUyIBTn/eaeovijOzS81hYqwf/5hqMj+D6xEbf/dR7T/ESzleoUfpGYg== dependencies: "@babel/runtime" "^7.9.6" "@types/bn.js" "^4.11.6"