nimbus-eth1/tests/graphql/queries.toml
Jamie Lokier 22241f3cff
GraphQL: Update protocolVersion expected result to hard-coded 65
Use a hard-coded number instead of the same expression as the client, so that
bugs introduced via that expression are detected.  Using the same expression as
the client can hide issues when the value is wrong in both places.

When the expected value genuinely changes, it'll be obvious.
Just change this number.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-07-27 14:12:48 +01:00

549 lines
11 KiB
TOML

[[units]]
name = "types introspection"
code = """
{
__schema {
types {
name
}
}
}
"""
result = """
{
"__schema":{
"types":[
{"name":"Log"},
{"name":"CallData"},
{"name":"SyncState"},
{"name":"BigInt"},
{"name":"Int"},
{"name":"Float"},
{"name":"Mutation"},
{"name":"Address"},
{"name":"Block"},
{"name":"CallResult"},
{"name":"Query"},
{"name":"Boolean"},
{"name":"FilterCriteria"},
{"name":"Bytes"},
{"name":"String"},
{"name":"Bytes32"},
{"name":"AccessTuple"},
{"name":"BlockFilterCriteria"},
{"name":"ID"},
{"name":"Pending"},
{"name":"Transaction"},
{"name":"Long"},
{"name":"Account"}
]
}
}
"""
[[units]]
name = "query.block(number)"
code = """
{
block(number: 3) {
__typename
number
hash
parent {
__typename
number
}
nonce
transactionsRoot
transactionCount
stateRoot
receiptsRoot
miner {
__typename
address
balance
transactionCount
code
storage(slot: "0x0000000000000000000000000000000000000000000000000000000000000000")
}
extraData
gasLimit
gasUsed
timestamp
logsBloom
mixHash
difficulty
totalDifficulty
ommerCount
ommers {
__typename
hash
}
ommerAt(index: 0) {
__typename
hash
}
nullOmmer: ommerAt(index: 1) {
__typename
hash
}
ommerHash
account(address:"0x095e7baea6a6c7c4c2dfeb977efac326af552d87") {
__typename
address
balance
transactionCount
code
storage(slot: "0x0000000000000000000000000000000000000000000000000000000000000000")
}
nullAccount: account(address:"0x095e7baea6a6c7c4c2dfeb977efac326af552000") {
__typename
}
}
}
"""
result = """
{
"block":{
"__typename":"Block",
"number":3,
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1",
"parent":{
"__typename":"Block",
"number":2
},
"nonce":"0x0000000000000000",
"transactionsRoot":"0x8c8775e959d553f9f991a21a8502dbe6819c53c518711f2cbbbd7ed998f65647",
"transactionCount":1,
"stateRoot":"0x81b1df384897709e96a4b6319fda4e8f7682a1c9d753b1fb772ed4fb19f1e443",
"receiptsRoot":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
"miner":{
"__typename":"Account",
"address":"0x8888f1f195afa192cfee860698584c030f4c9db1",
"balance":"0x542253a12a8f8dc0",
"transactionCount":0,
"code":"0x",
"storage":"0x0000000000000000000000000000000000000000000000000000000000000000"
},
"extraData":"0x42",
"gasLimit":3141592,
"gasUsed":21000,
"timestamp":"0x54c99839",
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"difficulty":"0x20000",
"totalDifficulty":"0x80000",
"ommerCount":1,
"ommers":[
{
"__typename":"Block",
"hash":"0x04ce5bd77e7ea5b155978bea58e4f82b52b70a1efedf960b3c4aa9f87aba4b43"
}
],
"ommerAt":{
"__typename":"Block",
"hash":"0x04ce5bd77e7ea5b155978bea58e4f82b52b70a1efedf960b3c4aa9f87aba4b43"
},
"nullOmmer":null,
"ommerHash":"0x0887ea790d755abdba5bfd980ea54ba4e390f4da120406ee6db4a8eddeaffeb8",
"account":{
"__typename":"Account",
"address":"0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"balance":"0x1e",
"transactionCount":0,
"code":"0x",
"storage":"0x0000000000000000000000000000000000000000000000000000000000000000"
},
"nullAccount":{"__typename":"Account"}
}
}
"""
[[units]]
name = "query.block(number) tx"
code = """
{
block(number: 1) {
transactions {
__typename
hash
nonce
index
from {
__typename
address
}
to {
__typename
address
}
value
gasPrice
gas
inputData
block {
__typename
number
}
status
gasUsed
cumulativeGasUsed
createdContract {
__typename
address
}
logs {
__typename
}
r
s
v
type
accessList {
address
storageKeys
}
}
transactionAt(index: 0) {
__typename
}
}
}
"""
result = """
{
"block":{
"transactions":[
{
"__typename":"Transaction",
"hash":"0xbb8e2ffb7276bc688c0305d5c35ae219cf036ac7a3b058ffa9d32275cc75f31b",
"nonce":0,
"index":0,
"from":{
"__typename":"Account",
"address":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
},
"to":{
"__typename":"Account",
"address":"0x095e7baea6a6c7c4c2dfeb977efac326af552d87"
},
"value":"0xa",
"gasPrice":"0x3e8",
"gas":314159,
"inputData":"0x",
"block":{
"__typename":"Block",
"number":1
},
"status":1,
"gasUsed":21000,
"cumulativeGasUsed":21000,
"createdContract":null,
"logs":[],
"r":"0x25d49a54362b5ae38cf895fa9a1d3ded6f7d5577e572c9a93cdebff6e33ceaf7",
"s":"0x773806df18e22db29acde1dd96c0418e28738af7f520e5e2c5c673494029e5",
"v":"0x1b",
"type":0,
"accessList":null
}
],
"transactionAt":{
"__typename":"Transaction"
}
}
}
"""
[[units]]
name = "query.block(hash)"
code = """
{
block(hash: "0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1") {
__typename
hash
number
}
}
"""
result = """
{
"block":{
"__typename":"Block",
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1",
"number":3
}
}
"""
[[units]]
name = "query.block(empty)"
code = """
{
block {
__typename
hash
number
}
}
"""
result = """
{
"block":{
"__typename":"Block",
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1",
"number":3
}
}
"""
[[units]]
name = "query.transaction"
code = """
{
transaction(hash: "0xbb8e2ffb7276bc688c0305d5c35ae219cf036ac7a3b058ffa9d32275cc75f31b") {
__typename
hash
value
}
}
"""
result = """
{
"transaction":{
"__typename":"Transaction",
"hash":"0xbb8e2ffb7276bc688c0305d5c35ae219cf036ac7a3b058ffa9d32275cc75f31b",
"value":"0xa"
}
}
"""
[[units]]
name = "query.gasPrice"
code = """
{
gasPrice
}
"""
result = """
{
"gasPrice":"0x3e8"
}
"""
[[units]]
name = "query.syncing"
code = """
{
syncing {
__typename
startingBlock
currentBlock
highestBlock
pulledStates
knownStates
}
}
"""
result = """
{
"syncing":{
"__typename":"SyncState",
"startingBlock":0,
"currentBlock":3,
"highestBlock":3,
"pulledStates":null,
"knownStates":null
}
}
"""
[[units]]
name = "query.blocks"
code = """
{
blocks(from: 0) {
__typename
number
hash
}
}
"""
result = """
{
"blocks":[
{
"__typename":"Block",
"number":0,
"hash":"0x2b253498ad5e63a16978753398bad1fde371a3e513438297b52d65dc98e1db29"
},
{
"__typename":"Block",
"number":1,
"hash":"0xa4b71270e83c38d941d61fc2d8f3842f98a83203b82c3dea3176f1feb5a67b17"
},
{
"__typename":"Block",
"number":2,
"hash":"0x579d2bdb721bde7a6bc56b53f4962a58493ee11482e8f738702ddb3d65888a74"
},
{
"__typename":"Block",
"number":3,
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1"
}
]
}
"""
[[units]]
name = "query.block(number) estimateGas"
code = """
{
block(number: 1) {
estimateGas(data: {
from: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
to: "0x095e7baea6a6c7c4c2dfeb977efac326af552d87"
gas: 500000
gasPrice: 123
value: 12345
})
}
}
"""
result = """
{
"block":{
"estimateGas":21000
}
}
"""
[[units]]
name = "query.block(number) call"
code = """
{
block(number: 1) {
call(data: {
from: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
to: "0x095e7baea6a6c7c4c2dfeb977efac326af552d87"
gas: 500000
gasPrice: 123
value: 12345
}) {
__typename
data
gasUsed
status
}
}
}
"""
result = """
{
"block":{
"call":{
"__typename":"CallResult",
"data":"0x",
"gasUsed":0,
"status":1
}
}
}
"""
[[units]]
name = "mutation.sendRawTransaction"
code = """
mutation {
sendRawTransaction(data: "0xf86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba077c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8a03f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288d")
}
"""
result = """
{
"sendRawTransaction":"0x4ffa559ae277813fb886d1fa8743a590ba6b699f9893de99f5d1bcea9620b278"
}
"""
[[units]]
name = "query.protocolVersion"
code = """
{
protocolVersion
}
"""
result = """
{
"protocolVersion":65
}
"""
[[units]]
name = "query.block(number) logs"
skip = true
code = """
{
block(number: 1) {
logs
}
}
"""
[[units]]
name = "query.logs"
skip = true
code = """
{
logs {
__typename
index
account
topics
data
transaction
}
}
"""
[[units]]
name = "query.pending"
skip = true
code = """
{
pending {
__typename
transactionCount
transactions
account
call
estimateGas
}
}
"""
[[units]]
name = "too complex eth api query"
code = """
{ block { transactions { block { transactions { block { number }}}}}}
"""
errors = ["[2, 1]: Fatal: Instrument Error: query complexity exceed max(200), got 204: @[]"]
result = """null"""
[[units]]
name = "too complex introspection query"
code = """
{ __schema { types { fields { type { fields { name }}}}}}
"""
errors = ["[2, 1]: Fatal: Instrument Error: query complexity exceed max(200), got 204: @[]"]
result = """null"""
[[units]]
name = "hex address is too long"
errors = ["[2, 11]: Error: 'address' got '\"0x095e7baea6a6c7c4c2dfeb977efac326af552d8700\"': Address len is too long: expect 42 got 44"]
code = """
{
account(address: "0x095e7baea6a6c7c4c2dfeb977efac326af552d8700") {
balance
}
}
"""