Commit Graph

15474 Commits

Author SHA1 Message Date
Marius Kjærstad
941ae33d7e
build: fix hash for go1.23.0.linux-riscv64.tar.gz (#30335)
build: fix hash for go1.23.0.linux-riscv64.tar.gz
2024-08-22 13:29:40 +02:00
Martin HS
30824faf90
eth/tracers: avoid panic in state test runner (#30332)
Make tracers more robust by handling `nil` receipt as input. 
Also pass in a receipt with gas used in the state test runner.
Closes https://github.com/ethereum/go-ethereum/issues/30117.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-08-21 15:16:08 +02:00
Martin HS
733fcbbc65
eth/protocols/eth: handle zero-count header requests (#30305)
Proper fix for handling `count=0` get header requests. 

https://en.wikipedia.org/wiki/Count_Zero
2024-08-21 09:22:33 +02:00
Guillaume Ballet
df645e77b7
trie: use go-verkle helper for speedier (*VerkleTrie).RollBackAccount (#30242)
This is a performance improvement on the account-creation rollback code
required for the archive node to support verkle. It uses the utility
function `DeleteAtStem` to remove code and account data per-group
instead of doing it leaf by leaf.

It also fixes an index bug, as code is chunked in 31-byte chunks, so
comparing with the code size should use 31 as its stride.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-08-21 10:00:31 +08:00
Martin HS
2a534ee133
travis.yml: use focal for builds (#30319) 2024-08-20 17:34:03 +02:00
lightclient
00294e9d28
cmd/utils,p2p: enable discv5 by default (#30327) 2024-08-20 16:02:54 +02:00
stevemilk
3c37db7989
all: clean up goerli flag and config (#30289)
Co-authored-by: lightclient <lightclient@protonmail.com>
2024-08-20 15:59:48 +02:00
John Hilliard
0fde5067c3
cmd/devp2p: require dns:read, dns:edit permissions for cloudflare deploy (#30326)
This PR adds the `dns:read` and `dns:edit` permissions to the required
set of permissions checked before deploying an ENR tree to Cloudflare.
These permissions are necessary for a successful publish.

**Background**:
The current logic for `devp2p dns to-cloudflare` checks for `zone:edit`
and `zone:read` permissions. However, when running the command with only
these two permissions, the following error occurs:
```
wrong permissions on zone REMOVED-ZONE: map[#zone:edit:false #zone:read:true]
```

Adding `zone:read` and `zone:edit` to the API token led to a different
error:
```
INFO [08-19|14:06:16.782] Retrieving existing TXT records on pos-nodes.hardfork.dev
Authentication error (10000)
```

This suggested that additional permissions were required. I added
`dns:read`, but encountered another error:
```
INFO [08-19|14:11:42.342] Retrieving existing TXT records on pos-nodes.hardfork.dev
INFO [08-19|14:11:42.851] Updating DNS entries
failed to publish REMOVED.pos-nodes.hardfork.dev: Authentication error (10000)
```

Finally, after adding both `dns:read` and `dns:edit` permissions, the
command executed successfully with the following output:
```
INFO [08-19|14:13:07.677] Checking Permissions on zone REMOVED-ZONE
INFO [08-19|14:13:08.014] Retrieving existing TXT records on pos-nodes.hardfork.dev
INFO [08-19|14:13:08.440] Updating DNS entries
INFO [08-19|14:13:08.440] "Updating pos-nodes.hardfork.dev from \"enrtree-root:v1 e=FSED3EDKEKRDDFMCLP746QY6CY l=FDXN3SN67NA5DKA4J2GOK7BVQI seq=1 sig=Glja2c9RviRqOpaaHR0MnHsQwU76nJXadJwFeiXpp8MRTVIhvL0LIireT0yE3ETZArGEmY5Ywz3FVHZ3LR5JTAE\" to \"enrtree-root:v1 e=AB66M4ULYD5OYN4XFFCPVZRLUM l=FDXN3SN67NA5DKA4J2GOK7BVQI seq=1 sig=H8cqDzu0FAzBplK4g3yudhSaNtszIebc2aj4oDm5a5ZE5PAg-xpCnQgVE_53CsgsqQpalD9byafx_FrUT61sagA\""
INFO [08-19|14:13:16.932] Updated DNS entries                      new=32 updated=1 untouched=100
INFO [08-19|14:13:16.932] Deleting stale DNS entries
INFO [08-19|14:13:24.663] Deleted stale DNS entries                count=31
```

With this PR, the required permissions for deploying an ENR tree to
Cloudflare now include `zone:read`, `zone:edit`, `dns:read`, and
`dns:edit`. The initial check now includes all of the necessary
permissions and indicates in the error message which permissions are
missing:
```
INFO [08-19|14:17:20.339] Checking Permissions on zone REMOVED-ZONE
wrong permissions on zone REMOVED-ZONE: map[#dns_records:edit:false #dns_records:read:false #zone:edit:false #zone:read:true]
```
2024-08-20 15:59:16 +02:00
lightclient
15fb0dcc67
rpc: add timeout to rpc client Unsubscribe (#30318)
Fixes #30156

This adds a repro of the linked issue. I fixed it by adding a timeout
when issuing the call to unsubscribe.
2024-08-20 15:54:28 +02:00
Martin HS
d0fd1331f1
all: update to go version 1.23.0 (#30323)
This PR updates the version of go used in builds and docker to
1.23.0. Release notes: https://go.dev/doc/go1.23

More importantly, following our policy of maintaining the last two
versions (which now becomes 1.23 and 1.22), we can now make use of
the things that were introduced in 1.22: https://go.dev/doc/go1.22

Go 1.22 makes two changes to “for” loops.
- each iteration creates new variables, 
- for loops may range over integers

Other than that, some interesting library changes and other stuff.
2024-08-20 15:50:07 +02:00
Martin HS
693e40a495
build: attempt at reproducible builds (#30321)
This PR implements the conclusions from
https://github.com/ethereum/go-ethereum/issues/28987#issuecomment-2296075028,
that is:

Building with `--strip-all` as a ld-flag to the cgo linker, to remove
symbols. Without that, some spurious reference to a temporary file is
included into the kzg-related library.

Building with `--build-id=none`, to avoid putting a `build id` into the file.
2024-08-20 15:33:28 +02:00
lmittmann
fc88cea648
core/vm: reuse Memory instances (#30137)
This PR adds a sync.Pool to reuse instances of Memory in EVMInterpreter.
2024-08-20 14:31:06 +02:00
Sina M
3b48b16290
core/rawdb: drop MigrateTable (#30331)
These are the leftovers from #24028.
2024-08-20 14:06:00 +02:00
chen4903
65aaf52f4c
accounts/abi: handle ABIs with contract type parameter (#30315)
convert parameter of type contract to the basic `address` type
---------

Co-authored-by: Martin HS <martin@swende.se>
2024-08-20 12:26:35 +02:00
lightclient
84565dc899
eth/catalyst: ensure period zero mode leaves no pending txs in pool (#30264)
closes #29475, replaces #29657, #30104 

Fixes two issues. First is a deadlock where the txpool attempts to reorg, but can't complete because there are no readers left for the new txs subscription. Second, resolves a problem with on demand mode where txs may be left pending when there are more pending txs than block space.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-08-19 15:32:15 -06:00
Martin HS
41b3b30863
gitignore: ignore upload-artefacts (#30325)
Our `WriteArchive`, used by ci builder, creates files in the repo root,in order to upload. After we've built the amd64-builds, we create the uploads, and cause the repo to be flagged as dirty for the remaining builds.

This change fixes it by adding the artefacts to gitignore. Closes #30324
2024-08-19 20:06:57 +02:00
Martin HS
8486722dcb
build: remove mantic from ppa builds (#30322)
removes ppa-build for ubuntu `mantic`
2024-08-19 13:35:41 +02:00
Martin HS
60db6a7b42
internal/build: include git-date on detached head (#30320)
When we are building in detached head, we cannot easily obtain the same information as we can if we're in non-detached head.

However, one thing we _can_ obtain is the git-hash and git-date. Currently, we omit to include the git-date into the build-info, which causes problem for reproducable builds which are on a detached head.

This change fixes it to include the date-info always.
2024-08-19 13:35:04 +02:00
Arran Schlosberg
710c3f32ac
vm: simplify error handling in vm.EVM.create() (#30292)
To allow all error paths in `vm.EVM.create()` to consume the necessary
gas, there is currently a pattern of gating code on `if err == nil`
instead of returning as soon as the error occurs. The same behaviour can
be achieved by abstracting the gated code into a method that returns
immediately on error, improving readability and thus making it easier to
understand and maintain.
2024-08-16 08:41:44 -06:00
Shude Li
09d889d2e3
core: remove withdrawal length check for state processor (#30286)
The withdrawal length is already verified by the beacon consensus package, so the check in the state processor is a duplicate.
2024-08-16 08:33:41 -06:00
Sina M
43640f12d8
beacon/light: handle endpoint URL more gracefully (#30306)
blsync was failing if the light endpoint it was provided ended with a
`/`. This change should handle the joining more gracefully.
2024-08-16 14:39:57 +02:00
Felix Lange
6eb42a6b4f
eth: dial nodes from discv5 (#30302)
Here I am adding a discv5 nodes source into the p2p dial iterator. It's
an improved version of #29533.

Unlike discv4, the discv5 random nodes iterator will always provide full
ENRs. This means we can apply filtering to the results and will only try
dialing nodes which explictly opt into the eth protocol with a matching
chain.

I have also removed the dial iterator from snap. We don't have an
official DNS list for snap anymore, and I doubt anyone else is running
one. While we could potentially filter for snap on discv5, there will be
very few nodes announcing it, and the extra iterator would just stall
the dialer.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2024-08-15 22:14:42 +02:00
Dylan Vassallo
7a149a159a
eth/tracers/js: add coinbase addr to ctx (#30231)
Add coinbase address to javascript tracer context.

This PR adds the `coinbase` address to `jsTracer.ctx`, allowing access
to the coinbase address (fee receipient) in custom JavaScript tracers.

Example usage:

```javascript
result: function(ctx) {
  return toAddress(ctx.coinbase);
}
```

This change enables custom tracers to access coinbase address,
previously unavailable, enhancing their capabilities to match built-in
tracers.
2024-08-15 16:36:35 +02:00
Felix Lange
c35684709c
eth/ethconfig: remove LES server config (#30298) 2024-08-15 11:42:39 +02:00
rjl493456442
c4b01d80b9
eth/fetcher: always expect transaction metadata in announcement (#30288)
This pull request drops the legacy transaction retrieval support from before
eth68, adding the restrictions that transaction metadata must be provided
along with the transaction announment.
2024-08-15 11:35:16 +02:00
Felix Lange
2f2e5b088a .golangci.yml: remove lint warning for TxLookupLimit 2024-08-15 10:11:03 +02:00
Marius van der Wijden
c686485a06
core: only compute state root once (#30299)
This PR refactors the genesis initialization a bit, s.th. we only
compute the blockhash once instead of twice as before (during hashAlloc
and flushAlloc)

This will significantly reduce the amount of memory allocated during
genesis init

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-08-15 15:16:23 +08:00
Adrian Sutton
2b9d198706
go.mod: upgrade to pebble v1.1.2 (#30297)
Includes a fix for MIPS32 support.

Pebble release:
https://github.com/cockroachdb/pebble/releases/tag/v1.1.2
Key fix for mips32:
9f3904a705
(also the only change from v1.1.1.
2024-08-14 11:45:51 +02:00
Zoo
bd57f35f8d
core/txpool/blobpool: fix error message (#30247)
the validation process only checks for 'less than', which is
inconsistent with the error output
2024-08-13 19:49:31 +08:00
jwasinger
bc95452e02
build: run 'go mod tidy' check as part of lint (#30291) 2024-08-12 20:46:15 +02:00
Shude Li
ab03c5746c
go.mod: remove github.com/julienschmidt/httprouter (#30290) 2024-08-12 20:42:36 +02:00
Felix Lange
1cf3b5d38a params: begin v1.14.9 release cycle 2024-08-12 14:19:35 +02:00
Felix Lange
880511dc39 params: release go-ethereum v1.14.8 stable 2024-08-12 14:15:30 +02:00
rjl493456442
5adf4adc8e
eth/protocols/snap: cleanup dangling account trie nodes due to incomplete storage (#30258)
This pull request fixes #30229.
 
During snap sync, large storage will be split into several pieces and
synchronized concurrently. Unfortunately, the tradeoff is that the respective
merkle trie of each storage chunk will be incomplete due to the incomplete
boundaries. The trie nodes on these boundaries will be discarded, and any
dangling nodes on disk will also be removed if they fall on these paths,
ensuring the state healer won't be blocked.

However, the dangling account trie nodes on the path from the root to the
associated account are left untouched. This means the dangling account trie
nodes could potentially stop the state healing and break the assumption that the
entire subtrie should exist if the subtrie root exists. We should consider the
account trie node as the ancestor of the corresponding storage trie node.

In the scenarios described in the above ticket, the state corruption could occur
if there is a dangling account trie node while some storage trie nodes are
removed due to synchronization redo.

The fixing idea is pretty straightforward, the trie nodes on the path from root
to account should all be explicitly removed if an incomplete storage trie
occurs. Therefore, a `delete` operation has been added into `gentrie` to
explicitly clear the account along with all nodes on this path. The special
thing is that it's a cross-trie clearing. In theory, there may be a dangling
node at any position on this account key and we have to clear all of them.
2024-08-12 10:43:54 +02:00
lightclient
33a13b6f21
p2p/simulations: remove packages (#30250)
Looking at the history of these packages over the past several years, there
haven't been any meaningful contributions or usages:
https://github.com/ethereum/go-ethereum/commits/master/p2p/simulations?before=de6d5976794a9ed3b626d4eba57bf7f0806fb970+35

Almost all of the commits are part of larger refactors or low-hanging-fruit contributions.
Seems like it's not providing much value and taking up team + contributor time.
2024-08-12 10:36:48 +02:00
Artyom Aminov
32a1e0643c
beacon/engine, consensus/beacon: use params.MaximumExtraDataSize instead of hard-coded value (#29721)
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: lightclient <lightclient@protonmail.com>
2024-08-10 12:44:31 +02:00
Martin HS
811a69cd3c
go.mod: update uint256 to 1.3.1 (#30280)
Release notes: https://github.com/holiman/uint256/releases/tag/v1.3.1
2024-08-09 23:11:22 +03:00
Martin HS
83e70aa3d0
cmd/evm: fix evm basefee (#30281)
fixes #30279 -- previously we did not use the basefee from the genesis, and instead the defaults were used from `runtime.go/setDefaults`-function
2024-08-08 18:58:08 +02:00
psogv0308
ebe31dfd5c
eth/downloader, core/types: take withdrawals-size into account in downloader queue (#30276)
Fixes a slight miscalculation in the downloader queue, which was not accurately taking block withdrawals into account when calculating the size of the items in the queue
2024-08-08 15:14:00 +02:00
taiking
d3dae66e59
tests: fix TransactionTest to actually run (#30272)
Due to https://github.com/ethereum/tests/releases/tag/v10.1, the format
of the TransactionTest changed, but it was not properly addressed, causing the test
to pass unexpectedly.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-08-08 13:50:00 +02:00
Marius Kjærstad
9ea766d6e9
build: upgrade -dlgo version to Go 1.22.6 (#30273) 2024-08-08 13:47:43 +02:00
lmittmann
4a3aed380e
core/vm: use uint64 in memory for indices everywhere (#30252)
Consistently use `uint64` for indices in `Memory` and drop lots of type
conversions from `uint64` to `int64`.

---------

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
2024-08-08 11:27:38 +03:00
llkhacquan
978041feea
signer/core: improve performance of isPrimitiveTypeValid function (#30274) (#30277)
Precomputes valid primitive types into a map to use for validation, thus removing sprintf.
2024-08-08 09:13:18 +02:00
lmittmann
b37ac5c102
core/vm: improved stack swap performance (#30249)
This PR adds the methods `Stack.swap1..16()` that faster than `Stack.swap(1..16)`. 

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
2024-08-06 14:38:47 +02:00
Zhihao Lin
e9981bc6f7
ethclient: support networkID in hex format (#30263)
Some chains’ network IDs use hexadecimal such as Optimism ("0xa" instead
of "10"), so when converting the string to big.Int, we cannot specify
base 10; otherwise, it will encounter errors with hexadecimal network
IDs.
2024-08-06 15:14:37 +03:00
lightclient
dbc1d04f5e
core/vm/runtime: ensure tracer benchmark calls OnTxStart (#30257)
The struct-based tracing added in #29189 seems to have caused an issue
with the benchmark `BenchmarkTracerStepVsCallFrame`. On master we see
the following panic:

```console
BenchmarkTracerStepVsCallFrame
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x1019782f0]

goroutine 37 [running]:
github.com/ethereum/go-ethereum/eth/tracers/js.(*jsTracer).OnOpcode(0x140004c4000, 0x0, 0x10?, 0x989680, 0x1, {0x101ea2298, 0x1400000e258}, {0x1400000e258?, 0x14000155928?, 0x10173020c?}, ...)
        /Users/matt/dev/go-ethereum/eth/tracers/js/goja.go:328 +0x140
github.com/ethereum/go-ethereum/core/vm.(*EVMInterpreter).Run(0x14000307da0, 0x140003cc0d0, {0x0, 0x0, 0x0}, 0x0)
 ...
FAIL    github.com/ethereum/go-ethereum/core/vm/runtime 0.420s
FAIL
```

The issue seems to be that `OnOpcode` expects that `OnTxStart` has
already been called to initialize the `env` value in the tracer. The JS
tracer uses it in `OnOpcode` for the `GetRefund()` method.

This patch resolves the issue by reusing the `Call` method already
defined in `runtime_test.go` which correctly calls `OnTxStart`.
2024-08-06 19:51:48 +08:00
stevemilk
cf8aa31e3e
params: remove unused les parameters (#30268) 2024-08-06 19:49:48 +08:00
Delweng
10586952df
eth/catalyst: get params.ExcessBlobGas but check with params.BlobGasUsed (#30267)
Seems it is checked with the wrong argument

Signed-off-by: jsvisa <delweng@gmail.com>
2024-08-05 11:14:22 -06:00
lightclient
142c94d628
cmd/evm: don't overwrite sender account (#30259)
Fixes #30254 

It seems like the removed CreateAccount call is very old and not needed anymore.
After removing it, setting a sender that does not exist in the state doesn't seem to cause
an issue.
2024-08-02 17:49:01 +02:00
Felix Lange
16cf5c5fed
eth/downloader: gofmt (#30261)
Fixes a regression introduced in
https://github.com/ethereum/go-ethereum/pull/30219
2024-08-02 17:36:28 +02:00