Commit Graph

15476 Commits

Author SHA1 Message Date
Alex Gartner
30ce17386b
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-10-15 11:49:08 +03:00
jwasinger
4b9c7821b9
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-10-15 10:02:02 +02:00
Felix Lange
add5709cb5
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-10-14 21:43:35 +02:00
Martin HS
5adc314817
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-10-14 19:25:22 +02:00
Martin HS
f4dc7530b1
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-10-14 13:32:15 +02:00
Felix Lange
16f64098b9
core: enable EIP-2935 in chain maker (#30575) 2024-10-13 18:51:51 +02:00
lightclient
2246d66135
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-10-13 18:47:51 +02:00
Hteev Oli
fad7e74a1b
build: add support for ubuntu 24.10 (#30580) 2024-10-12 12:25:58 +03:00
Felix Lange
3a5313f3f3
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-10-11 21:36:13 +02:00
Karol Chojnowski
16bf471151
core/tracing: add GetTransientState method to StateDB interface (#30531)
Allows live custom tracers to access contract transient storage through the StateDB interface.
2024-10-10 13:03:03 +02:00
Shude Li
5b393ac85a
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-10-10 10:47:40 +02:00
Martin HS
58cf152e98
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-10-10 07:54:07 +02:00
easyfold
7942a6b5ad
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-10-09 14:45:14 +02:00
Felix Lange
2936b41514
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-10-09 12:24:58 +02:00
asamuj
f8ac95e56f
log: remove unused parameter (#30432) 2024-10-08 13:30:07 +02:00
Marius Kjærstad
65e5ca7d81
build: upgrade -dlgo version to Go 1.23.2 (#30544)
New release: https://groups.google.com/g/golang-announce/c/NKEc8VT7Fz0
2024-10-04 13:53:06 +03:00
zhiqiangxu
84a80216c6
beacon/light: optimize lock usage in HeadTracker (#30485)
minimizes the time when the lock is held
2024-10-02 16:00:36 +02:00
Martin HS
56c4f2bfd4
core/vm, cmd/evm: implement eof validation (#30418)
The bulk of this PR is authored by @lightclient , in the original
EOF-work. More recently, the code has been picked up and reworked for the new EOF
specification, by @MariusVanDerWijden , in https://github.com/ethereum/go-ethereum/pull/29518, and also @shemnon has contributed with fixes.

This PR is an attempt to start eating the elephant one small bite at a
time, by selecting only the eof-validation as a standalone piece which
can be merged without interfering too much in the core stuff.

In this PR: 

- [x] Validation of eof containers, lifted from #29518, along with
test-vectors from consensus-tests and fuzzing, to ensure that the move
did not lose any functionality.
- [x] Definition of eof opcodes, which is a prerequisite for validation
- [x] Addition of `undefined` to a jumptable entry item. I'm not
super-happy with this, but for the moment it seems the least invasive
way to do it. A better way might be to go back and allowing nil-items or
nil execute-functions to denote "undefined".
- [x] benchmarks of eof validation speed 


---------

Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com>
2024-10-02 15:05:50 +02:00
Sina M
6416813cbe
internal/web3ext: rm unused modules (#30532)
Remove console extensions for already deleted API namespaces (les, vflux and ethash).
2024-10-01 18:27:25 +02:00
rjl493456442
eff0bed91b
core/rawdb: freezer index repair (#29792)
This pull request removes the `fsync` of index files in freezer.ModifyAncients function for 
performance gain.

Originally, fsync is added after each freezer write operation to ensure
the written data is truly transferred into disk. Unfortunately, it turns 
out `fsync` can be relatively slow, especially on
macOS (see https://github.com/ethereum/go-ethereum/issues/28754 for more
information). 

In this pull request, fsync for index file is removed as it turns out
index file can be recovered even after a unclean shutdown. But fsync for data file is still kept, as
we have no meaningful way to validate the data correctness after unclean shutdown.

---

**But why do we need the `fsync` in the first place?** 

As it's necessary for freezer to survive/recover after the machine crash
(e.g. power failure).
In linux, whenever the file write is performed, the file metadata update
and data update are
not necessarily performed at the same time. Typically, the metadata will
be flushed/journalled
ahead of the file data. Therefore, we make the pessimistic assumption
that the file is first
extended with invalid "garbage" data (normally zero bytes) and that
afterwards the correct
data replaces the garbage. 

We have observed that the index file of the freezer often contain
garbage entry with zero value
(filenumber = 0, offset = 0) after a machine power failure. It proves
that the index file is extended
without the data being flushed. And this corruption can destroy the
whole freezer data eventually.

Performing fsync after each write operation can reduce the time window
for data to be transferred
to the disk and ensure the correctness of the data in the disk to the
greatest extent.

---

**How can we maintain this guarantee without relying on fsync?**

Because the items in the index file are strictly in order, we can
leverage this characteristic to
detect the corruption and truncate them when freezer is opened.
Specifically these validation
rules are performed for each index file:

For two consecutive index items:

- If their file numbers are the same, then the offset of the latter one
MUST not be less than that of the former.
- If the file number of the latter one is equal to that of the former
plus one, then the offset of the latter one MUST not be 0.
- If their file numbers are not equal, and the latter's file number is
not equal to the former plus 1, the latter one is valid

And also, for the first non-head item, it must refer to the earliest
data file, or the next file if the
earliest file is not sufficient to place the first item(very special
case, only theoretical possible
in tests)

With these validation rules, we can detect the invalid item in index
file with greatest possibility.

--- 

But unfortunately, these scenarios are not covered and could still lead
to a freezer corruption if it occurs:

**All items in index file are in zero value**

It's impossible to distinguish if they are truly zero (e.g. all the data
entries maintained in freezer
are zero size) or just the garbage left by OS. In this case, these index
items will be kept by truncating
the entire data file, namely the freezer is corrupted.

However, we can consider that the probability of this situation
occurring is quite low, and even
if it occurs, the freezer can be considered to be close to an empty
state. Rerun the state sync
should be acceptable.

**Index file is integral while relative data file is corrupted**

It might be possible the data file is corrupted whose file size is
extended correctly with garbage
filled (e.g. zero bytes). In this case, it's impossible to detect the
corruption by index validation.

We can either choose to `fsync` the data file, or blindly believe that
if index file is integral then
the data file could be integral with very high chance. In this pull
request, the first option is taken.
2024-10-01 18:16:16 +02:00
Martin HS
90970ed3cd
params: begin v1.14.12 release cycle (#30536)
params: begin v1.14.12 release cycle
2024-10-01 15:23:35 +02:00
Martin Holst Swende
096c4d266e
params: begin v1.14.12 release cycle 2024-10-01 15:21:30 +02:00
Martin Holst Swende
f14f13bac7
params: go-ethereum v1.14.11 stable 2024-10-01 15:14:30 +02:00
Sina M
40fd887df6
internal/ethapi: remove td field from block (#30386)
implement https://github.com/ethereum/execution-apis/pull/570
2024-10-01 11:36:56 +02:00
Ng Wei Han
db6ae7fa12
cmd/geth: remove deprecated lightchaindata db (#30527)
This PR removes the dependencies on `lightchaindata` db as the light
protocol has been deprecated and removed from the codebase.
2024-09-30 19:32:39 +03:00
Martin HS
e67d5f8c44
eth/catalyst: use setcanonical instead of sethead in simulated fork (#30465)
Fixes https://github.com/ethereum/go-ethereum/issues/30448
2024-09-30 14:46:39 +02:00
Martin HS
cfe25c7a3b
build: use buildx to build multi-platform docker images (#30530) 2024-09-30 15:39:53 +03:00
minh-bq
0a21cb4d21
core/txpool/blobpool: use types.Sender instead of signer.Sender (#30473)
Use types.Sender(signer, tx) to utilize the transaction's sender cache
and avoid repeated address recover.
2024-09-30 12:06:10 +03:00
Felix Lange
6b61b54dc7
p2p/discover: add config option for disabling FINDNODE liveness check (#30512)
This is for fixing Prysm integration tests.
2024-09-30 10:56:14 +02:00
Péter Szilágyi
283be23817 params: begin v1.14.11 release cycle 2024-09-27 14:13:45 +03:00
Péter Szilágyi
269551876e params: release Geth v1.14.10 2024-09-27 14:09:42 +03:00
Péter Szilágyi
1df75dbe36
Revert "core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback" (#30521)
Reverts ethereum/go-ethereum#30495

You are free to create a proper Clear method if that's the best way. But
one that does a proper cleanup, not some hacky call to set gas which
screws up logs, metrics and everything along the way. Also doesn't work
for legacy pool local transactions.

The current code had a hack in the simulated code, now we have a hack in
live txpooling code. No, that's not acceptable. I want the live code to
be proper, meaningful API, meaningful comments, meaningful
implementation.
2024-09-27 13:56:25 +03:00
Péter Szilágyi
52a9d89655
Merge pull request #30518 from holiman/blobpool_fix
core/txpool/blobpool: return all reinject-addresses
2024-09-27 13:05:35 +03:00
Péter Szilágyi
abbd3d9d21 core/txpool/blobpool: add test to check internal shuffling 2024-09-27 12:20:12 +03:00
Martin Holst Swende
9274f28210
core/txpool/blobpool: revert part of #30437, return all reinject-addresses 2024-09-27 08:24:23 +02:00
jwasinger
bb9897f11b
core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback (#30495)
Here we move the method that drops all transactions by temporarily increasing the fee
into the TxPool itself. It's better to have it there because we can set it back to the
configured value afterwards. This resolves a TODO in the simulated backend.
2024-09-26 11:08:36 +02:00
Martin HS
93675d1da7
deps: update supranational/blst (#30504)
This update should only affect the fuzzers, as far as I know. But it
seems like it might also fix some arm/macos compilation issue in
https://github.com/ethereum/go-ethereum/issues/30494

Closes #30494 (I think)
2024-09-26 10:28:40 +03:00
Martin HS
b5a88dafae
p2p/discover: fix flaky tests writing to test.log after completion (#30506)
This PR fixes two tests, which had a tendency to sometimes write to the `*testing.T` `log` facility after the test function had completed, which is not allowed. This PR fixes it by using waitgroups to ensure that the handler/logwriter terminates before the test exits.

closes #30505
2024-09-26 08:12:12 +02:00
jwasinger
80b529ea71
core/vm: more benchmarks for bls g1/g2-multiexp precompiles (#30459)
This change adds more comprehensive benchmarks with a wider-variety of input sizes for g1 and g2 multi exponentiation.
2024-09-24 13:53:46 +02:00
Karol Chojnowski
55ed8fef0b
core/tracing, core/vm: add ContractCode to the OpContext (#30466)
Extends the opcontext interface to include accessor for code being executed in current context. While it is possible to get the code via `statedb.GetCode`, that approach doesn't work for initcode.
2024-09-24 13:18:36 +02:00
Sina M
f2e13c7e33
internal/ethapi: fix gascap 0 for eth_simulateV1 (#30496)
Similar to #30474.
2024-09-24 13:14:38 +02:00
maskpp
2278647ef2
core/rawdb: make sure specified state scheme is valid (#30499)
This change exits with error if user provided a `--state.scheme` which is neither `hash` nor `path`
2024-09-24 09:26:29 +02:00
jwasinger
564b616163
internal/ethapi/api: for simulated calls, set gaspool to max value if global gascap is 0 (#30474)
In #27720, we introduced RPC global gas cap. A value of `0` means an unlimited gas cap. However, this was not the case for simulated calls. This PR fixes the behaviour.
2024-09-23 13:31:56 +02:00
rjl493456442
b805772cb4
core/state: commit snapshot only if the base layer exists (#30493)
This pull request skips the state snapshot update if the base layer is
not existent, eliminating the numerous warning logs after an unclean
shutdown.

Specifically, Geth will rewind its chain head to a historical block
after unclean shutdown and state snapshot will be remained as unchanged
waiting for recovery. During this period of time, the snapshot is unusable
and all state updates should be ignored/skipped for state snapshot update.
2024-09-23 19:27:29 +08:00
zhiqiangxu
956d32d3e4
core/state: fix comment of mode (#30490) 2024-09-23 09:29:07 +02:00
zhiqiangxu
118c84af57
cmd/utils: fix setEtherbase (#30488)
Make `setEtherbase` fall thorugh and handle `miner.pending.feeRecipient` after showing deprecation-warning for `miner.etherbase`-flag.
2024-09-23 09:17:18 +02:00
Martin HS
f4c6c033c8
travis: work around travis/osx/go1.23 setup bug (#30491)
This is a work-around for a strange issue with travis, specifically,
`os=osx, go: 1.23.1`. When this is used, the actual go that ends up
being used is `go1.19.4 darwin/amd64 `.

Using `which go`, it told me that the `go` in the path was a softlink at
`/Users/travis/gopath/bin/go1.23.1 `. However, this was not true: using
`command -v go`, it told me that the actual `go` that was used is a
softlink at `/usr/local/bin/go`.

This change rewrites the `/usr/local/bin/go` softlink to point to the
binary at `/Users/travis/gopath/bin/go1.23.1`, so we get the right
go-version.
2024-09-22 10:12:47 +02:00
Péter Szilágyi
9326a118c7
beacon, core, eth, miner: integrate witnesses into production Geth (#30069)
This PR integrates witness-enabled block production, witness-creating
payload execution and stateless cross-validation into the `engine` API.
The purpose of the PR is to enable the following use-cases (for API
details, please see next section):

- Cross validating locally created blocks:
- Call `forkchoiceUpdatedWithWitness` instead of `forkchoiceUpdated` to
trigger witness creation too.
- Call `getPayload` as before to retrieve the new block and also the
above created witness.
- Call `executeStatelessPayload` against another client to
cross-validate the block.

- Cross validating locally processed blocks:
- Call `newPayloadWithWitness` instead of `newPayload` to trigger
witness creation too.
- Call `executeStatelessPayload` against another client to
cross-validate the block.

- Block production for stateless clients (local or MEV builders):
- Call `forkchoiceUpdatedWithWitness` instead of `forkchoiceUpdated` to
trigger witness creation too.
- Call `getPayload` as before to retrieve the new block and also the
above created witness.
- Propagate witnesses across the consensus libp2p network for stateless
Ethereum.

- Stateless validator validation:
- Call `executeStatelessPayload` with the propagated witness to
statelessly validate the block.

*Note, the various `WithWitness` methods could also *just be* an
additional boolean flag on the base methods, but this PR wanted to keep
the methods separate until a final consensus is reached on how to
integrate in production.*

---

The following `engine` API types are introduced:

```go
// StatelessPayloadStatusV1 is the result of a stateless payload execution.
type StatelessPayloadStatusV1 struct {
	Status          string      `json:"status"`
	StateRoot       common.Hash `json:"stateRoot"`
	ReceiptsRoot    common.Hash `json:"receiptsRoot"`
	ValidationError *string     `json:"validationError"`
}
```

- Add `forkchoiceUpdatedWithWitnessV1,2,3` with same params and returns
as `forkchoiceUpdatedV1,2,3`, but triggering a stateless witness
building if block production is requested.
- Extend `getPayloadV2,3` to return `executionPayloadEnvelope` with an
additional `witness` field of type `bytes` iff created via
`forkchoiceUpdatedWithWitnessV2,3`.
- Add `newPayloadWithWitnessV1,2,3,4` with same params and returns as
`newPayloadV1,2,3,4`, but triggering a stateless witness creation during
payload execution to allow cross validating it.
- Extend `payloadStatusV1` with a `witness` field of type `bytes` if
returned by `newPayloadWithWitnessV1,2,3,4`.
- Add `executeStatelessPayloadV1,2,3,4` with same base params as
`newPayloadV1,2,3,4` and one more additional param (`witness`) of type
`bytes`. The method returns `statelessPayloadStatusV1`, which mirrors
`payloadStatusV1` but replaces `latestValidHash` with `stateRoot` and
`receiptRoot`.
2024-09-20 16:43:42 +03:00
Martin HS
b018da9d02
build: fix macos builds by working around travis osx flaw (#30479)
This should fix https://github.com/ethereum/go-ethereum/issues/30471.
See investigation in https://github.com/ethereum/go-ethereum/pull/30478
for more background.
2024-09-20 14:06:12 +02:00
Guillaume Ballet
deb5c087c4
.github: add release maintainers to params/ CODEOWNERS (#30458) 2024-09-19 10:23:13 +02:00