Commit Graph

94 Commits

Author SHA1 Message Date
rjl493456442
765f2904d8
ethclient: fix flaky test (#28864)
Fix flaky test due to incomplete transaction indexing
2024-01-24 09:07:20 +01:00
colin
1c488298c8
ethclient: apply accessList field in toCallArg (#28832)
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-01-19 16:43:02 +01:00
hyunchel
7596db5f48
ethclient: add tests for TransactionInBlock (#28283)
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-01-15 11:10:26 +01:00
Sina Mahmoodi
407f779c8e
internal/ethapi: avoid using pending for defaults (#28784)
Given the discussions around deprecating pending (see #28623 or ethereum/execution-apis#495), we can move away from using the pending block internally, and use latest instead
2024-01-12 19:59:36 +01:00
Péter Szilágyi
065f82a8cc
accounts, ethclient: minor tweaks on the new simulated backend (#28799)
* accounts, ethclient: minor tweaks on the new simulated backend

* ethclient/simulated: add an initial batch of gas options

* accounts, ethclient: remove mandatory gasLimit constructor param

* accounts, ethclient: minor option naming tweaks
2024-01-12 15:58:49 +02:00
Marius van der Wijden
2d08c99009
ethclient/simulated: implement new sim backend (#28202)
This is a rewrite of the 'simulated backend', an implementation of the ethclient interfaces
which is backed by a simulated blockchain. It was getting annoying to maintain the old
version of the simulated backend feature because there was a lot of code duplication with
the main client. 

The new version is built using parts that we already have: an in-memory geth node instance
running in developer mode provides the chain, while the Go API is provided by ethclient.
A backwards-compatibility wrapper is provided, but the simulated backend has also moved to
a more sensible import path: github.com/ethereum/go-ethereum/ethclient/simulated

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-01-10 16:45:08 +01:00
Rossen Krastev
e3eeb64c94
ethclient: simplify error handling in TransactionReceipt (#28748)
Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-01-04 16:32:23 +01:00
alex
edc864f9ba
all: fix typos in comments (#28682)
chore(core,eth):fix a couple of typos
2023-12-18 09:35:12 +01:00
Delweng
ce5a4809fd
ethclient: add empty/nonexist account testcase for eth_getProof RPC (#28482)
Adds testcases for eth_getProof endpoint for the following cases: 

- the account/contract does not exist
- the account/contract exists but is empty.
2023-11-10 12:23:09 +01:00
Marius van der Wijden
4d9f3cd5d7
eth: set networkID to chainID by default (#28250)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-11-07 14:21:46 +01:00
Péter Szilágyi
e91cdb49be
ethclient: fix forwarding 1559 gas fields (#28462) 2023-11-03 19:40:37 +02:00
Adrian Sutton
b85c86022e
api/bind: add CallOpts.BlockHash to allow calling contracts at a specific block hash (#28084)
* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
2023-10-17 15:34:01 +03:00
Kero
1f11d2d340
ethclient: ensure the close of canceled context (#28349) 2023-10-17 14:09:48 +02:00
Martin Holst Swende
8b99ad4602
internal/ethapi: fix codehash lookup in eth_getProof (#28357)
This change fixes #28355, where eth_getProof failed to return the correct codehash under certain conditions. This PR changes the logic to unconditionally look up the codehash, and also adds some more tests.
2023-10-17 09:25:16 +02:00
Andryanau Kanstantsin
4985d83b8f
ethclient: fix BlockReceipts parameter encoding (#28087)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-09-25 23:24:20 +02:00
Martin Holst Swende
5cf53f51ac
ethclient: use 'input', not 'data' as field for transaction input (#28078) 2023-09-08 18:33:36 +02:00
Delweng
f1801a9fed
internal/ethapi: implement eth_getBlockReceipts (#27702) 2023-08-15 14:35:48 +02:00
Marius van der Wijden
a46f4173cd
ethclient/gethclient: gofmt -s (#27762) 2023-07-24 13:21:26 +03:00
James Prestwich
fd5d2ef0a6
internal/ethapi: quantity-encode storage keys in eth_getProof response (#27309)
This changes the eth_getProof method implementation to re-encode the requested
storage keys, canonicalizing them in the response. For backwards-compatibility reasons,
go-ethereum accepts non-canonical hex keys. Accepting them is fine, but we should
not mirror invalid inputs into the output.

Closes #27306

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-06-21 18:11:11 +02:00
Sanghee Choi
acc2a2ac61
node: remove unused error return from Attach (#27450)
node: Delete the unused error from return parameters of Node.Attach() func
2023-06-14 08:24:47 -04:00
Delweng
b0095eeb20
ethclient,event: replace noarg fmt.Errorf with errors.New (#27334)
Signed-off-by: jsvisa <delweng@gmail.com>
2023-05-24 12:39:49 +02:00
Martin Holst Swende
9231770811
rpc: change BlockNumber constant values to match ethclient (#27219)
ethclient accepts certain negative block number values as specifiers for the "pending",
"safe" and "finalized" block. In case of "pending", the value accepted by ethclient (-1)
did not match rpc.PendingBlockNumber (-2).

This wasn't really a problem, but other values accepted by ethclient did match the
definitions in package rpc, and it's weird to have this one special case where they don't.

To fix it, we decided to change the values of the constants rather than changing ethclient.
The constant values are not otherwise significant. This is a breaking API change, but we
believe not a dangerous one.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-05-23 13:18:38 +02:00
Delweng
c8b0afb2c4
ethclient: acquire the rpc.Client (#27246)
Signed-off-by: jsvisa <delweng@gmail.com>
2023-05-11 10:09:16 +03:00
Péter Szilágyi
dde2da0efb
all: remove ethash pow, only retain shims needed for consensus and tests (#27178)
* all: remove ethash pow, only retain shims needed for consensus and tests

* all: thank you linter

* all: disallow launching Geth in legacy PoW mode

* cmd/env/internal/t8ntool: remove dangling ethash flag
2023-05-03 12:58:39 +03:00
Sina Mahmoodi
ae66009640
internal/ethapi: add block overrides to eth_call (#26414)
Adds an optional config parameter to eth_call which allows users to override block context fields (same functionality that was added to traceCall in #24871)

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-05-02 04:28:43 -04:00
norwnd
df383addee
ethclient: ensure returned subscription is nil on error (#26976) 2023-03-25 22:38:43 +01:00
Felix Lange
4688d3c8f4
ethclient: fix panic when requesting missing blocks (#26817)
This fixes a regression introduced by #26723.
Fixes #26816.
2023-03-07 05:21:23 -05:00
Peter (bitfly)
e1b98f49a5
ethclient: include withdrawals in ethclient block responses (#26778)
* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization
2023-02-28 15:40:24 +02:00
rjl493456442
fe01a2f63b
all: use unified emptyRootHash and emptyCodeHash (#26718)
The EmptyRootHash and EmptyCodeHash are defined everywhere in the codebase, this PR replaces all of them with unified one defined in core/types package, and also defines constants for TxRoot, WithdrawalsRoot and UncleRoot
2023-02-21 06:12:27 -05:00
Mio
78d089b5b7
ethclient/gethclient: fix typo (#26580)
fix grammar typo
2023-01-31 03:28:32 -05:00
Felix Lange
d379e3f605
ethclient/gethclient: ensure getProof keys parameter is not null (#26409)
Other clients do not accept a parameter value of null for this array.
2023-01-12 11:31:21 +01:00
Marius van der Wijden
db82ea2ee3
core: reset txpool on sethead (#26392)
This change sends a HeadChainEvent when SetHead is invoked. The txpool will then reset the txnoncer on receiving the event.
2022-12-29 07:24:34 -05:00
ligi
bc90a88263
ethclient: docs, fix misleading comment (#26189)
closes #26188
2022-11-16 08:44:54 +01:00
lmittmann
5b1a04b9c7
eth/filters, ethclient/gethclient: add fullTx option to pending tx filter (#25186)
This PR adds a way to subscribe to the _full_ pending transactions, as opposed to just being notified about hashes. 

In use cases where client subscribes to newPendingTransactions and gets txhashes only to then request the actual transaction, the caller can now shortcut that flow and obtain the transactions directly. 


Co-authored-by: Felix Lange <fjl@twurst.com>
2022-10-12 11:54:52 +02:00
Martin Holst Swende
5a02b2d6d0
all: fix spelling mistakes (#25961) 2022-10-11 09:37:00 +02:00
Martin Holst Swende
067bac3f24
core, ethclient/gethclient: improve flaky tests (#25918)
* ethclient/gethclient: improve time-sensitive flaky test

* eth/catalyst: fix (?) flaky test

* core: stop blockchains in tests after use

* core: fix dangling blockchain instances

* core: rm whitespace

* eth/gasprice, eth/tracers, consensus/clique: stop dangling blockchains in tests

* all: address review concerns

* core: goimports

* eth/catalyst: fix another time-sensitive test

* consensus/clique: add snapshot test run function

* core: rename stop() to stopWithoutSaving()

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-10-06 13:39:20 +02:00
Janko Simonovic
1a63a76fcc
ethclient/gethclient: fix bugs in override object encoding (#25616)
This fixes a bug where contract code would be overridden to empty code ("0x")
when the Code field of OverrideAccount was left nil. The change also cleans up
the encoding of overrides to only send necessary fields, and improves documentation.

Fixes #25615

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-09-27 19:23:53 +02:00
rjl493456442
dea1fb3cfc
all: cleanup tests (#25641)
Follow-up to PR #25523 to cleanup all relevant tests.
2022-09-07 20:21:59 +02:00
Rachel Bousfield
8df8eb4e7a
ethclient: add 'finalized' and 'safe' block number support (#25580) 2022-08-30 14:56:39 +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
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
rjl493456442
a41ea8a97c
all: cleanup the APIs for initializing genesis (#25473)
* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment
2022-08-09 12:44:39 +03: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
Delweng
b196ad1c16
all: add whitespace linter (#25312)
* golangci: typo

Signed-off-by: Delweng <delweng@gmail.com>

* golangci: add whietspace

Signed-off-by: Delweng <delweng@gmail.com>

* *: rm whitesapce using golangci-lint

Signed-off-by: Delweng <delweng@gmail.com>

* cmd/puppeth: revert accidental resurrection

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-07-25 13:14:03 +03:00
Felipe Strozberg
f5ff022dbc
ethclient: add PeerCount method (#24849)
* adding peer count function

* Update ethclient.go

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-05-11 08:05:55 +03:00
Joshua Gutow
84041e8f31
ethclient/gethclient: return storage proofs in GetProof (#24697)
Storage proofs were being unmarshalled from the RPC form to the go struct, but were not being included in the final returned struct.
2022-04-27 11:51:24 +02:00
zhiqiangxu
e98114da4f
ethclient: add CallContractAtHash (#24355)
* add CallContractAtHash to ethclient

* add docstring and test

* optimize test

* ethclient: nits

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-02-15 11:55:55 +02:00
Felix Lange
0169d579d0
ethclient: fix unmarshaling of ethereum.SyncProgress (#24199)
SyncProgress was modified in PR #23576 to add the fields reported for
snap sync. The PR also changed ethclient to use the SyncProgress struct
directly instead of wrapping it for hex-decoding. This broke the
SyncProgress method.

Fix it by putting back the custom wrapper. While here, also put back the
fast sync related fields because SyncProgress is stable API and thus
removing fields is not allowed.

Fixes #24180
Fixes #24176
2022-01-05 16:12:47 +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
Lee Bousfield
16341e0563
ethclient: fix tx sender cache miss detection (#23877)
This fixes a bug in TransactionSender where it would return the
zero address for transactions where the sender address wasn't
cached already.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-11-17 14:44:41 +01:00