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>
M
Maksim Dimitrov committed
3787b76971223de949d516f50700506ce71c2183
Parent: 7638f0a
Committed by GitHub <noreply@github.com>
on 4/1/2026, 9:45:27 AM