Commit 4b281ce
rpc/graphql: implement transaction resolver, fix Long scalar and pre-Byzantium status (#20916)
### New implementations
- `transaction(hash)`: implemented transaction lookup by hash (was
panicking)
- `block(hash)`: implemented block lookup by hash (was unimplemented)
- `block.transactionAt(index)`: implemented with proper bounds checking
(was panicking)
### Bug fixes
- `transaction.type`: changed schema from `Int` to `Long` so
EIP-1559/EIP-4844
transactions return `"0x2"` / `"0x3"` (hex) instead of `2` / `3`
(decimal),
matching the GraphQL spec
- `transaction.status`: pre-Byzantium blocks now correctly return
`"0x0"` instead
of `null` (pre-Byzantium receipts carry `PostState` instead of `Status`)
- `transaction.gas`, `transaction.maxFeePerGas`,
`transaction.maxPriorityFeePerGas`,
`transaction.accessList`: fields were missing from the receipt map and
are now
populated correctly
### Hive simulator fix
- Added `HIVE_CANCUN_TIMESTAMP` to the client environment map in the
GraphQL hive
simulator. Without it, Erigon rejected Cancun blocks during chain
import,
truncating the canonical chain at block 29 and causing ~10 tests to fail
(withdrawals, Shanghai/Cancun block queries, block range queries).
## Tests
- Added unit tests for the new `Long` scalar (marshal/unmarshal)
- Added unit tests for nil guards in the `convertData` helpers
- Added unit tests for `transactionAt` bounds checking
- Added unit tests for `transaction` invalid hash error handling
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>1 parent e4ed80c commit 4b281ce
12 files changed
Lines changed: 747 additions & 258 deletions
File tree
- cmd/rpcdaemon/graphql
- graph
- model
- scalar
- rpc/jsonrpc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
0 commit comments