Commit 3787b76
authored
Gnd test improvements (#6442)
* gnd: implement transaction receipt support for gnd test
Build mock receipts from block events and attach them to log triggers.
Events sharing the same txHash share a receipt whose logs contains all
their logs in declaration order; events without an explicit txHash each
get a unique auto-generated hash and their own single-log receipt.
Receipts are only attached to logs whose event selector (topic0) matches
a handler that declares receipt: true in the manifest, mirroring
production behaviour where graph-node only fetches receipts from the RPC
for those handlers. The selector is computed using the same normalisation
as graph-node's MappingEventHandler::topic0() to handle the manifest's
indexed-before-type convention (e.g. Transfer(indexed address,...)).
Most receipt fields (gas, from, to, status) are hardcoded stubs; only
receipt.logs reflects the actual test data.
* gnd: fix txHash deserialization in test schema
* gnd: add mock IPFS client for file data source testing
Replaces the dummy IpfsRpcClient with a MockIpfsClient that serves
pre-loaded CID → bytes from a "files" array in test JSON files.
Missing CIDs are reported with a clear error instead of a 60-second
timeout. Also adds IpfsResponse::for_test() helper and documents the
unmocked eth_call timeout in the troubleshooting guide.
* gnd: add mock Arweave resolver for file/arweave data source testing
Introduces `MockArweaveResolver` and the `arweaveFiles` schema field so
`gnd test` can serve pre-loaded Arweave content without hitting the
network. Unresolved tx IDs are collected and reported as a clear test
failure, mirroring the existing IPFS mock behaviour.
* gnd: add file data source tests and split fixture subgraphs
Add IPFS and Arweave file data source test fixtures and split the
monolithic gnd_test fixture into four focused subgraphs:
- token/ ERC20 events, eth_call mocking, dynamic templates
- blocks/ Block handlers (every, once, polling filters)
- receipts/ Transaction receipts (receipt: true handlers)
- file-data-sources/ IPFS and Arweave file data sources
Each fixture is a standalone subgraph with its own schema, mappings,
ABIs, and test JSON files. The Rust test harness is updated to use a
generic setup_fixture(name) helper, with one test function per fixture.
* gnd: trim verbose inline comments in test module
* gnd: replace eth_call cache with mock transport layer
Replace the pre-populated eth_call cache approach with a mock Alloy
transport that intercepts RPC calls at the transport level. This makes
tests exercise the real production code path end-to-end.
- Add MockTransport serving eth_call, eth_getBalance, eth_getCode
- Add TestRuntimeAdapterBuilder to convert PossibleReorg → Deterministic
- Add getBalanceCalls/hasCodeCalls to test JSON schema
- Unmocked RPC calls now fail immediately with descriptive errors
- Disable RPC retries in test mode for fast failure
* gnd: update test docs for mock transport and file data sources
- Document getBalanceCalls and hasCodeCalls mock fields
- Document IPFS and Arweave file data source mocking
- Update architecture section to describe mock transport
- Update troubleshooting for immediate unmocked call errors
- Update known limitations table
* gnd: Separate tests and fix retry count env var value
Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>
---------
Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>1 parent 7638f0a commit 3787b76
48 files changed
Lines changed: 2145 additions & 449 deletions
File tree
- gnd
- docs
- src
- commands/test
- tests
- fixtures/gnd_test
- blocks
- abis
- src
- tests
- file-data-sources
- abis
- src
- tests
- receipts
- abis
- src
- tests
- subgraph
- token
- abis
- src
- tests
- graph/src/ipfs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
147 | 199 | | |
148 | 200 | | |
149 | 201 | | |
| |||
309 | 361 | | |
310 | 362 | | |
311 | 363 | | |
312 | | - | |
| 364 | + | |
313 | 365 | | |
314 | 366 | | |
315 | 367 | | |
| |||
364 | 416 | | |
365 | 417 | | |
366 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
367 | 523 | | |
368 | 524 | | |
369 | 525 | | |
| |||
597 | 753 | | |
598 | 754 | | |
599 | 755 | | |
600 | | - | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
601 | 759 | | |
602 | | - | |
603 | | - | |
| 760 | + | |
| 761 | + | |
604 | 762 | | |
605 | 763 | | |
606 | 764 | | |
| |||
714 | 872 | | |
715 | 873 | | |
716 | 874 | | |
717 | | - | |
718 | | - | |
| 875 | + | |
719 | 876 | | |
720 | | - | |
721 | 877 | | |
722 | 878 | | |
723 | 879 | | |
| |||
740 | 896 | | |
741 | 897 | | |
742 | 898 | | |
743 | | - | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
744 | 902 | | |
745 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
746 | 908 | | |
747 | 909 | | |
748 | | - | |
749 | | - | |
750 | | - | |
| 910 | + | |
| 911 | + | |
751 | 912 | | |
752 | 913 | | |
753 | 914 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 82 | + | |
| 83 | + | |
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
| |||
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 132 | + | |
| 133 | + | |
141 | 134 | | |
142 | 135 | | |
143 | 136 | | |
| |||
162 | 155 | | |
163 | 156 | | |
164 | 157 | | |
165 | | - | |
| 158 | + | |
166 | 159 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 160 | + | |
172 | 161 | | |
173 | 162 | | |
174 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 66 | + | |
| 67 | + | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
76 | 73 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 74 | + | |
81 | 75 | | |
82 | 76 | | |
83 | 77 | | |
| |||
0 commit comments