maticnetwork / bor

Official repository for the Polygon Blockchain
https://polygon.technology/
GNU Lesser General Public License v3.0
1k stars 489 forks source link

GraphQL reports panic on query transactions in all latest releases including 1.5.0-beta3 #1351

Open astudnev opened 1 week ago

astudnev commented 1 week ago

v1.5.0-beta3 has this issue, as well all previous v1.5X and 1.4.1 build

Example of query is:

  block(number: 62865016) {
    transactions {
      from {
        address
      }
      to {
        address
      }
      hash
      index
      gasUsed
    }
  }
}

returns error:

{"errors":[{"message":"panic occurred: runtime error: index out of range [9] with length 0","path":["block","transactions",9,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [7] with length 0","path":["block","transactions",7,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [5] with length 0","path":["block","transactions",5,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [2] with length 0","path":["block","transactions",2,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [8] with length 0","path":["block","transactions",8,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [1] with length 0","path":["block","transactions",1,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [0] with length 0","path":["block","transactions",0,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [4] with length 0","path":["block","transactions",4,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [3] with length 0","path":["block","transactions",3,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [6] with length 0","path":["block","transactions",6,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [10] with length 0","path":["block","transactions",10,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [19] with length 0","path":["block","transactions",19,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [11] with length 0","path":["block","transactions",11,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [12] with length 0","path":["block","transactions",12,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [13] with length 0","path":["block","transactions",13,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [14] with length 0","path":["block","transactions",14,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [15] with length 0","path":["block","transactions",15,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [16] with length 0","path":["block","transactions",16,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [17] with length 0","path":["block","transactions",17,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [18] with length 0","path":["block","transactions",18,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [28] with length 0","path":["block","transactions",28,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [20] with length 0","path":["block","transactions",20,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [21] with length 0","path":["block","transactions",21,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [31] with length 0","path":["block","transactions",31,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [22] with length 0","path":["block","transactions",22,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [23] with length 0","path":["block","transactions",23,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [24] with length 0","path":["block","transactions",24,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [25] with length 0","path":["block","transactions",25,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [26] with length 0","path":["block","transactions",26,"gasUsed"]},{"message":"panic occurred: runtime error: index out of range [27] with length 0","path":["block","transactions",27,"gasUsed"]},

and in logs:

graphql: panic occurred: runtime error: index out of range [24] with length 0
goroutine 1492143 [running]:
github.com/graph-gophers/graphql-go/log.(*DefaultLogger).LogPanic(0xc029211488?, {0x4382458, 0xc079d91b30}, {0x30339e0, 0xc060c0c708})
    /go/pkg/mod/github.com/graph-gophers/graphql-go@v1.5.0/log/log.go:21 +0x65
github.com/graph-gophers/graphql-go/internal/exec.execFieldSelection.func2.1()
    /go/pkg/mod/github.com/graph-gophers/graphql-go@v1.5.0/internal/exec/exec.go:187 +0x83
panic({0x30339e0?, 0xc060c0c708?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
github.com/ethereum/go-ethereum/graphql.(*Transaction).getReceipt(0xc08270e460, {0x4382458, 0xc079d91b30})
    /go/src/github.com/ethereum/go-ethereum/graphql/graphql.go:453 +0x86
github.com/ethereum/go-ethereum/graphql.(*Transaction).GasUsed(0x2?, {0x4382458?, 0xc079d91b30?})
    /go/src/github.com/ethereum/go-ethereum/graphql/graphql.go:469 +0x1d
reflect.Value.call({0x317d960?, 0xc07c3aa4c0?, 0x3293?}, {0x31fe463, 0x4}, {0xc03342df38, 0x1, 0x1?})
    /usr/local/go/src/reflect/value.go:596 +0xca6
reflect.Value.Call({0x317d960?, 0xc07c3aa4c0?, 0xc05eac0870?}, {0xc03342df38?, 0x31de9c0?, 0xc075b83580?})
    /usr/local/go/src/reflect/value.go:380 +0xb9
github.com/graph-gophers/graphql-go/internal/exec.execFieldSelection.func2(0xc077e1e900?, {0x4382458?, 0xc079d91b30?}, 0xc06333ea08, 0xc05c339380, 0xc029211eb8, {0x4382458, 0xc079d91b30})
    /go/pkg/mod/github.com/graph-gophers/graphql-go@v1.5.0/internal/exec/exec.go:211 +0x3fc
github.com/graph-gophers/graphql-go/internal/exec.execFieldSelection({0x4382458, 0xc079d91b30}, 0xc0808b3300, 0xc03f8eea50, 0xc05c339380, 0xc06333ea08, 0x1)
    /go/pkg/mod/github.com/graph-gophers/graphql-go@v1.5.0/internal/exec/exec.go:231 +0x1a5
github.com/graph-gophers/graphql-go/internal/exec.(*Request).execSelections.func1(0xc05c339380)
    /go/pkg/mod/github.com/graph-gophers/graphql-go@v1.5.0/internal/exec/exec.go:81 +0x1b2
created by github.com/graph-gophers/graphql-go/internal/exec.(*Request).execSelections in goroutine 1492138
    /go/pkg/mod/github.com/graph-gophers/graphql-go@v1.5.0/internal/exec/exec.go:77 +0x1af
astudnev commented 1 week ago

Possible cause of this reported in log:

context: context.Background.WithValue(type *http.contextKey, val <not Stringer>).WithValue(type *http.contextKey, val 192.168.5.212:8545).WithCancel.WithCancel.WithCancel
ERROR[10-10|12:16:36.999] Invalid receipt array RLP                hash=4442e8..c4cb37 err="rlp: too few elements for types.Log, decoding into ([]*types.ReceiptForStorage)[0](types.storedReceiptRLP).Logs[0]"

and the hash there is NOT the hash of the block i query, which is kind of strange