nimbus-eth1/tests/graphql/queries.toml

547 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":"Withdrawal"},
{"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 = """
{
chainID
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
baseFeePerGas
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 = """
{
"chainID":"0x1",
"block":{
"__typename":"Block",
"number":"0x3",
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1",
"parent":{
"__typename":"Block",
"number":"0x2"
},
"nonce":"0x0000000000000000",
"transactionsRoot":"0x8c8775e959d553f9f991a21a8502dbe6819c53c518711f2cbbbd7ed998f65647",
"transactionCount":"0x1",
"stateRoot":"0x81b1df384897709e96a4b6319fda4e8f7682a1c9d753b1fb772ed4fb19f1e443",
"receiptsRoot":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
"miner":{
"__typename":"Account",
"address":"0x8888f1f195afa192cfee860698584c030f4c9db1",
"balance":"0x542253a12a8f8dc0",
"transactionCount":"0x0",
"code":"0x",
"storage":"0x0000000000000000000000000000000000000000000000000000000000000000"
},
"extraData":"0x42",
"gasLimit":"0x2fefd8",
"baseFeePerGas":null,
"gasUsed":"0x5208",
"timestamp":"0x54c99839",
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"difficulty":"0x20000",
"totalDifficulty":"0x80000",
"ommerCount":"0x1",
"ommers":[
{
"__typename":"Block",
"hash":"0x04ce5bd77e7ea5b155978bea58e4f82b52b70a1efedf960b3c4aa9f87aba4b43"
}
],
"ommerAt":{
"__typename":"Block",
"hash":"0x04ce5bd77e7ea5b155978bea58e4f82b52b70a1efedf960b3c4aa9f87aba4b43"
},
"nullOmmer":null,
"ommerHash":"0x0887ea790d755abdba5bfd980ea54ba4e390f4da120406ee6db4a8eddeaffeb8",
"account":{
"__typename":"Account",
"address":"0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"balance":"0x1e",
"transactionCount":"0x0",
"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
}
maxFeePerGas
maxPriorityFeePerGas
effectiveGasPrice
chainID
}
transactionAt(index: 0) {
__typename
}
}
}
"""
result = """
{
"block":{
"transactions":[
{
"__typename":"Transaction",
"hash":"0xbb8e2ffb7276bc688c0305d5c35ae219cf036ac7a3b058ffa9d32275cc75f31b",
"nonce":"0x0",
"index":"0x0",
"from":{
"__typename":"Account",
"address":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
},
"to":{
"__typename":"Account",
"address":"0x095e7baea6a6c7c4c2dfeb977efac326af552d87"
},
"value":"0xa",
"gasPrice":"0x3e8",
"gas":"0x4cb2f",
"inputData":"0x",
"block":{
"__typename":"Block",
"number":"0x1"
},
"status":"0x1",
"gasUsed":"0x5208",
"cumulativeGasUsed":"0x5208",
"createdContract":null,
"logs":[],
"r":"0x25d49a54362b5ae38cf895fa9a1d3ded6f7d5577e572c9a93cdebff6e33ceaf7",
"s":"0x773806df18e22db29acde1dd96c0418e28738af7f520e5e2c5c673494029e5",
"v":"0x1b",
"type":"0x0",
"accessList":null,
"maxFeePerGas":null,
"maxPriorityFeePerGas":null,
"effectiveGasPrice":"0x3e8",
"chainID":null
}
],
"transactionAt":{
"__typename":"Transaction"
}
}
}
"""
[[units]]
name = "query.block(hash)"
code = """
{
block(hash: "0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1") {
__typename
hash
number
}
}
"""
result = """
{
"block":{
"__typename":"Block",
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1",
"number":"0x3"
}
}
"""
[[units]]
name = "query.block(empty)"
code = """
{
block {
__typename
hash
number
}
}
"""
result = """
{
"block":{
"__typename":"Block",
"hash":"0x72d69cc3c74c2740c27f4becae6c9f9fc524c702a9a48d23c564b13dce5fe0a1",
"number":"0x3"
}
}
"""
[[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":"0x0",
"currentBlock":"0x3",
"highestBlock":"0x0",
"pulledStates":null,
"knownStates":null
}
}
"""
[[units]]
name = "query.blocks"
code = """
{
blocks(from: 0) {
__typename
number
hash
}
}
"""
result = """
{
"blocks":[
{
"__typename":"Block",
"number":"0x0",
"hash":"0x2b253498ad5e63a16978753398bad1fde371a3e513438297b52d65dc98e1db29"
},
{
"__typename":"Block",
"number":"0x1",
"hash":"0xa4b71270e83c38d941d61fc2d8f3842f98a83203b82c3dea3176f1feb5a67b17"
},
{
"__typename":"Block",
"number":"0x2",
"hash":"0x579d2bdb721bde7a6bc56b53f4962a58493ee11482e8f738702ddb3d65888a74"
},
{
"__typename":"Block",
"number":"0x3",
"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":"0x5208"
}
}
"""
[[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":"0x5208",
"status":"0x1"
}
}
}
"""
[[units]]
name = "mutation.sendRawTransaction"
code = """
mutation {
sendRawTransaction(data: "0xf86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba077c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8a03f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288d")
}
"""
errors = ["[2, 3]: Fatal: Field 'sendRawTransaction' cannot be resolved: \"transaction rejected by txpool\": @[\"sendRawTransaction\"]"]
result = """null"""
[[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
}
}
"""