graphql: fix parameterized account fields and block logs#20539
Open
Keemosty12 wants to merge 5 commits into
Open
graphql: fix parameterized account fields and block logs#20539Keemosty12 wants to merge 5 commits into
Keemosty12 wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes several GraphQL fields that accept query arguments (e.g., block, filter) but were previously returning static struct data, ensuring nested account lookups and block-scoped log filtering resolve against the intended block context.
Changes:
- Forces resolvers for parameterized fields (
Block.logs(filter),Log.account(block),Transaction.from/to/createdContract(block),Block.miner(block), andBlock.account(address)), so arguments affect returned data. - Preserves block/transaction context on constructed models (
Transaction.Block,Log.Transaction, andBlock.Logs) to support nested resolution and filtering. - Adds unit tests covering block log filtering and block-aware account resolution.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/rpcdaemon/graphql/graph/schema.resolvers.go | Adds shared helpers and new resolvers for block/log/tx/account fields; threads block context through models and implements block log filtering. |
| cmd/rpcdaemon/graphql/graph/schema_resolvers_test.go | Adds resolver-focused tests for log filtering and block-aware account resolution via a mock GraphQLAPI. |
| cmd/rpcdaemon/graphql/graph/schema.graphqls | Adds @goField(forceResolver: true) on parameterized fields so gqlgen routes them through resolvers. |
| cmd/rpcdaemon/graphql/graph/generated.go | Regenerates gqlgen output to wire new resolver interfaces and resolver-based field execution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lupin012
reviewed
May 4, 2026
# Conflicts: # cmd/rpcdaemon/graphql/graph/generated.go # cmd/rpcdaemon/graphql/graph/schema.resolvers.go # cmd/rpcdaemon/graphql/graph/schema_resolvers_test.go
Author
|
Thanks for the detailed review — addressed in
On the N+1 concern: agreed. I kept eager account loading in this PR to keep scope focused on correctness/behavioral fixes. |
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.
Block.logs(filter),Log.account(block),Transaction.from(block),Transaction.to(block),Transaction.createdContract(block), andBlock.miner(block)through resolvers so query arguments affect the returned data.