mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-28 11:50:45 +00:00
rm graphql (EIP-1767) server (#3080)
This commit is contained in:
parent
c0e329d768
commit
c8e6247a16
@ -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"))
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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!
|
||||
}
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
echo "Running nimbus execution client with flags $FLAGS"
|
||||
$nimbus_execution_client $FLAGS
|
||||
|
@ -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()
|
Binary file not shown.
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
"{ block { number } }",
|
||||
|
||||
"responses": [{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"number" : "0x21"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"request" :"{block(number: 32) {estimateGas (data: {from :\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029\"})}}",
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"estimateGas" : "0x1b551"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"request" :"{block(number: 32) { estimateGas(data:{}) }}",
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"estimateGas" : "0x5208"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"request" :"{block{estimateGas (data: {from :\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", to :\"0x8888f1f195afa192cfee860698584c030f4c9db1\"})}}",
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"estimateGas" : "0x5208"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
"{ gasPrice }",
|
||||
"responses": [
|
||||
{
|
||||
"data" : {
|
||||
"gasPrice" : "0x10"
|
||||
}
|
||||
},
|
||||
{
|
||||
"data" : {
|
||||
"gasPrice" : "0x1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"request": "{block (number : 25) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}",
|
||||
"responses": [{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"balance": "0xfa"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"request": "{block (number: 25) {account(address: \"0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\") { balance } }}",
|
||||
"responses": [{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"balance": "0x0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"request": "{block{account(address: \"0xdeaff00ddeaff00ddeaff00ddeaff00ddeaff00d\") { balance } }}",
|
||||
"responses": [{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"balance": "0x0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"request": "{block{account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}",
|
||||
"responses":[{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"balance": "0x140"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
|
||||
"{block (hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {transactionCount}} ",
|
||||
|
||||
|
||||
"responses": [{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"transactionCount" : "0x1"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"request" : "{block{ account(address: \"0x8888f1f195afa192cfee860698584c030f4c9db1\") { code } }}",
|
||||
|
||||
"responses": [{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"code": "0x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"request" : "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { code } }}",
|
||||
|
||||
"responses": [{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"code": "0x6000357c010000000000000000000000000000000000000000000000000000000090048063102accc11461012c57806312a7b9141461013a5780631774e6461461014c5780631e26fd331461015d5780631f9030371461016e578063343a875d1461018057806338cc4831146101955780634e7ad367146101bd57806357cb2fc4146101cb57806365538c73146101e057806368895979146101ee57806376bc21d9146102005780639a19a9531461020e5780639dc2c8f51461021f578063a53b1c1e1461022d578063a67808571461023e578063b61c05031461024c578063c2b12a731461025a578063d2282dc51461026b578063e30081a01461027c578063e8beef5b1461028d578063f38b06001461029b578063f5b53e17146102a9578063fd408767146102bb57005b6101346104d6565b60006000f35b61014261039b565b8060005260206000f35b610157600435610326565b60006000f35b6101686004356102c9565b60006000f35b610176610442565b8060005260206000f35b6101886103d3565b8060ff1660005260206000f35b61019d610413565b8073ffffffffffffffffffffffffffffffffffffffff1660005260206000f35b6101c56104c5565b60006000f35b6101d36103b7565b8060000b60005260206000f35b6101e8610454565b60006000f35b6101f6610401565b8060005260206000f35b61020861051f565b60006000f35b6102196004356102e5565b60006000f35b610227610693565b60006000f35b610238600435610342565b60006000f35b610246610484565b60006000f35b610254610493565b60006000f35b61026560043561038d565b60006000f35b610276600435610350565b60006000f35b61028760043561035e565b60006000f35b6102956105b4565b60006000f35b6102a3610547565b60006000f35b6102b16103ef565b8060005260206000f35b6102c3610600565b60006000f35b80600060006101000a81548160ff021916908302179055505b50565b80600060016101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009081020402179055505b50565b80600060026101000a81548160ff021916908302179055505b50565b806001600050819055505b50565b806002600050819055505b50565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b806004600050819055505b50565b6000600060009054906101000a900460ff1690506103b4565b90565b6000600060019054906101000a900460000b90506103d0565b90565b6000600060029054906101000a900460ff1690506103ec565b90565b600060016000505490506103fe565b90565b60006002600050549050610410565b90565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061043f565b90565b60006004600050549050610451565b90565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be5806000602a81526020016000a15b565b6000602a81526020016000a05b565b60017f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b6000602a81526020016000a25b565b60016000602a81526020016000a15b565b3373ffffffffffffffffffffffffffffffffffffffff1660017f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b6000602a81526020016000a35b565b3373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a25b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f6000602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a35b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017fd5f0a30e4be0c6be577a71eceb7464245a796a7e6a55c0d971837b250de05f4e60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff16600160007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a35b56"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"request": "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { storage(slot: \"0x0000000000000000000000000000000000000000000000000000000000000021\") } }}",
|
||||
"responses": [
|
||||
{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"storage": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"request": "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { storage(slot: \"0x0000000000000000000000000000000000000000000000000000000000000004\") } }}",
|
||||
"responses": [
|
||||
{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"storage": "0xaabbccffffffffffffffffffffffffffffffffffffffffffffffffffffffffee"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
|
||||
"{ block(number: 30) { transactionAt(index: 1) {block{hash} hash} } }",
|
||||
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"transactionAt" : null
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
|
||||
"{transaction (hash : \"0xffc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block{hash} gas gasPrice hash inputData nonce index value }} ",
|
||||
|
||||
|
||||
"responses": [{
|
||||
"data" : {
|
||||
"transaction" : null
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"request": "{block{ account(address: \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\") { transactionCount } }}",
|
||||
"responses": [{
|
||||
"data": {
|
||||
"block": {
|
||||
"account": {
|
||||
"transactionCount": "0x21"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"request" : "mutation { sendRawTransaction(data: \"0xf901ca3285174876e800830fffff8080b90177608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb00291ca05d71c687073e23402e59853d85c587f6eebc735082f40a450e407451b42ee2a4a07d4f2db1717dc9be745b991962193fa0d5f6059b9c92350dba3efe3a99df6b52\") }",
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"sendRawTransaction" : "0xf9a25e1d6202e9ea1d984f76939e9bb3609bfb9aea2541ae8a629270343fbb2f"
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"request" : "mutation { sendRawTransaction(data: \"0xf8693785174876e800830fffff94450b61224a7df4d8a70f3e20d4fd6a6380b920d180843bdab8bf1ba054b00220864ab58246bbe0a6f6d50166f9bd0ba3f1711912f79c073da6368ca5a04f84bc3231ee4406b8ceb8740d6d8d1900f87b67b9f4a0a38bc55062121a94c6\") }",
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"sendRawTransaction" : "0x6ad12f495251471d1834852623c2eeb2cb04d2fb9e1a5d6cff481cfec7b233a8"
|
||||
}
|
||||
}],
|
||||
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"request" : "mutation { sendRawTransaction(data: \"0xf86d3785174876e801830222e0945aae326516b4f8fe08074b7e972e40a713048d628829a2241af62c0000801ca077d36666ce36d433b6f1ac62eafe7a232354c83ad2293cfcc2445a86bcd08b4da04b8bd0918d440507ab81d47cf562addaa15a1d28ac701989f5141c8da49615d0\") }",
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"sendRawTransaction" : "0x772b6d5c64b9798865d6dfa35ba44d181abd96a448f8ab7ea9e9631cabb7b290"
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
"{ syncing {startingBlock currentBlock highestBlock } }",
|
||||
|
||||
"responses": [{
|
||||
"data" : {
|
||||
"syncing" : null
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"request": "{ blocks(from:30) { number } }",
|
||||
"responses": [{
|
||||
"data": {
|
||||
"blocks": [
|
||||
{
|
||||
"number": "0x1e"
|
||||
},
|
||||
{
|
||||
"number": "0x1f"
|
||||
},
|
||||
{
|
||||
"number": "0x20"
|
||||
},
|
||||
{
|
||||
"number": "0x21"
|
||||
}
|
||||
]
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"request": "{block (number : \"0x1e\") { gasUsed gasLimit hash }} ",
|
||||
|
||||
"responses":[{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"gasUsed" : "0x5c21",
|
||||
"gasLimit" : "0x2fefd8",
|
||||
"hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"request":
|
||||
"{ block (number: 32) { number withdrawalsRoot withdrawals { index amount } } }",
|
||||
|
||||
"responses": [{
|
||||
"data" : {
|
||||
"block" : {
|
||||
"number" : "0x20",
|
||||
"withdrawalsRoot": null,
|
||||
"withdrawals": null
|
||||
}
|
||||
}
|
||||
}],
|
||||
"statusCode": 200
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -22,7 +22,6 @@ import
|
||||
test_generalstate_json,
|
||||
test_genesis,
|
||||
test_getproof_json,
|
||||
#test_graphql, -- fails
|
||||
test_jwt_auth,
|
||||
test_ledger,
|
||||
test_multi_keys,
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
@ -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)
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user