Commit Graph

15483 Commits

Author SHA1 Message Date
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
Felix Lange
e4675771ed
internal/debug: remove memsize (#30253)
Removing because memsize will very likely be broken by Go 1.23. See
https://github.com/fjl/memsize/issues/4
2024-08-02 06:44:03 +02:00
ysh0566
67b8137100
accounts/abi/bind: add accessList support to base bond contract (#30195)
Adding the correct accessList parameter when calling a contract can
reduce gas consumption. However, the current version only allows adding
the accessList manually when constructing the transaction. This PR can
provide convenience for saving gas.
2024-08-01 12:09:04 -06:00
Icarus Wu
b635089c7c
all: remove deprecated protobuf dependencies (#30232)
The package `github.com/golang/protobuf/proto` is deprecated in favor
`google.golang.org/protobuf/proto`. We should update the codes to
recommended package.

Signed-off-by: Icarus Wu <icaruswu66@qq.com>
2024-08-01 16:25:55 +02:00
Seungmin Kim
dad8f237ff
eth/downloader: correct sync mode logging to show old mode (#30219)
This PR fixes an issue in the setMode method of beaconBackfiller where the
log message was not displaying the previous mode correctly. The log message
now shows both the old and new sync modes.
2024-08-01 16:10:43 +02:00
Darioush Jalali
ff6e43e8c4
miner: remove outdated comment (#30248) 2024-08-01 16:06:43 +02:00
Daniel Knopik
de6d597679
p2p/discover: schedule revalidation also when all nodes are excluded (#30239)
## Issue

If `nextTime` has passed, but all nodes are excluded, `get` would return
`nil` and `run` would therefore not invoke `schedule`. Then, we schedule
a timer for the past, as neither `nextTime` value has been updated. This
creates a busy loop, as the timer immediately returns.

## Fix

With this PR, revalidation will be also rescheduled when all nodes are
excluded.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2024-07-31 21:38:23 +02:00
Marius G
6e33dbf96a
p2p: fix flaky test TestServerPortMapping (#30241)
The test specifies `ListenAddr: ":0"`, which means a random ephemeral
port will be chosen for the TCP listener by the OS. Additionally, since
no `DiscAddr` was specified, the same port that is chosen automatically
by the OS will also be used for the UDP listener in the discovery UDP
setup. This sometimes leads to test failures if the TCP listener picks a
free TCP port that is already taken for UDP. By specifying `DiscAddr:
":0"`, the UDP port will be chosen independently from the TCP port,
fixing the random failure.

See issue #29830.

Verified using
```
cd p2p
go test -c -race
stress ./p2p.test -test.run=TestServerPortMapping
...
5m0s: 4556 runs so far, 0 failures
```

The issue described above can technically lead to sporadic failures on
systems that specify a listen address via the `--port` flag of 0 while
not setting `--discovery.port`. Since the default is using port `30303`
and using a random ephemeral port is likely not used much to begin with,
not addressing the root cause might be acceptable.
2024-07-30 07:31:27 -06:00
dknopik
b0f66e34ca
p2p/nat: return correct port for ExtIP NAT (#30234)
Return the actually requested external port instead of 0 in the
AddMapping implementation for `--nat extip:<IP>`.
2024-07-27 10:18:05 +02:00
lightclient
f94baab238
internal/ethapi: fix state override test (#30228)
Looks like #30094 became a bit stale after #30185 was merged and now we
have a stale ref to a state override object causing CI to fail on
master.
2024-07-26 11:02:37 +08:00
caseylove
ac0f220040
eth/tracers, internal/ethapi: remove unnecessary map pointer in state override (#30094) 2024-07-25 01:01:59 +02:00
yukionfire
4dfc75deef
beacon/types, cmd/devp2p, p2p/enr: clean up uses of fmt.Errorf (#30182) 2024-07-25 00:32:58 +02:00
rjl493456442
4ad88e9463
triedb/pathdb: print out all trie owner and hash information (#30200)
This pull request explicitly prints out the full hash for debugging
purpose.
2024-07-24 20:32:28 +08:00
rjl493456442
766ce23032
core/state: fix SetStorage override behavior (#30185)
This pull request fixes the broken feature where the entire storage set is overridden.

Originally, the storage set override was achieved by marking the associated account
as deleted, preventing access to the storage slot on disk. However, since #29520, this
flag is also checked when accessing the account, rendering the account unreachable.

A fix has been applied in this pull request, which re-creates a new state object with all
account metadata inherited.
2024-07-23 14:54:35 +02:00
minh-bq
35b4183caa
cmd/utils: allow configurating blob pool from flags (#30203)
Currently, we have 3 flags to configure blob pool. However, we don't
read these flags and set the blob pool configuration in eth config
accordingly. This commit adds a function to check if these flags are
provided and set blob pool configuration based on them.
2024-07-23 14:44:01 +02:00
rjl493456442
1939813ece
core/state: check db error after intermediate call (#30171)
This pull request adds an additional error check after statedb.IntermediateRoot,
ensuring that no errors occur during this call. This step is essential, as the call might
encounter database errors.
2024-07-23 14:40:12 +02:00
minh-bq
6693fe1be2
core/txpool: use the cached address in ValidateTransactionWithState (#30208)
The address recover is executed and cached in ValidateTransaction already. It's
expected that the cached one is returned in ValidateTransaction. However,
currently, we use the wrong function signer.Sender instead of types.Sender which
will do all the address recover again.
2024-07-23 14:07:06 +02:00
Sina M
7026bae17c
core/tracing: update latest release version (#30211) 2024-07-23 14:05:46 +02:00
zhiqiangxu
57e6627932
rpc: show more error detail for invalidMessageError (#30191)
Here we add distinct error messages for network timeouts and JSON parsing errors.
Note this specifically applies to HTTP connections serving a single RPC request.

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-07-23 11:55:56 +02:00
rjl493456442
ef583e9d18
core/state: remove useless metrics (#30184)
Originally, these metrics were added to track the largest storage wiping.
Since account self-destruction was deprecated with the Cancun fork,
these metrics have become meaningless.
2024-07-22 23:44:31 +02:00
lightclient
7abe84c8d7
rpc: use stable object in notifier test (#30193)
This makes the test resilient to changes of types.Header -- otherwise the test needs to be
updated each time the header structure is modified.
2024-07-22 23:38:04 +02:00
Marius van der Wijden
380688c636
eth/gasprice: remove default from config (#30080)
* eth/gasprice: remove default from config

* eth/gasprice: sanitize startPrice
2024-07-22 15:58:53 +08:00
Sina M
944718bf16
ethdb: remove snapshot (#30189) 2024-07-22 11:40:14 +08:00
Alexander Mint
df3f0a81a7
go.mod: upgrade to btcsuite/btcd/btcec v2.3.4 (#30181) 2024-07-18 12:38:42 +02:00
Felix Lange
ad49c708f5
p2p/discover: remove type encPubkey (#30172)
The pubkey type was moved to package v4wire a long time ago. Remaining uses of
encPubkey were probably left in due to laziness.
2024-07-18 11:09:02 +02:00
rjl493456442
f59d013e40
core/rawdb, triedb, cmd: create an isolated disk namespace for verkle (#30105)
* core, triedb/pathdb, cmd: define verkle state ancient store

* core/rawdb, triedb: add verkle namespace in pathdb
2024-07-16 16:17:58 +03:00
Guillaume Ballet
c54294bd41
core/state: don't compute verkle storage tree roots (#30130) 2024-07-16 16:06:22 +03:00
maskpp
15936c64a2
core/txpool/legacypool: use maps.Keys and maps.Copy (#30091) 2024-07-16 13:42:30 +02:00
rjl493456442
b530d8e455
trie, triedb: remove unnecessary child resolver interface (#30167) 2024-07-16 18:52:19 +08:00
Jordan Krage
0d38b0cd34
eth/catalyst: fix (*SimulatedBeacon).AdjustTime() conversion (#30138) 2024-07-16 11:47:11 +02:00
zhiqiangxu
71210b0630
all: simplify tests using t.TempDir() (#30150) 2024-07-15 15:26:58 +02:00
JeukHwang
8adce57b41
SECURITY.md: correct PGP key block formatting (#30123) 2024-07-15 14:29:13 +02:00
Danyal Prout
a0d2613ef0
core/types: don't modify signature V when reading large chainID (#30157) 2024-07-15 12:09:32 +02:00
Jeremy Schlatter
169aa91449
cmd/utils: fix typo in flag description (#30127) 2024-07-15 11:36:21 +02:00
Nathan Jo
4bbe993252
p2p: fix ip change log parameter (#30158) 2024-07-15 10:15:35 +02:00
Guillaume Ballet
79d2327771
trie: add RollBackAccount function to verkle trees (#30135) 2024-07-15 15:05:59 +08:00
minh-bq
a0631f3ebd
core/txpool/blobpool: use nonce from argument instead of tx.Nonce() (#30148)
This does not change the behavior here as the nonce in the argument is
tx.Nonce(). This commit helps to make the function easier to read and avoid
capturing the tx in the function.
2024-07-15 10:28:06 +08:00
rjl493456442
cf0378499f
core/state: fix prefetcher for verkle (#29760) 2024-07-11 22:09:24 +08:00
Felix Lange
bcaf3747f8 params: begin v1.14.8 release cycle 2024-07-11 14:24:09 +02:00
Felix Lange
0aafbb31ab params: go-ethereum v1.14.7 stable 2024-07-11 14:23:27 +02:00
Marius van der Wijden
803dc6b664
core/txpool/blobpool: revert #29989, WLock on Nonce (#30142) 2024-07-11 10:28:27 +03:00
Aayush Rajasekaran
37590b2c55
eth/catalyst: fix params in failure log (#30131) 2024-07-09 15:19:55 +03:00