Commit graph

473 commits

Author SHA1 Message Date
Matthieu Vachon
7b77261b7c Added back OnNewAccount which is Firehose concept so I left it out of the merge commit just before this one 2024-03-13 16:24:14 -04:00
Matthieu Vachon
f47d2fc315 Merge branch 'extended-tracer-struct' into firehose-fh3.0
# Conflicts:
#	core/blockchain.go
#	core/state/statedb.go
#	eth/backend.go
#	eth/tracers/live/printer.go
#	go.mod
#	go.sum
2024-03-13 16:23:13 -04:00
Sina Mahmoodi
73ca96b97e resolve merge conflict 2024-03-12 17:55:17 +01:00
Péter Szilágyi
b393ad8d29
cmd, core, metrics: always report expensive metrics (#29191)
* cmd, core, metrics: always report expensive metrics

* core, metrics: report block processing metrics as resetting timer

* metrics: update reporter tests
2024-03-11 10:06:57 +02:00
rjl493456442
7b81cf6362
core/state, trie/triedb/pathdb: remove storage incomplete flag (#28940)
As SELF-DESTRUCT opcode is disabled in the cancun fork(unless the
account is created within the same transaction, nothing to delete
in this case). The account will only be deleted in the following
cases:

- The account is created within the same transaction. In this case
the original storage was empty.

- The account is empty(zero nonce, zero balance, zero code) and
is touched within the transaction. Fortunately this kind of accounts
are not-existent on ethereum-mainnet.

All in all, after cancun, we are pretty sure there is no large contract
deletion and we don't need this mechanism for oom protection.
2024-03-05 14:31:55 +01:00
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
buddho
bba3fa9af9
core,eth,internal: fix typo (#29024) 2024-02-20 19:42:48 +08: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
Matthieu Vachon
a46903cf0c Reduce amount of changes to Geth Live Tracer to keep Firehose backward compatibility
We removed the `precompile` check on `OnNewAccount` and moved it to the Firehose tracer directly. This way, we can remove our custom logic that toggle the check at the tracing code level and we can instead move the logic of backward compatibility back `FirehoseTracer`.

Refactored a bit also how precompiles are check. We moved the precompiles checker up to the block level now that `chainConfig` is available on `OnBlockStart` meaning we can extract the list of active precompiles. However, to make it work, we had to modify `OnGenesisBlock` to also receive `chainConfig` parameter, I've ask to add it to the geth codebase directly.
2024-02-05 12:01:21 -05:00
Matthieu Vachon
8767058368 Merge branch 'extended-tracer' into firehose-fh3.0
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	consensus/beacon/consensus.go
#	consensus/ethash/consensus.go
#	consensus/misc/dao.go
#	core/genesis.go
#	core/state/statedb.go
#	core/state/statedb_test.go
#	core/state_transition.go
#	core/txpool/blobpool/blobpool_test.go
#	core/txpool/legacypool/legacypool2_test.go
#	core/txpool/legacypool/legacypool_test.go
#	core/vm/evm.go
#	core/vm/interface.go
#	tests/state_test_util.go
2024-02-02 15:08:47 -05: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
Arun Dhyani
eae09aabda create account deleted corner case fix 2024-01-17 18:43:33 +08:00
Arun Dhyani
0b70fbd76a account creation fixes 2024-01-17 10:46:52 +08:00
Sina Mahmoodi
d07264afe0 no balance change reason on 0 balance selfdestruct 2024-01-16 21:03:16 +03:30
Matthieu Vachon
8545daf9f9 Fixed some small stuff while merging extended-tracer in 2024-01-15 14:03:07 -05:00
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