Commit Graph

19 Commits

Author SHA1 Message Date
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
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
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
Martin Holst Swende
2c6dda5ad7
eth/tracers: use non-threaded tracechain (#24283)
This makes non-JS tracers execute all block txs on a single goroutine.
In the previous implementation, we used to prepare every tx pre-state
on one goroutine, and then run the transactions again with tracing enabled.
Native tracers are usually faster, so it is faster overall to use their output as
the pre-state for tracing the next transaction.

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2023-01-10 15:11:53 +01:00
Martin Holst Swende
fa97788c75
eth/tracers/native: fix possible crash in prestate tracer (#26351) 2022-12-13 08:32:29 -05:00
Martin Holst Swende
1f35988a00
eth/tracers, core/vm: remove time from trace output and tracing interface (#26291)
This removes the 'time' field from logs, as well as from the tracer interface. This change makes the trace output deterministic.  If a tracer needs the time they can measure it themselves. No need for evm to do this.

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2022-12-05 16:57:47 +01:00
Sina Mahmoodi
64067fbdc4
eth/tracers: small refactor for native tracers (#26196)
Use noopTracer as a base for other native tracers to avoid extra boilerplate for unimplemented hooks.
2022-11-17 09:27:48 +01:00
Sina Mahmoodi
0c40df5f28
eth/tracers: prestateTracer - exclude unchanged storage slots in diffMode (#25944)
Fixes #25943
2022-11-01 14:25:44 +01:00
Martin Holst Swende
5f70f9fd37
eth/tracers: simplify test framework (#25973)
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2022-10-21 17:55:15 +02:00
Delweng
a404195c7b
eth/tracers: fix the issue prestate missing existing contract state (#25996)
The prestate tracer did not report accounts that existed at a given address prior to a contract being created at that address.

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2022-10-21 11:48:53 +02:00
Delweng
c776a98c83
eth/tracers: fix the issue of panic in prestate with diffmode (#25957)
In some cases, inner contract creation may not be successful, and an inner contract was not created. This PR fixes a crash that could occur when doing tracing in such situations.
2022-10-12 12:50:01 +02:00
Delweng
5d52a35931
eth/tracers: add diffMode to prestateTracer (#25422)
Backwards compatibility warning: The result will from now on omit empty fields instead
of including a zero value (e.g. no more `balance: '0x'`).

The prestateTracer will now take an option `diffMode: bool`. In this mode
the tracer will output the pre state and post data for the modified parts of state.
Read-only accesses will be completely omitted. Creations (be it account or slot)
will be signified by omission in the `pre` list and inclusion in `post`. Whereas
deletion (be it account or slot) will be signified by inclusion in `pre` and omission
in `post` list.

Signed-off-by: Delweng <delweng@gmail.com>
2022-10-05 19:05:43 -05:00
Delweng
85aafcfb2b
eth/tracers: fix a bug in prestateTracer (#25884) 2022-09-28 17:52:39 +02:00
Sina Mahmoodi
fc3e6d0162
eth/tracers: use gencodec for native tracers (#25637)
The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec.

OBS! 
This PR changes the call tracer result slightly:

-  Order of type and value fields are changed (should not matter). 
-  Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty.
2022-09-26 18:35:44 +02:00
Sina Mahmoodi
86de2e516e
eth/tracers: add onlyTopCall option to callTracer (#25430)
This PR allows users to pass in a config object directly to the tracers. Previously only the struct logger was configurable.

It also adds an option to the call tracer which if enabled makes it ignore any subcall and collect only information about the top-level call. See #25419 for discussion.

The tracers will silently ignore if they are passed a config they don't care about.
2022-08-09 11:04:57 +02:00
Sina Mahmoodi
9c82c646e4
eth/tracers: make txhash blockhash accessible to native tracers (#24679) 2022-04-12 21:09:27 +02:00
Sina Mahmoodi
3fd16af5a9
core,eth: implement tx-level hooks for tracers (#24510)
* core,eth: add empty tx logger hooks

* core,eth: add initial and remaining gas to tx hooks

* store tx gasLimit in js tracer

* use gasLimit to compute intrinsic cost for js tracer

* re-use rules in transitiondb

* rm logs

* rm logs

* Mv some fields from Start to TxStart

* simplify sender lookup in prestate tracer

* mv env to TxStart

* Revert "mv env to TxStart"

This reverts commit 656939634b9aff19f55a1cd167345faf8b1ec310.

* Revert "simplify sender lookup in prestate tracer"

This reverts commit ab65bce48007cab99e68232e7aac2fe008338d50.

* Revert "Mv some fields from Start to TxStart"

This reverts commit aa50d3d9b2559addc80df966111ef5fb5d0c1b6b.

* fix intrinsic gas for prestate tracer

* add comments

* refactor

* fix test case

* simplify consumedGas calc in prestate tracer
2022-03-31 11:51:44 +02:00
Sina Mahmoodi
c5436c8eb7
eth/tracers: clean-up tracer collection (#24320)
* eth/tracers: clean-up tracer collection

* Rm test for dropped tracer
2022-02-01 10:44:44 +01:00
Sina Mahmoodi
cac09a3823
eth/tracers: native prestate tracer (#24268)
* eth/tracers: add initial native prestate tracer

* fix balance hex

* handle prestate for tx from and to

* drop created contract from prestate

* fix sender balance

* use switch instead

Co-authored-by: Martin Holst Swende <martin@swende.se>

* minor fix

* lookup create2 account

* mv code around a bit

* check stackLen for create2

* fix transfer tx for js prestate tracer

* fix create2 addr

* track extcodehash in js prestate tracer

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-01-31 09:51:17 +01:00