Commit graph

203 commits

Author SHA1 Message Date
Sina Mahmoodi
03e48ee451 rename tracer methods to On pattern
# Conflicts
#	core/vm/interpreter.go
#	eth/tracers/directory/noop.go
#	eth/tracers/js/goja.go
#	eth/tracers/live/noop.go
#	eth/tracers/logger/logger.go
#	eth/tracers/logger/logger_json.go
#	eth/tracers/native/4byte.go
#	eth/tracers/native/call.go
#	eth/tracers/native/call_flat.go
#	eth/tracers/native/mux.go
2024-03-14 16:16:18 -04:00
Sina Mahmoodi
25a3a744c3 rename Capture hooks to On
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	core/vm/instructions.go
#	eth/tracers/directory/noop.go
#	eth/tracers/internal/tracetest/calltrace_test.go
#	eth/tracers/internal/tracetest/flat_calltrace_test.go
#	eth/tracers/internal/tracetest/prestate_test.go
#	eth/tracers/js/goja.go
#	eth/tracers/js/tracer_test.go
#	eth/tracers/live/noop.go
#	eth/tracers/native/4byte.go
#	eth/tracers/native/call.go
#	eth/tracers/native/call_flat.go
#	eth/tracers/native/mux.go
#	eth/tracers/native/prestate.go
2024-03-14 16:07:18 -04:00
Sina Mahmoodi
688f0b9654 rename scopeContext to opContext 2024-03-14 16:03:07 -04:00
Sina Mahmoodi
d4ec634c05 rename GetLogger to Hooks
# Conflicts:
#	eth/tracers/logger/access_list_tracer.go
#	eth/tracers/logger/logger.go
#	eth/tracers/logger/logger_json.go
#	eth/tracers/logger/logger_test.go
#	eth/tracers/tracers_test.go
#	internal/ethapi/api.go
2024-03-14 16:03:05 -04:00
Sina Mahmoodi
39fc9dcafb move logger interface to core/tracing
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	consensus/beacon/consensus.go
#	consensus/ethash/consensus.go
#	consensus/misc/dao.go
#	core/evm.go
#	core/genesis.go
#	core/state/state_object.go
#	core/state/state_test.go
#	core/state/statedb.go
#	core/state/statedb_fuzz_test.go
#	core/state/statedb_test.go
#	core/state/sync_test.go
#	core/state/trie_prefetcher_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/instructions.go
#	core/vm/interface.go
#	eth/api_debug_test.go
#	internal/ethapi/api.go
#	tests/block_test_util.go
#	tests/state_test_util.go
2024-03-14 15:59:21 -04:00
Sina Mahmoodi
b202e8ab74 renaming GetLogger
# Conflicts:
#	cmd/evm/internal/t8ntool/transition.go
#	eth/tracers/logger/logger_test.go
#	eth/tracers/tracers_test.go
2024-03-14 13:58:26 -04:00
Sina Mahmoodi
e1c669b3aa moaar fixes
# Conflicts:
#	core/state/state_test.go
#	core/state/statedb_fuzz_test.go
#	core/state/statedb_test.go
#	core/state/sync_test.go
#	core/state/trie_prefetcher_test.go
#	core/txpool/blobpool/blobpool_test.go
#	core/txpool/legacypool/legacypool2_test.go
#	core/txpool/legacypool/legacypool_test.go
#	eth/api_debug_test.go
2024-03-14 13:56:15 -04:00
Sina Mahmoodi
29ebfb30c3 fixes, rm t8ntool tracewriter
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	cmd/evm/internal/t8ntool/transition.go
#	core/vm/instructions.go
#	eth/tracers/internal/tracetest/calltrace_test.go
#	eth/tracers/internal/tracetest/flat_calltrace_test.go
#	eth/tracers/internal/tracetest/prestate_test.go
#	eth/tracers/js/tracer_test.go
#	eth/tracers/logger/logger_test.go
#	eth/tracers/tracers_test.go
#	tests/block_test_util.go
#	tests/state_test_util.go
2024-03-14 13:51:16 -04:00
Sina Mahmoodi
f1027b7c0a fix goja scope object wrappers 2024-03-14 13:42:40 -04:00
Sina Mahmoodi
6013241175 fix memory copy util func 2024-03-14 13:42:40 -04:00
Sina Mahmoodi
e0b96540b7 Add canceler interface 2024-03-14 13:42:40 -04:00
Sina Mahmoodi
4e43718bd0 full struct-based tracing infra
# Conflicts:
#	consensus/beacon/consensus.go
#	consensus/ethash/consensus.go
#	consensus/misc/dao.go
#	core/blockchain.go
#	core/evm.go
#	core/genesis.go
#	core/state/dump.go
#	core/state/state_object.go
#	core/state/statedb.go
#	core/state_transition.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	core/vm/interface.go
#	internal/ethapi/api.go
2024-03-14 12:09:18 -04:00
Sina Mahmoodi
4df6904051 use struct for tracing events
# Conflicts:
#	core/blockchain.go
#	core/state/state_object.go
#	core/state/statedb.go
2024-03-14 11:57:58 -04:00
Sina Mahmoodi
8ec4560e17 refactor onBlockStart params, new skip method 2024-03-14 11:54:59 -04:00
Sina Mahmoodi
b210cc761d remove onBeaconBlockRoot events 2024-03-14 11:54:59 -04:00
Sina Mahmoodi
d17940d2e7 minor fix 2024-03-14 11:54:59 -04:00
Sina Mahmoodi
318dc84314 add config for tracers 2024-03-14 11:54:59 -04:00
Sina Mahmoodi
2264a9c3fe fix mdLogger
Backport of cf6a31514b
2024-02-09 16:08:43 -05:00
Sina Mahmoodi
97e9a8b315 fix blockchain -> logger circular import
Backport of 03206befb9
2024-02-09 16:07:56 -05:00
Matthieu Vachon
7ff2ae6924 indicate Known block
Backport of 056f229260
2024-02-08 16:04:15 -05:00
Matthieu Vachon
31b3b7dca3 rm OnNewAccount
Backport of 57cd0c30df
2024-02-08 15:57:12 -05:00
Matthieu Vachon
9f71824d8c Backported commits from extended-tracer
- 6c44a594f4
- 188cd4182e
- f3c0a89b57
- 95b50299a5
- 2cc09548bb
2024-02-06 15:36:12 -05:00
Matthieu Vachon
7f8926e716 Backporting extended-tracer branch
We backported branch `extended-tracer` at commit 3078dfe80b back to v1.13.5 of Geth.

To achieve the backport, we did:
- git checkout -b extended-tracer-squashed
- git reset --hard 3078dfe80b
- git reset --mixed fc380f52ef # This was the latest merged commit not from `extended-tracer` branch
- git commit -A -m "<This message>"
- git checkout v1.13.5
- git checkout -b extended-tracer-backport-v1.13.5
- git cherry-pick extended-tracer-squashed
2024-02-06 13:06:08 -05:00
Alvaro Sevilla
b1cec853be
eth/tracers: add position field for callTracer logs (#28389)
Currently, one can use the "withLogs" parameter to include logs in the
callTracer results, which allows the user to see at which trace level
was each log emitted.
This commit adds a position field to the logs which determine
the exact ordering of a call's logs and its subcalls. This would
be useful e.g. for explorers wishing to display the flow of execution.

Co-authored-by: jsvisa <delweng@gmail.com>
2023-11-03 10:28:27 +01:00
Felix Lange
9b46986edc
all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994) 2023-08-24 11:47:42 +03:00
Péter Szilágyi
0c6bbeb423
core, eth, trie: expose more detailed dirty ram tracking for diff layers (#27971) 2023-08-23 14:08:39 +03:00
Joe Netti
e0b119884c
eth/tracers/js: use t.toBig on ctx.GasPrice for js tracing (#27903)
This change fixes a bug in js tracer, where `ctx.GasPrice.toString(16)` returns a number string in base `10`.
2023-08-15 14:19:37 -04:00
Péter Szilágyi
be65b47645
all: update golang/x/ext and fix slice sorting fallout (#27909)
The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
2023-08-12 00:04:12 +02:00
rjl493456442
503f1f7ada
all: activate pbss as experimental feature (#26274)
* all: activate pbss

* core/rawdb: fix compilation error

* cma, core, eth, les, trie: address comments

* cmd, core, eth, trie: polish code

* core, cmd, eth: address comments

* cmd, core, eth, les, light, tests: address comment

* cmd/utils: shorten log message

* trie/triedb/pathdb: limit node buffer size to 1gb

* cmd/utils: fix opening non-existing db

* cmd/utils: rename flag name

* cmd, core: group chain history flags and fix tests

* core, eth, trie: fix memory leak in snapshot generation

* cmd, eth, internal: deprecate flags

* all: enable state tests for pathdb, fixes

* cmd, core: polish code

* trie/triedb/pathdb: limit the node buffer size to 256mb

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2023-08-10 22:21:36 +03:00
jwasinger
d233b6b23a
core: replace instances of 'suicide' with 'selfdestruct' to improve code consistency. (#27716)
---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2023-07-15 10:35:30 -04:00
Ryan Schneider
517ac886d4
eth/tracers/native: panic on memory read in prestateTracer (#27691)
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2023-07-13 14:44:42 +02:00
Delweng
1e069cf802
eth/tracers: add ReturnData in the tracer's response (#27704)
The struct logger (or opcode tracer) was missing the return data field even
if this was explicitly enabled by user via `"enableReturnData": true` in the config.
This PR fixes this issue.

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2023-07-13 14:43:25 +02:00
Guillaume Ballet
85b8d1c06c
params, trie: add verkle fork management + upgrade go-verkle (#27464)
* params, trie: add verkle fork management + upgrade go-verkle

* remove the two verkle files

* core, eth, params: add missing function

* Gary's feedback

* remove trie/utils/verkle.go

* add verkle block override

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2023-06-28 12:08:48 +03:00
Dan Laine
b1ef0bfe03
eth: use slices package for sorting (#27490)
Also adds Hash.Less method for sorting purposes.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-06-19 23:38:57 +02:00
Sina Mahmoodi
7823ff6d06
eth/tracers: refactor exporting js buffer (#27472)
We had to do this workaround because it wasn't possible to export typed arrays from
JS to []byte. This was added in dop251/goja@2352993, so we can use the better way now.
2023-06-14 19:07:24 +02:00
Delweng
8a78a4f79f
eth,consensus: replace noarg fmt.Errorf with errors.New (#27330)
* eth: replace noarg fmt.Errorf with errors.New

Signed-off-by: jsvisa <delweng@gmail.com>

* consensus: replace noarg fmt.Errorf with errors.New

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
2023-05-25 02:57:34 -04:00
minh-bq
a190da9d68
eth/tracers: fix flatCallTracer crasher (#27304)
FlatCallTracer had a crasher when it was passed `onlyTopCall: true` as config.
This PR ignores config fields inherited from the normal call tracer.
2023-05-23 11:02:50 +02:00
sjlee1125
604e215d1b
eth/tracers: add txHash field on txTraceResult (#27183)
This PR modifies the interface for the results of `debug_traceBlock` and `debug_traceCall` by adding the `txHash`, allowing users to identify which transaction's trace result corresponds to. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-05-05 08:59:13 -04:00
Sina Mahmoodi
ae66009640
internal/ethapi: add block overrides to eth_call (#26414)
Adds an optional config parameter to eth_call which allows users to override block context fields (same functionality that was added to traceCall in #24871)

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-05-02 04:28:43 -04:00
Péter Szilágyi
bbc565ab05
core/types, params: add blob transaction type, RLP encoded for now (#27049)
* core/types, params: add blob transaction type, RLP encoded for now

* all: integrate Cancun (and timestamp based forks) into MakeSigner

* core/types: fix 2 back-and-forth type refactors

* core: fix review comment

* core/types: swap blob tx type id to 0x03
2023-04-21 12:52:02 +03:00
Delweng
5e4d726e2a
params: remove EIP150Hash from chainconfig (#27087)
The EIP150Hash was an idea where, after the fork, we hardcoded the forked hash as an extra defensive mechanism. It wasn't really used, since forks weren't contentious and for all the various testnets and private networks it's been a hassle to have around. 

This change removes that config field. 

---------

Signed-off-by: jsvisa <delweng@gmail.com>
2023-04-18 03:49:09 -04:00
s7v7nislands
2adce0b066
eth/tracers: use atomic type (#27031)
Use the new atomic types in package eth/tracers

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2023-04-04 12:34:52 -04:00
Martin Holst Swende
ab1a404b01
all: remove debug-field from vm config (#27048)
This PR removes the Debug field from vmconfig, making it so that if a tracer is set, debug=true is implied.

---------

Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2023-04-04 09:50:13 -04:00
Delweng
0b76eb3708
eth/tracers: report correct gasLimit in call tracers (#27029)
This includes a semantic change to the `callTracer` as well as `flatCallTracer`.
The value of field `gas` in the **first** call frame will change as follows:

- It previously contained gas available after initial deductions (i.e. tx costs)
- It will now contain the full tx gasLimit value

Signed-off-by: jsvisa <delweng@gmail.com>
2023-04-04 12:34:23 +02:00
jwasinger
fd94b4fcfa
eth/tracers/native: prevent panic for LOG edge-cases (#26848)
This PR fixes OOM panic in the callTracer as well as panicing on
opcode validation errors (e.g. stack underflow) in callTracer and
prestateTracer.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-03-28 11:46:53 +02:00
Roberto Bayardo
67ac5f0ae7
core, core/types: plain Message struct (#25977)
Here, the core.Message interface turns into a plain struct and
types.Message gets removed.

This is a breaking change to packages core and core/types. While we do
not promise API stability for package core, we do for core/types. An
exception can be made for types.Message, since it doesn't have any
purpose apart from invoking the state transition in package core.
types.Message was also marked deprecated by the same commit it
got added in, 4dca5d4db7 (November 2016).

The core.Message interface was added in December 2014, in commit
db494170dc, for the purpose of 'testing' state transitions. It's the
same change that made transaction struct fields private. Before that,
the state transition used *types.Transaction directly.

Over time, multiple implementations of the interface accrued across
different packages, since constructing a Message is required whenever
one wants to invoke the state transition. These implementations all
looked very similar, a struct with private fields exposing the fields
as accessor methods.

By changing Message into a struct with public fields we can remove all
these useless interface implementations. It will also hopefully
simplify future changes to the type with less updates to apply across
all of go-ethereum when a field is added to Message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-03-09 14:19:12 +01:00
Sina Mahmoodi
41af42e97c
eth/tracers/native: set created address to nil in case of failure (#26779)
Fixes #26073
2023-03-07 14:39:11 +01:00
Péter Szilágyi
cd31f2dee2
all: change chain head markers from block to header (#26777) 2023-03-02 08:29:15 +02:00
Chris Ziogas
2ad150d986
eth/tracers: add native flatCallTracer (aka parity style tracer) (#26377)
Adds support for a native call tracer with the Parity format, which outputs call frames
in a flat array. This tracer accepts the following options:

- `convertParityErrors: true` will convert error messages to match those of Parity
- `includePrecompiles: true` will report all calls to precompiles. The default
  matches Parity's behavior where CALL and STATICCALLs to precompiles are excluded

Incompatibilities with Parity include:

- Parity removes the result object in case of failure. This behavior is maintained
  with the exception of reverts. Revert output usually contains useful information,
  i.e. Solidity revert reason.
- The `gasUsed` field accounts for intrinsic gas (e.g. 21000 for simple transfers)
  and refunds unlike Parity
- Block rewards are not reported

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2023-02-28 13:54:37 +03:30
Darioush Jalali
7d29fff415
eth/tracers: more fork overrides in traceBlockToFile (#26655)
This change allows all post-Berlin forks to be specified as overrides for futureForkBlock in the config parameter for traceBlockToFile.
2023-02-13 05:01:35 -05:00