Commit Graph

283 Commits

Author SHA1 Message Date
Felix Lange
87186148e0
core/types: add EffectiveGasPrice in Receipt (#26713)
This change adds a struct field EffectiveGasPrice in types.Receipt. The field is present
in RPC responses, but not in the Go struct, and thus can't easily be accessed via ethclient.

Co-authored-by: PulsarAI <dev@pulsar-systems.fi>
2023-03-06 17:19:41 +01: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
2def62b99b
eth/filters: avoid block body retrieval when no matching logs (#25199)
Logs stored on disk have minimal information. Contextual information such as block
number, index of log in block, index of transaction in block are filled in upon request.
We can fill in all these fields only having the block header and list of receipts.
But determining the transaction hash of a log requires the block body.

The goal of this PR is postponing this retrieval until we are sure we the transaction hash.
It happens often that the header bloom filter signals there might be matches in a block,
but after actually checking them reveals the logs do not match. We want to avoid fetching
the body in this case.

Note that this changes the semantics of Backend.GetLogs. Downstream callers of
GetLogs now assume log context fields have not been derived, and need to call
DeriveFields on the logs if necessary.
2023-02-13 10:59:27 +01:00
Felix Lange
31d401ea68
rpc: remove DecimalOrHex type (#26629)
It's the same as math.HexOrDecimal64, which has more uses across the codebase.
2023-02-07 15:44:27 +01:00
lightclient
bd6a05e1ee
internal/ethapi: always return block withdrawals if present (#26565)
The execution-apis specification says that the full list of withdrawals should always be returned when requesting a block over RPC:

378c4304f7/src/schemas/block.yaml (L90-L94)

This change adopts the expected behavior.
2023-01-31 03:34:03 -05:00
Marius van der Wijden
2a2b0419fb
all: implement withdrawals (EIP-4895) (#26484)
This change implements withdrawals as specified in EIP-4895.

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: marioevz <marioevz@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-01-25 15:32:25 +01:00
Martin Holst Swende
2b57a27d9e
all: make timestamp-based fork checks based on uint64 (#26474)
This PR changes the API so that uint64 is used for fork timestamps.
It's a good choice because types.Header also uses uint64 for time.

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-01-25 12:12:28 +01:00
Martin Holst Swende
7a489623ac
core/state: remove notion of fake storage (#24916)
This PR removes the notion of fakeStorage from the state objects, and instead, for any state modifications that are needed, it simply makes the changes.
2023-01-10 08:24:30 -05:00
Marius van der Wijden
efc9409ca9
params: core: enable shanghai based on timestamps 2023-01-03 12:56:25 +02:00
rjl493456442
01808421e2
core/state: return error when storage trie can't be opened (#26350)
This changes the StorageTrie method to return an error when the trie
is not available. It used to return an 'empty trie' in this case, but that's
not possible anymore under PBSS.
2022-12-21 10:21:21 +01:00
Martin Holst Swende
8c5ce1107b
eth/filters: send rpctransactions in pending-subscription (#26126)
This PR changes the pending tx subscription to return RPCTransaction types instead of normal Transaction objects. This will fix the inconsistencies with other tx returning API methods (i.e. getTransactionByHash), and also fill in the sender value for the tx.

co-authored by @s1na
2022-11-14 14:48:01 +01:00
s7v7nislands
9b9a1b677d
internal/ethapi, accounts/abi/backends: use error defined in core (#26012)
Co-authored-by: seven <seven@nodereal.io>
2022-10-20 12:56:12 +02:00
Martin Holst Swende
5a02b2d6d0
all: fix spelling mistakes (#25961) 2022-10-11 09:37:00 +02:00
TY
88132afc3f
internal/ethapi: handle odd length hex in decodeHash (#25883)
This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. 

Co-authored-by: ty <ty@oncoder.com>
2022-09-28 18:55:44 +02:00
lightclient
8ade5e6c14
internal/ethapi: return error when requesting invalid trie key (#25762)
This change makes eth_getProof and eth_getStorageAt return an error when
the argument contains invalid hex in storage keys.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-09-16 18:16:32 +02:00
Felix Lange
b628d72766
build: upgrade to go 1.19 (#25726)
This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.
2022-09-10 13:25:40 +02:00
lightclient
70e1e65b1d
internal/ethapi: rename debug getters to match spec (#25176)
Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method.
2022-08-25 10:41:37 +02:00
Felix Lange
ac7ad811b4
internal/ethapi: fix build regression (#25555) 2022-08-19 14:48:49 +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
ucwong
fa1305f8bf
internal/ethapi: fix comment typo (#25548) 2022-08-19 09:01:09 +03:00
Justin Traglia
2c5648d891
all: fix some typos (#25551)
* Fix some typos

* Fix some mistakes

* Revert 4byte.json

* Fix an incorrect fix

* Change files to fails
2022-08-19 09:00:21 +03:00
lightclient
0be9d76e37
internal/ethapi: rework setDefaults for tx args so fee logic is separate (#25197)
Co-authored-by: bobpkr <bob.p@krustuniverse.com>
2022-08-11 10:56:53 +02:00
lightclient
948e08d55b
internal/ethapi: don't estimate gas if no limit provided in eth_createAccessList (#25467)
Because the goal of eth_createAccessList is providing the caller with the largest-possible
access list, it's generally not important that the gas limit used by the tracer will match the usage
of the call exactly. Avoiding the gas estimation step is a performance improvement. As long as the
call does not branch based on gas limit, the returned access list will be accurate.
2022-08-03 18:18:45 +02:00
lightclient
9ad508018e
ethereum, ethclient: add FeeHistory support (#25403)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-07-29 18:22:04 +02:00
lightclient
434ca026c9
internal/ethapi: error if tx args includes chain id that doesn't match local (#25157)
* internal/ethapi: error if tx args includes chain id that doesn't match local

* internal/ethapi: simplify code a bit

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-07-14 13:17:25 +03:00
Péter Szilágyi
b53d38246e
Merge pull request #25096 from lightclient/remove-version-field
all: remove version field
2022-07-14 12:13:59 +03:00
lightclient
ae8ce72022
internal/ethapi: fix chain ID check to return all non-zero IDs (#25244) 2022-07-07 21:50:28 +02:00
Sina Mahmoodi
cb7f35996d
internal/ethapi: add basefee to block overrides (#25219) 2022-07-05 14:48:34 +02:00
Seungbae.yu
2697e44d81
all: change format 0x%x to %#x (#25221) 2022-07-04 11:03:32 +03:00
lightclient
3e693e1ef6
internal/ethapi: return chain id for EIP-155 legacy txs (#25155) 2022-06-29 11:58:59 +02:00
lightclient@protonmail.com
0c6f81f888
all: remove version field from rpc.API 2022-06-27 12:39:46 +02:00
lightclient
119f955686
all: remove public field from rpc.API (#25059)
all: remove public field from rpc.API
2022-06-27 13:33:13 +03:00
lightclient
c7f485d9e5
internal/ethapi: add note about eth_chainId compatibility with EIP-695 (#25168)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-06-25 21:34:21 +02:00
lightclient
647c6f2db6
internal/ethapi: always return chain id (#25166)
The error was introduced in PR #21686, but there is no good reason to enforce sync
in this method, and it causes issues with EL/CL integration.
2022-06-24 18:03:13 +02:00
lightclient
10dc5dce08
all: remove concept of public/private API definitions (#25053)
* internal/ethapi: rename PublicEthereumAPI to EthereumAPI

* eth: rename PublicEthereumAPI to EthereumAPI

* internal/ethapi: rename PublicTxPoolAPI to TxPoolAPI

* internal/ethapi: rename PublicAccountAPI to EthereumAccountAPI

* internal/ethapi: rename PrivateAccountAPI to PersonalAccountAPI

* internal/ethapi: rename PublicBlockChainAPI to BlockChainAPI

* internal/ethapi: rename PublicTransactionPoolAPI to TransactionAPI

* internal/ethapi: rename PublicDebugAPI to DebugAPI

* internal/ethapi: move PrivateDebugAPI methods to DebugAPI

* internal/ethapi: rename PublicNetAPI to NetAPI

* les: rename PrivateLightServerAPI to LightServerAPI

* les: rename PrivateLightAPI to LightAPI

* les: rename PrivateDebugAPI to DebugAPI

* les: rename PublicDownloaderAPI to DownloaderAPI

* eth,les: rename PublicFilterAPI to FilterAPI

* eth: rename PublicMinerAPI to MinerAPI

* eth: rename PublicDownloaderAPI to DownloaderAPI

* eth: move PrivateMinerAPI methods to MinerAPI

* eth: rename PrivateAdminAPI to AdminAPI

* eth: rename PublicDebugAPI to DebugAPI

* eth: move PrivateDebugAPI methods to DebugAPI

* node: rename publicAdminAPI to adminAPI

* node: move privateAdminAPI methods to adminAPI

* node: rename publicWeb3API to web3API

* eth,internal/ethapi: sync comments with previous renamings
2022-06-21 12:05:43 +03:00
Sina Mahmoodi
d39f0cce71
internal/ethapi: remove SignAndSendTransaction (#25111) 2022-06-20 10:38:46 +02:00
Kosuke Taniguchi
ba99e19215
internal/ethapi: add comment explaining return of nil instead of error (#25097)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-06-16 17:08:25 +02:00
lmittmann
bc013bc42e
all: prefer new(big.Int) over big.NewInt(0) (#25087)
minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`
2022-06-14 15:09:48 +03:00
Luozhu
3f5b5ec3e5
internal/ethapi: fix typo in comment (#25056)
typo error: keccack256 -> keccak256
2022-06-10 10:57:32 +02:00
Sina Mahmoodi
d9566e39bd
eth/filters: fix getLogs for pending block (#24949)
* eth/filters: fix pending for getLogs

* add pending method to test backend

* fix block range validation
2022-06-07 08:31:19 +02:00
Martin Holst Swende
d8a2305565
eth/tracers: add support for block overrides in debug_traceCall (#24871)
This PR adds support for block overrides when doing debug_traceCall.

- Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
- With this change, we reject executing debug_traceCall against pending.
- And we add ability to override all evm-visible header fields.
2022-06-02 11:39:36 +02:00
Martin Holst Swende
57192bd0dc
ethdb/remotedb, cmd: add support for remote (readonly) databases (#24836)
* ethdb/remotedb, cmd: add support for remote (readonly) databases

* ethdb/remotedb: minor changes

* ethdb/remotedb: close the conn

* cmd, ethdb: add rpc accessor for ancient data

* internal/ethapi: license

* ethdb/remotedb: linter fixes
2022-05-18 17:27:17 +03:00
Ryan Schneider
ae7d834bc7
internal/ethapi: add debug_getRawReceipts RPC method (#24773)
Adds a method to retrieve all the binary encoded receipts from a block
2022-05-14 22:33:41 +02:00
Sina Mahmoodi
5b46f1d1eb
internal: drop TestSignCliqueBlock (#24837) 2022-05-10 10:46:26 +02:00
Sina Mahmoodi
16701c5169
internal/ethapi: add db operations to api (#24739)
Adds `debug_dbGet` method to rpc api
2022-04-27 08:37:48 +02:00
Sina Mahmoodi
fb3a081c7e
eth/tracers: refactor traceTx to separate out struct logging (#24326)
* eth/tracers: refactor traceTx to separate out struct logging

review fix

Update eth/tracers/api.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

Mv ExecutionResult type to logger package

review fix

impl GetResult for StructLogger

make formatLogs private

confused exit and end..

account for intrinsicGas in structlogger, fix TraceCall test

Add Stop method to logger

Simplify traceTx

Fix test

rm logger from blockchain test

account for refund in structLogger

* use tx hooks in struct logger

* minor

* avoid executionResult in struct logger

* revert blockchain test changes
2022-04-06 09:34:18 +02:00
Zhang Zhuo
b5a129ea24
internal/ethapi: add refund to StructLogRes (#24567)
* internal/ethapi: add refund to StructLogRes

* Update internal/ethapi/api.go

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2022-03-29 22:34:10 +02:00
b1ackd0t
f01e2fab07
internal/ethapi: fix incorrect type on empty slice (#24372)
* Fixes #24368

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update internal/ethapi/api.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-02-15 10:44:22 +01:00
Denver
06e16de894
internal/ethapi: remove unnecessary comment (#24271)
Because there is no `fullTx` parameter at function signatures and
uncle apis does not return txs also, those lines are un-necessary.
2022-01-24 06:43:51 +02:00
Denver
03aaea11d1
internal/ethapi: use same receiver names (#24252)
* Chore: use same receiver names

* Fix syntax issues
2022-01-20 10:38:42 +02:00