Commit Graph

15515 Commits

Author SHA1 Message Date
Delweng f3cbacf373 eth/tracers: add disableCode/Storage options for prestateTracer (#30648)
When using the prestateTracer, in some cases users are only concerned
with balances or nonce information, and are not interested in the lengthy
contract code or storage data.

Therefore, this PR introduces two new configuration options in the
`prestateTracerConfig` structure:
- `disableCode`
- `disableStorage`

These options allow users to control whether the tracer returns contract
code and storage data during execution tracing. By setting these
options, users can more flexibly customize their needs and focus on
obtaining information that is more critical and relevant to their
specific use cases.

These options work with the default mode as well as `diffMode: true`.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
2024-11-19 14:50:11 +01:00
Péter Szilágyi 856f807b9b cmd/geth: avoid hard coding the IPC name (#30687) 2024-11-19 14:50:11 +01:00
jwasinger 571628a114 build: document doGoModTidy function in ci.go (#30685) 2024-11-19 14:50:11 +01:00
Felföldi Zsolt a7e2b8be63 ethdb: add DeleteRange feature (#30668)
This PR adds `DeleteRange` to `ethdb.KeyValueWriter`. While range
deletion using an iterator can be really slow, `DeleteRange` is natively
supported by pebble and apparently runs in O(1) time (typically 20-30ms
in my tests for removing hundreds of millions of keys and gigabytes of
data). For leveldb and memorydb an iterator based fallback is
implemented. Note that since the iterator method can be slow and a
database function should not unexpectedly block for a very long time,
the number of deleted keys is limited at 10000 which should ensure that
it does not block for more than a second. ErrTooManyKeys is returned if
the range has only been partially deleted. In this case the caller can
repeat the call until it finally succeeds.
2024-11-19 14:50:11 +01:00
Felföldi Zsolt a7c01a235b beacon/blsync: add holesky config and update checkpoints (#30671)
This PR adds the beacon chain config for the holesky testnet. It also
updates beacon checkpoints for Mainnet and Sepolia.
2024-11-19 14:50:11 +01:00
jwasinger 6a3f575fa7 core/vm: remove debug printout in eof test (#30665) 2024-11-19 14:50:11 +01:00
Sina M 0d1d689c37 core: fix tracing of system calls (#30666)
This change makes it so that the wrapped statedb with tracing-hooks is passed to the system call processing

Fixes #30658
2024-11-19 14:50:11 +01:00
Fredrik Svantes 99ec8e4545 docs: update security policy (#30606)
previous key expired 2023-07-27, the new one expires 2026-02-22:

pub   rsa4096 2016-11-11 [SC] [expires: 2026-02-22]
      AE96ED969E479B0084F3E17FE88D3334FA5F6A0A
uid Ethereum Foundation Security Team <security@ethereum.org>
uid Ethereum Foundation Bug Bounty <bounty@ethereum.org>
sub   rsa4096 2016-11-11 [E] [expires: 2026-02-22]
2024-11-19 14:50:11 +01:00
Shude Li e9e1cb0784 eth/tracers/internal/tracertest: add missing Random to call context (#30652)
Fixes a configuration issue in a test-helper, so that we can do call tracing-tests post-merge
2024-11-19 14:50:11 +01:00
jwasinger 53e3f445ed all: remove TerminalTotalDifficultyPassed (#30609)
rebased https://github.com/ethereum/go-ethereum/pull/29766 . The
downstream branch appears to have been deleted and I don't have perms to
push to that fork.

`TerminalTotalDifficultyPassed` is removed. `TerminalTotalDifficulty`
must now be non-nil, and it is expected that networks are already
merged: we can only import PoW/Clique chains, not produce blocks on
them.

---------

Co-authored-by: stevemilk <wangpeculiar@gmail.com>
2024-11-19 14:50:11 +01:00
kevaundray cba2e77fe2 crypto, tests/fuzzers: add gnark bn254 precompile methods for fuzzing (#30585)
Makes the gnark precompile methods more amenable to fuzzing
2024-11-19 14:50:11 +01:00
Martin HS d7434facba core/state: move state log mechanism to a separate layer (#30569)
This PR moves the logging/tracing-facilities out of `*state.StateDB`,
in to a wrapping struct which implements `vm.StateDB` instead.

In most places, it is a pretty straight-forward change: 
- First, hoisting the invocations from state objects up to the statedb. 
- Then making the mutation-methods simply return the previous value, so
that the external logging layer could log everything.

Some internal code uses the direct object-accessors to mutate the state,
particularly in testing and in setting up state overrides, which means
that these changes are unobservable for the hooked layer. Thus, configuring
the overrides are not necessarily part of the API we want to publish.

The trickiest part about the layering is that when the selfdestructs are
finally deleted during `Finalise`, there's the possibility that someone
sent some ether to it, which is burnt at that point, and thus needs to
be logged. The hooked layer reaches into the inner layer to figure out
these events.

In package `vm`, the conversion from `state.StateDB + hooks` into a
hooked `vm.StateDB` is performed where needed.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-11-19 14:50:11 +01:00
Péter Szilágyi e5fb824e67 common: drop BigMin and BigMax, they pollute our dep graph (#30645)
Way back we've added `common.math.BigMin` and `common.math.BigMax`.
These were kind of cute helpers, but unfortunate ones, because package
all over out codebase added dependencies to this package just to avoid
having to write out 3 lines of code.

Because of this, we've also started having package name clashes with the
stdlib `math`, which got solves even more badly by moving some helpers
over ***from*** the stdlib into our custom lib (e.g. MaxUint64). The
latter ones were nuked out in a previous PR and this PR nukes out BigMin
and BigMax, inlining them at all call sites.

As we're transitioning to uint256, if need be, we can add a min and max
to that.
2024-11-19 14:50:11 +01:00
Péter Szilágyi c6823c77a3 consensus/clique, miner: remove clique -> accounts dependency (#30642)
Clique currently depends on the `accounts` package. This was a bit of a
big cannon even in the past, just to pass a signer "account" to the
Clique block producer. Either way, nowadays Geth does not support clique
mining any more, so by removing that bit of functionality from our code,
we can also break this dependency.

Clique should ideally be further torn out, but this at least gets us one
step closer to cleanups.
2024-11-19 14:50:11 +01:00
Martin HS 26e1470393 eth/tracers/js: avoid compiling js bigint when not needed (#30640)
While looking at some mem profiles from `evm` runs, I noticed that
`goja` compilation of the bigint library was present. The bigint library
compilation happens in a package `init`, whenever the package
`eth/tracers/js` is loaded. This PR changes it to load lazily when
needed.

It becomes slightly faster with this change, and slightly less alloc:y. 

Non-scientific benchmark with 100 executions: 
```
time for i in {1..100}; do ./evm --code 6040 run; done;
 ```

current `master`:

```
real    0m6.634s
user    0m5.213s
sys     0m2.277s
```
Without compiling bigint
```
real    0m5.802s
user    0m4.191s
sys     0m1.965s
```
2024-11-19 14:50:11 +01:00
Péter Szilágyi db03e01577 build, internal, version: break ci.go/version->common dependency (#30638)
This PR tries to break the ci.go to common dependency by moving the
version number out of params.
2024-11-19 14:50:11 +01:00
Péter Szilágyi b7d8f477db common/math: sigh, keep deleting dead code 2024-11-19 14:50:11 +01:00
Péter Szilágyi 997d122cbf common/math: delete some further dead code (#30639) 2024-11-19 14:50:11 +01:00
Péter Szilágyi 1c88e42ea9 build: get rid of ci.go -> common direct dependency (#30637) 2024-11-19 14:50:11 +01:00
Péter Szilágyi 7a79f2f89f all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-11-19 14:50:11 +01:00
Péter Szilágyi d03ed72022 core/state: fix runaway alloc caused by prefetcher heap escape (#30629)
Co-authored-by: lightclient <lightclient@protonmail.com>
2024-11-19 14:50:11 +01:00
rjl493456442 6412beedc4 core, trie, triedb: minor changes from snapshot integration (#30599)
This change ports some non-important changes from https://github.com/ethereum/go-ethereum/pull/30159, including interface renaming and some trivial refactorings.
2024-11-19 14:50:11 +01:00
Péter Szilágyi 56d14b228c build: reenable building arm64 concurrently (#30626) 2024-11-19 14:50:11 +01:00
Péter Szilágyi ac3ebe240d gitignore: get rid of some relics (#30623)
Clean out some ancient stuff from git ignore.
2024-11-19 14:50:11 +01:00
Péter Szilágyi 44c44c7534 swarm: nuke this leftover (#30622)
Swarm moved out more than 5 years ago, time to let it go.
2024-11-19 14:50:11 +01:00
Péter Szilágyi cfd1489b92 beacon/engine, core/txpool, eth/catalyst: add engine_getBlobsV1 API (#30537) 2024-11-19 14:50:11 +01:00
lightclient 1660698efc beacon/engine,eth/catalyst: hex marshal requests in engine api (#30603)
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-11-19 14:50:11 +01:00
lightclient 5d41ac58a8 miner: send full request when resolving full payload (#30615)
Fixes an issue missed in #30576 where we send empty requests for a full
payload being resolved, causing hash mismatch later on when we get the
payload back via `NewPayload`.
2024-11-19 14:50:11 +01:00
Sina M e648904ba2 eth/tracers: various fixes (#30540)
Breaking changes:

- The ChainConfig was exposed to tracers via VMContext passed in
`OnTxStart`. This is unnecessary specially looking through the lens of
live tracers as chain config remains the same throughout the lifetime of
the program. It was there so that native API-invoked tracers could
access it. So instead we moved it to the constructor of API tracers.

Non-breaking:

- Change the default config of the tracers to be `{}` instead of nil.
This way an extra nil check can be avoided.

Refactoring:

- Rename `supply` struct to `supplyTracer`.
- Un-export some hook definitions.
2024-11-19 14:50:11 +01:00
Marius van der Wijden 767a2928bc core: reduce peak memory usage during reorg (#30600)
~~Opening this as a draft to have a discussion.~~ Pressed the wrong
button
I had [a previous PR
](https://github.com/ethereum/go-ethereum/pull/24616)a long time ago
which reduced the peak memory used during reorgs by not accumulating all
transactions and logs.
This PR reduces the peak memory further by not storing the blocks in
memory.
However this means we need to pull the blocks back up from storage
multiple times during the reorg.
I collected the following numbers on peak memory usage: 

// Master: BenchmarkReorg-8 10000 899591 ns/op 820154 B/op 1440
allocs/op 1549443072 bytes of heap used
// WithoutOldChain: BenchmarkReorg-8 10000 1147281 ns/op 943163 B/op
1564 allocs/op 1163870208 bytes of heap used
// WithoutNewChain: BenchmarkReorg-8 10000 1018922 ns/op 943580 B/op
1564 allocs/op 1171890176 bytes of heap used

Each block contains a transaction with ~50k bytes and we're doing a 10k
block reorg, so the chain should be ~500MB in size

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2024-11-19 14:50:11 +01:00
Péter Szilágyi 9c054f8ad1 core, eth, ethstats: simplify chain head events (#30601) 2024-11-19 14:50:11 +01:00
rjl493456442 bcb2c15066 core, ethdb/pebble: run pebble in non-sync mode (#30573)
Implements https://github.com/ethereum/go-ethereum/issues/29819
2024-11-19 14:50:11 +01:00
Péter Szilágyi 4918c7c683 ethdb/pebble: switch to increasing level sizes (#30602) 2024-11-19 14:50:11 +01:00
Roman Krasiuk 8e27edbc3b beacon/engine: omit null witness field from payload envelope (#30597)
## Description

Omit null `witness` field from payload envelope.

## Motivation

Currently, JSON encoded payload types always include `"witness": null`,
which, I believe, is not intentional.
2024-11-19 14:50:11 +01:00
Alex Gartner ddbf548df2 crypto: use decred secp256k1 directly (#30595)
Use `github.com/decred/dcrd/dcrec/secp256k1/v4` directly rather than
`github.com/btcsuite/btcd/btcec/v2` which is just a wrapper around the
underlying decred library. Inspired by
https://github.com/cosmos/cosmos-sdk/pull/15018

`github.com/btcsuite/btcd/btcec/v2` has a very annoying breaking change
when upgrading from `v2.3.3` to `v2.3.4`. The easiest way to workaround
this is to just remove the wrapper.

Would be very nice if you could backport this to the release branches.

References:
- https://github.com/btcsuite/btcd/issues/2221
- https://github.com/cometbft/cometbft/pull/4294
- https://github.com/cometbft/cometbft/pull/3728
- https://github.com/zeta-chain/node/pull/2934
2024-11-19 14:50:11 +01:00
jwasinger 086a52d5cb internal/ethapi: refactor `TxArgs.setCancunFeeDefaults` (#30541)
calculating a reasonable tx blob fee cap (`max_blob_fee_per_gas *
total_blob_gas`) only depends on the excess blob gas of the parent
header. The parent header is assumed to be correct, so the method should
not be able to fail and return an error.
2024-11-19 14:50:11 +01:00
Felix Lange b755cec854 beacon/engine: strip type byte in requests (#30576)
This change brings geth into compliance with the current engine API
specification for the Prague fork. I have moved the assignment of
ExecutionPayloadEnvelope.Requests into BlockToExecutableData to ensure
there is a single place where the type is removed.

While doing so, I noticed that handling of requests in the miner was not
quite correct for the empty payload. It would return `nil` requests for
the empty payload even for blocks after the Prague fork. To fix this, I
have added the emptyRequests field in miner.Payload.
2024-11-19 14:50:11 +01:00
Martin HS 7a625d3a08 build: update to golangci-lint 1.61.0 (#30587)
Changelog: https://golangci-lint.run/product/changelog/#1610 

Removes `exportloopref` (no longer needed), replaces it with
`copyloopvar` which is basically the opposite.

Also adds: 
- `durationcheck`
- `gocheckcompilerdirectives`
- `reassign`
- `mirror`
- `tenv`

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2024-11-19 14:50:11 +01:00
Martin HS 118ed442c6 trie: concurrent commit (#30545)
This change makes the trie commit operation concurrent, if the number of changes exceed 100. 

Co-authored-by: stevemilk <wangpeculiar@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-11-19 14:50:11 +01:00
Felix Lange 912a13700c core: enable EIP-2935 in chain maker (#30575) 2024-11-19 14:50:11 +01:00
lightclient 54a4b1d2ff cmd/evm: fixup issues with requests in t8n (#30584)
This fixes a few issues missed in #29052:

* `requests` must be hex encoded, so added a helper to marshal.
* The statedb was committed too early and so the result of the system
calls was lost.
* For devnet-4 we need to pull off the type byte prefix from the request
data.
2024-11-19 14:50:11 +01:00
Hteev Oli 15b0152a5c build: add support for ubuntu 24.10 (#30580) 2024-11-19 14:50:11 +01:00
Felix Lange bee38ebb39 all: implement EIP-7002 & EIP-7251 (#30571)
This is a redo of #29052 based on newer specs. Here we implement EIPs
scheduled for the Prague fork:

- EIP-7002: Execution layer triggerable withdrawals
- EIP-7251: Increase the MAX_EFFECTIVE_BALANCE

Co-authored-by: lightclient <lightclient@protonmail.com>
2024-11-19 14:50:11 +01:00
Karol Chojnowski e6c1fb329b core/tracing: add GetTransientState method to StateDB interface (#30531)
Allows live custom tracers to access contract transient storage through the StateDB interface.
2024-11-19 14:50:11 +01:00
Shude Li f1ec974e2f eth/protocols/eth: remove Requests in block body (#30562)
Block no longer has Requests. This PR just removes some code that wasn't removed in #30425.
2024-11-19 14:50:11 +01:00
Martin HS 0205fb9fda eth/catalyst, core/txpool/blobpool: make tests output less logs (#30563)
A couple of tests set the debug level to `TRACE` on stdout,
and all subsequent tests in the same package are also affected
by that, resulting in outputs of tens of megabytes. 

This PR removes such calls from two packages where it was prevalent.
This makes getting a summary of failing tests simpler, and possibly
reduces some strain from the CI pipeline.
2024-11-19 14:50:11 +01:00
easyfold 8f3ae2a61a eth/tracers: do system contract processing prior to parallel-tracing (#30520)
This fixes `debug_traceBlock` methods for JS tracers in that it correctly
applies the beacon block root processing to the state.
2024-11-19 14:50:11 +01:00
Felix Lange c93656f18e all: implement flat deposit requests encoding (#30425)
This implements recent changes to EIP-7685, EIP-6110, and
execution-apis.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Shude Li <islishude@gmail.com>
2024-11-19 14:50:11 +01:00
asamuj 677bc2a5c2 log: remove unused parameter (#30432) 2024-11-19 14:50:11 +01:00
Marius Kjærstad 912b3b4a75 build: upgrade -dlgo version to Go 1.23.2 (#30544)
New release: https://groups.google.com/g/golang-announce/c/NKEc8VT7Fz0
2024-11-19 14:50:11 +01:00