rpc/graphql: implement transaction resolver, fix Long scalar and pre-Byzantium status #20916
Merged
rpc/graphql: implement transaction resolver, fix Long scalar and pre-Byzantium status #20916
Conversation
…ium status - Implement queryResolver.Transaction (getTransaction by hash) - Implement queryResolver.Block hash path (getBlockByHash) - Add GetBlockDetailsByHash and GetBlockNumberForTx to GraphQLAPI - Change Transaction.type schema from Int to Long so EIP-1559 txns return "0x2" (hex) instead of 2 (decimal), matching the spec - Default status=0 for pre-Byzantium receipts (PostState path) - Add custom Long scalar with hex marshal/unmarshal - Add nil guards to all three convertData helpers - Refactor block/tx building into resolver_helpers.go - Pre-allocate Logs, Topics, Transactions, Ommers, Withdrawals slices - Add unit tests: scalar marshal/unmarshal, helper nil guards, TransactionAt bounds, Transaction invalid hash Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AskAlexSharov
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromInttoLongso EIP-1559/EIP-4844transactions return
"0x2"/"0x3"(hex) instead of2/3(decimal),matching the GraphQL spec
transaction.status: pre-Byzantium blocks now correctly return"0x0"insteadof
null(pre-Byzantium receipts carryPostStateinstead ofStatus)transaction.gas,transaction.maxFeePerGas,transaction.maxPriorityFeePerGas,transaction.accessList: fields were missing from the receipt map and are nowpopulated correctly
Hive simulator fix
HIVE_CANCUN_TIMESTAMPto the client environment map in the GraphQL hivesimulator. 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
Longscalar (marshal/unmarshal)convertDatahelperstransactionAtbounds checkingtransactioninvalid hash error handling