Commit graph

392 commits

Author SHA1 Message Date
Matthieu Vachon
3cbe387cd6 Added a backward compatibility fix for aligning with Firehose 2.3 2024-12-20 16:20:00 -05:00
Matthieu Vachon
2ff5f62b6f Added a an extra logging for storage change in trace mode 2024-12-20 16:19:23 -05:00
Matthieu Vachon
d1f03614a4 Merge tag 'v1.14.12' into firehose-fh3.0
# Conflicts:
#	cmd/geth/misccmd.go
#	core/state/statedb.go
#	core/state_processor.go
#	go.mod
2024-12-17 16:01:41 -05:00
Matthieu Vachon
9bf4d2482f Added code to generate prestate test from RPC nodes
Alchemy and QuickNode offers `debug_traceTransaction` that we need, use one of them with a paid plan to generate prestate tests.
2024-05-01 19:31:22 -04:00
Matthieu Vachon
b567b08329 Added unit test to check different keccak256 on transaction 2024-05-01 19:26:40 -04:00
Matthieu Vachon
bc4162e99f Refactored tests and added new based on "prestate" testing 2024-05-01 13:41:36 -04:00
Matthieu Vachon
dccb2f36cd Fixed the rare case where a tx receipt is nil
I think this cannot happen in the wild while syncing block, otherwise it would mean the transaction would have no receipt which is impossible.

However in testing conditions or when doing "speculative exeuction", it's possible to get that condition.

This is just to better deal with a potential `nil pointer exception`.
2024-05-01 13:41:36 -04:00
Matthieu Vachon
f0dcb13f6b Fixed opcode representation when debugging via firehose(Info|Debug|Trace) call 2024-05-01 13:41:36 -04:00
Matthieu Vachon
f8c889f892 Fixed Kecakke256 computation panics in some transaction state
The EVM does memory expansion **after** notifying us about OnOpcode which we use to compute Keccak256 pre-images now. This creates problem when we want to retrieve the preimage data because the memory is not expanded yet but in the EVM is going to work because the memory is going to be expanded before the operation is actually executed so the memory will be of the correct size.

In this situation, we must pad with zeroes when the memory is not big enough.
2024-05-01 13:41:31 -04:00
Matthieu Vachon
c327b4d7fc Added first pass on integration tests 2024-04-29 17:10:51 -04:00
Matthieu Vachon
e3a43bf49c Removed callerView
This can work only if resolve at call site directly, which we don't want to do.
2024-04-29 17:10:37 -04:00
Matthieu Vachon
27ace57951 Renamed callerViewer to _callViewer to align with other "view" structs 2024-04-29 11:50:19 -04:00
Matthieu Vachon
8d802608f5 Adding standard Geth logging on NewFirehose and on OnBlockchainInit 2024-04-29 11:34:59 -04:00
Matthieu Vachon
bb041978a7 Added back OnSystemCallStart/End that were lost in update to latest Geth version 2024-04-29 10:37:32 -04:00
Matthieu Vachon
a4e3ab8818 Merge tag 'v1.14.0' into firehose-fh3.0 2024-04-24 09:02:12 -04:00
Matthieu Vachon
ade7515c81
eth, eth/tracers: process beacon root before transactions (#29402)
The beacon root when applied in `state_processor.go` is performed right before executing transaction. That means that contract reliying on this value would query the same value found in the block header.

In that spirit, it means that any tracing/operation relying on state data which touches transaction must have updated the beacon root before any transaction processing.
2024-04-24 07:58:05 +02:00
Matthieu Vachon
a64a69dbfc Merge remote-tracking branch 'origin/master' into firehose-fh3.0
# Conflicts:
#	go.mod
2024-04-23 15:40:14 -04:00
Matthieu Vachon
7ae7701b37 Added further tracing on config and apply backward compatibility value 2024-04-22 14:22:14 -04:00
Matthieu Vachon
2108b9d42a Fixed a few linting errors 2024-04-22 14:22:03 -04:00
Matthieu Vachon
ad7fdb83cc Ported various improvements done in the Firehose tracer in other supported chains 2024-04-17 16:15:59 -04:00
Martin HS
7aafad2233
core/vm: better error-info for vm errors (#29354) 2024-04-06 12:22:55 +02:00
Aaron Chen
ccb76c01d7
eth/tracers: use slices.Contains (#29461) 2024-04-06 12:16:25 +02:00
Delweng
8c5576b1ac
eth/tracers: fix base fee and set blob fee in tests (#29376)
Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-04-01 14:53:56 +02:00
Brandon Liu
a3829178af
eth/tracers/js: consistent name for method receivers (#29375) 2024-03-28 17:35:40 +01:00
cui
0183c7ad82
eth/tracers/logger: using maps.Equal (#29384)
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-03-28 14:09:21 +01:00
Sina M
767b00b0b5
t8ntool: add optional call frames to json logger (#29353)
Adds a flag `--trace.callframes` to t8n which will log info when entering or exiting a call frame in addition to the execution steps.

---------

Co-authored-by: Mario Vega <marioevz@gmail.com>
2024-03-27 16:12:57 +01:00
Aaron Chen
723b1e36ad
all: fix mismatched names in comments (#29348)
* all: fix mismatched names in comments

* metrics: fix mismatched name in UpdateIfGt
2024-03-26 21:01:28 +01:00
Matthieu Vachon
262c3117f6 Merge remote-tracking branch 'origin/master' into firehose-fh3.0
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	cmd/evm/internal/t8ntool/transition.go
#	cmd/utils/flags.go
#	consensus/beacon/consensus.go
#	core/blockchain.go
#	core/state_processor.go
#	core/tracing/hooks.go
#	core/vm/runtime/runtime.go
#	eth/backend.go
#	eth/tracers/api.go
#	eth/tracers/dir.go
#	eth/tracers/directory/tracers.go
#	eth/tracers/internal/tracetest/calltrace_test.go
#	eth/tracers/internal/tracetest/flat_calltrace_test.go
#	eth/tracers/js/goja.go
#	eth/tracers/js/tracer_test.go
#	eth/tracers/live/noop.go
#	eth/tracers/logger/logger.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/noop.go
#	eth/tracers/native/prestate.go
#	eth/tracers/tracers.go
#	go.mod
2024-03-25 14:45:08 -04:00
Martin HS
14cc967d19
all: remove dependency on golang.org/exp (#29314)
This change includes a leftovers from https://github.com/ethereum/go-ethereum/pull/29307
- using the [new `slices` package](https://go.dev/doc/go1.21#slices) and
- using the [new `cmp.Ordered`](https://go.dev/doc/go1.21#cmp) instead of exp `constraints.Ordered`
2024-03-25 07:50:18 +01:00
Sina M
064f37d6f6
eth/tracers: live chain tracing with hooks (#29189)
Here we add a Go API for running tracing plugins within the main block import process. 

As an advanced user of geth, you can now create a Go file in eth/tracers/live/, and within
that file register your custom tracer implementation. Then recompile geth and select your tracer
on the command line. Hooks defined in the tracer will run whenever a block is processed.

The hook system is defined in package core/tracing. It uses a struct with callbacks, instead of 
requiring an interface, for several reasons:

- We plan to keep this API stable long-term. The core/tracing hook API does not depend on
  on deep geth internals.
- There are a lot of hooks, and tracers will only need some of them. Using a struct allows you
   to implement only the hooks you want to actually use.

All existing tracers in eth/tracers/native have been rewritten to use the new hook system.

This change breaks compatibility with the vm.EVMLogger interface that we used to have.
If you are a user of vm.EVMLogger, please migrate to core/tracing, and sorry for breaking
your stuff. But we just couldn't have both the old and new tracing APIs coexist in the EVM.

---------

Co-authored-by: Matthieu Vachon <matthieu.o.vachon@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Martin HS <martin@swende.se>
2024-03-22 18:53:53 +01:00
Matthieu Vachon
ecc78f5dd0 Merge branch 'extended-tracer-struct' into firehose-fh3.0 2024-03-18 15:46:07 -04:00
Martin Holst Swende
4f87f174b3 eth/tracers, cmd/evm: unexport JSONlogger 2024-03-18 17:33:55 +01:00
Matthieu Vachon
b1d1d36dc4 Merge branch 'firehose-fh3.0-backport-1.13.5' into firehose-fh3.0
# Conflicts:
#	accounts/abi/bind/backends/simulated.go
#	cmd/evm/internal/t8ntool/execution.go
#	cmd/evm/internal/t8ntool/flags.go
#	cmd/evm/internal/t8ntool/transition.go
#	cmd/geth/snapshot.go
#	consensus/beacon/consensus.go
#	consensus/ethash/consensus.go
#	consensus/misc/dao.go
#	core/blockchain.go
#	core/chain_makers.go
#	core/evm.go
#	core/genesis.go
#	core/genesis_test.go
#	core/state/dump.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/tracing/hooks.go
#	core/txpool/blobpool/blobpool_test.go
#	core/txpool/legacypool/legacypool2_test.go
#	core/txpool/legacypool/legacypool_test.go
#	core/types/account.go
#	core/vm/errors.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	core/vm/interface.go
#	core/vm/interpreter.go
#	eth/api_debug_test.go
#	eth/tracers/api.go
#	eth/tracers/directory/util_test.go
#	eth/tracers/firehose.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/logger/logger.go
#	eth/tracers/logger/logger_test.go
#	eth/tracers/native/call_flat.go
#	eth/tracers/native/prestate.go
#	eth/tracers/tracers_test.go
#	go.mod
#	internal/ethapi/api.go
#	light/odr_test.go
#	miner/worker.go
#	params/version.go
#	tests/block_test_util.go
#	tests/state_test_util.go
2024-03-15 12:48:29 -04:00
Matthieu Vachon
5cf6340406 Fixed new keccak256 implementation that wasn't working properly 2024-03-15 10:57:39 -04:00
Matthieu Vachon
d673f1927c Added Firehose 3.0 backport tracer 2024-03-15 10:56:57 -04:00
Matthieu Vachon
3834f135a9 Series of changes to get backport to 1.13.5 working 2024-03-14 16:53:22 -04:00
Sina Mahmoodi
77486e91fb fix lint issue 2024-03-14 16:23:56 -04:00
Sina Mahmoodi
d0a86c45b5 rm canceler 2024-03-14 16:23:56 -04:00
Sina Mahmoodi
94fc0b4a9e replace opcode with byte
# Conflicts:
#	core/tracing/hooks.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	eth/tracers/js/tracer_test.go
2024-03-14 16:23:54 -04:00
Sina Mahmoodi
5c6fb316b7 rm OnKeccakPreimage
# Conflicts:
#	core/tracing/hooks.go
2024-03-14 16:16:43 -04:00
Sina Mahmoodi
7190602bd2 rm embedding of noop tracer 2024-03-14 16:16:20 -04:00
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