Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql queries do not work #1655

Open
roderik opened this issue Jun 23, 2023 · 0 comments
Open

Graphql queries do not work #1655

roderik opened this issue Jun 23, 2023 · 0 comments

Comments

@roderik
Copy link

roderik commented Jun 23, 2023

System information

Quorum version: 23.4.0
Geth version:

Geth
Version: 1.10.3-stable
Quorum Version: 23.4.0
Architecture: amd64
Network Id: 1337
Go Version: go1.19.7
Operating System: linux
GOPATH=
GOROOT=

OS & Version: Linux

Expected behaviour

When querying blocks with from to, if the "to" block is higher than the tip, the error below is thrown. It would be better to just return the blocks that are there in the range and not panic

Actual behaviour

{
  "errors": [
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        10,
        "number"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        10,
        "gasUsed"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        10,
        "gasLimit"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        10,
        "miner"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        10,
        "timestamp"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        11,
        "timestamp"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        11,
        "gasUsed"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        10,
        "hash"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        13,
        "timestamp"
      ]
    },
    {
      "message": "panic occurred: runtime error: invalid memory address or nil pointer dereference",
      "path": [
        "blocks",
        11,
        "miner"
      ]
    },
...

Steps to reproduce the behaviour

Start a new network, before you reach 10 blocks run

query listBlocks() {
      blocks(from: 1, to: 10) {
        number
        transactions {
          hash
        }
        timestamp
        gasUsed
        gasLimit
        hash
        miner {
          address
        }
        parent {
          hash
        }
      }
    }

-> crash

then run the same with a lower to e.g 4 and the call works

Backtrace

2023-06-23 16:46:46.012117 I | graphql: panic occurred: runtime error: invalid memory address or nil pointer dereference
goroutine 3589 [running]:
github.com/graph-gophers/graphql-go/log.(*DefaultLogger).LogPanic(0x0?, {0x19310e0?, 0xc00239cd80}, {0x145b9c0, 0x2292750})
    github.com/graph-gophers/graphql-go@v1.3.0/log/log.go:21 +0x65
github.com/graph-gophers/graphql-go/internal/exec.execFieldSelection.func2.1()
    github.com/graph-gophers/graphql-go@v1.3.0/internal/exec/exec.go:187 +0x89
panic({0x145b9c0, 0x2292750})
    runtime/panic.go:884 +0x212
github.com/ethereum/go-ethereum/graphql.(*Resolver).Blocks(0xc0005949e0, {0xc00238e9f0?, 0xc000927500?}, {0x0?, 0x0?})
    github.com/ethereum/go-ethereum/graphql/graphql.go:1076 +0x3e
reflect.Value.call({0x1575e80?, 0xc0005949e0?, 0x30?}, {0x1641f53, 0x4}, {0xc00239ce70, 0x2, 0x4ae2ae?})
    reflect/value.go:584 +0x8c5
reflect.Value.Call({0x1575e80?, 0xc0005949e0?, 0x13d62c0?}, {0xc00239ce70?, 0x1b?, 0x0?})
    reflect/value.go:368 +0xbc
github.com/graph-gophers/graphql-go/internal/exec.execFieldSelection.func2(0x203000?, {0x19310e0?, 0xc00239cd80?}, 0xc0023a0108, 0xc00239ad80, 0xc000eb9ec0, {0x19310e0?, 0xc00239ce40})
    github.com/graph-gophers/graphql-go@v1.3.0/internal/exec/exec.go:211 +0x4cb
github.com/graph-gophers/graphql-go/internal/exec.execFieldSelection({0x19310e0, 0xc00239cd80}, 0xc000514580, 0x475505?, 0xc00239ad80, 0xc001ad7768?, 0x1)
    github.com/graph-gophers/graphql-go@v1.3.0/internal/exec/exec.go:231 +0x1ce
github.com/graph-gophers/graphql-go/internal/exec.(*Request).execSelections.func1(0xc00239ad80)
    github.com/graph-gophers/graphql-go@v1.3.0/internal/exec/exec.go:81 +0x1b8
created by github.com/graph-gophers/graphql-go/internal/exec.(*Request).execSelections
    github.com/graph-gophers/graphql-go@v1.3.0/internal/exec/exec.go:77 +0x1d0

context: context.Background.WithValue(type *http.contextKey, val <not Stringer>).WithValue(type *http.contextKey, val 10.4.34.155:8545).WithCancel.WithCancel.WithValue(type rpc.securityContextKey, val <not Stringer>).WithValue(type rpc.securityContextKey, val private).

When submitting logs: please submit them as text and not screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant