diff --git a/packages/route-processor-watcher/.gitignore b/packages/route-processor-watcher/.gitignore index 1c88d0a..549d70b 100644 --- a/packages/route-processor-watcher/.gitignore +++ b/packages/route-processor-watcher/.gitignore @@ -1,7 +1,8 @@ node_modules/ dist/ out/ -gql-logs/ .vscode .idea + +gql-logs/ diff --git a/packages/route-processor-watcher/.husky/pre-commit b/packages/route-processor-watcher/.husky/pre-commit old mode 100644 new mode 100755 diff --git a/packages/route-processor-watcher/README.md b/packages/route-processor-watcher/README.md index acfaa5f..76651f7 100644 --- a/packages/route-processor-watcher/README.md +++ b/packages/route-processor-watcher/README.md @@ -2,7 +2,7 @@ ## Source -* Subgraph: sushiswap-subgraphs v0.1.2-watcher +* Subgraph: [sushiswap-subgraphs v0.1.2-watcher](https://github.com/cerc-io/sushiswap-subgraphs/releases/tag/v0.1.2-watcher-0.1.0) ## Setup diff --git a/packages/route-processor-watcher/environments/local.toml b/packages/route-processor-watcher/environments/local.toml index 292ddc8..f3cb6d3 100644 --- a/packages/route-processor-watcher/environments/local.toml +++ b/packages/route-processor-watcher/environments/local.toml @@ -64,7 +64,6 @@ [upstream] [upstream.ethServer] - gqlApiEndpoint = "http://127.0.0.1:8082/graphql" rpcProviderEndpoints = [ "http://127.0.0.1:8081" ] @@ -93,6 +92,9 @@ subgraphEventsOrder = true blockDelayInMilliSecs = 2000 + # Number of blocks by which block processing lags behind head + blockProcessingOffset = 16 + # Boolean to switch between modes of processing events when starting the server. # Setting to true will fetch filtered events and required blocks in a range of blocks and then process them. # Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head). diff --git a/packages/route-processor-watcher/package.json b/packages/route-processor-watcher/package.json index 74f67a3..cfcf339 100644 --- a/packages/route-processor-watcher/package.json +++ b/packages/route-processor-watcher/package.json @@ -29,7 +29,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/cerc-io/watcher-ts.git" + "url": "https://github.com/cerc-io/watcher-ts.git" }, "author": "", "license": "AGPL-3.0", @@ -39,11 +39,11 @@ "homepage": "https://github.com/cerc-io/watcher-ts#readme", "dependencies": { "@apollo/client": "^3.3.19", - "@cerc-io/cli": "^0.2.93", - "@cerc-io/ipld-eth-client": "^0.2.93", - "@cerc-io/solidity-mapper": "^0.2.93", - "@cerc-io/util": "^0.2.93", - "@cerc-io/graph-node": "^0.2.93", + "@cerc-io/cli": "^0.2.97", + "@cerc-io/ipld-eth-client": "^0.2.97", + "@cerc-io/solidity-mapper": "^0.2.97", + "@cerc-io/util": "^0.2.97", + "@cerc-io/graph-node": "^0.2.97", "@ethersproject/providers": "^5.4.4", "debug": "^4.3.1", "decimal.js": "^10.3.1", @@ -71,6 +71,7 @@ "eslint-plugin-standard": "^5.0.0", "husky": "^7.0.2", "ts-node": "^10.2.1", - "typescript": "^5.0.2" + "typescript": "^5.0.2", + "winston": "^3.13.0" } } diff --git a/packages/route-processor-watcher/src/resolvers.ts b/packages/route-processor-watcher/src/resolvers.ts index 0f72ba2..9b1d1b7 100644 --- a/packages/route-processor-watcher/src/resolvers.ts +++ b/packages/route-processor-watcher/src/resolvers.ts @@ -69,6 +69,8 @@ const executeAndRecordMetrics = async ( apiKey: expressContext.req.header('x-api-key'), origin: expressContext.req.headers.origin }); + + throw error; } finally { endTimer(); } diff --git a/yarn.lock b/yarn.lock index 0e00ac0..8d827c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -205,6 +205,17 @@ fs-extra "^10.0.0" level "^7.0.0" +"@cerc-io/cache@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.97/cache-0.2.97.tgz#996380c8cf842efd84ca1763720b4a4c97f2dd9f" + integrity sha512-O7qcuNt1+5ufRGFBeuWVALjFpu4oMn5OEqnhTqCLQuJ6FaosFArH7PFAYSyZfjYmE4UQRpAbzfpRj1EdhzU7Pg== + dependencies: + canonical-json "^0.0.4" + debug "^4.3.1" + ethers "^5.4.4" + fs-extra "^10.0.0" + level "^7.0.0" + "@cerc-io/cli@^0.2.94": version "0.2.94" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.94/cli-0.2.94.tgz#f193165a4b85174c48150051ea4b0e3df57fdf9e" @@ -238,6 +249,39 @@ typeorm "0.2.37" yargs "^17.0.1" +"@cerc-io/cli@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.97/cli-0.2.97.tgz#6aab38e5db520ea2f600fb6cd9f64566e80d3e81" + integrity sha512-F9o1LTQx5fEHMLL4HShhplHtDGZ565+71NBwiIV1dnfqz8HOxXIRDffGRHKl56EBWWkdxNis2vMIcLz98r9RfA== + dependencies: + "@apollo/client" "^3.7.1" + "@cerc-io/cache" "^0.2.97" + "@cerc-io/ipld-eth-client" "^0.2.97" + "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" + "@cerc-io/nitro-node" "^0.1.15" + "@cerc-io/peer" "^0.2.97" + "@cerc-io/rpc-eth-client" "^0.2.97" + "@cerc-io/util" "^0.2.97" + "@ethersproject/providers" "^5.4.4" + "@graphql-tools/utils" "^9.1.1" + "@ipld/dag-cbor" "^8.0.0" + "@libp2p/interface-peer-id" "^2.0.0" + apollo-server-express "^3.11.1" + debug "^4.3.1" + ethers "^5.4.4" + express "^4.18.2" + graphql "^15.5.0" + graphql-request "^6.1.0" + graphql-subscriptions "^2.0.0" + http-proxy-middleware "^2.0.6" + js-yaml "^4.0.0" + json-diff "^0.5.4" + lodash "^4.17.21" + pluralize "^8.0.0" + reflect-metadata "^0.1.13" + typeorm "0.2.37" + yargs "^17.0.1" + "@cerc-io/graph-node@^0.2.94": version "0.2.94" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.94/graph-node-0.2.94.tgz#e8d346daa9e7733098d039d27e7d575e0f978b20" @@ -264,6 +308,32 @@ typeorm-naming-strategies "^2.0.0" yargs "^17.0.1" +"@cerc-io/graph-node@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.97/graph-node-0.2.97.tgz#31b49709123a513dbb043cbb05d60958973a72c0" + integrity sha512-v7PK2M4f41Z8ESm0QNaP3arGZdpMGO+Z4z3jp3+vISlzPkDdiY/Vmjzv8Sl5kI0LBm3ifziCRPxnBYJeLMj6GA== + dependencies: + "@apollo/client" "^3.3.19" + "@cerc-io/assemblyscript" "0.19.10-watcher-ts-0.1.2" + "@cerc-io/cache" "^0.2.97" + "@cerc-io/ipld-eth-client" "^0.2.97" + "@cerc-io/util" "^0.2.97" + "@types/json-diff" "^0.5.2" + "@types/yargs" "^17.0.0" + bn.js "^4.11.9" + debug "^4.3.1" + fs-extra "^10.0.0" + graphql "^15.5.0" + json-diff "^0.5.4" + lodash "^4.17.21" + omit-deep "^0.3.0" + pluralize "^8.0.0" + reflect-metadata "^0.1.13" + toml "^3.0.0" + typeorm "0.2.37" + typeorm-naming-strategies "^2.0.0" + yargs "^17.0.1" + "@cerc-io/ipld-eth-client@^0.2.94": version "0.2.94" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.94/ipld-eth-client-0.2.94.tgz#22f79eaf82da60a25d8f89f23cf45581c012d6ff" @@ -281,6 +351,23 @@ ws "^8.11.0" zen-observable-ts "^1.1.0" +"@cerc-io/ipld-eth-client@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.97/ipld-eth-client-0.2.97.tgz#1ba6a774b6ee944bb6dea9977ad11b35e17a1a3e" + integrity sha512-AuH//S/IPJ1NQ2zfizBLLDHv6HEbpSliTkR+SgexzECtAZwRmbmZ9x+4fdN5EnRMS1W7LJ1FmcyXjarRBCBAiA== + dependencies: + "@apollo/client" "^3.7.1" + "@cerc-io/cache" "^0.2.97" + "@cerc-io/util" "^0.2.97" + cross-fetch "^3.1.4" + debug "^4.3.1" + ethers "^5.4.4" + graphql "^15.5.0" + graphql-ws "^5.11.2" + left-pad "^1.3.0" + ws "^8.11.0" + zen-observable-ts "^1.1.0" + "@cerc-io/libp2p@0.42.2-laconic-0.1.4", "@cerc-io/libp2p@^0.42.2-laconic-0.1.4": version "0.42.2-laconic-0.1.4" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flibp2p/-/0.42.2-laconic-0.1.4/libp2p-0.42.2-laconic-0.1.4.tgz#ac9347e70d6d3cee040ad02074cae3070b91a8fb" @@ -394,40 +481,10 @@ lodash "^4.17.21" uint8arrays "^4.0.3" -"@cerc-io/peer@^0.2.65": - version "0.2.93" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.93/peer-0.2.93.tgz#4290d8e279f4e36d6e6673f493395a78230b5567" - integrity sha512-LA2x973cp4QtuBhILgX/2HYH5hQFB4su7w/gTQEzgKsnm8Zwv+dKriciJP0vxycMlZFRIDsSheYJkRPBz2vVEQ== - dependencies: - "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" - "@cerc-io/prometheus-metrics" "1.1.4" - "@chainsafe/libp2p-gossipsub" "^6.0.0" - "@chainsafe/libp2p-noise" "^11.0.0" - "@chainsafe/libp2p-yamux" "3.0.7" - "@libp2p/floodsub" "^6.0.0" - "@libp2p/mplex" "^7.1.1" - "@libp2p/peer-id-factory" "^2.0.0" - "@libp2p/pubsub-peer-discovery" "^8.0.0" - "@libp2p/websockets" "^5.0.5" - "@multiformats/multiaddr" "^11.1.4" - assert "^2.0.0" - buffer "^6.0.3" - chai "^4.3.4" - debug "^4.3.1" - it-length-prefixed "^8.0.4" - it-map "^2.0.0" - it-pipe "^2.0.5" - it-pushable "^3.1.2" - mocha "^8.4.0" - p-event "^5.0.1" - uint8arrays "^4.0.3" - unique-names-generator "^4.7.1" - yargs "^17.0.1" - -"@cerc-io/peer@^0.2.94": - version "0.2.94" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.94/peer-0.2.94.tgz#c8776a9968b32d96fb91ed2a2c6d4b62b365e4a0" - integrity sha512-QQANziPnT08guAD/Nwy/HoqgIIX+w1+GS2bOUE4hfS+LJmTiZ+Zquiqcj69qGQeMQxfiUHmsBPttioF+B9rp/A== +"@cerc-io/peer@^0.2.65", "@cerc-io/peer@^0.2.94", "@cerc-io/peer@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.97/peer-0.2.97.tgz#6b386a53220bb4b026337eb2ef4246b3eeb947f9" + integrity sha512-ylJslts/q6uGVlHS27GiHKYVpTTTv/4vryexxqDPA45YJRk0vCleqRDPehRQr40kCgBQjG9W92Uwcwr7HcSQxQ== dependencies: "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" "@cerc-io/prometheus-metrics" "1.1.4" @@ -479,6 +536,19 @@ left-pad "^1.3.0" mocha "^8.4.0" +"@cerc-io/rpc-eth-client@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.97/rpc-eth-client-0.2.97.tgz#b854a4ac3eaeeb8b67cb79963b32230c1a3f56db" + integrity sha512-b9FbiuKKYWYaDDwfABiqItazNqkXi7YdWFmJ2mLTPGfnUT7OVKFji8LcWAsmubjTQb1mVhyHPz1y+bqAvhyxHA== + dependencies: + "@cerc-io/cache" "^0.2.97" + "@cerc-io/ipld-eth-client" "^0.2.97" + "@cerc-io/util" "^0.2.97" + chai "^4.3.4" + ethers "^5.4.4" + left-pad "^1.3.0" + mocha "^8.4.0" + "@cerc-io/solidity-mapper@^0.2.94": version "0.2.94" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.94/solidity-mapper-0.2.94.tgz#a414653bf20fcbedd91d4a544c6a019c8a02d958" @@ -486,6 +556,13 @@ dependencies: dotenv "^10.0.0" +"@cerc-io/solidity-mapper@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.97/solidity-mapper-0.2.97.tgz#a7f666b00ce7a8867746a855d92575b09f1ca5eb" + integrity sha512-hUdqZ20NYa1NpbFs7z2AiInVGxjtAznE31uydRg1A20EN9csKUJ8+FP2C7ilFnB/UdB1qFVecB3QSw9Zc7TlUg== + dependencies: + dotenv "^10.0.0" + "@cerc-io/ts-channel@1.0.3-ts-nitro-0.1.1": version "1.0.3-ts-nitro-0.1.1" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fts-channel/-/1.0.3-ts-nitro-0.1.1/ts-channel-1.0.3-ts-nitro-0.1.1.tgz#0768781313a167295c0bf21307f47e02dc17e936" @@ -545,6 +622,60 @@ ws "^8.11.0" yargs "^17.0.1" +"@cerc-io/util@^0.2.97": + version "0.2.97" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.97/util-0.2.97.tgz#5bc0865cfda68660215d59604cf42fb6c5b74352" + integrity sha512-wtpffWlXyc3+iEgX6bSD4+fWDTVqu9ryiD8mYtb+eTcK7/gA+VsGqzeDBD7tvEa6+cLpW6PqIc8ZpsMS62dASQ== + dependencies: + "@apollo/utils.keyvaluecache" "^1.0.1" + "@cerc-io/nitro-node" "^0.1.15" + "@cerc-io/peer" "^0.2.97" + "@cerc-io/solidity-mapper" "^0.2.97" + "@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/providers" "^5.4.4" + "@ethersproject/web" "^5.7.1" + "@graphql-tools/schema" "^9.0.10" + "@graphql-tools/utils" "^9.1.1" + "@ipld/dag-cbor" "^6.0.12" + "@libp2p/interface-connection" "^3.0.2" + "@libp2p/interface-peer-id" "^2.0.0" + "@libp2p/peer-id" "^2.0.0" + apollo-server-core "^3.11.1" + apollo-server-express "^3.11.1" + apollo-server-plugin-response-cache "^3.8.1" + apollo-type-bigint "^0.1.3" + bunyan "^1.8.15" + debug "^4.3.1" + decimal.js "^10.3.1" + ethers "^5.4.4" + express "^4.18.2" + express-queue "^0.0.13" + fs-extra "^10.0.0" + graphql "^15.5.0" + graphql-subscriptions "^2.0.0" + graphql-ws "^5.11.2" + ipfs-http-client "^56.0.3" + it-length-prefixed "^8.0.4" + it-pipe "^2.0.5" + it-pushable "^3.1.2" + js-yaml "^4.1.0" + json-bigint "^1.0.0" + lodash "^4.17.21" + lru-cache "^10.0.0" + mokka "^1.4.2" + multiformats "^9.4.8" + pg "^8.5.1" + pg-boss "^6.1.0" + prom-client "^14.0.1" + read-pkg "^9.0.1" + toml "^3.0.0" + typeorm "0.2.37" + typeorm-naming-strategies "^2.0.0" + winston "^3.13.0" + ws "^8.11.0" + yargs "^17.0.1" + "@chainsafe/is-ip@^2.0.1": version "2.0.2" resolved "https://registry.yarnpkg.com/@chainsafe/is-ip/-/is-ip-2.0.2.tgz#7311e7403f11d8c5cfa48111f56fcecaac37c9f6"