Catch no matching event errors while parsing logs and upgrade dependencies (#1)

Part of https://www.notion.so/Generate-ajna-finance-subgraph-watcher-with-codegen-5b80ac149b3f449fb138f5d92cc5485e

Reviewed-on: #1
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
Prathamesh Musale 2024-03-19 13:12:30 +00:00 committed by nabarun
parent 9c25a4c717
commit 287a8e2663
3 changed files with 98 additions and 54 deletions

View File

@ -39,11 +39,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.82", "@cerc-io/cli": "^0.2.83",
"@cerc-io/ipld-eth-client": "^0.2.82", "@cerc-io/ipld-eth-client": "^0.2.83",
"@cerc-io/solidity-mapper": "^0.2.82", "@cerc-io/solidity-mapper": "^0.2.83",
"@cerc-io/util": "^0.2.82", "@cerc-io/util": "^0.2.83",
"@cerc-io/graph-node": "^0.2.82", "@cerc-io/graph-node": "^0.2.83",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"debug": "^4.3.1", "debug": "^4.3.1",
"decimal.js": "^10.3.1", "decimal.js": "^10.3.1",

View File

@ -513,20 +513,34 @@ export class Indexer implements IndexerInterface {
console.timeEnd('time:indexer#processBlockAfterEvents-dump_subgraph_state'); console.timeEnd('time:indexer#processBlockAfterEvents-dump_subgraph_state');
} }
parseEventNameAndArgs (kind: string, logObj: any): any { parseEventNameAndArgs (kind: string, logObj: any): { eventParsed: boolean, eventDetails: any } {
const { topics, data } = logObj; const { topics, data } = logObj;
const contract = this._contractMap.get(kind); const contract = this._contractMap.get(kind);
assert(contract); assert(contract);
const logDescription = contract.parseLog({ data, topics }); let logDescription: ethers.utils.LogDescription;
try {
logDescription = contract.parseLog({ data, topics });
} catch (err) {
// Return if no matching event found
if ((err as Error).message.includes('no matching event')) {
log(`WARNING: Skipping event for contract ${kind} as no matching event found in the ABI`);
return { eventParsed: false, eventDetails: {} };
}
throw err;
}
const { eventName, eventInfo, eventSignature } = this._baseIndexer.parseEvent(logDescription); const { eventName, eventInfo, eventSignature } = this._baseIndexer.parseEvent(logDescription);
return { return {
eventParsed: true,
eventDetails: {
eventName, eventName,
eventInfo, eventInfo,
eventSignature eventSignature
}
}; };
} }

118
yarn.lock
View File

@ -176,10 +176,10 @@
binaryen "101.0.0-nightly.20210723" binaryen "101.0.0-nightly.20210723"
long "^4.0.0" long "^4.0.0"
"@cerc-io/cache@^0.2.82": "@cerc-io/cache@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.82/cache-0.2.82.tgz#b3ccc72047e9fd59f8cfe1e6d55a7139e0b61b7b" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.83/cache-0.2.83.tgz#2802fe7a360990c8f5d14f5a76112d1085e52f81"
integrity sha512-auQhFYShmn6KaV27WcLqhPhsMjr8s/adThLpg2MYqlR880YNPx9WSXK0gku3xBej4XIXBurZy/QkMq4A3IF2vw== integrity sha512-JGUmhs6dbYIYZPDJ6LPTU+TcV3+/AqMQnczZB8n/E6ccHheb9LcIlVJZYylEfN8+hpgukd1p2ihXSGqkFj7HRw==
dependencies: dependencies:
canonical-json "^0.0.4" canonical-json "^0.0.4"
debug "^4.3.1" debug "^4.3.1"
@ -187,19 +187,19 @@
fs-extra "^10.0.0" fs-extra "^10.0.0"
level "^7.0.0" level "^7.0.0"
"@cerc-io/cli@^0.2.82": "@cerc-io/cli@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.82/cli-0.2.82.tgz#783782cfb60fe302d6ca2fa151d49f9fec53302e" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.83/cli-0.2.83.tgz#827694470b87c0b7c3604e020803ac88102aefa8"
integrity sha512-d86uMh2mXo+ZPT9Jr9qMdQZ2q7ZeGv1xyGpJD/42XK+jf5t59ZjAzK2MxNgzEe/vYghiRdsg3+sJPA8wKmR6Bg== integrity sha512-1lU4bzE9Oej+dtoOvClNq52jGhIJorfGLaBAQAd52Jar7wAspZVBI9zFteVKjJiCaVLsLpeZLqyBp4KA6ZeQ1g==
dependencies: dependencies:
"@apollo/client" "^3.7.1" "@apollo/client" "^3.7.1"
"@cerc-io/cache" "^0.2.82" "@cerc-io/cache" "^0.2.83"
"@cerc-io/ipld-eth-client" "^0.2.82" "@cerc-io/ipld-eth-client" "^0.2.83"
"@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4"
"@cerc-io/nitro-node" "^0.1.15" "@cerc-io/nitro-node" "^0.1.15"
"@cerc-io/peer" "^0.2.82" "@cerc-io/peer" "^0.2.83"
"@cerc-io/rpc-eth-client" "^0.2.82" "@cerc-io/rpc-eth-client" "^0.2.83"
"@cerc-io/util" "^0.2.82" "@cerc-io/util" "^0.2.83"
"@ethersproject/providers" "^5.4.4" "@ethersproject/providers" "^5.4.4"
"@graphql-tools/utils" "^9.1.1" "@graphql-tools/utils" "^9.1.1"
"@ipld/dag-cbor" "^8.0.0" "@ipld/dag-cbor" "^8.0.0"
@ -220,16 +220,16 @@
typeorm "0.2.37" typeorm "0.2.37"
yargs "^17.0.1" yargs "^17.0.1"
"@cerc-io/graph-node@^0.2.82": "@cerc-io/graph-node@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.82/graph-node-0.2.82.tgz#9e62dd7bf5497f014fc253d97cb6fee7c862a9ba" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.83/graph-node-0.2.83.tgz#79d0d684724825d675db84df78e4a3c3b2d0a581"
integrity sha512-2b1/0CR0BBDWB/KIIxtM9vg2iHxPCNFN/XnEyumzmLXDgSwlNZkYLcPHWANK/X8nH3x8eqEA4BBfl0hDT9tnww== integrity sha512-UxFoK7DpIBOYdKY6TFAGi9SgK1gET/xAgdIKhQ7+d+QYDdMZYoEfCK0TDkAhzoarX5B/gYQ8gwbM8RQ1h4QMlA==
dependencies: dependencies:
"@apollo/client" "^3.3.19" "@apollo/client" "^3.3.19"
"@cerc-io/assemblyscript" "0.19.10-watcher-ts-0.1.2" "@cerc-io/assemblyscript" "0.19.10-watcher-ts-0.1.2"
"@cerc-io/cache" "^0.2.82" "@cerc-io/cache" "^0.2.83"
"@cerc-io/ipld-eth-client" "^0.2.82" "@cerc-io/ipld-eth-client" "^0.2.83"
"@cerc-io/util" "^0.2.82" "@cerc-io/util" "^0.2.83"
"@types/json-diff" "^0.5.2" "@types/json-diff" "^0.5.2"
"@types/yargs" "^17.0.0" "@types/yargs" "^17.0.0"
bn.js "^4.11.9" bn.js "^4.11.9"
@ -246,14 +246,14 @@
typeorm-naming-strategies "^2.0.0" typeorm-naming-strategies "^2.0.0"
yargs "^17.0.1" yargs "^17.0.1"
"@cerc-io/ipld-eth-client@^0.2.82": "@cerc-io/ipld-eth-client@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.82/ipld-eth-client-0.2.82.tgz#2d682ab8cdfc99d6b37cc2af6ee168f002b4639e" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.83/ipld-eth-client-0.2.83.tgz#8aeb35c17b4695a14316640c0b755e3f63ca5df7"
integrity sha512-dbZ7n1TxVdwQ56T+KcE/Ac2bFWZXFkTCcs5fH5hlpUc4HyZI86MZ5IuaaNco4BBHYXUABntESWtvlx4cepeZCg== integrity sha512-H/H0kfwOc3CiMDRk6Axx7rhorqUlLTVEIO3NIOYlrg6mqm7dPSg5LulTBK8pLamwmtjpKpAXp7WB/mOCLUX2Kg==
dependencies: dependencies:
"@apollo/client" "^3.7.1" "@apollo/client" "^3.7.1"
"@cerc-io/cache" "^0.2.82" "@cerc-io/cache" "^0.2.83"
"@cerc-io/util" "^0.2.82" "@cerc-io/util" "^0.2.83"
cross-fetch "^3.1.4" cross-fetch "^3.1.4"
debug "^4.3.1" debug "^4.3.1"
ethers "^5.4.4" ethers "^5.4.4"
@ -376,7 +376,7 @@
lodash "^4.17.21" lodash "^4.17.21"
uint8arrays "^4.0.3" uint8arrays "^4.0.3"
"@cerc-io/peer@^0.2.65", "@cerc-io/peer@^0.2.82": "@cerc-io/peer@^0.2.65":
version "0.2.82" version "0.2.82"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.82/peer-0.2.82.tgz#e27a1cafd06c25f9c4e02d49d4615f45a76ce22b" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.82/peer-0.2.82.tgz#e27a1cafd06c25f9c4e02d49d4615f45a76ce22b"
integrity sha512-wKkBXO7hxuN13Av60otDj+2O7nyoogYp+n8uTKNU9cv6J87OLRUZZAuGb5FggUONgDqxS3cyaXD6vqLpkhbbIA== integrity sha512-wKkBXO7hxuN13Av60otDj+2O7nyoogYp+n8uTKNU9cv6J87OLRUZZAuGb5FggUONgDqxS3cyaXD6vqLpkhbbIA==
@ -406,6 +406,36 @@
unique-names-generator "^4.7.1" unique-names-generator "^4.7.1"
yargs "^17.0.1" yargs "^17.0.1"
"@cerc-io/peer@^0.2.83":
version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.83/peer-0.2.83.tgz#128d3243ec6a7d1f7272b1d45978bf76de66591b"
integrity sha512-q6XRfJkxwT7k45Kayz1JKP7mtUH5I63vNhejwxTAfmM/puLOpbgVKSay6UfQHuSSniIQSMRrWOy3OQmJXNvMEQ==
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/prometheus-metrics@1.1.4": "@cerc-io/prometheus-metrics@1.1.4":
version "1.1.4" version "1.1.4"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fprometheus-metrics/-/1.1.4/prometheus-metrics-1.1.4.tgz#51006b0b5bf6168394390c78072a1c0bb2b02f28" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fprometheus-metrics/-/1.1.4/prometheus-metrics-1.1.4.tgz#51006b0b5bf6168394390c78072a1c0bb2b02f28"
@ -418,23 +448,23 @@
it-stream-types "^1.0.4" it-stream-types "^1.0.4"
promjs "^0.4.2" promjs "^0.4.2"
"@cerc-io/rpc-eth-client@^0.2.82": "@cerc-io/rpc-eth-client@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.82/rpc-eth-client-0.2.82.tgz#44d58f22f8375adf4bf167a314691368cfa74b06" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.83/rpc-eth-client-0.2.83.tgz#ee49baef3a3f0c142de7320e4e2ee12998c6d142"
integrity sha512-ndMkbOORQ6qs8zi+yIOU3btTXC1aVjzg+pCtNR62ieVZDJYTCXCD6kmZB4vx340PHnH2f5+51N9n/icY6CU0pQ== integrity sha512-lVInLT3dERd4y+Mmb4ocjRsDSjvkjypC7+lo0ytn5k+d+wogIv2BsZd+ZI1PKTN1TUwqnPy0m815Egn5/PMvsQ==
dependencies: dependencies:
"@cerc-io/cache" "^0.2.82" "@cerc-io/cache" "^0.2.83"
"@cerc-io/ipld-eth-client" "^0.2.82" "@cerc-io/ipld-eth-client" "^0.2.83"
"@cerc-io/util" "^0.2.82" "@cerc-io/util" "^0.2.83"
chai "^4.3.4" chai "^4.3.4"
ethers "^5.4.4" ethers "^5.4.4"
left-pad "^1.3.0" left-pad "^1.3.0"
mocha "^8.4.0" mocha "^8.4.0"
"@cerc-io/solidity-mapper@^0.2.82": "@cerc-io/solidity-mapper@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.82/solidity-mapper-0.2.82.tgz#1ba9d41ac28c1963748d198bf400bae98e156342" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.83/solidity-mapper-0.2.83.tgz#f3a732696e72604e58444723229bf0da78f925e3"
integrity sha512-braGSAB+iuIwwnpBWuSUtw0bhSEFMKKE6cYMr0O6Aj3NVLowmjrENKqCYDG6XwRpUKZheAgUUd8GJ5Dush412Q== integrity sha512-3U6MJejvvUWzpbnsOTdKciKapSxzF0BuwlSrwaXJQKskbS5dIV2Jk1bsfogCokc86PrBxjusV4UNh8HohHbbmA==
dependencies: dependencies:
dotenv "^10.0.0" dotenv "^10.0.0"
@ -443,15 +473,15 @@
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" 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"
integrity sha512-2jFICUSyffuZ+8+qRhXuLSJq4GJ6Y02wxiXoubH0Kzv2lIKkJtWICY1ZQQhtXAvP0ncAQB85WJHqtqwH8l7J3Q== integrity sha512-2jFICUSyffuZ+8+qRhXuLSJq4GJ6Y02wxiXoubH0Kzv2lIKkJtWICY1ZQQhtXAvP0ncAQB85WJHqtqwH8l7J3Q==
"@cerc-io/util@^0.2.82": "@cerc-io/util@^0.2.83":
version "0.2.82" version "0.2.83"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.82/util-0.2.82.tgz#aa0646bd4276ac5afa6789459eb78b88a4f170a5" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.83/util-0.2.83.tgz#747813a51569dee7465ed1bfb4ac3d4ecdf99eb4"
integrity sha512-rqcc5k7KEb261vxuNRD/+agYvp1CJjhWFohNGroxpQcP6be21PRh/Evm2wdqYq75GgN9suQooCdmsXsdXlMgXA== integrity sha512-6ZqIH1pUq1MWDXf2psXJvKhAWojtXWGFwXCHxF7pi68IjMqMQxXVpk/eZzympBsWQhzvl6IPH8JShJTTxK5ybQ==
dependencies: dependencies:
"@apollo/utils.keyvaluecache" "^1.0.1" "@apollo/utils.keyvaluecache" "^1.0.1"
"@cerc-io/nitro-node" "^0.1.15" "@cerc-io/nitro-node" "^0.1.15"
"@cerc-io/peer" "^0.2.82" "@cerc-io/peer" "^0.2.83"
"@cerc-io/solidity-mapper" "^0.2.82" "@cerc-io/solidity-mapper" "^0.2.83"
"@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1" "@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1"
"@ethersproject/properties" "^5.7.0" "@ethersproject/properties" "^5.7.0"
"@ethersproject/providers" "^5.4.4" "@ethersproject/providers" "^5.4.4"