Commit graph

462 commits

Author SHA1 Message Date
Sina Mahmoodi
a2829c6f49 rename LiveLogger to hooks 2024-02-28 19:38:04 +01:00
Sina Mahmoodi
7d8db9b503 move logger interface to core/tracing 2024-02-28 19:34:49 +01:00
Sina Mahmoodi
8cc747f439 moaar fixes 2024-02-28 19:20:17 +01:00
Sina Mahmoodi
fc35780124 full struct-based tracing infra 2024-02-21 18:47:59 +01:00
Sina Mahmoodi
50095906e2 use struct for tracing events 2024-02-16 11:20:56 +01:00
Sina Mahmoodi
35291e6a8c resolve merge conflict 2024-02-15 10:22:56 +01:00
Martin HS
8321fe2fda
tests: fix goroutine leak related to state snapshot generation (#28974)
---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-02-14 17:02:56 +01:00
Sina Mahmoodi
4cd7cb3637 resolve merge conflict 2024-02-14 15:40:27 +01:00
rjl493456442
fe91d476ba
all: remove the dependency from trie to triedb (#28824)
This change removes the dependency from trie package to triedb package.
2024-02-13 14:49:53 +01:00
Sina Mahmoodi
27f662d96c fix merge conflict 2024-02-08 19:07:00 +01:00
Sina Mahmoodi
57cd0c30df rm OnNewAccount 2024-02-08 16:30:14 +01:00
lmittmann
199e0c9ff5
core/state, core/vm: minor uint256 related perf improvements (#28944) 2024-02-07 17:01:38 +01:00
Dimitris Apostolou
8fd43c8013
all: fix typos in comments (#28881) 2024-02-05 22:16:32 +01:00
Sina Mahmoodi
188cd4182e remove precompile check for newAccount 2024-02-05 18:37:57 +01:00
Sina Mahmoodi
6c44a594f4 fix self destruct burn condition 2024-02-05 18:29:53 +01:00
Sina Mahmoodi
56862cf07f emit onNewAccount when reseting account 2024-01-30 16:36:14 +01:00
Sina Mahmoodi
4c1d675041 resolve merge conflict 2024-01-29 20:00:43 +01:00
Marius van der Wijden
c89a3da7d9
core/state/snapshot: use AddHash/ContainHash instead of Hasher interface (#28849)
This change switches from using the `Hasher` interface to add/query the bloomfilter to implementing it as methods.
This significantly reduces the allocations for Search and Rebloom.
2024-01-23 15:15:48 +01:00
Martin HS
a5a4fa7032
all: use uint256 in state (#28598)
This change makes use of uin256 to represent balance in state. It touches primarily upon statedb, stateobject and state processing, trying to avoid changes in transaction pools, core types, rpc and tracers.
2024-01-23 14:51:58 +01:00
Sina Mahmoodi
d07264afe0 no balance change reason on 0 balance selfdestruct 2024-01-16 21:03:16 +03:30
Sina Mahmoodi
626fee4fed fix withdraw balance change name 2024-01-15 19:40:55 +03:30
Darioush Jalali
29b73555ae
core/state: unexport GetOrNewStateObject (#28804) 2024-01-14 12:32:23 +01:00
Sina Mahmoodi
aa0db68d3a resolve merge conflict 2024-01-12 17:58:24 +03:30
Sina Mahmoodi
f241a76f4a fix comment' 2024-01-12 16:24:42 +03:30
cygaar
d2e3cb894b
core/state: logic equivalence for GetCodeHash (#28733) 2023-12-26 16:38:11 +08:00
Sina Mahmoodi
2d14bb573c rename and document balance change reasons 2023-12-13 17:52:56 +03:30
Sina Mahmoodi
5e82cbec8d nil check 2023-12-11 15:59:23 +03:30
Sina Mahmoodi
0484068df5 fix lint issues 2023-12-11 14:17:29 +03:30
Martin HS
1048e2d6a3
cmd/evm: fix dump after state-test exec (#28650)
The dump after state-test didn't work, the problem was an error, "Already committed", which was silently ignored. 

This change re-initialises the state, so the dumping works again.
2023-12-08 11:06:01 +01:00
Sina Mahmoodi
0967291487 Track burnt and selfdestruct withdraw bal changes 2023-12-07 18:07:14 +03:30
Sina Mahmoodi
9360cab0df assign values for balance reasons 2023-12-07 11:18:38 +03:30
Sina Mahmoodi
c5e407ba66 resolve merge conflicts 2023-12-05 18:13:41 +03:30
rjl493456442
ab0eb46a84
core/state: make stateobject.create selfcontain (#28459) 2023-11-29 16:07:51 +08:00
jwasinger
28e7371701
all: replace log15 with slog (#28187)
This PR replaces Geth's logger package (a fork of [log15](https://github.com/inconshreveable/log15)) with an implementation using slog, a logging library included as part of the Go standard library as of Go1.21.

Main changes are as follows:
* removes any log handlers that were unused in the Geth codebase.
* Json, logfmt, and terminal formatters are now slog handlers.
* Verbosity level constants are changed to match slog constant values.  Internal translation is done to make this opaque to the user and backwards compatible with existing `--verbosity` and `--vmodule` options.
* `--log.backtraceat` and `--log.debug` are removed.

The external-facing API is largely the same as the existing Geth logger.  Logger method signatures remain unchanged.

A small semantic difference is that a `Handler` can only be set once per `Logger` and not changed dynamically.  This just means that a new logger must be instantiated every time the handler of the root logger is changed.

----
For users of the `go-ethereum/log` module. If you were using this module for your own project, you will need to change the initialization. If you previously did 
```golang
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
```
You now instead need to do 
```golang
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
```
See more about reasoning here: https://github.com/ethereum/go-ethereum/issues/28558#issuecomment-1820606613
2023-11-29 08:33:50 +01:00
Martin Holst Swende
63979bc9cc
cmd/evm, core/state: fix post-exec dump of state (statetests, blockchaintests) (#28504)
There were several problems related to dumping state. 

- If a preimage was missing, even if we had set the `OnlyWithAddresses` to `false`, to export them anyway, the way the mapping was constructed (using `common.Address` as key) made the entries get lost anyway. Concerns both state- and blockchain tests. 
- Blockchain test execution was not configured to store preimages.

This changes makes it so that the block test executor takes a callback, just like the state test executor already does. This callback can be used to examine the post-execution state, e.g. to aid debugging of test failures.
2023-11-28 13:54:17 +01:00
Sina Mahmoodi
00ee953593 rm comment 2023-11-28 14:40:20 +03:30
Sina Mahmoodi
9c00b1290b fix merge conflict 2023-11-24 16:09:47 +03:30
Sina Mahmoodi
1d136450d8 move balance reason to metadata file 2023-11-24 12:39:47 +03:30
Sina Mahmoodi
b80aa1efb8 fix double-allocation 2023-11-24 12:35:20 +03:30
Marius van der Wijden
146e8d999c
core, trie, rpc: speed up tests (#28461)
* rpc: make subscription test faster

reduces time for TestClientSubscriptionChannelClose
from 25 sec to < 1 sec.

* trie: cache trie nodes for faster sanity check

This reduces the time spent on TestIncompleteSyncHash
from ~25s to ~16s.

* core/forkid: speed up validation test

This takes the validation test from > 5s to sub 1 sec

* core/state: improve snapshot test run
brings the time for TestSnapshotRandom from 13s down to 6s

* accounts/keystore: improve keyfile test

This removes some unnecessary waits and reduces the
runtime of TestUpdatedKeyfileContents from 5 to 3 seconds

* trie: remove resolver
* trie: only check ~5% of all trie nodes
2023-11-21 12:19:28 +01:00
rjl493456442
661bd45188
core/state/snapshot: print correct error from trie iterator (#28560) 2023-11-21 10:47:37 +08:00
Guillaume Ballet
fa8d39807d
cmd, core, trie: verkle-capable geth init (#28270)
This change allows the creation of a genesis block for verkle testnets. This makes for a chunk of code that is easier to review and still touches many discussion points.
2023-11-14 13:09:40 +01:00
Sina Mahmoodi
6b8d216578 fix setBalance reasons 2023-11-13 12:17:17 +03:00
Sina Mahmoodi
ee58cc79d9 statedb: precompile check before onNewAccount 2023-11-07 15:41:58 +03:00
Sina Mahmoodi
14d603b009 add comment re newAccount precompile 2023-11-03 17:20:15 +01:00
Sina Mahmoodi
429dcc99ca fix merge conflict 2023-11-02 15:58:17 +01:00
Matthieu Vachon
1914bc6ed0
error code for VM failures (#18)
* Experimental: EVMLogger fixed error code

* First pass of review

* Move error to `core/vm/errors.go`, ensure also we strictly implement `rpc.Error` (without depending on it)
2023-10-27 17:49:52 +02:00
Martin Holst Swende
96b75033c0
trie: use explicit errors in stacktrie (instead of panic) (#28361)
This PR removes panics from stacktrie (mostly), and makes the Update return errors instead. While adding tests for this, I also found that one case of possible corruption was not caught, which is now fixed.
2023-10-25 14:53:50 +02:00
aaronbuchwald
6c6982163b
core/state/pruner: track number of skipped items during state pruning (#28368) 2023-10-23 13:24:32 +08:00
Martin Holst Swende
c1d5a012ea
core/state, tests: fix memory leak via fastcache (#28387)
This change fixes a memory leak, when running either state-tests or blockchain-tests, we allocate a `1MB` fastcache during snapshot generation. `fastcache` is a bit special, and requires a `Reset()` (it has it's own memory allocator). 

The `1MB` was hidden [here](https://github.com/ethereum/go-ethereum/blob/master/tests/state_test_util.go#L333) and [here](https://github.com/ethereum/go-ethereum/blob/master/tests/block_test_util.go#L146) respectively.
2023-10-20 13:35:49 +02:00