Commit Graph

46 Commits

Author SHA1 Message Date
Sina Mahmoodi
62fb7d3f85
graphql: revert storage access regression (#27007) 2023-03-30 06:57:49 -04:00
Sina Mahmoodi
a236e03d00
graphql: fix data races (#26965)
Fixes multiple data races caused by the fact that resolving fields are done concurrently by the graphql library. It also enforces caching at the stateobject level for account fields.
2023-03-28 03:08:10 -04:00
Péter Szilágyi
cd31f2dee2
all: change chain head markers from block to header (#26777) 2023-03-02 08:29:15 +02:00
Sina Mahmoodi
818ff32ff5
graphql: fixes missing tx logs (#25745)
* graphql: fix tx logs

* graphql: refactor test service setup

* graphql: add test for tx logs
2022-09-13 22:49:52 +03:00
Sina Mahmoodi
8cfcb41e57
graphql: return correct logs for tx (#25612)
* graphql: fix tx logs

* minor

* Use optimized search for selecting tx logs
2022-08-31 16:14:53 +02:00
Sina Mahmoodi
36874b63a1
eth/filters: add global block logs cache (#25459)
This adds a cache for block logs which is shared by all filters. The cache
size of is configurable using the `--cache.blocklogs` flag.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-08-19 11:14:59 +02:00
Felix Lange
f809cf6ea6
graphql: embed *Resolver instead of backend interface (#25468)
This creates some infrastructure to share resources between graphql
API objects.
2022-08-03 19:08:32 +02:00
Sina Mahmoodi
29a6b6bcac
graphql: add raw fields to block and tx (#24816) 2022-05-17 11:31:17 +03:00
Sina Mahmoodi
440c9fcf75
graphql: fix long literal passed in a variable (#24864) 2022-05-12 21:10:08 +02:00
Sina Mahmoodi
d73df893a6
graphql: add rawReceipt field to transaction type (#24738)
* graphql: add tx receiptsRLP field

* use MarshalBinary

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>

* update schema

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>

* rename to rawReceipt

* indent fix

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
2022-05-04 14:31:07 +02:00
Sina Mahmoodi
57cec89253
graphql: fee history fields (#24452)
This PR adds the `NextBaseFeePerGas` to `Block` and `EffectiveTip` to `Transaction` to make it easier for clients to compute fee history themselves via graphql queries.
2022-03-10 13:59:22 +01:00
Sina Mahmoodi
862f8e98bc
graphql: fix nonce for pending accounts (#24443) 2022-02-22 10:45:11 +01:00
Sina Mahmoodi
3ccd6b6dbb
graphql: fix block resolving for parent field (#24191)
Fixes #24161
2022-01-05 16:22:46 +01:00
Sina Mahmoodi
c20de3c4bd
graphql: fix pre-byzantium receipt status (#24188)
Fixes #24124
2022-01-05 16:21:08 +01:00
Sina Mahmoodi
c0d17bca52
graphql: check header first in blocks query (#24190)
Fixes #24167

New behaviour is that the endpoint returns results only for available
blocks without returning an error when it doesn't find a block. Note we
skip any block after a non-existent block.

This adds a header fetch for every block in range (even if header
is not needed). Alternatively, we could do the check in every field's
resolver method to avoid this overhead.
2022-01-05 16:11:46 +01:00
Péter Szilágyi
c10a0a62c3
eth: request id dispatcher and direct req/reply APIs (#23576)
* eth: request ID based message dispatcher

* eth: fix dispatcher cancellation, rework fetchers idleness tracker

* eth/downloader: drop peers who refuse to serve advertised chains
2021-11-26 13:26:03 +02:00
noam-alchemy
633e7ef478
eth,rpc: allow for flag configured timeouts for eth_call (#23645)
* eth,rpc: allow for flag configured timeouts for eth_call

* lint: account for package-local import order

* cr: rename `rpc.calltimeout` to `rpc.evmtimeout`
2021-10-12 10:46:04 +02:00
Martin Holst Swende
42bc1944a1
graphql: add storage slots to access list (#23650)
Fixes #23640
2021-09-29 00:28:17 +02:00
Péter Szilágyi
9e17648d8c
les: duplicate downloader and fetcher to allow progressive refactoring 2021-09-10 11:11:59 +03:00
gary rong
bef78efb49
graphql: fix transaction API (#23052) 2021-06-22 12:13:48 +03:00
Péter Szilágyi
aa69d36152
core, graphql, internal: expose effectiveGasPrice in receipts 2021-06-16 09:52:06 +03:00
Péter Szilágyi
c503f98f6d
all: rename internal 1559 gas fields, add support for graphql (#23010)
* all: rename internal 1559 gas fields, add support for graphql

* cmd/evm/testdata, core: use public 1559 gas names on API surfaces
2021-06-08 12:05:41 +02:00
Martin Holst Swende
5cff9754d7
core, eth, internal, les: RPC methods and fields for EIP 1559 (#22964)
* internal/ethapi: add baseFee to RPCMarshalHeader

* internal/ethapi: add FeeCap, Tip and correct GasPrice to EIP-1559 RPCTransaction results

* core,eth,les,internal: add support for tip estimation in gas price oracle

* internal/ethapi,eth/gasprice: don't suggest tip larger than fee cap

* core/types,internal: use correct eip1559 terminology for json marshalling

* eth, internal/ethapi: fix rebase problems

* internal/ethapi: fix rpc name of basefee

* internal/ethapi: address review concerns

* core, eth, internal, les: simplify gasprice oracle (#25)

* core, eth, internal, les: simplify gasprice oracle

* eth/gasprice: fix typo

* internal/ethapi: minor tweak in tx args

* internal/ethapi: calculate basefee for pending block

* internal/ethapi: fix panic

* internal/ethapi, eth/tracers: simplify txargs ToMessage

* internal/ethapi: remove unused param

* core, eth, internal: fix regressions wrt effective gas price in the evm

* eth/gasprice: drop weird debug println

* internal/jsre/deps: hack in 1559 gas conversions into embedded web3

* internal/jsre/deps: hack basFee to decimal conversion

* internal/ethapi: init feecap and tipcap for legacy txs too

* eth, graphql, internal, les: fix gas price suggestion on all combos

* internal/jsre/deps: handle decimal tipcap and feecap

* eth, internal: minor review fixes

* graphql, internal: export max fee cap RPC endpoint

* internal/ethapi: fix crash in transaction_args

* internal/ethapi: minor refactor to make the code safer

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-06-02 16:13:10 +03:00
aaronbuchwald
05dab7f6bd
internal/ethapi: remove unused vm.Config parameter of DoCall (#22942) 2021-05-26 08:39:41 +02:00
gary rong
51b32cc7e4
internal/ethapi: merge CallArgs and SendTxArgs (#22718)
There are two transaction parameter structures defined in
the codebase, although for different purposes. But most of
the parameters are shared. So it's nice to reduce the code
duplication by merging them together.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-05-25 22:30:21 +02:00
AmitBRD
adf09aeab1
graphql: add support for tx types and tx access lists (#22491)
This adds support for EIP-2718 access list transactions in the GraphQL API.

Co-authored-by: Amit Shah <amitshah0t7@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-04-06 15:58:36 +02:00
lightclient
bbfb1e4008
all: add support for EIP-2718, EIP-2930 transactions (#21502)
This adds support for EIP-2718 typed transactions as well as EIP-2930
access list transactions (tx type 1). These EIPs are scheduled for the
Berlin fork.

There very few changes to existing APIs in core/types, and several new APIs
to deal with access list transactions. In particular, there are two new
constructor functions for transactions: types.NewTx and types.SignNewTx.
Since the canonical encoding of typed transactions is not RLP-compatible,
Transaction now has new methods for encoding and decoding: MarshalBinary
and UnmarshalBinary.

The existing EIP-155 signer does not support the new transaction types.
All code dealing with transaction signatures should be updated to use the
newer EIP-2930 signer. To make this easier for future updates, we have
added new constructor functions for types.Signer: types.LatestSigner and
types.LatestSignerForChainID. 

This change also adds support for the YoloV3 testnet.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
2021-02-25 15:26:57 +01:00
rene
c0862f4f4c
graphql: change receipt status to decimal instead of hex (#22187)
This PR fixes the receipt status field to be decimal instead of a hex string,
as called for by the spec.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-01-25 11:31:18 +01:00
rene
072fd96254
graphql: return decimal for estimateGas and cumulativeGas queries (#22126)
* estimateGas, cumulativeGas
* linted
* add test for estimateGas
2021-01-06 17:19:16 +01:00
Antoine Toulme
eb2a1dfdd2
graphql: use a decimal representation for gas limit and gas used (#21883)
This changes the JSON encoding of blocks returned by the API
to have decimal instead of hexadecimal numbers. The spec wants
it this way.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-01-05 11:22:32 +01:00
Péter Szilágyi
017831dd5b
core, eth: split eth package, implement snap protocol (#21482)
This commit splits the eth package, separating the handling of eth and snap protocols. It also includes the capability to run snap sync (https://github.com/ethereum/devp2p/blob/master/caps/snap.md) , but does not enable it by default. 

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2020-12-14 10:27:15 +01:00
Alex Prut
810f9e057d
all: remove redundant conversions and import names (#21903) 2020-11-25 21:00:23 +01:00
Shude Li
341f451083
graphql: add support for retrieving the chain id (#21451) 2020-08-25 11:38:56 +03:00
gary rong
6eef141aef
les: historical data garbage collection (#19570)
This change introduces garbage collection for the light client. Historical
chain data is deleted periodically. If you want to disable the GC, use
the --light.nopruning flag.
2020-07-13 11:02:54 +02:00
Marius van der Wijden
0b3f3be2b5
internal/ethapi: return revert reason for eth_call (#21083)
* internal/ethapi: return revert reason for eth_call

* internal/ethapi: moved revert reason logic to doCall

* accounts/abi/bind/backends: added revert reason logic to simulated backend

* internal/ethapi: fixed linting error

* internal/ethapi: check if require reason can be unpacked

* internal/ethapi: better error logic

* internal/ethapi: simplify logic

* internal/ethapi: return vmError()

* internal/ethapi: move handling of revert out of docall

* graphql: removed revert logic until spec change

* rpc: internal/ethapi: added custom error types

* graphql: use returndata instead of return

Return() checks if there is an error. If an error is found, we return nil.
For most use cases it can be beneficial to return the output even if there
was an error. This code should be changed anyway once the spec supports
error reasons in graphql responses

* accounts/abi/bind/backends: added tests for revert reason

* internal/ethapi: add errorCode to revert error

* internal/ethapi: add errorCode of 3 to revertError

* internal/ethapi: unified estimateGasErrors, simplified logic

* internal/ethapi: unified handling of errors in DoEstimateGas

* rpc: print error data field

* accounts/abi/bind/backends: unify simulatedBackend and RPC

* internal/ethapi: added binary data to revertError data

* internal/ethapi: refactored unpacking logic into newRevertError

* accounts/abi/bind/backends: fix EstimateGas

* accounts, console, internal, rpc: minor error interface cleanups

* Revert "accounts, console, internal, rpc: minor error interface cleanups"

This reverts commit 2d3ef53c5304e429a04983210a417c1f4e0dafb7.

* re-apply the good parts of 2d3ef53c53

* rpc: add test for returning server error data from client

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2020-06-08 11:09:49 +03:00
gary rong
b9df7ecdc3
all: seperate consensus error and evm internal error (#20830)
* all: seperate consensus error and evm internal error

There are actually two types of error will be returned when
a tranaction/message call is executed: (a) consensus error
(b) evm internal error. The former should be converted to
a consensus issue, e.g. The sender doesn't enough asset to
purchase the gas it specifies. The latter is allowed since
evm itself is a blackbox and internal error is allowed to happen.

This PR emphasizes the difference by introducing a executionResult
structure. The evm error is embedded inside. So if any error
returned, it indicates consensus issue happens.

And also this PR improve the `EstimateGas` API to return the concrete
revert reason if the transaction always fails

* all: polish

* accounts/abi/bind/backends: add tests

* accounts/abi/bind/backends, internal: cleanup error message

* all: address comments

* core: fix lint

* accounts, core, eth, internal: address comments

* accounts, internal: resolve revert reason if possible

* accounts, internal: address comments
2020-04-22 11:25:36 +03:00
AmitBRD
34bb132b10
graphql: add transaction signature values (#20623)
The feature update allows the GraphQL API endpoint to retrieve
transaction signature R,S,V parameters.

Co-authored-by: amitshah <amitshah0t7@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2020-02-09 21:50:44 +01:00
Ryan Schneider
ad03d9801c internal/ethapi: support block number or hash on state-related methods (#19491)
This change adds support for EIP-1898.
2019-09-26 10:47:31 +02:00
gary rong
c9cdf144d5 graphql, internal/ethapi: support overriding accounts in eth_call (#19917)
* graphql, internal/ethapi: extend eth_call

This PR offers the third option parameter for eth_call API.
Caller can specify a batch of contracts for overriding the
original account metadata(nonce, balance, code, state).
It has a few advantages:

* It's friendly for debugging
* It's can make on-chain contract lighter for getting rid of
  state access functions

* core, internal: address comments
2019-08-08 16:44:11 +03:00
gary rong
8812c4d3f9 eth, graphql, internal/ethapi, les: polish and improve graphql (#19886) 2019-07-25 09:29:53 +03:00
Péter Szilágyi
1a83114c74
all: update author list and licenses 2019-07-22 12:17:27 +03:00
Péter Szilágyi
e3ec77f50e
cmd, graphql, node: graphql flag polishes, les integration 2019-06-20 09:40:26 +03:00
Martin Holst Swende
e2f3465e83 eth, les, geth: implement cli-configurable global gas cap for RPC calls (#19401)
* eth, les, geth: implement cli-configurable global gas cap for RPC calls

* graphql, ethapi: place gas cap in DoCall

* ethapi: reformat log message
2019-04-08 14:49:52 +03:00
Martin Holst Swende
0b4fe8d192 all: simplify timestamps to uint64 (#19372)
* all: simplify timestamps to uint64

* tests: update definitions

* clef, faucet, mobile: leftover uint64 fixups

* ethash: fix tests

* graphql: update schema for timestamp

* ethash: remove unused variable
2019-04-02 23:28:48 +03:00
Nick Johnson
acebccc3bf graphql: Updates to graphql support to match EIP1767 (#19238)
Updates to match EIP1767
2019-03-18 07:24:43 +01:00
Shunsuke Watanabe
95b2ec7169 changed file name grahpql.go to graphql.go (#19267)
graphql: fix typo in file name
2019-03-14 11:38:54 +02:00