Commit Graph

14277 Commits

Author SHA1 Message Date
Martin Holst Swende
c2e0abce2e
ethstats: set readlimit on ethstats server connection (#26207)
This prevents DoS when connected to a malicious ethstats server.
2022-11-17 15:33:03 +01:00
Martin Holst Swende
97c563e055
rpc, internal/guide: speed up tests a bit (#26193)
This removes an RPC test which takes > 90s to execute, and updates the
internal/guide tests to use lighter scrypt parameters.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-17 15:30:53 +01:00
therainisme
722bb210bf
rlp: improve tests for Split functions (#26200)
This PR improves and extends the tests a bit
2022-11-17 14:19:03 +01:00
Felix Lange
12df45662a
all: remove remaining uses of untyped golang-lru (#26194) 2022-11-17 11:15:28 +01:00
Felix Lange
c3b42683b3
Dockerfile: upgrade to Go 1.19 (#26195) 2022-11-17 10:54:28 +01:00
Sina Mahmoodi
64067fbdc4
eth/tracers: small refactor for native tracers (#26196)
Use noopTracer as a base for other native tracers to avoid extra boilerplate for unimplemented hooks.
2022-11-17 09:27:48 +01:00
storyicon
add337e0f7
rpc: support injecting HTTP headers through context (#26023)
This adds a way to specify HTTP headers per request.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-16 15:22:12 +01:00
Mark Tyneway
b4ea2bf7dd
all: implement EIP-1153 transient storage (#26003)
Implements TSTORE and TLOAD as specified by the following EIP:

https://eips.ethereum.org/EIPS/eip-1153
https://ethereum-magicians.org/t/eip-1153-transient-storage-opcodes/553


Co-authored-by: Sara Reynolds <snreynolds2506@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2022-11-16 10:18:52 +01:00
ligi
bc90a88263
ethclient: docs, fix misleading comment (#26189)
closes #26188
2022-11-16 08:44:54 +01:00
Felix Lange
ae42148093
rpc: fix connection tracking set in Server (#26180)
rpc: fix connection tracking in Server

When upgrading to mapset/v2 with generics, the set element type used in
rpc.Server had to be changed to *ServerCodec because ServerCodec is not
'comparable'. While the distinction is technically correct, we know all
possible ServerCodec types, and all of them are comparable. So just use
a map instead.
2022-11-15 14:05:16 +01:00
Felix Lange
9afc6816d2
common/lru: add generic LRU implementation (#26162)
It seems there is no fully typed library implementation of an LRU cache.
So I wrote one. Method names are the same as github.com/hashicorp/golang-lru,
and the new type can be used as a drop-in replacement.

Two reasons to do this:

- It's much easier to understand what a cache is for when the types are right there.
- Performance: the new implementation is slightly faster and performs zero memory
   allocations in Add when the cache is at capacity. Overall, memory usage of the cache
   is much reduced because keys are values are no longer wrapped in interface.
2022-11-14 15:41:56 +01:00
Jolly Zhao
f58ebd9696
all: use github.com/deckarep/golang-set/v2 (generic set) (#26159)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-14 15:16:52 +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
Martin Holst Swende
e34e540e4c
accounts/keystore: replace inotify with fsnotify (#26176) 2022-11-14 12:38:10 +01:00
Martin Holst Swende
8334b5f51a
common/lru: fix race in lru (#26164)
This fixes a problem in the SizeConstrainedLRU. The SCLRU uses an underlying simple lru which is not thread safe.
During the Get operation, the recentness of the accessed item is updated, so it is not a pure read-operation. Therefore, the mutex we need is a full mutex, not RLock.

This PR changes the mutex to be a regular Mutex, instead of RWMutex, so a reviewer can at a glance see that all affected locations are fixed.
2022-11-11 19:48:36 +01:00
Martin Holst Swende
ea65edaa28
eth, catalyst: fix flaky tests (#26153)
* eth/catalyst: fix time-dependent (flaky) test

* eth: increase timeout on TestTransactionPropagation
2022-11-11 13:22:54 +01:00
Felix Lange
c539bda166
metrics: improve reading Go runtime metrics (#25886)
This changes how we read performance metrics from the Go runtime. Instead
of using runtime.ReadMemStats, we now rely on the API provided by package
runtime/metrics.

runtime/metrics provides more accurate information. For example, the new
interface has better reporting of memory use. In my testing, the reported
value of held memory more accurately reflects the usage reported by the OS.

The semantics of metrics system/memory/allocs and system/memory/frees have
changed to report amounts in bytes. ReadMemStats only reported the count of
allocations in number-of-objects. This is imprecise: 'tiny objects' are not
counted because the runtime allocates them in batches; and certain
improvements in allocation behavior, such as struct size optimizations,
will be less visible when the number of allocs doesn't change.

Changing allocation reports to be in bytes makes it appear in graphs that
lots more is being allocated. I don't think that's a problem because this
metric is primarily interesting for geth developers.

The metric system/memory/pauses has been changed to report statistical
values from the histogram provided by the runtime. Its name in influxdb has
changed from geth.system/memory/pauses.meter to
geth.system/memory/pauses.histogram.

We also have a new histogram metric, system/cpu/schedlatency, reporting the
Go scheduler latency.
2022-11-11 13:16:13 +01:00
Felix Lange
62c973eba6
go.mod: minimum Go version 1.18 (#26160)
This will allow use of generics and other new standard library APIs
such as package net/netip.
2022-11-11 13:11:24 +01:00
Felix Lange
5b4c149f97
internal/debug: add --log.file option (#26149)
This adds an option to direct log output to a file. This feature has been
requested a lot. It's sometimes useful to have this available when running
geth in an environment that doesn't easily allow redirecting the output.

Notably, there is no support for log rotation with this change. The --log.file option
opens the file once on startup and then keeps writing to the file handle. 
This can become an issue when external log rotation tools are involved, so it's
best not to use them with this option for now.
2022-11-11 11:33:18 +01:00
protolambda
0ad2014026
go.mod: update status-im/keycard-go (#26141) 2022-11-10 01:32:02 +01:00
Martin Holst Swende
093b2ac32a
eth/filters: fix failing benchmark-test (#26144) 2022-11-09 09:49:42 +01:00
Martin Holst Swende
dffd93b475
cmd/evm: slight change in how t8n handles coinbase pre eip-158 (#26139)
This PR fixes a subtle bug in t8n. After this PR, t8n behaves like our state-test runner in certain pre-EIP-158 scenarios
2022-11-09 09:34:42 +01:00
Martin Holst Swende
5fded04037
core/state: replace fastcache code cache with gc-friendly structure (#26092)
This PR replaces fastcache with a pretty simple LRU which does not require explicit closing.
2022-11-09 08:06:02 +01:00
yihuang
7dc5e785a8
core/vm: deepcopy jumptable when enabling extra eips (#26137)
When the interpreter is configured to use extra-eips, this change makes it so that all the opcodes are deep-copied, to prevent accidental modification of the 'base' jumptable. 

Closes: #26136

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-09 07:52:13 +01:00
Joseph Cook
6685f88455
cmd/clef: only print first N accounts on startup (#26128)
PR #26082 added account listing to OnSignerStartup but did not consider the case where a user has a large number of accounts which would be annoying to display.

This PR updates showAccounts() so that if there are more than 20 accounts available the user sees the first 20 displayed in the console followed by: First 20 accounts listed (N more available).

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-08 21:17:12 +01:00
Ahmet Avci
ee9ff06469
graphql: add query timeout (#26116)
This PR adds a 60 second timeout to graphql queries.
2022-11-08 13:14:14 +01:00
Felix Lange
913973436b
cmd/devp2p: add more nodekey commands (#26129)
This adds new commands to turn a node key file into signed ENR / node ID.
2022-11-08 12:15:32 +01:00
Mark Tyneway
a609e7b81f
common/types: add Address.Big (#26132)
Many of the other types have a function to convert the type to a big.Int,
but Address was missing this function.

It is useful to be able to turn an Address into a big.Int when doing
EVM-like computations natively in Go. Sometimes a Solidity address
type is casted to a uint256 and having a Big method on the Address
type makes this easy.
2022-11-08 12:14:11 +01:00
zhiqiangxu
4cb1fca43d
p2p/enode: implement per-source timeout in FairMix (#25962)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-08 12:12:36 +01:00
Sina Mahmoodi
53b624b56d
eth/tracers: add multiplexing tracer (#26086)
* eth/tracers: add native multiplexing tracer

* minor improv callTracer

* mv evm cancellation to api
2022-11-08 10:16:52 +01:00
Marcin Sobczak
d629e02047
cmd/devp2p/internal/v4test: ignore FINDNODE in BondThenPingWithWrongFrom (#26085)
This fixes a race in the test.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-07 22:46:21 +01:00
Marius van der Wijden
055528ae05
cmd/devp2p/internal/ethtest: add support for eth/68 (#26078)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-07 20:47:04 +01:00
Felix Lange
9027ee0b45
p2p/discover: improve discv5 NODES response packing (#26033)
Instead of using a limit of three nodes per message, we can pack more nodes
into each message based on ENR size. In my testing, this halves the number
of sent NODES messages, because ENR size is usually < 300 bytes.

This also adds RLP helper functions that compute the encoded size of
[]byte and string.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-07 19:19:02 +01:00
Joseph Cook
55a92fa0a4
cmd/clef: list accounts at startup (#26082)
Reports accounts known to Clef during startup, after master seed is provided by the user.
2022-11-07 16:41:36 +01:00
Martin Holst Swende
ca948b8579
eth/catalyst, miner: deduplicate work + show payload id (#26115)
This PR now also includes a fix to the problem of mult-routines building blocks on the same input. This PR works as before with regards to stopping the work, but it just will not spin up a second routine if one is already building. So if the CL does N calls to FCU+buildblock, and N calls to GetPayload, only the first of each will do something, the other calls will be mostly no-ops.

This PR also adds printout of the payload id into the logs.
2022-11-07 15:30:54 +01:00
Nicolas Gotchac
111ed1af1b
accounts/abi: properly quote untrusted data in error message (#26110)
* abi: Format data as hex-string instead of string(data)

* Update accounts/abi/abi.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-07 13:58:00 +01:00
Martin Holst Swende
17744639da
cmd/clef: add importraw feature to clef (#26058)
This adds a subcommand that imports a raw secp256k1 key
into the keystore managed by clef.
2022-11-06 13:02:49 +01:00
Saman H. Pasha
33e23ee37d
accounts/abi.bind: don't fetch head in transact unless required (#25988)
If GasFeeCap and GasTipCap are specified, we don't need to retrieve the head block for constructing a transaction
2022-11-04 22:03:34 +01:00
Obtuse7772
6d55908347
signer/core/apitypes: support more input types for eip-712 encoding (#26074)
* apitypes: synchronize handling of types

* signer/core/apitypes: improve array check

* apitypes: add a test for big.Int -> int32

* signer/core/apitypes: Add a test for parsing addresses from [20]byte, []byte and string

* signer/core/apitypes: add some testcases

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-04 16:28:12 +01:00
protolambda
a51188a163
params: make eip1559 params non-global (#25994)
This PR changes geth to read the eip1559 params from the chain config instead of the globals.

This way the parameters may be changed by forking the chain config code, without creating a large diff throughout the past and future usages of the parameters.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-04 16:27:15 +01:00
AusIV
1805f477ae
Merge pull request #60 from openrelayxyz/feature/merge-v1.10.26
Feature/merge v1.10.26
2022-11-03 11:39:32 -05:00
philip-morlier
db52b5e61d Merge tag 'v1.10.26' into feature/merge-v1.10.26 2022-11-03 09:06:21 -07:00
rjl493456442
08fb1aade6
miner: display change in fees, change recommit period (#26097)
* miner: add logs for displaying fees change

* miner: simplify feesInEther calculation

* miner: fix lock

* miner: change to default recommit to 2 seconds
2022-11-03 15:18:28 +01:00
Felix Lange
e5eb32acee params: release geth v1.10.26 stable 2022-11-03 11:59:33 +01:00
jwasinger
9a4e8e222e
crypto/bls12381: docs - fix broken links to references (#26095) 2022-11-03 08:48:13 +01:00
Jordan Krage
211dbb7197 rpc: handle wrong HTTP batch response length (#26064) 2022-11-03 01:15:36 +01:00
Martin Holst Swende
27600a5b84 eth/filters: change filter block to be by-ref (#26054)
This PR changes the block field in the filter to be a pointer, to disambiguate between empty hash and no hash
2022-11-03 01:15:36 +01:00
Péter Szilágyi
99bbb33701 eth: fix a rare datarace on CHT challenge reply / shutdown (#25831) 2022-11-03 01:15:27 +01:00
Péter Szilágyi
a32e69a28c trie: check childrens' existence concurrently for snap heal (#25694) 2022-11-03 01:15:11 +01:00
Péter Szilágyi
937ea491f9 eth/protocols/snap: throttle trie heal requests when peers DoS us (#25666)
* eth/protocols/snap: throttle trie heal requests when peers DoS us

* eth/protocols/snap: lower heal throttle log to debug

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

* eth/protocols/snap: fix comment

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-03 01:15:11 +01:00