From 29262a9d8f74660190f5b72a737931f589d4e5e9 Mon Sep 17 00:00:00 2001 From: Sebastian Lorenz Date: Tue, 26 Aug 2025 21:55:35 +0200 Subject: [PATCH] test: try to reproduce addresse string corruption --- pnpm-lock.yaml | 335 +++++++++++++++++- .../address-corruption/abis/Contract.abi | 33 ++ .../address-corruption/package.json | 13 + .../address-corruption/schema.graphql | 3 + .../address-corruption/src/mapping.ts | 13 + .../address-corruption/subgraph.yaml | 22 ++ tests/tests/integration_tests.rs | 39 ++ 7 files changed, 441 insertions(+), 17 deletions(-) create mode 100644 tests/integration-tests/address-corruption/abis/Contract.abi create mode 100644 tests/integration-tests/address-corruption/package.json create mode 100644 tests/integration-tests/address-corruption/schema.graphql create mode 100644 tests/integration-tests/address-corruption/src/mapping.ts create mode 100644 tests/integration-tests/address-corruption/subgraph.yaml diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9bc3c730543..45eee714f44 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,15 @@ importers: .: {} + tests/integration-tests/address-corruption: + devDependencies: + '@graphprotocol/graph-cli': + specifier: 0.97.1 + version: 0.97.1(@types/node@24.3.0)(bufferutil@4.0.9)(typescript@5.9.2)(utf-8-validate@5.0.10)(zod@3.25.76) + '@graphprotocol/graph-ts': + specifier: 0.37.0 + version: 0.37.0 + tests/integration-tests/base: devDependencies: '@graphprotocol/graph-cli': @@ -426,6 +435,11 @@ packages: engines: {node: '>=20.18.1'} hasBin: true + '@graphprotocol/graph-cli@0.97.1': + resolution: {integrity: sha512-j5dc2Tl694jMZmVQu8SSl5Yt3VURiBPgglQEpx30aW6UJ89eLR/x46Nn7S6eflV69fmB5IHAuAACnuTzo8MD0Q==} + engines: {node: '>=20.18.1'} + hasBin: true + '@graphprotocol/graph-ts@0.30.0': resolution: {integrity: sha512-h5tJqlsZXglGYM0PcBsBOqof4PT0Fr4Z3QBTYN/IjMF3VvRX2A8/bdpqaAnva+2N0uAfXXwRcwcOcW5O35yzXw==} @@ -444,6 +458,9 @@ packages: '@graphprotocol/graph-ts@0.36.0-alpha-20241129215038-b75cda9': resolution: {integrity: sha512-DPLx/owGh38n6HCQaxO6rk40zfYw3EYqSvyHp+s3ClMCxQET9x4/hberkOXrPaxxiPxgUTVa6ie4mwc7GTroEw==} + '@graphprotocol/graph-ts@0.37.0': + resolution: {integrity: sha512-3xp/sO8zFDBkX44ydGB87ow5Cyrfr/SAm/cWzIRzUVL7ROw0KUyFBG1xj4KKlMnAod7/RL99zChYquC15H4Oqg==} + '@inquirer/checkbox@4.2.1': resolution: {integrity: sha512-bevKGO6kX1eM/N+pdh9leS5L7TBF4ICrzi9a+cbWkrxeAeIcwlo/7OfWGCDERdRCI2/Q6tjltX4bt07ALHDwFw==} engines: {node: '>=18'} @@ -684,6 +701,10 @@ packages: resolution: {integrity: sha512-jHww7lIqyifamynDSjDNNjNOwFTQdKYeOSYaxUaoWhqXnRwacZ+pfUN4Y0L9lqSN4MQtlWM9mwnBD7FvlT9kPw==} engines: {node: '>=18.0.0'} + '@oclif/core@4.3.0': + resolution: {integrity: sha512-lIzHY+JMP6evrS5E/sGijNnwrCoNtGy8703jWXcMuPOYKiFhWoAqnIm1BGgoRgmxczkbSfRsHUL/lwsSgh74Lw==} + engines: {node: '>=18.0.0'} + '@oclif/core@4.5.2': resolution: {integrity: sha512-eQcKyrEcDYeZJKu4vUWiu0ii/1Gfev6GF4FsLSgNez5/+aQyAUCjg3ZWlurf491WiYZTXCWyKAxyPWk8DKv2MA==} engines: {node: '>=18.0.0'} @@ -990,6 +1011,11 @@ packages: resolution: {integrity: sha512-fwOQNZVTMga5KRsfY80g7cpOl4PsFQczMwHzdtgoqLXaYhkhavufKb0sB0l3T1DUxpAufA0KNhlbpuuhZUwxMA==} hasBin: true + assemblyscript@0.27.31: + resolution: {integrity: sha512-Ra8kiGhgJQGZcBxjtMcyVRxOEJZX64kd+XGpjWzjcjgxWJVv+CAQO0aDBk4GQVhjYbOkATarC83mHjAVGtwPBQ==} + engines: {node: '>=16', npm: '>=7'} + hasBin: true + assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} @@ -1057,6 +1083,10 @@ packages: resolution: {integrity: sha512-GCJBVB5exbxzzvyt8MGDv/MeUjs6gkXDvf4xOIItRBptYl0Tz5sm1o/uG95YK0L0VeG5ajDu3hRtkBP2kzqC5w==} hasBin: true + binaryen@116.0.0-nightly.20240114: + resolution: {integrity: sha512-0GZrojJnuhoe+hiwji7QFaL3tBlJoA+KFUN7ouYSDGZLSo9CKM8swQX8n/UcbR0d1VuZKU+nhogNzv423JEu5A==} + hasBin: true + bl@1.2.3: resolution: {integrity: sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==} @@ -1190,6 +1220,10 @@ packages: resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==} engines: {node: '>= 14.16.0'} + chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} + chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} @@ -1393,6 +1427,10 @@ packages: resolution: {integrity: sha512-VrkQJNafPQ5d6bGULW0P6KqcxSkv3ZU5Wn2wQA19oB71o7+55vQ9ogFe2MMeNbK+jc9rrKVy280DnHO5JLMWOQ==} engines: {node: '>= 6.0.0'} + docker-compose@1.2.0: + resolution: {integrity: sha512-wIU1eHk3Op7dFgELRdmOYlPYS4gP8HhH1ZmZa13QZF59y0fblzFDFmKPhyc05phCy2hze9OEvNZAsoljrs+72w==} + engines: {node: '>= 6.0.0'} + docker-modem@1.0.9: resolution: {integrity: sha512-lVjqCSCIAUDZPAZIeyM125HXfNvOmYYInciphNrLrylUtKyW66meAjSPXWchKVzoIYZx69TPnAepVSSkeawoIw==} engines: {node: '>= 0.8'} @@ -1615,6 +1653,10 @@ packages: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} + fs-extra@11.3.0: + resolution: {integrity: sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==} + engines: {node: '>=14.14'} + fs-extra@9.1.0: resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==} engines: {node: '>=10'} @@ -1672,6 +1714,11 @@ packages: engines: {node: 20 || >=22} hasBin: true + glob@11.0.2: + resolution: {integrity: sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -1758,9 +1805,6 @@ packages: resolution: {integrity: sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==} engines: {node: '>=4'} - hash.js@1.1.3: - resolution: {integrity: sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==} - hash.js@1.1.7: resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} @@ -1814,6 +1858,9 @@ packages: immutable@5.0.3: resolution: {integrity: sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==} + immutable@5.1.2: + resolution: {integrity: sha512-qHKXW1q6liAk1Oys6umoaZbDRqjcjgSrbnrifHsfsttza7zcvRAsL7mMV6xWcyhwQy7Xj5v4hhbr6b+iDYwlmQ==} + import-fresh@3.3.1: resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} engines: {node: '>=6'} @@ -2056,6 +2103,11 @@ packages: engines: {node: '>=8'} hasBin: true + jayson@4.2.0: + resolution: {integrity: sha512-VfJ9t1YLwacIubLhONk0KFeosUBwstRWQ0IRT1KDjEjnVnSOVHC3uwugyV7L0c7R9lpVyrUGT2XWiBA1UTtpyg==} + engines: {node: '>=8'} + hasBin: true + js-sha3@0.8.0: resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} @@ -2399,6 +2451,10 @@ packages: resolution: {integrity: sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==} engines: {node: '>=18'} + open@10.1.2: + resolution: {integrity: sha512-cxN6aIDPz6rm8hbebcP7vrQNhvRcveZoJU72Y7vskh4oIm+BZwBECnx5nTmrlres1Qapvx27Qo1Auukpf8PKXw==} + engines: {node: '>=18'} + open@8.4.2: resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} engines: {node: '>=12'} @@ -2514,6 +2570,11 @@ packages: engines: {node: '>=14'} hasBin: true + prettier@3.5.3: + resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} + engines: {node: '>=14'} + hasBin: true + process-nextick-args@2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} @@ -2680,6 +2741,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.7.2: + resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==} + engines: {node: '>=10'} + hasBin: true + set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} @@ -2749,6 +2815,12 @@ packages: engines: {node: '>=0.10.0'} hasBin: true + stream-chain@2.2.5: + resolution: {integrity: sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==} + + stream-json@1.9.1: + resolution: {integrity: sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==} + stream-to-it@0.2.4: resolution: {integrity: sha512-4vEbkSs83OahpmBybNJXlJd7d6/RxzkkSdT3I0mnGt79Xd2Kk+e1JqbvAvsQfCeKj3aKb0QIWkyK3/n0j506vQ==} @@ -2928,6 +3000,10 @@ packages: resolution: {integrity: sha512-WZkQ6eH9f5ZT93gaIffsbUaDpBwjbpvmMbfaEhOnbdUneurTESeRxwPGwjI28mRFESH3W3e8Togijh37ptOQqA==} engines: {node: '>=20.18.1'} + undici@7.9.0: + resolution: {integrity: sha512-e696y354tf5cFZPXsF26Yg+5M63+5H3oE6Vtkh2oqbvsE2Oe7s2nIbcQh5lmG7Lp/eS29vJtTpw9+p6PX0qNSg==} + engines: {node: '>=20.18.1'} + universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} @@ -3083,6 +3159,11 @@ packages: engines: {node: '>= 14'} hasBin: true + yaml@2.8.0: + resolution: {integrity: sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==} + engines: {node: '>= 14.6'} + hasBin: true + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} @@ -3569,6 +3650,42 @@ snapshots: - utf-8-validate - zod + '@graphprotocol/graph-cli@0.97.1(@types/node@24.3.0)(bufferutil@4.0.9)(typescript@5.9.2)(utf-8-validate@5.0.10)(zod@3.25.76)': + dependencies: + '@float-capital/float-subgraph-uncrashable': 0.0.0-internal-testing.5 + '@oclif/core': 4.3.0 + '@oclif/plugin-autocomplete': 3.2.34 + '@oclif/plugin-not-found': 3.2.65(@types/node@24.3.0) + '@oclif/plugin-warn-if-update-available': 3.1.46 + '@pinax/graph-networks-registry': 0.6.7 + '@whatwg-node/fetch': 0.10.10 + assemblyscript: 0.19.23 + chokidar: 4.0.3 + debug: 4.4.1(supports-color@8.1.1) + docker-compose: 1.2.0 + fs-extra: 11.3.0 + glob: 11.0.2 + gluegun: 5.2.0(debug@4.4.1) + graphql: 16.11.0 + immutable: 5.1.2 + jayson: 4.2.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) + js-yaml: 4.1.0 + kubo-rpc-client: 5.2.0(undici@7.9.0) + open: 10.1.2 + prettier: 3.5.3 + semver: 7.7.2 + tmp-promise: 3.0.3 + undici: 7.9.0 + web3-eth-abi: 4.4.1(typescript@5.9.2)(zod@3.25.76) + yaml: 2.8.0 + transitivePeerDependencies: + - '@types/node' + - bufferutil + - supports-color + - typescript + - utf-8-validate + - zod + '@graphprotocol/graph-ts@0.30.0': dependencies: assemblyscript: 0.19.10 @@ -3593,6 +3710,10 @@ snapshots: dependencies: assemblyscript: 0.19.10 + '@graphprotocol/graph-ts@0.37.0': + dependencies: + assemblyscript: 0.27.31 + '@inquirer/checkbox@4.2.1(@types/node@24.3.0)': dependencies: '@inquirer/core': 10.1.15(@types/node@24.3.0) @@ -3936,7 +4057,7 @@ snapshots: chalk: 4.1.2 clean-stack: 3.0.1 cli-progress: 3.12.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.1(supports-color@8.1.1) ejs: 3.1.10 fs-extra: 9.1.0 get-package-type: 0.1.0 @@ -3948,7 +4069,7 @@ snapshots: natural-orderby: 2.0.3 object-treeify: 1.1.33 password-prompt: 1.1.3 - semver: 7.4.0 + semver: 7.6.3 string-width: 4.2.3 strip-ansi: 6.0.1 supports-color: 8.1.1 @@ -3985,6 +4106,27 @@ snapshots: wordwrap: 1.0.0 wrap-ansi: 7.0.0 + '@oclif/core@4.3.0': + dependencies: + ansi-escapes: 4.3.2 + ansis: 3.17.0 + clean-stack: 3.0.1 + cli-spinners: 2.9.2 + debug: 4.4.1(supports-color@8.1.1) + ejs: 3.1.10 + get-package-type: 0.1.0 + globby: 11.1.0 + indent-string: 4.0.0 + is-wsl: 2.2.0 + lilconfig: 3.1.3 + minimatch: 9.0.5 + semver: 7.7.2 + string-width: 4.2.3 + supports-color: 8.1.1 + widest-line: 3.1.0 + wordwrap: 1.0.0 + wrap-ansi: 7.0.0 + '@oclif/core@4.5.2': dependencies: ansi-escapes: 4.3.2 @@ -4146,7 +4288,7 @@ snapshots: '@types/concat-stream@1.6.1': dependencies: - '@types/node': 8.10.66 + '@types/node': 24.3.0 '@types/connect@3.4.38': dependencies: @@ -4158,7 +4300,7 @@ snapshots: '@types/form-data@0.0.33': dependencies: - '@types/node': 8.10.66 + '@types/node': 24.3.0 '@types/long@4.0.2': {} @@ -4316,6 +4458,12 @@ snapshots: transitivePeerDependencies: - debug + apisauce@2.1.6(debug@4.4.1): + dependencies: + axios: 0.21.4(debug@4.4.1) + transitivePeerDependencies: + - debug + app-module-path@2.2.0: {} arg@4.1.3: {} @@ -4351,6 +4499,11 @@ snapshots: long: 5.3.2 source-map-support: 0.5.21 + assemblyscript@0.27.31: + dependencies: + binaryen: 116.0.0-nightly.20240114 + long: 5.3.2 + assert-plus@1.0.0: {} astral-regex@2.0.0: {} @@ -4381,6 +4534,12 @@ snapshots: transitivePeerDependencies: - debug + axios@0.21.4(debug@4.4.1): + dependencies: + follow-redirects: 1.15.11(debug@4.4.1) + transitivePeerDependencies: + - debug + axios@0.26.1(debug@4.3.7): dependencies: follow-redirects: 1.15.11(debug@4.3.7) @@ -4421,6 +4580,8 @@ snapshots: binaryen@102.0.0-nightly.20211028: {} + binaryen@116.0.0-nightly.20240114: {} + bl@1.2.3: dependencies: readable-stream: 2.3.8 @@ -4575,6 +4736,10 @@ snapshots: dependencies: readdirp: 4.1.2 + chokidar@4.0.3: + dependencies: + readdirp: 4.1.2 + chownr@1.1.4: {} chownr@2.0.0: {} @@ -4661,7 +4826,7 @@ snapshots: dependencies: cipher-base: 1.0.6 inherits: 2.0.4 - ripemd160: 2.0.1 + ripemd160: 2.0.2 sha.js: 2.4.12 create-hash@1.2.0: @@ -4759,7 +4924,7 @@ snapshots: dns-over-http-resolver@1.2.3(node-fetch@2.7.0(encoding@0.1.13)): dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.1(supports-color@8.1.1) native-fetch: 3.0.0(node-fetch@2.7.0(encoding@0.1.13)) receptacle: 1.3.2 transitivePeerDependencies: @@ -4778,6 +4943,10 @@ snapshots: dependencies: yaml: 2.6.1 + docker-compose@1.2.0: + dependencies: + yaml: 2.8.0 + docker-modem@1.0.9: dependencies: JSONStream: 1.3.2 @@ -5006,6 +5175,10 @@ snapshots: optionalDependencies: debug: 4.3.7(supports-color@8.1.1) + follow-redirects@1.15.11(debug@4.4.1): + optionalDependencies: + debug: 4.4.1(supports-color@8.1.1) + for-each@0.3.5: dependencies: is-callable: 1.2.7 @@ -5040,6 +5213,12 @@ snapshots: jsonfile: 6.2.0 universalify: 2.0.1 + fs-extra@11.3.0: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.2.0 + universalify: 2.0.1 + fs-extra@9.1.0: dependencies: at-least-node: 1.0.0 @@ -5106,6 +5285,15 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 2.0.0 + glob@11.0.2: + dependencies: + foreground-child: 3.3.1 + jackspeak: 4.1.1 + minimatch: 10.0.3 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 2.0.0 + glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -5236,6 +5424,41 @@ snapshots: transitivePeerDependencies: - debug + gluegun@5.2.0(debug@4.4.1): + dependencies: + apisauce: 2.1.6(debug@4.4.1) + app-module-path: 2.2.0 + cli-table3: 0.6.0 + colors: 1.4.0 + cosmiconfig: 7.0.1 + cross-spawn: 7.0.3 + ejs: 3.1.8 + enquirer: 2.3.6 + execa: 5.1.1 + fs-jetpack: 4.3.1 + lodash.camelcase: 4.3.0 + lodash.kebabcase: 4.1.1 + lodash.lowercase: 4.3.0 + lodash.lowerfirst: 4.3.1 + lodash.pad: 4.5.1 + lodash.padend: 4.6.1 + lodash.padstart: 4.6.1 + lodash.repeat: 4.1.0 + lodash.snakecase: 4.1.1 + lodash.startcase: 4.4.0 + lodash.trim: 4.5.1 + lodash.trimend: 4.5.1 + lodash.trimstart: 4.5.1 + lodash.uppercase: 4.3.0 + lodash.upperfirst: 4.3.1 + ora: 4.0.2 + pluralize: 8.0.0 + semver: 7.3.5 + which: 2.0.2 + yargs-parser: 21.1.1 + transitivePeerDependencies: + - debug + gopd@1.2.0: {} graceful-fs@4.2.10: {} @@ -5283,11 +5506,6 @@ snapshots: readable-stream: 3.6.2 safe-buffer: 5.2.1 - hash.js@1.1.3: - dependencies: - inherits: 2.0.4 - minimalistic-assert: 1.0.1 - hash.js@1.1.7: dependencies: inherits: 2.0.4 @@ -5301,7 +5519,7 @@ snapshots: hmac-drbg@1.0.1: dependencies: - hash.js: 1.1.3 + hash.js: 1.1.7 minimalistic-assert: 1.0.1 minimalistic-crypto-utils: 1.0.1 @@ -5349,6 +5567,8 @@ snapshots: immutable@5.0.3: {} + immutable@5.1.2: {} + import-fresh@3.3.1: dependencies: parent-module: 1.0.1 @@ -5396,7 +5616,7 @@ snapshots: any-signal: 2.1.2 blob-to-it: 1.0.4 browser-readablestream-to-it: 1.0.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.1(supports-color@8.1.1) err-code: 3.0.1 ipfs-core-types: 0.9.0(node-fetch@2.7.0(encoding@0.1.13)) ipfs-unixfs: 6.0.9 @@ -5425,7 +5645,7 @@ snapshots: '@ipld/dag-pb': 2.1.18 abort-controller: 3.0.0 any-signal: 2.1.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.4.1(supports-color@8.1.1) err-code: 3.0.1 ipfs-core-types: 0.9.0(node-fetch@2.7.0(encoding@0.1.13)) ipfs-core-utils: 0.13.0(encoding@0.1.13)(node-fetch@2.7.0(encoding@0.1.13)) @@ -5658,6 +5878,24 @@ snapshots: - bufferutil - utf-8-validate + jayson@4.2.0(bufferutil@4.0.9)(utf-8-validate@5.0.10): + dependencies: + '@types/connect': 3.4.38 + '@types/node': 12.20.55 + '@types/ws': 7.4.7 + commander: 2.20.3 + delay: 5.0.0 + es6-promisify: 5.0.0 + eyes: 0.1.8 + isomorphic-ws: 4.0.1(ws@7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10)) + json-stringify-safe: 5.0.1 + stream-json: 1.9.1 + uuid: 8.3.2 + ws: 7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + js-sha3@0.8.0: {} js-tokens@4.0.0: {} @@ -5742,6 +5980,44 @@ snapshots: transitivePeerDependencies: - undici + kubo-rpc-client@5.2.0(undici@7.9.0): + dependencies: + '@ipld/dag-cbor': 9.2.4 + '@ipld/dag-json': 10.2.5 + '@ipld/dag-pb': 4.1.5 + '@libp2p/crypto': 5.1.7 + '@libp2p/interface': 2.10.5 + '@libp2p/logger': 5.1.21 + '@libp2p/peer-id': 5.1.8 + '@multiformats/multiaddr': 12.5.1 + '@multiformats/multiaddr-to-uri': 11.0.2 + any-signal: 4.1.1 + blob-to-it: 2.0.10 + browser-readablestream-to-it: 2.0.10 + dag-jose: 5.1.1 + electron-fetch: 1.9.1 + err-code: 3.0.1 + ipfs-unixfs: 11.2.5 + iso-url: 1.2.1 + it-all: 3.0.9 + it-first: 3.0.9 + it-glob: 3.0.4 + it-last: 3.0.9 + it-map: 3.1.4 + it-peekable: 3.0.8 + it-to-stream: 1.0.0 + merge-options: 3.0.4 + multiformats: 13.4.0 + nanoid: 5.1.5 + native-fetch: 4.0.2(undici@7.9.0) + parse-duration: 2.1.4 + react-native-fetch-api: 3.0.0 + stream-to-it: 1.0.1 + uint8arrays: 5.1.0 + wherearewe: 2.0.1 + transitivePeerDependencies: + - undici + lilconfig@3.1.3: {} lines-and-columns@1.2.4: {} @@ -5925,6 +6201,10 @@ snapshots: dependencies: undici: 7.1.1 + native-fetch@4.0.2(undici@7.9.0): + dependencies: + undici: 7.9.0 + natural-orderby@2.0.3: {} node-addon-api@2.0.2: {} @@ -5973,6 +6253,13 @@ snapshots: is-inside-container: 1.0.0 is-wsl: 3.1.0 + open@10.1.2: + dependencies: + default-browser: 5.2.1 + define-lazy-prop: 3.0.0 + is-inside-container: 1.0.0 + is-wsl: 3.1.0 + open@8.4.2: dependencies: define-lazy-prop: 2.0.0 @@ -6077,6 +6364,8 @@ snapshots: prettier@3.4.2: {} + prettier@3.5.3: {} + process-nextick-args@2.0.1: {} progress-events@1.0.1: {} @@ -6277,6 +6566,8 @@ snapshots: semver@7.6.3: {} + semver@7.7.2: {} + set-function-length@1.2.2: dependencies: define-data-property: 1.1.4 @@ -6363,6 +6654,12 @@ snapshots: safer-buffer: 2.1.2 tweetnacl: 0.14.5 + stream-chain@2.2.5: {} + + stream-json@1.9.1: + dependencies: + stream-chain: 2.2.5 + stream-to-it@0.2.4: dependencies: get-iterator: 1.0.2 @@ -6577,6 +6874,8 @@ snapshots: undici@7.1.1: {} + undici@7.9.0: {} + universalify@2.0.1: {} uri-js@4.4.1: @@ -6749,6 +7048,8 @@ snapshots: yaml@2.6.1: {} + yaml@2.8.0: {} + yargs-parser@21.1.1: {} yn@3.1.1: {} diff --git a/tests/integration-tests/address-corruption/abis/Contract.abi b/tests/integration-tests/address-corruption/abis/Contract.abi new file mode 100644 index 00000000000..02da1a9e7f3 --- /dev/null +++ b/tests/integration-tests/address-corruption/abis/Contract.abi @@ -0,0 +1,33 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "x", + "type": "uint16" + } + ], + "name": "Trigger", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "x", + "type": "uint16" + } + ], + "name": "emitTrigger", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/tests/integration-tests/address-corruption/package.json b/tests/integration-tests/address-corruption/package.json new file mode 100644 index 00000000000..e110a6cf653 --- /dev/null +++ b/tests/integration-tests/address-corruption/package.json @@ -0,0 +1,13 @@ +{ + "name": "address-corruption", + "version": "0.0.0", + "private": true, + "scripts": { + "codegen": "graph codegen --skip-migrations", + "deploy:test": "graph deploy test/address-corruption --version-label v0.0.1 --ipfs $IPFS_URI --node $GRAPH_NODE_ADMIN_URI" + }, + "devDependencies": { + "@graphprotocol/graph-cli": "0.97.1", + "@graphprotocol/graph-ts": "0.37.0" + } +} diff --git a/tests/integration-tests/address-corruption/schema.graphql b/tests/integration-tests/address-corruption/schema.graphql new file mode 100644 index 00000000000..ccab2b06503 --- /dev/null +++ b/tests/integration-tests/address-corruption/schema.graphql @@ -0,0 +1,3 @@ +type AddressTest @entity(immutable: true) { + id: ID! +} diff --git a/tests/integration-tests/address-corruption/src/mapping.ts b/tests/integration-tests/address-corruption/src/mapping.ts new file mode 100644 index 00000000000..f5062e1e20f --- /dev/null +++ b/tests/integration-tests/address-corruption/src/mapping.ts @@ -0,0 +1,13 @@ +import { Address, log } from '@graphprotocol/graph-ts' +import { Trigger } from "../generated/Contract/Contract" + +export function handleTrigger(_: Trigger): void { + log.info("ADDRESS CORRUPTION TEST - ADDRESS: {}", ["0x3b44b2a187a7b3824131f8db5a74194d0a42fc15"]) + log.info("ADDRESS CORRUPTION TEST - LENGTH: {}", ["0x3b44b2a187a7b3824131f8db5a74194d0a42fc15".length.toString()]) + + // This call should fail with: "Failed to convert string to Address/H160: '': Invalid input length" + let address = Address.fromString("0x3b44b2a187a7b3824131f8db5a74194d0a42fc15") + + // If we reach here, the bug is not reproduced + log.info("ADDRESS CORRUPTION TEST - ALL GOOD: {}", [address.toHexString()]) +} diff --git a/tests/integration-tests/address-corruption/subgraph.yaml b/tests/integration-tests/address-corruption/subgraph.yaml new file mode 100644 index 00000000000..22da548d258 --- /dev/null +++ b/tests/integration-tests/address-corruption/subgraph.yaml @@ -0,0 +1,22 @@ +specVersion: 0.0.4 +schema: + file: ./schema.graphql +dataSources: + - kind: ethereum/contract + name: Contract + network: test + source: + abi: Contract + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + abis: + - name: Contract + file: ./abis/Contract.abi + entities: + - AddressTest + eventHandlers: + - event: Trigger(uint16) + handler: handleTrigger + file: ./src/mapping.ts diff --git a/tests/tests/integration_tests.rs b/tests/tests/integration_tests.rs index ebec6fd8fc4..77616ee38fe 100644 --- a/tests/tests/integration_tests.rs +++ b/tests/tests/integration_tests.rs @@ -1086,6 +1086,44 @@ async fn wait_for_blockchain_block(block_number: i32) -> bool { false } +async fn test_address_corruption(ctx: TestContext) -> anyhow::Result<()> { + let subgraph = ctx.subgraph; + assert!(subgraph.healthy); + + // Read the graph-node.log file to analyze the actual log output + let file = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("integration-tests") + .join("graph-node.log"); + let log = std::fs::read_to_string(&file) + .with_context(|| format!("Failed to read log file: {}", file.display()))?; + + const ADDRESS: &str = "0x3b44b2a187a7b3824131f8db5a74194d0a42fc15"; + + // Ensure our test actually ran with the specific problematic address + assert!( + log.contains(&format!("ADDRESS CORRUPTION TEST - ADDRESS: {}", ADDRESS)), + "Missing expected test log output" + ); + assert!( + log.contains("ADDRESS CORRUPTION TEST - LENGTH: 42"), + "Missing expected test log output" + ); + + // Assert that the test completed successfully with the parsed address (bug is not reproduced) + assert!( + log.contains(&format!("ADDRESS CORRUPTION TEST - ALL GOOD: {}", ADDRESS)), + "Missing expected test log output" + ); + + // Assert that the bug error is not present + assert!( + !log.contains("Failed to convert string to Address/H160: ''"), + "Detected string corruption bug in test log output" + ); + + Ok(()) +} + /// The main test entrypoint. #[tokio::test] async fn integration_tests() -> anyhow::Result<()> { @@ -1094,6 +1132,7 @@ async fn integration_tests() -> anyhow::Result<()> { let cases = vec![ TestCase::new("reverted-calls", test_reverted_calls_are_indexed), TestCase::new("host-exports", test_host_exports), + TestCase::new("address-corruption", test_address_corruption), TestCase::new("non-fatal-errors", test_non_fatal_errors), TestCase::new("overloaded-functions", test_overloaded_functions), TestCase::new("poi-for-failed-subgraph", test_poi_for_failed_subgraph),