diff --git a/execution_chain/config.nim b/execution_chain/config.nim index 55a4c6336..0a4f57a88 100644 --- a/execution_chain/config.nim +++ b/execution_chain/config.nim @@ -434,13 +434,13 @@ type of noCommand: httpPort* {. separator: "\pLOCAL SERVICES OPTIONS:" - desc: "Listening port of the HTTP server(rpc, ws, graphql)" + desc: "Listening port of the HTTP server(rpc, ws)" defaultValue: defaultHttpPort defaultValueDesc: $defaultHttpPort name: "http-port" }: Port httpAddress* {. - desc: "Listening IP address of the HTTP server(rpc, ws, graphql)" + desc: "Listening IP address of the HTTP server(rpc, ws)" defaultValue: defaultAdminListenAddress defaultValueDesc: $defaultAdminListenAddressDesc name: "http-address" }: IpAddress @@ -467,11 +467,6 @@ type defaultValueDesc: $RpcFlag.Eth name: "ws-api" }: seq[string] - graphqlEnabled* {. - desc: "Enable the GraphQL HTTP server" - defaultValue: false - name: "graphql" }: bool - engineApiEnabled* {. desc: "Enable the Engine API" defaultValue: false @@ -779,9 +774,7 @@ func shareServerWithEngineApi*(conf: NimbusConf): bool = conf.engineApiPort == conf.httpPort func httpServerEnabled*(conf: NimbusConf): bool = - conf.graphqlEnabled or - conf.wsEnabled or - conf.rpcEnabled + conf.wsEnabled or conf.rpcEnabled func era1Dir*(conf: NimbusConf): OutDir = conf.era1DirOpt.get(OutDir(conf.dataDir.string & "/era1")) diff --git a/execution_chain/graphql/ethapi.nim b/execution_chain/graphql/ethapi.nim deleted file mode 100644 index fa5671edc..000000000 --- a/execution_chain/graphql/ethapi.nim +++ /dev/null @@ -1,1447 +0,0 @@ -# nim-graphql -# Copyright (c) 2021-2025 Status Research & Development GmbH -# Licensed under either of -# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) -# * MIT license ([LICENSE-MIT](LICENSE-MIT)) -# at your option. -# This file may not be copied, modified, or distributed except according to -# those terms. - -import - std/[strutils], - stew/byteutils, stint, - results, - eth/common/transaction_utils, - chronos, - graphql, graphql/graphql as context, - graphql/common/types, graphql/httpserver, - graphql/instruments/query_complexity, - ../db/[ledger], - ../rpc/rpc_utils, - ".."/[transaction, evm/state, config, constants], - ../transaction/call_evm, - ../core/[tx_pool, tx_pool/tx_item], - ../core/chain/forked_chain, - ../common/common, - web3/eth_api_types - -from eth/p2p import EthereumNode -export httpserver - -type - EthTypes = enum - ethAccount = "Account" - ethLog = "Log" - ethTransaction = "Transaction" - ethBlock = "Block" - ethCallResult = "CallResult" - ethSyncState = "SyncState" - ethPending = "Pending" - ethQuery = "Query" - ethMutation = "Mutation" - ethAccessTuple = "AccessTuple" - ethWithdrawal = "Withdrawal" - - HeaderNode = ref object of Node - header: Header - - AccountNode = ref object of Node - address: Address - account: Account - db: LedgerRef - - TxNode = ref object of Node - tx: Transaction - index: uint64 - blockNumber: base.BlockNumber - receipt: Receipt - gasUsed: GasInt - baseFee: Opt[UInt256] - - LogNode = ref object of Node - log: Log - index: int - tx: TxNode - - AclNode = ref object of Node - acl: AccessPair - - WdNode = ref object of Node - wd: Withdrawal - - GraphqlContextRef = ref GraphqlContextObj - GraphqlContextObj = object of Graphql - ids: array[EthTypes, Name] - com: CommonRef - chainDB: CoreDbRef - ethNode: EthereumNode - txPool: TxPoolRef - chain: ForkedChainRef - -{.push gcsafe, raises: [].} -{.pragma: apiRaises, raises: [].} -{.pragma: apiPragma, cdecl, gcsafe, apiRaises.} - -proc toHash(n: Node): Hash32 {.gcsafe, raises: [ValueError].} = - Hash32.fromHex(n.stringVal) - -proc toBlockNumber(n: Node): base.BlockNumber {.gcsafe, raises: [ValueError].} = - if n.kind == nkInt: - result = parse(n.intVal, UInt256, radix = 10).truncate(base.BlockNumber) - elif n.kind == nkString: - result = parse(n.stringVal, UInt256, radix = 16).truncate(base.BlockNumber) - else: - doAssert(false, "unknown node type: " & $n.kind) - -proc headerNode(ctx: GraphqlContextRef, header: Header): Node = - HeaderNode( - kind: nkMap, - typeName: ctx.ids[ethBlock], - pos: Pos(), - header: header - ) - -proc accountNode(ctx: GraphqlContextRef, acc: Account, address: Address, db: LedgerRef): Node = - AccountNode( - kind: nkMap, - typeName: ctx.ids[ethAccount], - pos: Pos(), - account: acc, - address: address, - db: db - ) - -proc txNode(ctx: GraphqlContextRef, tx: Transaction, index: uint64, blockNumber: base.BlockNumber, baseFee: Opt[UInt256]): Node = - TxNode( - kind: nkMap, - typeName: ctx.ids[ethTransaction], - pos: Pos(), - tx: tx, - index: index, - blockNumber: blockNumber, - baseFee: baseFee - ) - -proc logNode(ctx: GraphqlContextRef, log: Log, index: int, tx: TxNode): Node = - LogNode( - kind: nkMap, - typeName: ctx.ids[ethLog], - pos: Pos(), - log: log, - index: index, - tx: tx - ) - -proc aclNode(ctx: GraphqlContextRef, accessPair: AccessPair): Node = - AclNode( - kind: nkMap, - typeName: ctx.ids[ethAccessTuple], - pos: Pos(), - acl: accessPair - ) - -proc wdNode(ctx: GraphqlContextRef, wd: Withdrawal): Node = - WdNode( - kind: nkMap, - typeName: ctx.ids[ethWithdrawal], - pos: Pos(), - wd: wd - ) - -proc getLedger(com: CommonRef, header: Header): LedgerRef {.deprecated: "LedgerRef does not support loading a particular state".} = - ## Retrieves the account db from canonical head - ## we don't use accounst_cache here because it's read only operations - # TODO the ledger initialized here refers to the base, not the given header! - LedgerRef.init(com.db.ctx.txFrameBegin(nil)) # TODO use frame from forkedchain! - -proc getBlockByNumber(ctx: GraphqlContextRef, number: Node): RespResult = - try: - let header = ?ctx.chain.headerByNumber(toBlockNumber(number)) - ok(headerNode(ctx, header)) - except ValueError as exc: - err(exc.msg) - -proc getBlockByNumber(ctx: GraphqlContextRef, number: base.BlockNumber): RespResult = - let header = ?ctx.chain.headerByNumber(number) - ok(headerNode(ctx, header)) - -proc getBlockByHash(ctx: GraphqlContextRef, hash: Node): RespResult = - try: - let header = ?ctx.chain.headerByHash(toHash(hash)) - ok(headerNode(ctx, header)) - except ValueError as exc: - err(exc.msg) - -proc getBlockByHash(ctx: GraphqlContextRef, hash: Hash32): RespResult = - let header = ?ctx.chain.headerByHash(hash) - ok(headerNode(ctx, header)) - -proc getLatestBlock(ctx: GraphqlContextRef): RespResult = - let header = ctx.chain.latestHeader - ok(headerNode(ctx, header)) - -proc getTxCount(ctx: GraphqlContextRef, txRoot: Hash32): RespResult = - # TODO forkedchain! - let txCount = ctx.chainDB.baseTxFrame().getTransactionCount(txRoot) - ok(resp(txCount)) - -proc longNode(val: uint64 | int64): RespResult = - ok(Node(kind: nkInt, intVal: $val, pos: Pos())) - -proc longNode(val: UInt256): RespResult = - ok(Node(kind: nkInt, intVal: val.toString, pos: Pos())) - -proc stripLeadingZeros(x: string): string = - strip(x, leading = true, trailing = false, chars = {'0'}) - -proc bigIntNode(val: UInt256): RespResult = - if val == 0.u256: - ok(Node(kind: nkString, stringVal: "0x0", pos: Pos())) - else: - let hex = stripLeadingZeros(val.toHex) - ok(Node(kind: nkString, stringVal: "0x" & hex, pos: Pos())) - -proc bigIntNode(x: uint64 | int64): RespResult = - # stdlib toHex is not suitable for hive - const - HexChars = "0123456789abcdef" - - if x == 0: - return ok(Node(kind: nkString, stringVal: "0x0", pos: Pos())) - - var - n = cast[uint64](x) - r: array[2*sizeof(uint64), char] - i = 0 - while n > 0: - r[i] = HexChars[int(n and 0xF)] - n = n shr 4 - inc i - var hex = newString(i+2) - hex[0] = '0' - hex[1] = 'x' - while i > 0: - hex[hex.len-i] = r[i-1] - dec i - ok(Node(kind: nkString, stringVal: hex, pos: Pos())) - -proc byte32Node(val: UInt256): RespResult = - ok(Node(kind: nkString, stringVal: "0x" & val.dumpHex, pos: Pos())) - -proc resp(hash: Hash32 | Bytes32): RespResult = - ok(resp(hash.to0xHex)) - -proc resp(data: openArray[byte]): RespResult = - ok(resp("0x" & data.toHex)) - -proc getTotalDifficulty(ctx: GraphqlContextRef, blockHash: Hash32): RespResult = - let score = getScore(ctx.chainDB.baseTxFrame(), blockHash).valueOr: - return err("can't get total difficulty") - - bigIntNode(score) - -proc getOmmerCount(ctx: GraphqlContextRef, ommersHash: Hash32): RespResult = - let ommers = ?ctx.chainDB.baseTxFrame().getUnclesCount(ommersHash) - ok(resp(ommers)) - -proc getOmmers(ctx: GraphqlContextRef, ommersHash: Hash32): RespResult = - let uncles = ?ctx.chainDB.baseTxFrame().getUncles(ommersHash) - when false: - # EIP 1767 says no ommers == null - # but hive test case want empty array [] - if uncles.len == 0: - return ok(respNull()) - var list = respList() - for n in uncles: - list.add headerNode(ctx, n) - ok(list) - -proc getOmmerAt(ctx: GraphqlContextRef, ommersHash: Hash32, index: int): RespResult = - let uncles = ?ctx.chainDB.baseTxFrame().getUncles(ommersHash) - if uncles.len == 0: - return ok(respNull()) - if index < 0 or index >= uncles.len: - return ok(respNull()) - ok(headerNode(ctx, uncles[index])) - -proc getTxs(ctx: GraphqlContextRef, header: Header): RespResult = - let txCount = getTransactionCount(ctx.chainDB.baseTxFrame(), header.txRoot) - if txCount == 0: - return ok(respNull()) - var list = respList() - var index = 0'u64 - - let txList = ?ctx.chainDB.baseTxFrame().getTransactions(header.txRoot) - for tx in txList: - list.add txNode(ctx, tx, index, header.number, header.baseFeePerGas) - inc index - - index = 0'u64 - var prevUsed = 0.GasInt - let receiptList = ?ctx.chainDB.baseTxFrame().getReceipts(header.receiptsRoot) - for r in receiptList: - let tx = TxNode(list.sons[index]) - tx.receipt = r - tx.gasUsed = r.cumulativeGasUsed - prevUsed - prevUsed = r.cumulativeGasUsed - inc index - - ok(list) - -proc getWithdrawals(ctx: GraphqlContextRef, header: Header): RespResult = - if header.withdrawalsRoot.isNone: - return ok(respNull()) - - let wds = ?ctx.chainDB.baseTxFrame().getWithdrawals(header.withdrawalsRoot.get) - var list = respList() - for wd in wds: - list.add wdNode(ctx, wd) - ok(list) - -proc getTxAt(ctx: GraphqlContextRef, header: Header, index: uint64): RespResult = - let tx = ctx.chainDB.baseTxFrame().getTransactionByIndex(header.txRoot, index.uint16).valueOr: - return ok(respNull()) - - let txn = txNode(ctx, tx, index, header.number, header.baseFeePerGas) - var i = 0'u64 - var prevUsed = 0.GasInt - let receiptList = ?ctx.chainDB.baseTxFrame().getReceipts(header.receiptsRoot) - for r in receiptList: - if i == index: - let tx = TxNode(txn) - tx.receipt = r - tx.gasUsed = r.cumulativeGasUsed - prevUsed - prevUsed = r.cumulativeGasUsed - inc i - ok(txn) - -proc getTxByHash(ctx: GraphqlContextRef, hash: Hash32): RespResult = - let - txKey = ?ctx.chainDB.baseTxFrame().getTransactionKey(hash) - header = ?ctx.chainDB.baseTxFrame().getBlockHeader(txKey.blockNumber) - getTxAt(ctx, header, txKey.index) - -proc accountNode(ctx: GraphqlContextRef, header: Header, address: Address): RespResult = - try: - let db = getLedger(ctx.com, header) - when false: - # EIP 1767 unclear about non existent account - # but hive test case demand something - if not db.accountExists(address): - return ok(respNull()) - let acc = db.getEthAccount(address) - ok(accountNode(ctx, acc, address, db)) - except RlpError as ex: - err(ex.msg) - -func hexCharToInt(c: char): uint64 = - case c - of 'a'..'f': return c.uint64 - 'a'.uint64 + 10'u64 - of 'A'..'F': return c.uint64 - 'A'.uint64 + 10'u64 - of '0'..'9': return c.uint64 - '0'.uint64 - else: doAssert(false, "invalid hex digit: " & $c) - -proc parseU64(node: Node): uint64 = - if node.kind == nkString: - if node.stringVal.len > 2 and node.stringVal[1] == 'x': - for i in 2.. expectedLen: - return err("$1 len is too long: expect $2 got $3" % - [kind, $expectedLen, $x.stringVal.len]) - - for i in prefixLen.. 2 and node.stringVal[1] == 'x': - if node.stringVal[0] != '0': - return err("Big Int hex malformed") - if node.stringVal.len > 66: - # 256 bits = 32 bytes = 64 hex nibbles - # 64 hex nibbles + '0x' prefix = 66 bytes - return err("Big Int hex should not exceed 66 bytes") - for i in 2.. 64: - return err("Big Int hex should not exceed 64 bytes") - for i in 0.. 2 and node.stringVal[1] == 'x': - let val = parse(node.stringVal, UInt256, radix = 16) - if val > maxU64: - return err("long value overflow") - ok(node) - else: - let val = parse(node.stringVal, UInt256, radix = 10) - if val > maxU64: - return err("long value overflow") - ok(Node(kind: nkString, pos: node.pos, stringVal: "0x" & val.toHex)) - of nkInt: - let val = parse(node.intVal, UInt256, radix = 10) - if val > maxU64: - return err("long value overflow") - ok(Node(kind: nkString, pos: node.pos, stringVal: "0x" & val.toHex)) - else: - err("expect int, but got '" & $node.kind & "'") - except CatchableError as e: - err("scalar Long error: " & e.msg) - -proc accountAddress(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acc = AccountNode(parent) - resp(acc.address.data) - -proc accountBalance(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acc = AccountNode(parent) - bigIntNode(acc.account.balance) - -proc accountTxCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acc = AccountNode(parent) - longNode(acc.account.nonce) - -proc accountCode(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acc = AccountNode(parent) - try: - let code = acc.db.getCode(acc.address) - resp(code.bytes()) - except RlpError as ex: - err(ex.msg) - -proc accountStorage(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acc = AccountNode(parent) - try: - let slot = parse(params[0].val.stringVal, UInt256, radix = 16) - let val = acc.db.getStorage(acc.address, slot) - byte32Node(val) - except RlpError as ex: - err(ex.msg) - except ValueError as ex: - err(ex.msg) - -const accountProcs = { - # Note: Need to define it as ResolverProc else a proc with noSideEffect is - # assumed and this fails for accountCode and accountStorage. - "address": ResolverProc accountAddress, - "balance": accountBalance, - "transactionCount": accountTxCount, - "code": accountCode, - "storage": accountStorage -} - -proc logIndex(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let log = LogNode(parent) - ok(resp(log.index)) - -proc logAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: with block param - let ctx = GraphqlContextRef(ud) - let log = LogNode(parent) - - let hres = ctx.getBlockByNumber(log.tx.blockNumber) - if hres.isErr: - return hres - let h = HeaderNode(hres.get()) - ctx.accountNode(h.header, log.log.address) - -proc logTopics(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let log = LogNode(parent) - var list = respList() - for n in log.log.topics: - list.add resp("0x" & n.toHex) - ok(list) - -proc logData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let log = LogNode(parent) - resp(log.log.data) - -proc logTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let log = LogNode(parent) - ok(cast[Node](log.tx)) - -const logProcs = { - "account": logAccount, - "index": logIndex, - "topics": logTopics, - "data": logData, - "transaction": logTransaction -} - -proc txHash(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let - tx = TxNode(parent) - txHash = rlpHash(tx.tx) # beware EIP-4844 - resp(txHash) - -proc txNonce(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - longNode(tx.tx.nonce) - -proc txIndex(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - ok(resp(tx.index.int)) - -proc txFrom(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let tx = TxNode(parent) - - let blockNumber = if params[0].val.kind != nkEmpty: - parseU64(params[0].val) - else: - tx.blockNumber - - let sender = tx.tx.recoverSender.valueOr: - return ok(respNull()) - let hres = ctx.getBlockByNumber(blockNumber) - if hres.isErr: - return hres - let h = HeaderNode(hres.get()) - ctx.accountNode(h.header, sender) - -proc txTo(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let tx = TxNode(parent) - - let blockNumber = if params[0].val.kind != nkEmpty: - parseU64(params[0].val) - else: - tx.blockNumber - - if tx.tx.contractCreation: - return ok(respNull()) - let hres = ctx.getBlockByNumber(blockNumber) - if hres.isErr: - return hres - let h = HeaderNode(hres.get()) - ctx.accountNode(h.header, tx.tx.to.get()) - -proc txValue(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - bigIntNode(tx.tx.value) - -proc txGasPrice(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.tx.txType >= TxEip1559: - if tx.baseFee.isNone: - return bigIntNode(tx.tx.gasPrice) - - let baseFee = tx.baseFee.get().truncate(GasInt) - let priorityFee = min(tx.tx.maxPriorityFeePerGas, tx.tx.maxFeePerGas - baseFee) - bigIntNode(priorityFee + baseFee) - else: - bigIntNode(tx.tx.gasPrice) - -proc txMaxFeePerGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.tx.txType >= TxEip1559: - bigIntNode(tx.tx.maxFeePerGas) - else: - ok(respNull()) - -proc txMaxPriorityFeePerGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.tx.txType >= TxEip1559: - bigIntNode(tx.tx.maxPriorityFeePerGas) - else: - ok(respNull()) - -proc txEffectiveGasPrice(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.baseFee.isNone: - return bigIntNode(tx.tx.gasPrice) - - let baseFee = tx.baseFee.get().truncate(GasInt) - let priorityFee = min(tx.tx.maxPriorityFeePerGas, tx.tx.maxFeePerGas - baseFee) - bigIntNode(priorityFee + baseFee) - -proc txChainId(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.tx.txType == TxLegacy: - ok(respNull()) - else: - longNode(tx.tx.chainId.uint64) - -proc txGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - longNode(tx.tx.gasLimit) - -proc txInputData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - resp(tx.tx.payload) - -proc txBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let tx = TxNode(parent) - ctx.getBlockByNumber(tx.blockNumber) - -proc txStatus(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.receipt.hasStatus: - longNode(tx.receipt.status.uint64) - else: - ok(respNull()) - -proc txGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - longNode(tx.gasUsed) - -proc txCumulativeGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - longNode(tx.receipt.cumulativeGasUsed) - -proc txCreatedContract(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let tx = TxNode(parent) - let sender = tx.tx.recoverSender.valueOr: - return err("can't calculate sender") - - if not tx.tx.contractCreation: - return ok(respNull()) - - let hres = getBlockByNumber(ctx, tx.blockNumber) - if hres.isErr: - return hres - let h = HeaderNode(hres.get()) - let contractAddress = generateAddress(sender, tx.tx.nonce) - ctx.accountNode(h.header, contractAddress) - -proc txLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let tx = TxNode(parent) - var list = respList() - for i, n in tx.receipt.logs: - list.add logNode(ctx, n, i, tx) - ok(list) - -proc txR(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - bigIntNode(tx.tx.R) - -proc txS(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - bigIntNode(tx.tx.S) - -proc txV(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - bigIntNode(tx.tx.V) - -proc txType(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - let typ = resp(ord(tx.tx.txType)) - ok(typ) - -proc txAccessList(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let tx = TxNode(parent) - if tx.tx.txType == TxLegacy: - ok(respNull()) - else: - var list = respList() - for x in tx.tx.accessList: - list.add aclNode(ctx, x) - ok(list) - -proc txMaxFeePerBlobGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.tx.txType < TxEip4844: - ok(respNull()) - else: - longNode(tx.tx.maxFeePerBlobGas) - -proc txVersionedHashes(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - if tx.tx.txType < TxEip4844: - ok(respNull()) - else: - var list = respList() - for hs in tx.tx.versionedHashes: - list.add resp("0x" & hs.data.toHex) - ok(list) - -proc txRaw(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - let txBytes = rlp.encode(tx.tx) - resp(txBytes) - -proc txRawReceipt(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let tx = TxNode(parent) - let recBytes = rlp.encode(tx.receipt) - resp(recBytes) - -const txProcs = { - "from": txFrom, - "hash": txHash, - "nonce": txNonce, - "index": txIndex, - "to": txTo, - "value": txValue, - "gasPrice": txGasPrice, - "gas": txGas, - "inputData": txInputData, - "block": txBlock, - "status": txStatus, - "gasUsed": txGasUsed, - "cumulativeGasUsed": txCumulativeGasUsed, - "createdContract": txCreatedContract, - "logs": txLogs, - "r": txR, - "s": txS, - "v": txV, - "type": txType, - "accessList": txAccessList, - "maxFeePerGas": txMaxFeePerGas, - "maxPriorityFeePerGas": txMaxPriorityFeePerGas, - "effectiveGasPrice": txEffectiveGasPrice, - "chainID": txChainId, - "maxFeePerBlobGas": txMaxFeePerBlobGas, - "versionedHashes": txVersionedHashes, - "raw": txRaw, - "rawReceipt": txRawReceipt -} - -proc aclAddress(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acl = AclNode(parent) - resp(acl.acl.address.data) - -proc aclStorageKeys(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let acl = AclNode(parent) - if acl.acl.storageKeys.len == 0: - ok(respNull()) - else: - var list = respList() - for n in acl.acl.storageKeys: - list.add resp(n.data).get() - ok(list) - -const aclProcs = { - "address": aclAddress, - "storageKeys": aclStorageKeys -} - -proc wdIndex(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let w = WdNode(parent) - longNode(w.wd.index) - -proc wdValidator(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let w = WdNode(parent) - longNode(w.wd.validatorIndex) - -proc wdAddress(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let w = WdNode(parent) - resp(w.wd.address.data) - -proc wdAmount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let w = WdNode(parent) - longNode(w.wd.amount) - -const wdProcs = { - "index": wdIndex, - "validator": wdValidator, - "address": wdAddress, - "amount": wdAmount -} - -proc blockNumberImpl(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - longNode(h.header.number) - -proc blockHashImpl(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - let hash = blockHash(h.header) - resp(hash) - -proc blockParent(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - getBlockByHash(ctx, h.header.parentHash) - -proc blockNonce(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - ok(resp("0x" & h.header.nonce.toHex)) - -proc blockTransactionsRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.txRoot) - -proc blockTransactionCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - ctx.getTxCount(h.header.txRoot) - -proc blockStateRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.stateRoot) - -proc blockReceiptsRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.receiptsRoot) - -proc blockMiner(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - ctx.accountNode(h.header, h.header.coinbase) - -proc blockExtraData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.extraData) - -proc blockGasLimit(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - longNode(h.header.gasLimit) - -proc blockGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - longNode(h.header.gasUsed) - -proc blockTimestamp(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - bigIntNode(h.header.timestamp.uint64) - -proc blockLogsBloom(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.logsBloom.data) - -proc blockMixHash(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.mixHash) - -proc blockDifficulty(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - bigIntNode(h.header.difficulty) - -proc blockTotalDifficulty(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - let hash = blockHash(h.header) - getTotalDifficulty(ctx, hash) - -proc blockOmmerCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - getOmmerCount(ctx, h.header.ommersHash) - -proc blockOmmers(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - getOmmers(ctx, h.header.ommersHash) - -proc blockOmmerAt(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - let index = parseU64(params[0].val) - getOmmerAt(ctx, h.header.ommersHash, index.int) - -proc blockOmmerHash(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - resp(h.header.ommersHash) - -proc blockTransactions(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - {.cast(noSideEffect).}: - getTxs(ctx, h.header) - -proc blockTransactionAt(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - try: - let index = parseU64(params[0].val) - {.cast(noSideEffect).}: - getTxAt(ctx, h.header, index) - except ValueError as ex: - err(ex.msg) - -proc blockLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc blockAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - try: - let address = Address.fromHex(params[0].val.stringVal) - ctx.accountNode(h.header, address) - except ValueError as ex: - err(ex.msg) - -const - fFrom = 0 - fTo = 1 - fGasLimit = 2 - fGasPrice = 3 - fMaxFee = 4 - fMaxPriorityFee = 5 - fValue = 6 - fData = 7 - -template isSome(n: Node, field: int): bool = - # [0] is the field's name node - # [1] is the field's value node - n[field][1].kind != nkEmpty - -template fieldString(n: Node, field: int): string = - n[field][1].stringVal - -template optionalAddress(dstField: untyped, n: Node, field: int) = - if isSome(n, field): - let address = addresses.Address.fromHex(fieldString(n, field)) - dstField = Opt.some(primitives.Address address.data) - -template optionalGasInt(dstField: untyped, n: Node, field: int) = - if isSome(n, field): - dstField = Opt.some(parseU64(n[field][1]).Quantity) - -template optionalGasHex(dstField: untyped, n: Node, field: int) = - if isSome(n, field): - let gas = parse(fieldString(n, field), UInt256, radix = 16) - dstField = Opt.some(gas.truncate(uint64).Quantity) - -template optionalHexU256(dstField: untyped, n: Node, field: int) = - if isSome(n, field): - dstField = Opt.some(parse(fieldString(n, field), UInt256, radix = 16)) - -template optionalBytes(dstField: untyped, n: Node, field: int) = - if isSome(n, field): - dstField = Opt.some(hexToSeqByte(fieldString(n, field))) - -proc toTxArgs(n: Node): TransactionArgs {.gcsafe, raises: [ValueError].} = - optionalAddress(result.`from`, n, fFrom) - optionalAddress(result.to, n, fTo) - optionalGasInt(result.gas, n, fGasLimit) - optionalGasHex(result.gasPrice, n, fGasPrice) - optionalGasHex(result.maxFeePerGas, n, fMaxFee) - optionalGasHex(result.maxPriorityFeePerGas, n, fMaxPriorityFee) - optionalHexU256(result.value, n, fValue) - optionalBytes(result.data, n, fData) - -proc makeCall(ctx: GraphqlContextRef, args: TransactionArgs, - header: Header): RespResult = - let - headerHash = header.blockHash - txFrame = ctx.chain.txFrame(headerHash) - res = rpcCallEvm(args, header, headerHash, ctx.com, txFrame).valueOr: - return err("Failed to call rpcCallEvm") - var map = respMap(ctx.ids[ethCallResult]) - map["data"] = resp("0x" & res.output.toHex) - map["gasUsed"] = longNode(res.gasUsed).get() - map["status"] = longNode(if res.isError: 0 else: 1).get() - ok(map) - -proc blockCall(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - let param = params[0].val - try: - let args = toTxArgs(param) - {.cast(noSideEffect).}: - ctx.makeCall(args, h.header) - except CatchableError as em: - err("call error: " & em.msg) - -proc blockEstimateGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - let param = params[0].val - try: - let - args = toTxArgs(param) - headerHash = h.header.blockHash - txFrame = ctx.chain.txFrame(headerHash) - # TODO: DEFAULT_RPC_GAS_CAP should configurable - {.cast(noSideEffect).}: - let gasUsed = rpcEstimateGas(args, h.header, headerHash, ctx.com, txFrame, DEFAULT_RPC_GAS_CAP).valueOr: - return err("Failed to call rpcEstimateGas") - longNode(gasUsed) - except CatchableError as em: - err("estimateGas error: " & em.msg) - -proc blockBaseFeePerGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - if h.header.baseFeePerGas.isSome: - bigIntNode(h.header.baseFeePerGas.get) - else: - ok(respNull()) - -proc blockWithdrawalsRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - if h.header.withdrawalsRoot.isSome: - resp(h.header.withdrawalsRoot.get) - else: - ok(respNull()) - -proc blockWithdrawals(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let h = HeaderNode(parent) - getWithdrawals(ctx, h.header) - -proc blockBlobGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - if h.header.blobGasUsed.isSome: - longNode(h.header.blobGasUsed.get) - else: - ok(respNull()) - -proc blockExcessBlobGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - if h.header.excessBlobGas.isSome: - longNode(h.header.excessBlobGas.get) - else: - ok(respNull()) - -proc blockParentBeaconBlockRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let h = HeaderNode(parent) - if h.header.parentBeaconBlockRoot.isSome: - resp(h.header.parentBeaconBlockRoot.get) - else: - ok(respNull()) - - -const blockProcs = { - "parent": blockParent, - "number": blockNumberImpl, - "hash": blockHashImpl, - "nonce": blockNonce, - "transactionsRoot": blockTransactionsRoot, - "transactionCount": blockTransactionCount, - "stateRoot": blockStateRoot, - "receiptsRoot": blockReceiptsRoot, - "miner": blockMiner, - "extraData": blockExtraData, - "gasLimit": blockGasLimit, - "gasUsed": blockGasUsed, - "timestamp": blockTimestamp, - "logsBloom": blockLogsBloom, - "mixHash": blockMixHash, - "difficulty": blockDifficulty, - "totalDifficulty": blockTotalDifficulty, - "ommerCount": blockOmmerCount, - "ommers": blockOmmers, - "ommerAt": blockOmmerAt, - "ommerHash": blockOmmerHash, - "transactions": blockTransactions, - "transactionAt": blockTransactionAt, - "logs": blockLogs, - "account": blockAccount, - "call": blockCall, - "estimateGas": blockEstimateGas, - "baseFeePerGas": blockBaseFeePerGas, - "withdrawalsRoot": blockWithdrawalsRoot, - "withdrawals": blockWithdrawals, - "blobGasUsed": blockBlobGasUsed, - "excessBlobGas": blockExcessBlobGas, - "parentBeaconBlockRoot": blockParentBeaconBlockRoot, -} - -proc callResultData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - ok(parent.map[0].val) - -proc callResultGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - ok(parent.map[1].val) - -proc callResultStatus(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - ok(parent.map[2].val) - -const callResultProcs = { - "data": callResultData, - "gasUsed": callResultGasUsed, - "status": callResultStatus -} - -proc syncStateStartingBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - longNode(ctx.com.syncStart) - -proc syncStateCurrentBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - longNode(ctx.com.syncCurrent) - -proc syncStateHighestBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - longNode(ctx.com.syncHighest) - -proc syncStatePulledStates(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: what is this ? - ok(respNull()) - -proc syncStateKnownStates(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: what is this ? - ok(respNull()) - -const syncStateProcs = { - "startingBlock": syncStateStartingBlock, - "currentBlock": syncStateCurrentBlock, - "highestBlock": syncStateHighestBlock, - "pulledStates": syncStatePulledStates, - "knownStates": syncStateKnownStates -} - -proc pendingTransactionCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc pendingTransactions(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc pendingAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc pendingCall(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc pendingEstimateGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -const pendingProcs = { - "transactionCount": pendingTransactionCount, - "transactions": pendingTransactions, - "account": pendingAccount, - "call": pendingCall, - "estimateGas": pendingEstimateGas -} - -proc pickBlockNumber(ctx: GraphqlContextRef, number: Node): base.BlockNumber = - if number.kind == nkEmpty: - ctx.com.syncCurrent - else: - parseU64(number) - -proc queryAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - try: - let address = Address.fromHex(params[0].val.stringVal) - let blockNumber = pickBlockNumber(ctx, params[1].val) - let hres = getBlockByNumber(ctx, blockNumber) - if hres.isErr: - return hres - let h = HeaderNode(hres.get()) - accountNode(ctx, h.header, address) - except ValueError as ex: - err(ex.msg) - -proc queryBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let number = params[0].val - let hash = params[1].val - if number.kind != nkEmpty and hash.kind != nkEmpty: - err("only one param allowed, number or hash, not both") - elif number.kind == nkInt: - getBlockByNumber(ctx, number) - elif number.kind == nkString: - try: - let blockNumber = toBlockNumber(number) - getBlockByNumber(ctx, blockNumber) - except ValueError as ex: - err(ex.msg) - elif hash.kind == nkString: - getBlockByHash(ctx, hash) - else: - getLatestBlock(ctx) - -proc queryBlocks(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - let fromNumber = parseU64(params[0].val) - - let to = params[1].val - let toNumber = pickBlockNumber(ctx, to) - - if fromNumber > toNumber: - return err("from(" & $fromNumber & - ") is bigger than to(" & $toNumber & ")") - - # TODO: what is the maximum number here? - if toNumber - fromNumber > 32'u64: - return err("can't get more than 32 blocks at once") - - var list = respList() - var number = fromNumber - while number <= toNumber: - let n = getBlockByNumber(ctx, number) - if n.isErr: - list.add respNull() - else: - list.add n.get() - number += 1'u64 - - ok(list) - -proc queryPending(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc queryTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - try: - let hash = toHash(params[0].val) - {.cast(noSideEffect).}: - getTxByHash(ctx, hash) - except ValueError as ex: - err(ex.msg) - -proc queryLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc queryGasPrice(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - try: - bigIntNode(calculateMedianGasPrice(ctx.chain)) - except CatchableError as em: - err("can't get gasPrice: " & em.msg) - -proc queryProtocolVersion(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - for n in ctx.ethNode.capabilities: - if n.name == "eth": - return bigIntNode(n.version) - err("can't get protocol version") - -proc querySyncing(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - ok(respMap(ctx.ids[ethSyncState])) - -proc queryMaxPriorityFeePerGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # TODO: stub, missing impl - err("not implemented") - -proc queryChainId(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - let ctx = GraphqlContextRef(ud) - longNode(ctx.com.chainId.uint64) - -const queryProcs = { - "account": queryAccount, - "block": queryBlock, - "blocks": queryBlocks, - "pending": queryPending, - "transaction": queryTransaction, - "logs": queryLogs, - "gasPrice": queryGasPrice, - "protocolVersion": queryProtocolVersion, - "syncing": querySyncing, - "maxPriorityFeePerGas": queryMaxPriorityFeePerGas, - "chainID": queryChainId -} - -proc sendRawTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} = - # if tx validation failed, the result will be null - let ctx = GraphqlContextRef(ud) - try: - let data = hexToSeqByte(params[0].val.stringVal) - let tx = decodePooledTx(data) # we want to know if it is a valid tx blob - let txHash = rlpHash(tx) - - ctx.txPool.addTx(tx).isOkOr: - return err($error) - return resp(txHash) - except CatchableError as em: - return err("failed to process raw transaction: " & em.msg) - -const mutationProcs = { - "sendRawTransaction": sendRawTransaction -} - -const - ethSchema = staticRead("ethapi.ql") - -type - QcNames = enum - qcType = "__Type" - qcFields = "fields" - qcBlock = "block" - qcTransaction = "Transaction" - - EthQueryComplexity = ref object of QueryComplexity - names: array[QcNames, Name] - -proc calcQC(qc: QueryComplexity, field: FieldRef): int {.cdecl, - gcsafe, apiRaises.} = - let qc = EthQueryComplexity(qc) - if field.parentType.sym.name == qc.names[qcType] and - field.field.name.name == qc.names[qcFields]: - return 100 - elif field.parentType.sym.name == qc.names[qcTransaction] and - field.field.name.name == qc.names[qcBlock]: - return 100 - else: - return 1 - -proc newQC(ctx: GraphqlContextRef): EthQueryComplexity = - const MaxQueryComplexity = 200 - var qc = EthQueryComplexity() - qc.init(calcQC, MaxQueryComplexity) - for n in QcNames: - let name = ctx.createName($n) - qc.names[n] = name - qc - -proc initEthApi(ctx: GraphqlContextRef) = - ctx.customScalar("Bytes32", scalarBytes32) - ctx.customScalar("Address", scalarAddress) - ctx.customScalar("Bytes", scalarBytes) - ctx.customScalar("BigInt", scalarBigInt) - ctx.customScalar("Long", scalarLong) - - for n in EthTypes: - let name = ctx.createName($n) - ctx.ids[n] = name - - ctx.addResolvers(ctx, ctx.ids[ethAccount ], accountProcs) - ctx.addResolvers(ctx, ctx.ids[ethLog ], logProcs) - ctx.addResolvers(ctx, ctx.ids[ethTransaction], txProcs) - ctx.addResolvers(ctx, ctx.ids[ethBlock ], blockProcs) - ctx.addResolvers(ctx, ctx.ids[ethCallResult ], callResultProcs) - ctx.addResolvers(ctx, ctx.ids[ethSyncState ], syncStateProcs) - ctx.addResolvers(ctx, ctx.ids[ethPending ], pendingProcs) - ctx.addResolvers(ctx, ctx.ids[ethQuery ], queryProcs) - ctx.addResolvers(ctx, ctx.ids[ethMutation ], mutationProcs) - ctx.addResolvers(ctx, ctx.ids[ethAccessTuple], aclProcs) - ctx.addResolvers(ctx, ctx.ids[ethWithdrawal ], wdProcs) - - var qc = newQC(ctx) - ctx.addInstrument(qc) - - let res = ctx.parseSchema(ethSchema) - if res.isErr: - echo res.error - quit(QuitFailure) - -proc setupGraphqlContext*(chain: ForkedChainRef, - ethNode: EthereumNode, - txPool: TxPoolRef): GraphqlContextRef = - let ctx = GraphqlContextRef( - chainDB: chain.com.db, - com : chain.com, - ethNode: ethNode, - txPool : txPool, - chain : chain, - ) - graphql.init(ctx) - ctx.initEthApi() - ctx - -proc setupGraphqlHttpHandler*(chain: ForkedChainRef, - ethNode: EthereumNode, - txPool: TxPoolRef): GraphqlHttpHandlerRef = - let ctx = setupGraphqlContext(chain, ethNode, txPool) - GraphqlHttpHandlerRef.new(ctx) - -{.pop.} diff --git a/execution_chain/graphql/ethapi.ql b/execution_chain/graphql/ethapi.ql deleted file mode 100644 index 517f7a22d..000000000 --- a/execution_chain/graphql/ethapi.ql +++ /dev/null @@ -1,505 +0,0 @@ -# Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal. -scalar Bytes32 - -# Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal. -scalar Address - -# Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal. -# An empty byte string is represented as '0x'. Byte strings must have an even number of hexadecimal nibbles. -scalar Bytes - -# BigInt is a large integer. Input is accepted as either a JSON number or as a string. -# Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all -# 0x-prefixed hexadecimal. -scalar BigInt - -# Long is a 64 bit unsigned integer. Input is accepted as either a JSON number or as a string. -# Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all -# 0x-prefixed hexadecimal. -scalar Long - -schema { - query: Query - mutation: Mutation -} - -# Account is an Ethereum account at a particular block. -type Account { - # Address is the address owning the account. - address: Address! - - # Balance is the balance of the account, in wei. - balance: BigInt! - - # TransactionCount is the number of transactions sent from this account, - # or in the case of a contract, the number of contracts created. Otherwise - # known as the nonce. - transactionCount: Long! - - # Code contains the smart contract code for this account, if the account - # is a (non-self-destructed) contract. - code: Bytes! - - # Storage provides access to the storage of a contract account, indexed - # by its 32 byte slot identifier. - storage(slot: Bytes32!): Bytes32! -} - -# Log is an Ethereum event log. -type Log { - # Index is the index of this log in the block. - index: Long! - - # Account is the account which generated this log - this will always - # be a contract account. - account(block: Long): Account! - - # Topics is a list of 0-4 indexed topics for the log. - topics: [Bytes32!]! - - # Data is unindexed data for this log. - data: Bytes! - - # Transaction is the transaction that generated this log entry. - transaction: Transaction! -} - -# EIP-2718 Access List -type AccessTuple { - # access list address. - address: Address! - - # access list storage keys, null if not present. - storageKeys: [Bytes32!] -} - -# EIP-4895 -type Withdrawal { - # Index is a monotonically increasing identifier issued by consensus layer. - index: Long! - - # Validator is index of the validator associated with withdrawal. - validator: Long! - - # Recipient address of the withdrawn amount. - address: Address! - - # Amount is the withdrawal value in Gwei. - amount: Long! -} - -# Transaction is an Ethereum transaction. -type Transaction { - # Hash is the hash of this transaction. - hash: Bytes32! - - # Nonce is the nonce of the account this transaction was generated with. - nonce: Long! - - # Index is the index of this transaction in the parent block. This will - # be null if the transaction has not yet been mined. - index: Long - - # From is the account that sent this transaction - this will always be - # an externally owned account. - from(block: Long): Account! - - # To is the account the transaction was sent to. This is null for - # contract-creating transactions. - to(block: Long): Account - - # Value is the value, in wei, sent along with this transaction. - value: BigInt! - - # GasPrice is the price offered to miners for gas, in wei per unit. - gasPrice: BigInt! - - # MaxFeePerGas is the maximum fee per gas offered to include a transaction, in wei. - maxFeePerGas: BigInt - - # MaxPriorityFeePerGas is the maximum miner tip per gas offered to include a transaction, in wei. - maxPriorityFeePerGas: BigInt - - # Gas is the maximum amount of gas this transaction can consume. - gas: Long! - - # InputData is the data supplied to the target of the transaction. - inputData: Bytes! - - # Block is the block this transaction was mined in. This will be null if - # the transaction has not yet been mined. - block: Block - - #----------------------- Receipt fields --------------------------------- - - # Status is the return status of the transaction. This will be 1 if the - # transaction succeeded, or 0 if it failed (due to a revert, or due to - # running out of gas). If the transaction has not yet been mined, this - # field will be null. - status: Long - - # GasUsed is the amount of gas that was used processing this transaction. - # If the transaction has not yet been mined, this field will be null. - gasUsed: Long - - # CumulativeGasUsed is the total gas used in the block up to and including - # this transaction. If the transaction has not yet been mined, this field - # will be null. - cumulativeGasUsed: Long - - # EffectiveGasPrice is actual value per gas deducted from the sender's - # account. Before EIP-1559, this is equal to the transaction's gas price. - # After EIP-1559, it is baseFeePerGas + min(maxFeePerGas - baseFeePerGas, - # maxPriorityFeePerGas). Legacy transactions and EIP-2930 transactions are - # coerced into the EIP-1559 format by setting both maxFeePerGas and - # maxPriorityFeePerGas as the transaction's gas price. - effectiveGasPrice: BigInt - - # CreatedContract is the account that was created by a contract creation - # transaction. If the transaction was not a contract creation transaction, - # or it has not yet been mined, this field will be null. - createdContract(block: Long): Account - - # Logs is a list of log entries emitted by this transaction. If the - # transaction has not yet been mined, this field will be null. - logs: [Log!] - - # signature field R - r: BigInt! - - # signature fields S - s: BigInt! - - # signature fields V - v: BigInt! - - # EIP 2718: envelope transaction support - type: Long - - # EIP 2930: optional access list, null if not present - accessList: [AccessTuple!] - - # EIP-4844: blob gas a user willing to pay - maxFeePerBlobGas: Long - - # EIP-4844: represents a list of hash outputs from kzg_to_versioned_hash - versionedHashes: [Bytes32!] - - #--------------------------Extensions------------------------------- - - # If type == 0, chainID returns null. - # If type > 0, chainID returns replay protection chainID - chainID: Long - - # Raw is the canonical encoding of the transaction. - # For legacy transactions, it returns the RLP encoding. - # For EIP-2718 typed transactions, it returns the type and payload. - raw: Bytes! - - # RawReceipt is the canonical encoding of the receipt. For post EIP-2718 typed transactions - # this is equivalent to TxType || ReceiptEncoding. - rawReceipt: Bytes! -} - -# BlockFilterCriteria encapsulates log filter criteria for a filter applied -# to a single block. -input BlockFilterCriteria { - # Addresses is list of addresses that are of interest. If this list is - # empty, results will not be filtered by address. - addresses: [Address!] - - # Topics list restricts matches to particular event topics. Each event has a list - # of topics. Topics matches a prefix of that list. An empty element array matches any - # topic. Non-empty elements represent an alternative that matches any of the - # contained topics. - # - # Examples: - # - [] or nil matches any topic list - # - [[A]] matches topic A in first position - # - [[], [B]] matches any topic in first position, B in second position - # - [[A], [B]] matches topic A in first position, B in second position - # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position - topics: [[Bytes32!]!] -} - -# Block is an Ethereum block. -type Block { - # Number is the number of this block, starting at 0 for the genesis block. - number: Long! - - # Hash is the block hash of this block. - hash: Bytes32! - - # Parent is the parent block of this block. - parent: Block - - # Nonce is the block nonce, an 8 byte sequence determined by the miner. - nonce: Bytes! - - # TransactionsRoot is the keccak256 hash of the root of the trie of transactions in this block. - transactionsRoot: Bytes32! - - # TransactionCount is the number of transactions in this block. if - # transactions are not available for this block, this field will be null. - transactionCount: Long - - # StateRoot is the keccak256 hash of the state trie after this block was processed. - stateRoot: Bytes32! - - # ReceiptsRoot is the keccak256 hash of the trie of transaction receipts in this block. - receiptsRoot: Bytes32! - - # Miner is the account that mined this block. - miner(block: Long): Account! - - # ExtraData is an arbitrary data field supplied by the miner. - extraData: Bytes! - - # GasLimit is the maximum amount of gas that was available to transactions in this block. - gasLimit: Long! - - # GasUsed is the amount of gas that was used executing transactions in this block. - gasUsed: Long! - - # BaseFeePerGas is the fee perunit of gas burned by the protocol in this block. - baseFeePerGas: BigInt - - # Timestamp is the unix timestamp at which this block was mined. - timestamp: BigInt! - - # LogsBloom is a bloom filter that can be used to check if a block may - # contain log entries matching a filter. - logsBloom: Bytes! - - # MixHash is the hash that was used as an input to the PoW process. - mixHash: Bytes32! - - # Difficulty is a measure of the difficulty of mining this block. - difficulty: BigInt! - - # TotalDifficulty is the sum of all difficulty values up to and including - # this block. - totalDifficulty: BigInt! - - # OmmerCount is the number of ommers (AKA uncles) associated with this - # block. If ommers are unavailable, this field will be null. - ommerCount: Long - - # Ommers is a list of ommer (AKA uncle) blocks associated with this block. - # If ommers are unavailable, this field will be null. Depending on your - # node, the transactions, transactionAt, transactionCount, ommers, - # ommerCount and ommerAt fields may not be available on any ommer blocks. - ommers: [Block] - - # OmmerAt returns the ommer (AKA uncle) at the specified index. If ommers - # are unavailable, or the index is out of bounds, this field will be null. - ommerAt(index: Int!): Block - - # OmmerHash is the keccak256 hash of all the ommers (AKA uncles) - # associated with this block. - ommerHash: Bytes32! - - # Transactions is a list of transactions associated with this block. If - # transactions are unavailable for this block, this field will be null. - transactions: [Transaction!] - - # TransactionAt returns the transaction at the specified index. If - # transactions are unavailable for this block, or if the index is out of - # bounds, this field will be null. - transactionAt(index: Int!): Transaction - - # Logs returns a filtered set of logs from this block. - logs(filter: BlockFilterCriteria!): [Log!]! - - # Account fetches an Ethereum account at the current block's state. - account(address: Address!): Account - - # Call executes a local call operation at the current block's state. - call(data: CallData!): CallResult - - # EstimateGas estimates the amount of gas that will be required for - # successful execution of a transaction at the current block's state. - estimateGas(data: CallData!): Long! - - # WithdrawalsRoot is the withdrawals trie root in this block. - # If withdrawals are unavailable for this block, this field will be null. - withdrawalsRoot: Bytes32 - - # Withdrawals is a list of withdrawals associated with this block. If - # withdrawals are unavailable for this block, this field will be null. - withdrawals: [Withdrawal!] - - # EIP-4844: is the total amount of blob gas consumed by the transactions - # within the block. - blobGasUsed: Long - - # EIP-4844: is a running total of blob gas consumed in excess of the target, - # prior to the block. Blocks with above-target blob gas consumption increase - # this value, blocks with below-target blob gas consumption decrease it - # (bounded at 0). - excessBlobGas: Long - - # EIP-4788: This root consumes 32 bytes and is exactly the hash tree root - # of the parent beacon block for the given execution block. - parentBeaconBlockRoot: Bytes32 - - #--------------------------Extensions------------------------------- - - # RawHeader is the RLP encoding of the block's header. - rawHeader: Bytes! - - # Raw is the RLP encoding of the block. - raw: Bytes! -} - -# CallData represents the data associated with a local contract call. -# All fields are optional. -input CallData { - # From is the address making the call. - from: Address - - # To is the address the call is sent to. - to: Address - - # Gas is the amount of gas sent with the call. - gas: Long - - # GasPrice is the price, in wei, offered for each unit of gas. - gasPrice: BigInt - - # MaxFeePerGas is the maximum fee per gas offered, in wei. - maxFeePerGas: BigInt - - # MaxPriorityFeePerGas is the maximum miner tip per gas offered, in wei. - maxPriorityFeePerGas: BigInt - - # Value is the value, in wei, sent along with the call. - value: BigInt - - # Data is the data sent to the callee. - data: Bytes -} - -# CallResult is the result of a local call operation. -type CallResult { - # Data is the return data of the called contract. - data: Bytes! - - # GasUsed is the amount of gas used by the call, after any refunds. - gasUsed: Long! - - # Status is the result of the call - 1 for success or 0 for failure. - status: Long! -} - -# FilterCriteria encapsulates log filter criteria for searching log entries. -input FilterCriteria { - # FromBlock is the block at which to start searching, inclusive. Defaults - # to the latest block if not supplied. - fromBlock: Long - - # ToBlock is the block at which to stop searching, inclusive. Defaults - # to the latest block if not supplied. - toBlock: Long - - # Addresses is a list of addresses that are of interest. If this list is - # empty, results will not be filtered by address. - addresses: [Address!] - - # Topics list restricts matches to particular event topics. Each event has a list - # of topics. Topics matches a prefix of that list. An empty element array matches any - # topic. Non-empty elements represent an alternative that matches any of the - # contained topics. - # - # Examples: - # - [] or nil matches any topic list - # - [[A]] matches topic A in first position - # - [[], [B]] matches any topic in first position, B in second position - # - [[A], [B]] matches topic A in first position, B in second position - # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position - topics: [[Bytes32!]!] -} - -# SyncState contains the current synchronisation state of the client. -type SyncState{ - # StartingBlock is the block number at which synchronisation started. - startingBlock: Long! - - # CurrentBlock is the point at which synchronisation has presently reached. - currentBlock: Long! - - # HighestBlock is the latest known block number. - highestBlock: Long! - - # PulledStates is the number of state entries fetched so far, or null - # if this is not known or not relevant. - pulledStates: Long - - # KnownStates is the number of states the node knows of so far, or null - # if this is not known or not relevant. - knownStates: Long -} - -# Pending represents the current pending state. -type Pending { - # TransactionCount is the number of transactions in the pending state. - transactionCount: Long! - - # Transactions is a list of transactions in the current pending state. - transactions: [Transaction!] - - # Account fetches an Ethereum account for the pending state. - account(address: Address!): Account - - # Call executes a local call operation for the pending state. - call(data: CallData!): CallResult - - # EstimateGas estimates the amount of gas that will be required for - # successful execution of a transaction for the pending state. - estimateGas(data: CallData!): Long! -} - -type Query { - # Account fetches an Ethereum account at the specified block number. - # If blockNumber is not provided, it defaults to the most recent block. - account(address: Address!, blockNumber: Long): Account! - - # Block fetches an Ethereum block by number or by hash. If neither is - # supplied, the most recent known block is returned. - block(number: Long, hash: Bytes32): Block - - # Blocks returns all the blocks between two numbers, inclusive. If - # to is not supplied, it defaults to the most recent known block. - blocks(from: Long!, to: Long): [Block!]! - - # Pending returns the current pending state. - pending: Pending! - - # Transaction returns a transaction specified by its hash. - transaction(hash: Bytes32!): Transaction - - # Logs returns log entries matching the provided filter. - logs(filter: FilterCriteria!): [Log!]! - - # GasPrice returns the node's estimate of a gas price sufficient to - # ensure a transaction is mined in a timely fashion. - gasPrice: BigInt! - - # MaxPriorityFeePerGas returns the node's estimate of a gas tip sufficient - # to ensure a transaction is mined in a timely fashion. - maxPriorityFeePerGas: BigInt! - - # ProtocolVersion returns the current wire protocol version number. - protocolVersion: Int! - - # Syncing returns information on the current synchronisation state. - syncing: SyncState - - # ChainID returns the current chain ID for transaction replay protection. - chainID: Long! -} - -type Mutation { - # SendRawTransaction sends an RLP-encoded transaction to the network. - sendRawTransaction(data: Bytes!): Bytes32! -} diff --git a/execution_chain/rpc.nim b/execution_chain/rpc.nim index c72e3d5f8..b10d7d56b 100644 --- a/execution_chain/rpc.nim +++ b/execution_chain/rpc.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2022-2024 Status Research & Development GmbH +# Copyright (c) 2022-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -11,7 +11,6 @@ import chronicles, websock/websock, json_rpc/rpcserver, - graphql/httpserver, ./rpc/common, #./rpc/debug, ./rpc/engine_api, @@ -19,8 +18,7 @@ import ./rpc/cors, ./rpc/rpc_server, ./rpc/server_api, - ./nimbus_desc, - ./graphql/ethapi + ./nimbus_desc export common, @@ -121,22 +119,6 @@ func addHandler(handlers: var seq[RpcHandlerProc], handlers.add handlerProc -func addHandler(handlers: var seq[RpcHandlerProc], - server: GraphqlHttpHandlerRef) = - - proc handlerProc(request: HttpRequestRef): - Future[RpcHandlerResult] {.async: (raises: []).} = - try: - let res = await server.serveHTTP(request) - if res.isNil: - return RpcHandlerResult(status: RpcHandlerStatus.Skip) - else: - return RpcHandlerResult(status: RpcHandlerStatus.Response, response: res) - except CatchableError: - return RpcHandlerResult(status: RpcHandlerStatus.Error) - - handlers.add handlerProc - proc addHttpServices(handlers: var seq[RpcHandlerProc], nimbus: NimbusNode, conf: NimbusConf, com: CommonRef, serverApi: ServerAPIRef, @@ -147,12 +129,6 @@ proc addHttpServices(handlers: var seq[RpcHandlerProc], # ws depends on Sec-WebSocket-Version header # json-rpc have no reliable identification - if conf.graphqlEnabled: - let ctx = setupGraphqlContext(nimbus.chainRef, nimbus.ethNode, nimbus.txPool) - let server = GraphqlHttpHandlerRef.new(ctx) - handlers.addHandler(server) - info "GraphQL API enabled", url = "http://" & $address - if conf.wsEnabled: let server = newRpcWebsocketHandler() let rpcFlags = conf.getWsFlags() + {RpcFlag.Eth} @@ -193,13 +169,7 @@ proc addServices(handlers: var seq[RpcHandlerProc], com: CommonRef, serverApi: ServerAPIRef, address: TransportAddress) = - # The order is important: graphql, ws, rpc - - if conf.graphqlEnabled: - let ctx = setupGraphqlContext(nimbus.chainRef, nimbus.ethNode, nimbus.txPool) - let server = GraphqlHttpHandlerRef.new(ctx) - handlers.addHandler(server) - info "GraphQL API enabled", url = "http://" & $address + # The order is important: ws, rpc if conf.wsEnabled or conf.engineApiWsEnabled: let server = newRpcWebsocketHandler() diff --git a/hive_integration/README.md b/hive_integration/README.md index 756315a51..2c2e83aca 100644 --- a/hive_integration/README.md +++ b/hive_integration/README.md @@ -70,7 +70,6 @@ or - `ethereum/sync` - `ethereum/consensus` - `ethereum/rpc` -- `ethereum/graphql` - `ethereum/engine` - `smoke/network` - `smoke/genesis` @@ -79,7 +78,6 @@ or The number of passes and fails output at the time of writing (2022-11-18) is: ethereum/consensus: 48682 pass, 0 fail, 48682 total London - ethereum/graphql: 39 pass, 7 fail, 46 total devp2p/discv4: 14 pass, 0 fail, 14 total devp2p/eth: 16 pass, 0 fail, 16 total devp2p/snap 0 pass, 5 fail, 5 total @@ -109,12 +107,6 @@ in a markdown file with the same name with the simulator. you compile from the _hive_integration/nodocker_ directory on a Posix system, the _./tests_ directory would be a symlink to _../../tests_. -- ethereum/graphql - ```nim - nim c -r -d:release hive_integration/nodocker/graphql/graphql_sim - ``` - Similar to above, the directory _./hive_integration_ is expected. - - ethereum/engine ```nim nim c -r -d:release hive_integration/nodocker/engine/engine_sim diff --git a/hive_integration/nimbus/nimbus.sh b/hive_integration/nimbus/nimbus.sh index 36155a812..f43d29193 100644 --- a/hive_integration/nimbus/nimbus.sh +++ b/hive_integration/nimbus/nimbus.sh @@ -1,5 +1,13 @@ #!/bin/bash +# Copyright (c) 2021-2025 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + # Startup script to initialize and boot a nimbus instance. # # This script assumes the following files: @@ -103,13 +111,9 @@ fi set -e # Configure RPC. -if [ "$HIVE_GRAPHQL_ENABLED" != "" ]; then - FLAGS="$FLAGS --graphql --graphql-address:0.0.0.0 --graphql-port:8545" -else - FLAGS="$FLAGS --rpc --rpc-api:eth,debug --rpc-address:0.0.0.0 --rpc-port:8545" - FLAGS="$FLAGS --ws --ws-api:eth,debug --ws-address:0.0.0.0 --ws-port:8546" - FLAGS="$FLAGS --engine-api:true --engine-api-address:0.0.0.0 --engine-api-port:8551" -fi +FLAGS="$FLAGS --rpc --rpc-api:eth,debug --rpc-address:0.0.0.0 --rpc-port:8545" +FLAGS="$FLAGS --ws --ws-api:eth,debug --ws-address:0.0.0.0 --ws-port:8546" +FLAGS="$FLAGS --engine-api:true --engine-api-address:0.0.0.0 --engine-api-port:8551" echo "Running nimbus execution client with flags $FLAGS" $nimbus_execution_client $FLAGS diff --git a/hive_integration/nodocker/graphql/graphql_sim.nim b/hive_integration/nodocker/graphql/graphql_sim.nim deleted file mode 100644 index a29c4d8ff..000000000 --- a/hive_integration/nodocker/graphql/graphql_sim.nim +++ /dev/null @@ -1,111 +0,0 @@ -# Nimbus -# Copyright (c) 2021-2025 Status Research & Development GmbH -# Licensed under either of -# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) -# * MIT license ([LICENSE-MIT](LICENSE-MIT)) -# at your option. -# This file may not be copied, modified, or distributed except according to -# those terms. - -import - std/[os, json, times], - eth/p2p, - ../../../execution_chain/sync/protocol, - ../../../execution_chain/config, - ../../../execution_chain/graphql/ethapi, - ../../../tests/test_helpers, - ../../../execution_chain/core/[tx_pool, block_import], - ../../../execution_chain/common, - graphql, ../sim_utils - -const - baseFolder = "hive_integration" / "nodocker" / "graphql" - blocksFile = baseFolder / "init" / "blocks.rlp" - genesisFile = baseFolder / "init" / "genesis.json" - caseFolder = baseFolder / "testcases" - -template testCond(expr: untyped) = - if not (expr): - result = TestStatus.Failed - -proc processNode(ctx: GraphqlRef, node: JsonNode, fileName: string): TestStatus = - let request = node["request"] - let responses = node["responses"] - let statusCode = node["statusCode"].getInt() - - let savePoint = ctx.getNameCounter() - let res = ctx.parseQuery(request.getStr()) - - result = TestStatus.OK - block: - if res.isErr: - if statusCode == 200: - debugEcho res.error - testCond statusCode != 200 - break - - let resp = JsonRespStream.new() - let r = ctx.executeRequest(respStream(resp)) - if r.isErr: - if statusCode == 200: - debugEcho r.error - testCond statusCode != 200 - break - - testCond statusCode == 200 - testCond r.isOk - - let nimbus = resp.getString() - var resultOK = false - for x in responses: - let hive = $(x["data"]) - if nimbus == hive: - resultOK = true - break - - testCond resultOK - if not resultOK: - debugEcho "NIMBUS RESULT: ", nimbus - for x in responses: - let hive = $(x["data"]) - debugEcho "HIVE RESULT: ", hive - - ctx.purgeQueries() - ctx.purgeNames(savePoint) - -proc main() = - let - conf = makeConfig(@["--custom-network:" & genesisFile]) - ethCtx = newEthContext() - ethNode = setupEthNode(conf, ethCtx, eth) - com = CommonRef.new(newCoreDbRef DefaultDbMemory, - Taskpool.new(), - conf.networkId, - conf.networkParams - ) - chain = ForkedChainRef.init(com) - txPool = TxPoolRef.new(chain) - - discard importRlpBlock(blocksFile, com) - let ctx = setupGraphqlContext(com, ethNode, txPool) - - var stat: SimStat - let start = getTime() - - for fileName in walkDirRec( - caseFolder, yieldFilter = {pcFile,pcLinkToFile}): - if not fileName.endsWith(".json"): - continue - - let (_, name) = fileName.splitPath() - let node = parseFile(fileName) - let status = ctx.processNode(node, fileName) - stat.inc(name, status) - - # simulate the real simulator - txPool.disposeAll() - - let elpd = getTime() - start - print(stat, elpd, "graphql") - -main() diff --git a/hive_integration/nodocker/graphql/init/blocks.rlp b/hive_integration/nodocker/graphql/init/blocks.rlp deleted file mode 100644 index 480efc87d..000000000 Binary files a/hive_integration/nodocker/graphql/init/blocks.rlp and /dev/null differ diff --git a/hive_integration/nodocker/graphql/init/genesis.json b/hive_integration/nodocker/graphql/init/genesis.json deleted file mode 100644 index 4226f31c7..000000000 --- a/hive_integration/nodocker/graphql/init/genesis.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "config": { - "chainId": 1, - "homesteadBlock": 33, - "eip150Block": 33, - "eip155Block": 33, - "eip158Block": 33, - "byzantiumBlock": 33, - "constantinopleBlock": 33, - "petersburgBlock": 33, - "istanbulBlock": 33, - "muirGlacierBlock": 33, - "berlinBlock": 33, - "londonBlock": 33, - "mergeForkBlock": 33, - "terminalTotalDifficulty": 4357120, - "shanghaiTime": 1444660030 - }, - "genesis": { - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "0x020000", - "extraData" : "0x42", - "gasLimit" : "0x2fefd8", - "mixHash" : "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", - "nonce" : "0x78cc16f7b4f65485", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp" : "0x54c98c81", - "alloc" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b": { - "balance" : "0x09184e72a000" - } - } - } -} diff --git a/hive_integration/nodocker/graphql/testcases/01_eth_blockNumber.json b/hive_integration/nodocker/graphql/testcases/01_eth_blockNumber.json deleted file mode 100644 index 8ff5d2aa9..000000000 --- a/hive_integration/nodocker/graphql/testcases/01_eth_blockNumber.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": - "{ block { number } }", - - "responses": [{ - "data" : { - "block" : { - "number" : "0x21" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/02_eth_call_Block8.json b/hive_integration/nodocker/graphql/testcases/02_eth_call_Block8.json deleted file mode 100644 index fdcac0dee..000000000 --- a/hive_integration/nodocker/graphql/testcases/02_eth_call_Block8.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "request": "{block(number :8) {number call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}}}" - , - "responses":[{ - "data" : { - "block" : { - "number" : "0x8", - "call" : { - "data" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "status" : "0x1" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/03_eth_call_BlockLatest.json b/hive_integration/nodocker/graphql/testcases/03_eth_call_BlockLatest.json deleted file mode 100644 index b3a19b269..000000000 --- a/hive_integration/nodocker/graphql/testcases/03_eth_call_BlockLatest.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "request": "{block {number call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}}}" - , - "responses":[{ - "data" : { - "block" : { - "number" : "0x21", - "call" : { - "data" : "0x0000000000000000000000000000000000000000000000000000000000000001", - "status" : "0x1" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/04_eth_estimateGas_contractDeploy.json b/hive_integration/nodocker/graphql/testcases/04_eth_estimateGas_contractDeploy.json deleted file mode 100644 index e478559af..000000000 --- a/hive_integration/nodocker/graphql/testcases/04_eth_estimateGas_contractDeploy.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request" :"{block(number: 32) {estimateGas (data: {from :\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029\"})}}", - "responses":[{ - "data" : { - "block" : { - "estimateGas" : "0x1b551" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/05_eth_estimateGas_noParams.json b/hive_integration/nodocker/graphql/testcases/05_eth_estimateGas_noParams.json deleted file mode 100644 index 9eb5656b5..000000000 --- a/hive_integration/nodocker/graphql/testcases/05_eth_estimateGas_noParams.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request" :"{block(number: 32) { estimateGas(data:{}) }}", - "responses":[{ - "data" : { - "block" : { - "estimateGas" : "0x5208" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/06_eth_estimateGas_transfer.json b/hive_integration/nodocker/graphql/testcases/06_eth_estimateGas_transfer.json deleted file mode 100644 index c35dbadf4..000000000 --- a/hive_integration/nodocker/graphql/testcases/06_eth_estimateGas_transfer.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request" :"{block{estimateGas (data: {from :\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", to :\"0x8888f1f195afa192cfee860698584c030f4c9db1\"})}}", - "responses":[{ - "data" : { - "block" : { - "estimateGas" : "0x5208" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/07_eth_gasPrice.json b/hive_integration/nodocker/graphql/testcases/07_eth_gasPrice.json deleted file mode 100644 index e54d5b280..000000000 --- a/hive_integration/nodocker/graphql/testcases/07_eth_gasPrice.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "request": - "{ gasPrice }", - "responses": [ - { - "data" : { - "gasPrice" : "0x10" - } - }, - { - "data" : { - "gasPrice" : "0x1" - } - } - ], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/08_eth_getBalance_0x19.json b/hive_integration/nodocker/graphql/testcases/08_eth_getBalance_0x19.json deleted file mode 100644 index 6e17cfb97..000000000 --- a/hive_integration/nodocker/graphql/testcases/08_eth_getBalance_0x19.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{block (number : 25) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", - "responses": [{ - "data": { - "block": { - "account": { - "balance": "0xfa" - } - } - } - }], - "statusCode": 200 -} - diff --git a/hive_integration/nodocker/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json b/hive_integration/nodocker/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json deleted file mode 100644 index e22db9858..000000000 --- a/hive_integration/nodocker/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": "{block (number: 25) {account(address: \"0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\") { balance } }}", - "responses": [{ - "data": { - "block": { - "account": { - "balance": "0x0" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json b/hive_integration/nodocker/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json deleted file mode 100644 index 885795588..000000000 --- a/hive_integration/nodocker/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": "{block{account(address: \"0xdeaff00ddeaff00ddeaff00ddeaff00ddeaff00d\") { balance } }}", - "responses": [{ - "data": { - "block": { - "account": { - "balance": "0x0" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/11_eth_getBalance_latest.json b/hive_integration/nodocker/graphql/testcases/11_eth_getBalance_latest.json deleted file mode 100644 index 6dfdb27d9..000000000 --- a/hive_integration/nodocker/graphql/testcases/11_eth_getBalance_latest.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{block{account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", - "responses":[{ - "data": { - "block": { - "account": { - "balance": "0x140" - } - } - } - }], - "statusCode": 200 -} - diff --git a/hive_integration/nodocker/graphql/testcases/12_eth_getBalance_toobig_bn.json b/hive_integration/nodocker/graphql/testcases/12_eth_getBalance_toobig_bn.json deleted file mode 100644 index 39d4c98b0..000000000 --- a/hive_integration/nodocker/graphql/testcases/12_eth_getBalance_toobig_bn.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "request": "{block (number: 33) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/account) : Invalid params", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "account" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }, - { - "data": { - "block": null - } - }], - "statusCode": 400 -} - diff --git a/hive_integration/nodocker/graphql/testcases/13_eth_getBalance_without_addr.json b/hive_integration/nodocker/graphql/testcases/13_eth_getBalance_without_addr.json deleted file mode 100644 index 54bb700d1..000000000 --- a/hive_integration/nodocker/graphql/testcases/13_eth_getBalance_without_addr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "request": "{block{account { balance } }}", - "responses": [{ - "errors": [ - { - "message": "Validation error of type MissingFieldArgument: Missing field argument address @ 'account'", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "extensions": { - "classification": "ValidationError" - } - } - ] - }], - "statusCode": 400 -} - diff --git a/hive_integration/nodocker/graphql/testcases/14_eth_getBlock_byHash.json b/hive_integration/nodocker/graphql/testcases/14_eth_getBlock_byHash.json deleted file mode 100644 index decf15c17..000000000 --- a/hive_integration/nodocker/graphql/testcases/14_eth_getBlock_byHash.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "request": - - "{block (hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {number transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot}} ", - - - "responses": [{ - "data" : { - "block" : { - "number" : "0x1e", - "transactions" : [ { - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } ], - "timestamp" : "0x561bc336", - "difficulty" : "0x20740", - "totalDifficulty" : "0x3e6cc0", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "ommerCount" : "0x0", - "logsBloom" : "0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000800000000040000000000000000000000000000000000000000010000000000000000000000000", - "mixHash" : "0x6ce1c4afb4f85fefd1b0ed966b20cd248f08d9a5b0df773f75c6c2f5cc237b7c", - "ommerHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "extraData" : "0x", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1", - "transactionsRoot" : "0x5a8d5d966b48e1331ae19eb459eb28882cdc7654e615d37774b79204e875dc01" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/15_eth_getBlock_byHashInvalid.json b/hive_integration/nodocker/graphql/testcases/15_eth_getBlock_byHashInvalid.json deleted file mode 100644 index a53a10834..000000000 --- a/hive_integration/nodocker/graphql/testcases/15_eth_getBlock_byHashInvalid.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "request": "{block (hash : \"0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0\") {number } }", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/block) : Block hash 0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0 was not found", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "block" - ], - "extensions": { - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/16_eth_getBlock_byNumber.json b/hive_integration/nodocker/graphql/testcases/16_eth_getBlock_byNumber.json deleted file mode 100644 index 34244dbc5..000000000 --- a/hive_integration/nodocker/graphql/testcases/16_eth_getBlock_byNumber.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "request": - - "{block (number : 30) {transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot ommers{hash} ommerAt(index : 1){hash} miner{address} account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\"){balance} parent{hash} }} ", - - - "responses":[{ - "data" : { - "block" : { - "transactions" : [ { - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } ], - "timestamp" : "0x561bc336", - "difficulty" : "0x20740", - "totalDifficulty" : "0x3e6cc0", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "ommerCount" : "0x0", - "logsBloom" : "0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000800000000040000000000000000000000000000000000000000010000000000000000000000000", - "mixHash" : "0x6ce1c4afb4f85fefd1b0ed966b20cd248f08d9a5b0df773f75c6c2f5cc237b7c", - "ommerHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "extraData" : "0x", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1", - "transactionsRoot" : "0x5a8d5d966b48e1331ae19eb459eb28882cdc7654e615d37774b79204e875dc01", - "ommers" : [ ], - "ommerAt" : null, - "miner" : { - "address" : "0x8888f1f195afa192cfee860698584c030f4c9db1" - }, - "account" : { - "balance" : "0x12c" - }, - "parent" : { - "hash" : "0xf8cfa377bd766cdf22edb388dd08cc149e85d24f2796678c835f3c54ab930803" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/17_eth_getBlock_byNumberInvalid.json b/hive_integration/nodocker/graphql/testcases/17_eth_getBlock_byNumberInvalid.json deleted file mode 100644 index 90eefbaf9..000000000 --- a/hive_integration/nodocker/graphql/testcases/17_eth_getBlock_byNumberInvalid.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "request": "{block (number: 88888888) {number }} ", - "responses": [ - { - "errors": [ - { - "message": "Exception while fetching data (/block) : Block number 88888888 was not found", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "block" - ], - "extensions": { - "classification": "DataFetchingException" - } - } - ], - "data": null - }, - { - "data": { - "block": null - } - } - ], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/18_eth_getBlock_wrongParams.json b/hive_integration/nodocker/graphql/testcases/18_eth_getBlock_wrongParams.json deleted file mode 100644 index f2e7f663a..000000000 --- a/hive_integration/nodocker/graphql/testcases/18_eth_getBlock_wrongParams.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "{block (number: \"0x03\", hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {number transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot}} ", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/block) : Invalid params", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "block" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json b/hive_integration/nodocker/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json deleted file mode 100644 index 3a31866f1..000000000 --- a/hive_integration/nodocker/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": - - "{block (hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {transactionCount}} ", - - - "responses": [{ - "data" : { - "block" : { - "transactionCount" : "0x1" - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json b/hive_integration/nodocker/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json deleted file mode 100644 index 4573355da..000000000 --- a/hive_integration/nodocker/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "request": - - "{block (number : 30) {transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot}} ", - - - "responses": [{ - "data" : { - "block" : { - "transactions" : [ { - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } ], - "timestamp" : "0x561bc336", - "difficulty" : "0x20740", - "totalDifficulty" : "0x3e6cc0", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "ommerCount" : "0x0", - "logsBloom" : "0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000800000000040000000000000000000000000000000000000000010000000000000000000000000", - "mixHash" : "0x6ce1c4afb4f85fefd1b0ed966b20cd248f08d9a5b0df773f75c6c2f5cc237b7c", - "ommerHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "extraData" : "0x", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1", - "transactionsRoot" : "0x5a8d5d966b48e1331ae19eb459eb28882cdc7654e615d37774b79204e875dc01" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/21_eth_getCode_noCode.json b/hive_integration/nodocker/graphql/testcases/21_eth_getCode_noCode.json deleted file mode 100644 index f70d77d1d..000000000 --- a/hive_integration/nodocker/graphql/testcases/21_eth_getCode_noCode.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request" : "{block{ account(address: \"0x8888f1f195afa192cfee860698584c030f4c9db1\") { code } }}", - - "responses": [{ - "data": { - "block": { - "account": { - "code": "0x" - } - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/22_eth_getCode.json b/hive_integration/nodocker/graphql/testcases/22_eth_getCode.json deleted file mode 100644 index e8babeb9b..000000000 --- a/hive_integration/nodocker/graphql/testcases/22_eth_getCode.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request" : "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { code } }}", - - "responses": [{ - "data": { - "block": { - "account": { - "code": "0x6000357c010000000000000000000000000000000000000000000000000000000090048063102accc11461012c57806312a7b9141461013a5780631774e6461461014c5780631e26fd331461015d5780631f9030371461016e578063343a875d1461018057806338cc4831146101955780634e7ad367146101bd57806357cb2fc4146101cb57806365538c73146101e057806368895979146101ee57806376bc21d9146102005780639a19a9531461020e5780639dc2c8f51461021f578063a53b1c1e1461022d578063a67808571461023e578063b61c05031461024c578063c2b12a731461025a578063d2282dc51461026b578063e30081a01461027c578063e8beef5b1461028d578063f38b06001461029b578063f5b53e17146102a9578063fd408767146102bb57005b6101346104d6565b60006000f35b61014261039b565b8060005260206000f35b610157600435610326565b60006000f35b6101686004356102c9565b60006000f35b610176610442565b8060005260206000f35b6101886103d3565b8060ff1660005260206000f35b61019d610413565b8073ffffffffffffffffffffffffffffffffffffffff1660005260206000f35b6101c56104c5565b60006000f35b6101d36103b7565b8060000b60005260206000f35b6101e8610454565b60006000f35b6101f6610401565b8060005260206000f35b61020861051f565b60006000f35b6102196004356102e5565b60006000f35b610227610693565b60006000f35b610238600435610342565b60006000f35b610246610484565b60006000f35b610254610493565b60006000f35b61026560043561038d565b60006000f35b610276600435610350565b60006000f35b61028760043561035e565b60006000f35b6102956105b4565b60006000f35b6102a3610547565b60006000f35b6102b16103ef565b8060005260206000f35b6102c3610600565b60006000f35b80600060006101000a81548160ff021916908302179055505b50565b80600060016101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009081020402179055505b50565b80600060026101000a81548160ff021916908302179055505b50565b806001600050819055505b50565b806002600050819055505b50565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b806004600050819055505b50565b6000600060009054906101000a900460ff1690506103b4565b90565b6000600060019054906101000a900460000b90506103d0565b90565b6000600060029054906101000a900460ff1690506103ec565b90565b600060016000505490506103fe565b90565b60006002600050549050610410565b90565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061043f565b90565b60006004600050549050610451565b90565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be5806000602a81526020016000a15b565b6000602a81526020016000a05b565b60017f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b6000602a81526020016000a25b565b60016000602a81526020016000a15b565b3373ffffffffffffffffffffffffffffffffffffffff1660017f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b6000602a81526020016000a35b565b3373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a25b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f6000602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a35b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017fd5f0a30e4be0c6be577a71eceb7464245a796a7e6a55c0d971837b250de05f4e60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff16600160007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a35b56" - } - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/23_eth_getLogs_matchTopic.json b/hive_integration/nodocker/graphql/testcases/23_eth_getLogs_matchTopic.json deleted file mode 100644 index cf7f6e4b1..000000000 --- a/hive_integration/nodocker/graphql/testcases/23_eth_getLogs_matchTopic.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request": "{ block(number: 23) { logs( filter: { topics : [[\"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b\", \"0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580\"]]}) { index topics data account{address} transaction{hash} } } }", - "responses": [{ - "data" : { - "block" : { - "logs" : [ { - "index" : "0x0", - "topics" : [ "0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580" ], - "data" : "0x000000000000000000000000000000000000000000000000000000000000002a", - "account" : { - "address" : "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "transaction" : { - "hash" : "0x97a385bf570ced7821c6495b3877ddd2afd5c452f350f0d4876e98d9161389c6" - } - } ] - } - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/24_eth_getLogs_range.json b/hive_integration/nodocker/graphql/testcases/24_eth_getLogs_range.json deleted file mode 100644 index 6b0446674..000000000 --- a/hive_integration/nodocker/graphql/testcases/24_eth_getLogs_range.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "request": "{ logs( filter: { fromBlock:20, toBlock: 24, topics : [], addresses : []}) { index topics data account{address} transaction{hash block {number}} } }", - "responses": [{ - "data": { - "logs": [ - { - "index": "0x0", - "topics": [ - "0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580" - ], - "data": "0x000000000000000000000000000000000000000000000000000000000000002a", - "account": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "transaction": { - "hash": "0x97a385bf570ced7821c6495b3877ddd2afd5c452f350f0d4876e98d9161389c6", - "block": { - "number": "0x17" - } - } - }, - { - "index": "0x0", - "topics": [], - "data": "0x000000000000000000000000000000000000000000000000000000000000002a", - "account": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "transaction": { - "hash": "0x5ecd942096ab3f70c5bcc8f3a98f88c4ff0a3bd986417df9948eb1819db76d0e", - "block": { - "number": "0x18" - } - } - } - ] - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json b/hive_integration/nodocker/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json deleted file mode 100644 index 499519276..000000000 --- a/hive_integration/nodocker/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { storage(slot: \"0x0000000000000000000000000000000000000000000000000000000000000021\") } }}", - "responses": [ - { - "data": { - "block": { - "account": { - "storage": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - } - } - } - ], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/26_eth_getStorageAt.json b/hive_integration/nodocker/graphql/testcases/26_eth_getStorageAt.json deleted file mode 100644 index 57ae71911..000000000 --- a/hive_integration/nodocker/graphql/testcases/26_eth_getStorageAt.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { storage(slot: \"0x0000000000000000000000000000000000000000000000000000000000000004\") } }}", - "responses": [ - { - "data": { - "block": { - "account": { - "storage": "0xaabbccffffffffffffffffffffffffffffffffffffffffffffffffffffffffee" - } - } - } - } - ], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json b/hive_integration/nodocker/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json deleted file mode 100644 index a445305c3..000000000 --- a/hive_integration/nodocker/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "request": - - "{ block(hash: \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") { transactionAt(index: 0) {block{hash} hash } } }", - - "responses":[{ - "data" : { - "block" : { - "transactionAt" : { - "block" : { - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } - } - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json b/hive_integration/nodocker/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json deleted file mode 100644 index 00a41f132..000000000 --- a/hive_integration/nodocker/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "request": - - "{ block(number: 30) { transactionAt(index: 0) {block{hash} hash} } }", - - "responses":[{ - "data" : { - "block" : { - "transactionAt" : { - "block" : { - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } - } - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json b/hive_integration/nodocker/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json deleted file mode 100644 index f7dd2b952..000000000 --- a/hive_integration/nodocker/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": - - "{ block(number: 30) { transactionAt(index: 1) {block{hash} hash} } }", - - "responses":[{ - "data" : { - "block" : { - "transactionAt" : null - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/30_eth_getTransaction_byHash.json b/hive_integration/nodocker/graphql/testcases/30_eth_getTransaction_byHash.json deleted file mode 100644 index b5607f0fb..000000000 --- a/hive_integration/nodocker/graphql/testcases/30_eth_getTransaction_byHash.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "request": "{transaction (hash : \"0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block{hash} gas gasPrice hash inputData nonce index value from {address} to {address} logs{index} status createdContract{address} } } ", - "responses": [ - { - "data": { - "transaction": { - "block": { - "hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "gas": "0x4cb2f", - "gasPrice": "0x1", - "hash": "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4", - "inputData": "0xe8beef5b", - "nonce": "0x1d", - "index": "0x0", - "value": "0xa", - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "to": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "logs": [ - { - "index": "0x0" - } - ], - "status": null, - "createdContract": null - } - } - }, - { - "data": { - "transaction": { - "block": { - "hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "createdContract": null, - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "gas": "0x4cb2f", - "gasPrice": "0x1", - "hash": "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4", - "index": 0, - "inputData": "0xe8beef5b", - "logs": [ - { - "index": 0 - } - ], - "nonce": "0x1d", - "status": "0x0", - "to": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "value": "0xa" - } - } - } - ], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/31_eth_getTransaction_byHashNull.json b/hive_integration/nodocker/graphql/testcases/31_eth_getTransaction_byHashNull.json deleted file mode 100644 index cf238cb74..000000000 --- a/hive_integration/nodocker/graphql/testcases/31_eth_getTransaction_byHashNull.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": - - "{transaction (hash : \"0xffc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block{hash} gas gasPrice hash inputData nonce index value }} ", - - - "responses": [{ - "data" : { - "transaction" : null - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/32_eth_getTransactionCount.json b/hive_integration/nodocker/graphql/testcases/32_eth_getTransactionCount.json deleted file mode 100644 index 7234ea96b..000000000 --- a/hive_integration/nodocker/graphql/testcases/32_eth_getTransactionCount.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": "{block{ account(address: \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\") { transactionCount } }}", - "responses": [{ - "data": { - "block": { - "account": { - "transactionCount": "0x21" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/33_eth_getTransactionReceipt.json b/hive_integration/nodocker/graphql/testcases/33_eth_getTransactionReceipt.json deleted file mode 100644 index e481c1d7e..000000000 --- a/hive_integration/nodocker/graphql/testcases/33_eth_getTransactionReceipt.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "request": "{ transaction(hash: \"0x812742182a79a8e67733edc58cfa3767aa2d7ad06439d156ddbbb33e3403b4ed\") {block{hash logsBloom} hash createdContract{address} cumulativeGasUsed gas gasUsed logs{topics} from{address} to{address} index } }", - "responses": [ - { - "data": { - "transaction": { - "block": { - "hash": "0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "createdContract": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "cumulativeGasUsed": "0x78674", - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "gas": "0x2fefd8", - "gasUsed": "0x78674", - "hash": "0x812742182a79a8e67733edc58cfa3767aa2d7ad06439d156ddbbb33e3403b4ed", - "index": "0x0", - "logs": [], - "to": null - } - } - }, - { - "data": { - "transaction": { - "block": { - "hash": "0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "createdContract": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "cumulativeGasUsed": "0x78674", - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "gas": "0x2fefd8", - "gasUsed": "0x78674", - "hash": "0x812742182a79a8e67733edc58cfa3767aa2d7ad06439d156ddbbb33e3403b4ed", - "index": 0, - "logs": [], - "to": null - } - } - } - ], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json b/hive_integration/nodocker/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json deleted file mode 100644 index 2f710211a..000000000 --- a/hive_integration/nodocker/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "request" : "mutation { sendRawTransaction(data: \"0xf901ca3285174876e800830fffff8080b90177608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb00291ca05d71c687073e23402e59853d85c587f6eebc735082f40a450e407451b42ee2a4a07d4f2db1717dc9be745b991962193fa0d5f6059b9c92350dba3efe3a99df6b52\") }", - "responses":[{ - "data" : { - "sendRawTransaction" : "0xf9a25e1d6202e9ea1d984f76939e9bb3609bfb9aea2541ae8a629270343fbb2f" - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/35_graphql_pending.json b/hive_integration/nodocker/graphql/testcases/35_graphql_pending.json deleted file mode 100644 index 7aceb9064..000000000 --- a/hive_integration/nodocker/graphql/testcases/35_graphql_pending.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "request": - "{ pending { transactionCount transactions { nonce gas } account(address:\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance} estimateGas(data:{}) call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}} }", - - "responses": [{ - "data": { - "pending": { - "transactionCount": "0x1", - "transactions": [ - { - "nonce": "0x32", - "gas": "0xfffff" - } - ], - "account": { - "balance": "0x140" - }, - "estimateGas": "0x5208", - "call": { - "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "status": "0x1" - } - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/36_eth_sendRawTransaction_messageCall.json b/hive_integration/nodocker/graphql/testcases/36_eth_sendRawTransaction_messageCall.json deleted file mode 100644 index e5eace1ff..000000000 --- a/hive_integration/nodocker/graphql/testcases/36_eth_sendRawTransaction_messageCall.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "request" : "mutation { sendRawTransaction(data: \"0xf8693785174876e800830fffff94450b61224a7df4d8a70f3e20d4fd6a6380b920d180843bdab8bf1ba054b00220864ab58246bbe0a6f6d50166f9bd0ba3f1711912f79c073da6368ca5a04f84bc3231ee4406b8ceb8740d6d8d1900f87b67b9f4a0a38bc55062121a94c6\") }", - "responses":[{ - "data" : { - "sendRawTransaction" : "0x6ad12f495251471d1834852623c2eeb2cb04d2fb9e1a5d6cff481cfec7b233a8" - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json b/hive_integration/nodocker/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json deleted file mode 100644 index 5d677670f..000000000 --- a/hive_integration/nodocker/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "mutation { sendRawTransaction(data: \"0xf86410018304cb2f946295ee1b4f6dd65047762f924ecd367c17eabf8f0a8457cb2fc41ca0060dc80554e845b572ab6b88dab08f7491f83b4405fea2f067a80b3742127fb0a0246160f01d027a0335be590d443335ecb2cf5d9f9589c8efffa4acbda4acafea\") }", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/sendRawTransaction) : Nonce too low", - "locations": [ - { - "line": 1, - "column": 12 - } - ], - "path": [ - "sendRawTransaction" - ], - "extensions": { - "errorCode": -32001, - "errorMessage": "Nonce too low", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/38_eth_sendRawTransaction_transferEther.json b/hive_integration/nodocker/graphql/testcases/38_eth_sendRawTransaction_transferEther.json deleted file mode 100644 index 466d22f7f..000000000 --- a/hive_integration/nodocker/graphql/testcases/38_eth_sendRawTransaction_transferEther.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "request" : "mutation { sendRawTransaction(data: \"0xf86d3785174876e801830222e0945aae326516b4f8fe08074b7e972e40a713048d628829a2241af62c0000801ca077d36666ce36d433b6f1ac62eafe7a232354c83ad2293cfcc2445a86bcd08b4da04b8bd0918d440507ab81d47cf562addaa15a1d28ac701989f5141c8da49615d0\") }", - "responses":[{ - "data" : { - "sendRawTransaction" : "0x772b6d5c64b9798865d6dfa35ba44d181abd96a448f8ab7ea9e9631cabb7b290" - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json b/hive_integration/nodocker/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json deleted file mode 100644 index 30b83680a..000000000 --- a/hive_integration/nodocker/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "mutation { sendRawTransaction(data: \"0xed0a85174876e800830222e0945aae326516b4f8fe08074b7e972e40a713048d62880de0b6b3a7640000801c8080\") }", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/sendRawTransaction) : Invalid params", - "locations": [ - { - "line": 1, - "column": 12 - } - ], - "path": [ - "sendRawTransaction" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/40_eth_syncing.json b/hive_integration/nodocker/graphql/testcases/40_eth_syncing.json deleted file mode 100644 index 3c9a1997c..000000000 --- a/hive_integration/nodocker/graphql/testcases/40_eth_syncing.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request": - "{ syncing {startingBlock currentBlock highestBlock } }", - - "responses": [{ - "data" : { - "syncing" : null - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/41_graphql_blocks_byFrom.json b/hive_integration/nodocker/graphql/testcases/41_graphql_blocks_byFrom.json deleted file mode 100644 index 020f78780..000000000 --- a/hive_integration/nodocker/graphql/testcases/41_graphql_blocks_byFrom.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request": "{ blocks(from:30) { number } }", - "responses": [{ - "data": { - "blocks": [ - { - "number": "0x1e" - }, - { - "number": "0x1f" - }, - { - "number": "0x20" - }, - { - "number": "0x21" - } - ] - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/42_graphql_blocks_byRange.json b/hive_integration/nodocker/graphql/testcases/42_graphql_blocks_byRange.json deleted file mode 100644 index 1552e2de4..000000000 --- a/hive_integration/nodocker/graphql/testcases/42_graphql_blocks_byRange.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "request": - - "{blocks (from : 30, to: 32) { number gasUsed gasLimit hash nonce stateRoot receiptsRoot transactionCount }} ", - - - "responses":[{ - "data" : { - "blocks" : [ { - "number" : "0x1e", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1" - }, { - "number" : "0x1f", - "gasUsed" : "0x5eef", - "gasLimit" : "0x2fefd8", - "hash" : "0x0f765087745aa259d9e5ac39c367c57432a16ed98e3b0d81c5b51d10f301dc49", - "nonce" : "0xd3a27a3001616468", - "stateRoot" : "0xa80997cf804269d64f2479baf535cf8f9090b70fbf515741c6995564f1e678bd", - "receiptsRoot" : "0x2440c44a3f75ad8b0425a73e7be2f61a5171112465cfd14e62e735b56d7178e6", - "transactionCount" : "0x1" - }, { - "number" : "0x20", - "gasUsed" : "0x5c99", - "gasLimit" : "0x2fefd8", - "hash" : "0x71d59849ddd98543bdfbe8548f5eed559b07b8aaf196369f39134500eab68e53", - "nonce" : "0xdb063000b00e8026", - "stateRoot" : "0xf65f3dd13f72f5fa5607a5224691419969b4f4bae7a00a6cdb853f2ca9eeb1be", - "receiptsRoot" : "0xa50a7e67e833f4502524371ee462ccbcc6c6cabd2aeb1555c56150007a53183c", - "transactionCount" : "0x1" - } ] - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/43_graphql_blocks_byWrongRange.json b/hive_integration/nodocker/graphql/testcases/43_graphql_blocks_byWrongRange.json deleted file mode 100644 index 32e3f2c6c..000000000 --- a/hive_integration/nodocker/graphql/testcases/43_graphql_blocks_byWrongRange.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "{blocks (from : \"0x1e\", to: \"0x1c\") { number gasUsed gasLimit hash nonce stateRoot receiptsRoot transactionCount }} ", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/blocks) : Invalid params", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "blocks" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/44_getBlock_byHexNumber.json b/hive_integration/nodocker/graphql/testcases/44_getBlock_byHexNumber.json deleted file mode 100644 index 0d4e0ed79..000000000 --- a/hive_integration/nodocker/graphql/testcases/44_getBlock_byHexNumber.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{block (number : \"0x1e\") { gasUsed gasLimit hash }} ", - - "responses":[{ - "data" : { - "block" : { - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/45_eth_getLogs_range_hex.json b/hive_integration/nodocker/graphql/testcases/45_eth_getLogs_range_hex.json deleted file mode 100644 index f7891fc7d..000000000 --- a/hive_integration/nodocker/graphql/testcases/45_eth_getLogs_range_hex.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request": "{ logs( filter: { fromBlock:\"0x14\", toBlock: \"0x18\", topics : [], addresses : []}) { index transaction{hash} } }", - "responses": [{ - "data": { - "logs": [ - { - "index": "0x0", - "transaction": { - "hash": "0x97a385bf570ced7821c6495b3877ddd2afd5c452f350f0d4876e98d9161389c6" - } - }, - { - "index": "0x0", - "transaction": { - "hash": "0x5ecd942096ab3f70c5bcc8f3a98f88c4ff0a3bd986417df9948eb1819db76d0e" - } - } - ] - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/46_transaction_fromByHexBlockNumber.json b/hive_integration/nodocker/graphql/testcases/46_transaction_fromByHexBlockNumber.json deleted file mode 100644 index 96ff90d14..000000000 --- a/hive_integration/nodocker/graphql/testcases/46_transaction_fromByHexBlockNumber.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "request": "{transaction (hash : \"0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block { number } from(block: \"0x1d\") {transactionCount}} } ", - "responses": [ - { - "data": { - "transaction": { - "block": { - "number": "0x1e" - }, - "from": { - "transactionCount": "0x1d" - } - } - } - } - ], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/47_block_withdrawals_pre_shanghai.json b/hive_integration/nodocker/graphql/testcases/47_block_withdrawals_pre_shanghai.json deleted file mode 100644 index 1699f5c9d..000000000 --- a/hive_integration/nodocker/graphql/testcases/47_block_withdrawals_pre_shanghai.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": - "{ block (number: 32) { number withdrawalsRoot withdrawals { index amount } } }", - - "responses": [{ - "data" : { - "block" : { - "number" : "0x20", - "withdrawalsRoot": null, - "withdrawals": null - } - } - }], - "statusCode": 200 -} diff --git a/hive_integration/nodocker/graphql/testcases/48_block_withdrawals.json b/hive_integration/nodocker/graphql/testcases/48_block_withdrawals.json deleted file mode 100644 index 154c685f9..000000000 --- a/hive_integration/nodocker/graphql/testcases/48_block_withdrawals.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "request": - "{ block (number: 33) { number withdrawalsRoot withdrawals { index amount validator address } } }", - - "responses": [{ - "data" : { - "block" : { - "number" : "0x21", - "withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3", - "withdrawals": [{ - "index": "0x0", - "amount": "0x2540be400", - "validator": "0xa", - "address": "0x0000000000000000000000000000000000000dad" - }] - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/49_get_type2Transaction.json b/hive_integration/nodocker/graphql/testcases/49_get_type2Transaction.json deleted file mode 100644 index 5ceb49f1f..000000000 --- a/hive_integration/nodocker/graphql/testcases/49_get_type2Transaction.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "request": "{transaction (hash : \"0x3ecd2ca6cf26c864d0ea5f038a58d4cd4a46a3e242fe92f446f392fdc232dd98\") { accessList { address storageKeys } maxFeePerGas maxPriorityFeePerGas nonce type status } } ", - "responses": [{ - "data": { - "transaction": { - "accessList": [{ - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "storageKeys": ["0x0000000000000000000000000000000000000000000000000000000000000000"] - }], - "maxFeePerGas": "0xb2d05e00", - "maxPriorityFeePerGas": "0x3b9aca00", - "nonce": "0x20", - "type": "0x2", - "status": "0x1" - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/50_eth_getBlock_shanghai.json b/hive_integration/nodocker/graphql/testcases/50_eth_getBlock_shanghai.json deleted file mode 100644 index 7c7d8bd58..000000000 --- a/hive_integration/nodocker/graphql/testcases/50_eth_getBlock_shanghai.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "request": "{block (number : 33) { baseFeePerGas difficulty extraData miner { address } mixHash nonce stateRoot totalDifficulty withdrawalsRoot withdrawals { address amount index validator } }} ", - "responses":[{ - "data" : { - "block" : { - "baseFeePerGas": "0x3b9aca00", - "difficulty": "0x0", - "extraData": "0x", - "miner": { - "address": "0x0000000000000000000000000000000000000000" - }, - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce": "0x0000000000000000", - "stateRoot": "0x0d3c456bb68669bad05da3a1a766daab236c9df1da8f74edf5ebe9383f00084c", - "totalDifficulty": "0x427c00", - "withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3", - "withdrawals": [ - { - "address": "0x0000000000000000000000000000000000000dad", - "amount": "0x2540be400", - "index": "0x0", - "validator": "0xa" - } - ] - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/51_graphql_tooComplex.json b/hive_integration/nodocker/graphql/testcases/51_graphql_tooComplex.json deleted file mode 100644 index a49a6090a..000000000 --- a/hive_integration/nodocker/graphql/testcases/51_graphql_tooComplex.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{ block { transactions { block { transactions { block { number }}}}}}", - "responses": [{ - "errors": [ - { - "message": "maximum query complexity exceeded 204 > 200", - "extensions": { - "classification": "ExecutionAborted" - } - } - ] - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/hive_integration/nodocker/graphql/testcases/52_graphql_tooComplexSchema.json b/hive_integration/nodocker/graphql/testcases/52_graphql_tooComplexSchema.json deleted file mode 100644 index 70b82a9c8..000000000 --- a/hive_integration/nodocker/graphql/testcases/52_graphql_tooComplexSchema.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{ __schema { types { fields { type { fields { name }}}}}}", - "responses": [{ - "errors": [ - { - "message": "maximum query complexity exceeded 204 > 200", - "extensions": { - "classification": "ExecutionAborted" - } - } - ] - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/tests/all_tests.nim b/tests/all_tests.nim index 20f4b843c..a869cf012 100644 --- a/tests/all_tests.nim +++ b/tests/all_tests.nim @@ -22,7 +22,6 @@ import test_generalstate_json, test_genesis, test_getproof_json, - #test_graphql, -- fails test_jwt_auth, test_ledger, test_multi_keys, diff --git a/tests/test_configuration.nim b/tests/test_configuration.nim index 9b1293f43..9d8e48ad9 100644 --- a/tests/test_configuration.nim +++ b/tests/test_configuration.nim @@ -180,7 +180,6 @@ proc configurationMain*() = conf.rpcEnabled == false conf.wsEnabled == false conf.engineApiWsEnabled == false - conf.graphqlEnabled == false conf.engineApiServerEnabled conf.httpServerEnabled == false conf.shareServerWithEngineApi @@ -192,7 +191,6 @@ proc configurationMain*() = conf.wsEnabled conf.engineApiEnabled == false conf.rpcEnabled == false - conf.graphqlEnabled == false conf.engineApiServerEnabled conf.httpServerEnabled conf.shareServerWithEngineApi @@ -204,7 +202,6 @@ proc configurationMain*() = conf.rpcEnabled conf.engineApiWsEnabled == false conf.wsEnabled == false - conf.graphqlEnabled == false conf.httpServerEnabled conf.engineApiServerEnabled conf.shareServerWithEngineApi == false @@ -216,20 +213,18 @@ proc configurationMain*() = conf.wsEnabled conf.engineApiEnabled == false conf.rpcEnabled == false - conf.graphqlEnabled == false conf.httpServerEnabled conf.engineApiServerEnabled conf.shareServerWithEngineApi == false - test "graphql enabled. ws, rpc, and engine api not enabled": - let conf = makeConfig(@["--graphql"]) + test "ws, rpc, and engine api not enabled": + let conf = makeConfig(@[]) check: conf.engineApiWsEnabled == false conf.wsEnabled == false conf.engineApiEnabled == false conf.rpcEnabled == false - conf.graphqlEnabled == true - conf.httpServerEnabled == true + conf.httpServerEnabled == false conf.engineApiServerEnabled == false conf.shareServerWithEngineApi == false diff --git a/tests/test_graphql.nim b/tests/test_graphql.nim deleted file mode 100644 index 23b9b9479..000000000 --- a/tests/test_graphql.nim +++ /dev/null @@ -1,96 +0,0 @@ -# nim-graphql -# Copyright (c) 2021-2025 Status Research & Development GmbH -# Licensed under either of -# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) -# * MIT license ([LICENSE-MIT](LICENSE-MIT)) -# at your option. -# This file may not be copied, modified, or distributed except according to -# those terms. - -import - std/[json], - stew/byteutils, - eth/[p2p, rlp], - graphql, ../execution_chain/graphql/ethapi, graphql/test_common, - ../execution_chain/sync/protocol, - ../execution_chain/config, - ../execution_chain/core/[chain, tx_pool], - ../execution_chain/common/[common, context], - ./test_helpers - -const - caseFolder = "tests/graphql" - dataFolder = "tests/fixtures/eth_tests/BlockchainTests/ValidBlocks/bcUncleTest" - -proc toBlock(n: JsonNode, key: string): Block = - let rlpBlob = hexToSeqByte(n[key].str) - rlp.decode(rlpBlob, Block) - -proc setupChain(): ForkedChainRef = - let config = ChainConfig( - chainId : MainNet.ChainId, - byzantiumBlock : Opt.some(0.BlockNumber), - constantinopleBlock : Opt.some(0.BlockNumber), - petersburgBlock : Opt.some(0.BlockNumber), - istanbulBlock : Opt.some(0.BlockNumber), - muirGlacierBlock : Opt.some(0.BlockNumber), - berlinBlock : Opt.some(10.BlockNumber) - ) - - var jn = json.parseFile(dataFolder & "/oneUncle.json") - for k, v in jn: - if v["network"].str == "Istanbul": - jn = v - break - - let gen = jn.toBlock("genesisRLP") - var genesis = Genesis( - nonce : gen.header.nonce, - extraData : gen.header.extraData, - gasLimit : gen.header.gasLimit, - difficulty: gen.header.difficulty, - mixHash : gen.header.mixHash, - coinBase : gen.header.coinbase, - timestamp : gen.header.timestamp, - baseFeePerGas: gen.header.baseFeePerGas - ) - if not parseGenesisAlloc($(jn["pre"]), genesis.alloc): - quit(QuitFailure) - - let - customNetwork = NetworkParams( - config: config, - genesis: genesis - ) - com = CommonRef.new( - newCoreDbRef DefaultDbMemory, - taskpool = nil, - CustomNet, - customNetwork - ) - chain = ForkedChainRef.init(com) - blocks = jn["blocks"] - - for n in blocks: - let blk = n.toBlock("rlp") - chain.importBlock(blk).isOkOr: - doAssert(false, error) - - chain - -proc graphqlMain*() = - let - conf = makeTestConfig() - ethCtx = newEthContext() - ethNode = setupEthNode(conf, ethCtx, eth) - chain = setupChain() - txPool = TxPoolRef.new(chain) - - let ctx = setupGraphqlContext(chain, ethNode, txPool) - when isMainModule: - ctx.main(caseFolder, purgeSchema = false) - else: - ctx.executeCases(caseFolder, purgeSchema = false) - -when isMainModule: - graphqlMain() diff --git a/tests/test_jwt_auth.nim b/tests/test_jwt_auth.nim index bdcacd349..6ef6e9c6b 100644 --- a/tests/test_jwt_auth.nim +++ b/tests/test_jwt_auth.nim @@ -8,7 +8,7 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. -## Test Jwt Authorisation Functionality +## Test JWT Authorisation Functionality ## ==================================== import @@ -84,12 +84,12 @@ proc setErrorLevel = # Private Functions # ------------------------------------------------------------------------------ -proc fakeGenSecret(fake: JwtSharedKey): JwtGenSecret = +func fakeGenSecret(fake: JwtSharedKey): JwtGenSecret = ## Key random generator, fake version result = proc: JwtSharedKey = fake -proc base64urlEncode(x: auto): string = +func base64urlEncode(x: auto): string = ## from nimbus-eth2, engine_authentication.nim base64.encode(x, safe = true).replace("=", "") @@ -97,24 +97,24 @@ func getIatToken(time: uint64): JsonNode = ## from nimbus-eth2, engine_authentication.nim %* {"iat": time} -proc getSignedToken(key: openArray[byte], payload: string): string = +func getSignedToken(key: openArray[byte], payload: string): string = ## from nimbus-eth2, engine_authentication.nim # Using hard coded string for """{"typ": "JWT", "alg": "HS256"}""" let sData = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." & base64urlEncode(payload) sData & "." & sha256.hmac(key, sData).data.base64urlEncode -proc getSignedToken2(key: openArray[byte], payload: string): string = +func getSignedToken2(key: openArray[byte], payload: string): string = ## Variant of `getSignedToken()`: different algorithm encoding let jNode = %* {"alg": "HS256", "typ": "JWT" } sData = base64urlEncode($jNode) & "." & base64urlEncode(payload) sData & "." & sha256.hmac(key, sData).data.base64urlEncode -proc getHttpAuthReqHeader(secret: JwtSharedKey; time: uint64): HttpTable = +func getHttpAuthReqHeader(secret: JwtSharedKey; time: uint64): HttpTable = let bearer = secret.UnGuardedKey.getSignedToken($getIatToken(time)) result.add("aUtHoRiZaTiOn", "Bearer " & bearer) -proc getHttpAuthReqHeader2(secret: JwtSharedKey; time: uint64): HttpTable = +func getHttpAuthReqHeader2(secret: JwtSharedKey; time: uint64): HttpTable = let bearer = secret.UnGuardedKey.getSignedToken2($getIatToken(time)) result.add("aUtHoRiZaTiOn", "Bearer " & bearer) @@ -151,27 +151,13 @@ func localAddress(server: GraphqlHttpServerRef): TransportAddress = # Http combo helpers # ------------------------------------------------------------------------------ -proc newGraphqlHandler(): GraphqlHttpHandlerRef = - const schema = """type Query {name: String}""" - - let ctx = GraphqlRef.new() - let r = ctx.parseSchema(schema) - if r.isErr: - debugEcho r.error - # continue with empty schema - - GraphqlHttpHandlerRef.new(ctx) - -proc installRPC(server: RpcServer) = +func installRPC(server: RpcServer) = server.rpc("rpc_echo") do(input: int) -> string: result = "hello: " & $input proc setupComboServer(hooks: sink seq[RpcAuthHook]): HttpResult[NimbusHttpServerRef] = var handlers: seq[RpcHandlerProc] - let qlServer = newGraphqlHandler() - handlers.addHandler(qlServer) - let wsServer = newRpcWebsocketHandler() wsServer.installRPC() handlers.addHandler(wsServer) @@ -383,24 +369,6 @@ proc runJwtAuth(noisy = true; keyFile = jwtKeyFile) = server.start() - test "Graphql query no auth": - let client = setupClient(server.localAddress) - let res = waitFor client.sendRequest(query) - check res.isOk - let resp = res.get() - check resp.status == 403 - check resp.reason == "Forbidden" - check resp.response == "Missing authorization token" - - test "Graphql query with auth": - let client = setupClient(server.localAddress) - let res = waitFor client.sendRequest(query, req.toList) - check res.isOk - let resp = res.get() - check resp.status == 200 - check resp.reason == "OK" - check resp.response == """{"data":{"__type":{"kind":"SCALAR"}}}""" - test "rpc query no auth": let client = newRpcHttpClient() waitFor client.connect("http://" & $server.localAddress) diff --git a/tests/test_tools_build.nim b/tests/test_tools_build.nim index 8ad95e5d7..6850918a9 100644 --- a/tests/test_tools_build.nim +++ b/tests/test_tools_build.nim @@ -1,5 +1,5 @@ # nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2018-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license: [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT # * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) @@ -16,7 +16,6 @@ import #./persistBlockTestGen, # -- ditto ../hive_integration/nodocker/rpc/rpc_sim, ../hive_integration/nodocker/consensus/consensus_sim, - #../hive_integration/nodocker/graphql/graphql_sim, # -- does not compile ../hive_integration/nodocker/engine/engine_sim, ../hive_integration/nodocker/pyspec/pyspec_sim, ../tools/t8n/t8n,