Commit Graph

15562 Commits

Author SHA1 Message Date
lightclient 2ae47cf2c9
cmd/evm: print state root for jsonl format 2024-11-21 22:22:47 +08:00
lightclient 092b99f49f
cmd/evm: review fixes 2024-11-21 17:23:07 +08:00
lightclient 7c34200d74
cmd/evm: unify staterunner and blockrunner more, add human-readable output, stateless cross-checking option 2024-11-21 16:48:38 +08:00
rjl493456442 e3d61e6db0
core, eth, internal, cmd: rework EVM constructor (#30745)
This pull request refactors the EVM constructor by removing the
TxContext parameter.

The EVM object is frequently overused. Ideally, only a single EVM
instance should be created and reused throughout the entire state
transition of a block, with the transaction context switched as needed
by calling evm.SetTxContext.

Unfortunately, in some parts of the code, the EVM object is repeatedly
created, resulting in unnecessary complexity. This pull request is the
first step towards gradually improving and simplifying this setup.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-11-20 12:35:52 +01:00
Martin HS 6d3d252a5e
core/vm/program: evm bytecode-building utility (#30725)
In many cases, there is a need to create somewhat nontrivial bytecode. A
recent example is the verkle statetests, where we want a `CREATE2`- op
to create a contract, which can then be invoked, and when invoked does a
selfdestruct-to-self.

It is overkill to go full solidity, but it is also a bit tricky do
assemble this by concatenating bytes. This PR takes an approach that
has been used in in goevmlab for several years.

Using this utility, the case can be expressed as: 
```golang
	// Some runtime code
	runtime := program.New().Ops(vm.ADDRESS, vm.SELFDESTRUCT).Bytecode()
	// A constructor returning the runtime code
	initcode := program.New().ReturnData(runtime).Bytecode()
	// A factory invoking the constructor
	outer := program.New().Create2AndCall(initcode, nil).Bytecode()
```

We have a lot of places in the codebase where we concatenate bytes, cast
from `vm.OpCode` . By taking tihs approach instead, thos places can be made a
bit more maintainable/robust.
2024-11-20 08:40:21 +01:00
Martin Holst Swende aa63692129
version: fix typo in v1.14.13 release cycle name 2024-11-19 16:58:52 +01:00
Martin Holst Swende 66d8185aad
version: begin v1.14.13 release cycle 2024-11-19 14:51:54 +01:00
Martin Holst Swende c64cf28f9c
version: go-ethereum v1.14.12 stable 2024-11-19 14:46:38 +01:00
Håvard Anda Estensen e20150f888
rpc: run tests in parallel (#30384)
Continuation of https://github.com/ethereum/go-ethereum/pull/30381
2024-11-19 13:43:33 +01:00
jwasinger 581e2140f2
core/txpool, eth/catalyst: clear transaction pool in Rollback (#30534)
This adds an API method `DropTransactions` to legacy pool, blob pool and
txpool interface. This method removes all txs currently tracked in the
pools.

It modifies the simulated beacon to use the new method in `Rollback`
which removes previous hacky implementation that also erroneously reset
the gas tip to 1 gwei.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-11-19 13:35:52 +01:00
jwasinger 61ff3a1186
all: remove kilic dependency from bls12381 fuzzers (#30296)
The [kilic](https://github.com/kilic/bls12-381) bls12381 implementation
has been archived. It shouldn't be necessary to include it as a fuzzing
target any longer.

This also adds fuzzers for G1/G2 mul that use inputs that are guaranteed
to be valid. Previously, we just did random input fuzzing for these
precompiles.
2024-11-19 13:29:23 +01:00
bitcoin-lightning 83790b0729
core: fix typos (#30767) 2024-11-19 14:26:39 +08:00
Marius Kjærstad 7c0ff05685
build: upgrade -dlgo version to Go 1.23.3 (#30742)
New release: https://groups.google.com/g/golang-announce/c/X5KodEJYuqI
2024-11-15 14:05:23 +01:00
Martin HS a5f0001845
cmd/geth: remove unlock commandline flag (#30737)
This is one further step towards removing account management from
`geth`. This PR deprecates the flag `unlock`, and makes the flag moot:
unlock via geth is no longer possible.
2024-11-15 10:15:15 +01:00
Martin HS ec280e030f
core/state: tests on the binary iterator (#30754)
Fixes an error in the binary iterator, adds additional testcases

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-11-15 07:59:06 +01:00
witty df182a742c
docs: fix typo (#30740)
fixes a typo on one of the postmortems
2024-11-11 12:14:18 +01:00
tianyeyouyou ae83912841
p2p/netutil: unittests for addrutil (#30439)
add unit tests for `p2p/addrutil`

---------

Co-authored-by: Martin HS <martin@swende.se>
2024-11-11 11:43:22 +01:00
rjl493456442 77f3ef3714
tests: fix test panic (#30741)
Fix panic in tests
2024-11-10 10:57:05 +01:00
Marius van der Wijden 3f5f2efccb
eth/protocols/eth: add ETH68 protocol handler fuzzers (#30417)
Adds a protocol handler fuzzer to fuzz the ETH68 protocol handlers
2024-11-09 16:07:17 +01:00
rjl493456442 74ef47462f
core/state, triedb/database: refactor state reader (#30712)
Co-authored-by: Martin HS <martin@swende.se>
2024-11-09 08:08:06 +08:00
Péter Szilágyi 55fdbb7e7b
travis: build and upload RISC-V docker images too (#30739)
Requested by @barnabasbusa
2024-11-08 18:20:48 +02:00
zhiqiangxu 896fc51379
trie/utils: remove unneeded initialization (#30472) 2024-11-08 15:28:42 +01:00
Karol Chojnowski 3c7336b0e9
core/state: invoke OnCodeChange-hook on selfdestruct (#30686)
This change invokes the OnCodeChange hook when selfdestruct operation is performed, and a contract is removed. This is an event which can be consumed by tracers.
2024-11-08 15:25:30 +01:00
Felföldi Zsolt 7cbce8ed58
beacon/blsync: remove cli dependencies (#30720)
This PR moves chain config related code (config file processing, fork
logic, network defaults) from `beacon/types` and `beacon/blsync` into
`beacon/params` while the command line flag logic of the chain config is
moved into `cmd/utils`, thereby removing the cli dependencies from
package `beacon` and its sub-packages.
2024-11-08 15:21:00 +01:00
jwasinger d42d45046c
cmd/evm: benchmarking via `statetest` command + filter by name, index and fork (#30442)
When `evm statetest --bench` is specified, benchmark the execution
similarly to `evm run`.

Also adds the ability to filter tests by name, index and fork. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-11-08 15:18:42 +01:00
Naveen 5b78aef009
signer/core: extended support for EIP-712 array types (#30620)
This change updates the EIP-712 implementation to resolve [#30619](https://github.com/ethereum/go-ethereum/issues/30619).

The test cases have been repurposed from the ethers.js [repository](https://github.com/ethers-io/ethers.js/blob/main/testcases/typed-data.json.gz), but have been updated to remove tests that don't have a valid domain separator; EIP-712 messages without a domain separator are not supported by geth.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-11-08 15:04:17 +01:00
Madhur Shrimal a6037d027f
accounts/usbwallet: support dynamic tx (#30180)
Adds support non-legacy transaction-signing using ledger

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-11-08 14:57:29 +01:00
jwasinger 0fc9cca994
internal/ethapi: Set basefee for `AccessList` based on given block, not chain tip (#30538) 2024-11-08 13:33:43 +01:00
SangIlMo 8e00f95056
ethclient/gethclient: testcase for createAccessList, make tabledriven (#30194)
Adds testcase for createAccessList when user requested gasPrice is less than baseFee, also makes the tests tabledriven
---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-11-08 13:28:16 +01:00
Felix Lange e92e22a7cf
ethclient: add RevertErrorData function and example (#30669)
Here I'm adding a new helper function that extracts the revert reason of
a contract call. Unfortunately, this aspect of the API is underspecified.
See these spec issues for more detail:

- https://github.com/ethereum/execution-apis/issues/232
- https://github.com/ethereum/execution-apis/issues/463
- https://github.com/ethereum/execution-apis/issues/523

The function added here only works with Geth-like servers that return
error code `3`. We will not be able to support all possible servers.
However, if there is a specific server implementation that makes it
possible to extract the same info, we could add it in the same function
as well.

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2024-11-07 20:26:02 +01:00
dependabot[bot] 4bac6e669e
build(deps): bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#30728)
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1.


Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-07 14:48:51 +01:00
Marius van der Wijden 9c08631bb0
cmd/utils: change blssync.JWTSecretFlag to DirectoryFlag (#30729)
closes https://github.com/ethereum/go-ethereum/issues/30304

We already use `DirectoryFlag` for `authrpc.jwtsecret` which expands the
tilde, so this should work out of the box
2024-11-06 18:24:55 +01:00
Martin HS e56bbd77a4
core/state: small fix in hooked statedb (#30732)
fixes a very tiny bug
2024-11-05 18:29:37 +01:00
Delweng 229ce6411a
eth/tracers: fill the creationMethod in flatCall (#30539)
`flatCallTracer` will now specify the type of a create in the action
via the `creationMethod` field.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-11-05 08:42:22 +01:00
Martin HS da17f2d65b
all: fix issues with benchmarks (#30667)
This PR fixes some issues with benchmarks

- [x] Removes log output from a log-test
- [x] Avoids a `nil`-defer in `triedb/pathdb`
- [x] Fixes some crashes re tracers
- [x] Refactors a very resource-expensive benchmark for blobpol.
**NOTE**: this rewrite touches live production code (a little bit), as
it makes the validator-function used by the blobpool configurable.
- [x] Switch some benches over to use pebble over leveldb
- [x] reduce mem overhead in the setup-phase of some tests
- [x] Marks some tests with a long setup-phase to be skipped if `-short`
is specified (where long is on the order of tens of seconds). Ideally,
in my opinion, one should be able to run with `-benchtime 10ms -short`
and sanity-check all tests very quickly.
- [x]  Drops some metrics-bechmark which times the speed of `copy`.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-11-04 15:10:12 +01:00
Guillaume Ballet 06cbc80754
core, trie: verkle state processor tests (#30672)
Tests that are crucial to for verifying the verkle testnet functions properly.

---------

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Ignacio Hagopian <jsign.uy@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Martin HS <martin@swende.se>
2024-11-04 14:19:50 +01:00
Martin HS 014e2b037f
core/vm/runtime: invoke tx-end hook (#30711)
When using the `core/vm/runtime` helpers to execute code, callbacks for the tx end were not invoked. This change fixes it by invoking them.
2024-11-04 11:39:06 +01:00
Péter Szilágyi 7d6e153fd5
eth/catalyst: make engine api test time independent (#30713)
This test depends on a 100ms timer, which fails quite often, messing up
our pipelines. Hook directly into the internal version of getPayload
which has the capacity to wait for the full payload before returning.
This might not be absolutely correct from a test perspective, but it
beats failing ci. The alternative would be to expose the full build hook
into the outside, but it might be a bit overkill for this scenario.
2024-11-04 12:33:42 +02:00
piersy 484f0f4e84
core/txpool: improve error responses with wrapped errors (#30715) 2024-11-04 12:32:41 +02:00
Martin HS 6e1fedb12a
tests/fuzzers/bls12381: more verbose fuzzing-output (#30724)
This PR updates the fuzzing verbosity a bit, in case of mismatches
2024-11-04 10:49:23 +01:00
zhiqiangxu c48e936b70
build: use slices.Clone for copying slice (#30716) 2024-11-03 21:05:44 +01:00
Delweng a1093d98eb
eth/tracers: flatCallTracer error compatible with parity (#30497)
Compatible error message in the flat call tracer with parity-style endpoints.

Signed-off-by: jsvisa <delweng@gmail.com>
2024-11-01 09:51:06 +01:00
Martin HS f3b4bbbaf3
all: remove `personal` RPC namespace (#30704)
This PR is a first step towards removing account management from geth,
and contains a lot of the user-facing changes.

With this PR, the `personal` namespace disappears. **Note**: `personal`
namespace has been deprecated for quite some time (since
https://github.com/ethereum/go-ethereum/pull/26390 1 year and 8 months
ago), and users who have wanted to use it has been forced to used the
flag `--rpc.enabledeprecatedpersonal`. So I think it's fairly
non-controversial to drop it at this point.

Specifically, this means: 

- Account/wallet listing
  -`personal.getListAccounts`  
  -`personal.listAccounts`     
  -`personal.getListWallets`   
  -`personal.listWallets`      
- Lock/unlock
  -`personal.lockAccount`      
  -`personal.openWallet`       
  -`personal.unlockAccount`
- Sign ops
  -`personal.sign`             
  -`personal.sendTransaction`  
  -`personal.signTransaction`  
- Imports / inits
  -`personal.deriveAccount`    
  -`personal.importRawKey`     
  -`personal.initializeWallet` 
  -`personal.newAccount`       
  -`personal.unpair` 
- Other: 
  -`personal.ecRecover`        


The underlying keystores and account managent code is still in place,
which means that `geth --dev` still works as expected, so that e.g. the
example below still works:

```
> eth.sendTransaction({data:"0x6060", value: 1, from:eth.accounts[0]})
```	

Also, `ethkey` and `clef` are untouched. 

With the removal of `personal`, as far as I know we have no more API
methods which contain credentials, and if we want to implement
logging-capabilities of RPC ingress payload, it would be possible after
this.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-10-31 19:53:35 +01:00
Péter Szilágyi a1d049c1c4
internal/flags: remove low-use type TextMarshalerFlag (#30707)
Currently we have a custom TextMarshalerFlag. It's a nice idea, allowing
anything implementing text marshaller to be used as a flag. That said,
we only ever used it in one place because it's not that obvious how to
use and it needs some boilerplate on the type itself too, apart of the
heavy boilerplate got the custom flag.

All in all there's no *need* to drop this feature just now, but while
porting the cmds over to cli @v3, all other custom flags worker
perfectly, whereas this one started crashing deep inside the cli
package. The flag handling in v3 got rebuild on generics and there are a
number of new methods needed; and my guess is that maybe one of them
doesn't work like this flag currently is designed too.

We could definitely try and redesign this flag for cli v3... but all
that effort and boilerplate just to use it for 1 flag in 1 location,
seems not worth it. So for now I'm suggesting removing it and maybe
reconsider a similar feature in cli v3 with however it will work.
2024-10-31 19:52:39 +01:00
Péter Szilágyi 20bf543a64
internal/flags: remove Merge, it's identical to slices.Concat (#30706)
This is a noop change to not have custom code for stdlib functionality.
2024-10-31 19:26:02 +02:00
Péter Szilágyi 5230b06d51
cmd/utils, eth/ethconfig: remove some ancient leftover flag (#30705)
This is a flag leftover from the swarm era. No need to deprecate it,
it's been useless/dead forever now.
2024-10-31 16:03:47 +01:00
lightclient 9afb18dd6f
core: add code to witness when state object is accessed (#30698)
I think the core code should generally be agnostic about the witness and
the statedb layer should determine what elements need to be included in
the witness. Because code is accessed via `GetCode`, and
`GetCodeLength`, the statedb will always know when it needs to add that
code into the witness.

The edge case is block hashes, so we continue to add them manually in
the implementation of `BLOCKHASH`.

It probably makes sense to refactor statedb so we have a wrapped
implementation that accumulates the witness, but this is a simpler
change that makes #30078 less aggressive.
2024-10-31 12:19:01 +02:00
Martin HS 25bc07749c
core/vm: speed up push and interpreter loop (#30662)
Looking at the cpu profile of a burntpix benchmark, I noticed that a lot
of time was spent in gas-used, in the interpreter loop. It's an actual
call (not inlined), which explicitly wants to be ignored by tracing
("tracing.GasChangeIgnored"), so it can be safely and simply inlined.

The other change is in `pushX`. These also do a call to
`common.RightPadBytes`. I replaced that by a doing a corresponding `Lsh`
on the `u256` if needed. Note: it's needed only to make the stack output
look right, for fuzzers. It technically doesn't matter what we put
there: if code ends on a pushdata immediate, nothing will consume the
stack element. We could just as well just ignore it, if we didn't care
about fuzzers (which I do).

Seems quite a lot faster on burntpix, according to my runs. 

This PR:
```
EVM gas used:    5642735088
execution time:  34.84609475s
allocations:     915683
allocated bytes: 175334088
```
```
EVM gas used:    5642735088
execution time:  36.671958278s
allocations:     915701
allocated bytes: 175340528
```

Master
```
EVM gas used:    5642735088
execution time:  49.349209526s
allocations:     915684
allocated bytes: 175333368
```
```
EVM gas used:    5642735088
execution time:  46.581006598s
allocations:     915681
allocated bytes: 175330728
```

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-10-30 18:01:47 +01:00
zhiqiangxu 87465e98f9
beacon/light: remove unused CommitteeChain.signerThreshold (#30484)
This field is a duplicate of UpdateScore.SignerCount and never referenced.
2024-10-30 15:22:10 +01:00
Péter Szilágyi 8c73523812
appveyor, build, internal: ci.go cleanups, add package dep checker (#30696) 2024-10-29 13:21:17 +02:00