Commit graph

13484 commits

Author SHA1 Message Date
Daniel Liu
06f50c7226
eth/tracers: fix gasUsed for native and JS tracers #26048 (#1305)
* eth/tracers: fix gasUsed in call tracer

* fix js tracers gasUsed

* fix legacy prestate tracer

* fix restGas in test

* drop intrinsicGas field from js tracers

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-09-09 07:57:17 +08:00
Daniel Liu
25caabb77a
eth/tracers: simplify test framework #25973 (#1304)
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-09-09 07:46:56 +08:00
Daniel Liu
ebba3c13b4
eth/tracers: fix the issue prestate missing existing contract state #25996 (#1303)
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: Delweng <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-09-09 07:27:07 +08:00
Daniel Liu
b0937bc62f
eth/tracers: fix the issue of panic in prestate with diffmode #25957 (#1302)
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.

Co-authored-by: Delweng <delweng@gmail.com>
2025-09-09 07:19:43 +08:00
Daniel Liu
c51f227944
eth/tracers: improve flaky tests #25918 (#1301) 2025-09-09 07:10:44 +08:00
Daniel Liu
51f4757eed
eth/traces: add state limit #25812 (#1300)
This PR introduces a new mechanism in chain tracer for preventing creating too many trace states.

The workflow of chain tracer can be divided into several parts:

- state creator generates trace state in a thread
- state tracer retrieves the trace state and applies the tracing on top in another thread
- state collector gathers all result from state tracer and stream to users

It's basically a producer-consumer model here, while if we imagine that the state producer generates states too fast, then it will lead to accumulate lots of unused states in memory. Even worse, in path-based state scheme it will only keep the latest 128 states in memory, and the newly generated state will invalidate the oldest one by marking it as stale.

The solution for fixing it is to limit the speed of state generation. If there are over 128 states un-consumed in memory, then the creation will be paused until the states are be consumed properly.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-09 07:03:24 +08:00
Daniel Liu
0988b4b9fd
eth/tracers: add diffMode to prestateTracer #25422 (#1299)
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>
Co-authored-by: Delweng <delweng@gmail.com>
2025-09-09 06:56:34 +08:00
Daniel Liu
9d8bec712d
eth/tracers: remove revertReasonTracer, add revert reason to callTracer #25508 (#1298)
* eth/tracers: add revertReason to callTracer

* update callframe gen json

* add revertal to calltrace test

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-09-09 06:43:32 +08:00
Daniel Liu
d962a06975
eth/tracers: fix a bug in prestateTracer #25884 (#1297)
Co-authored-by: Delweng <delweng@gmail.com>
2025-09-09 06:41:52 +08:00
Daniel Liu
de4fa1d674
eth/tracers: use gencodec for native tracers #25637 (#1296)
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.

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-09-09 06:40:01 +08:00
Daniel Liu
b72c76eb30
eth/tracers: pad memory slice on OOB case #25213 (#1295)
* eth/tracers: pad memory slice on oob case

* eth/tracers/js: fix testfailure due to err msg capitalization

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-09-09 06:38:10 +08:00
Daniel Liu
98be4bb911
eth: rework chain tracer #25143 #25715 #29162 (#1294) 2025-09-09 00:06:07 +08:00
Daniel Liu
3b80bd0347
eth/tracers/js: improve integer types in log object #25668 (#1293)
All fields related to gas must be represented as uint64. Depth is
internally tracked as int, so it makes sense to also store it as int.

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-08 23:42:04 +08:00
Daniel Liu
a935810d4c
eth/tracers/js: fill in refund field #25661 (#1292) 2025-09-08 23:40:07 +08:00
Daniel Liu
67efb14ff3
eth/tracers: add onlyTopCall option to callTracer #25430 (#1291) 2025-09-08 23:38:19 +08:00
Daniel Liu
bfc00e775b
eth/tracers: add initial revertReasonTracer tracer #25265 (#1289)
Adds a native tracer that returns that in case of failure returns the error message or the revert reason of a transaction.

Co-authored-by: Philip Fan <fanwengang@hotmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-09-08 23:36:28 +08:00
wit765
a943fcee3c
internal/ethapi: fix time type (#1455)
Co-authored-by: wit <wit765765346@gmail>
2025-09-08 23:30:09 +08:00
Daniel Liu
241ad1d635
eth/tracers: optimize goja buffer conversion #25156 (#1287)
This changes the []byte <-> Uint8Array conversion to use an
ArrayBuffer, avoiding inefficient copying of the slice data in Goja.

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-08 21:24:58 +08:00
Daniel Liu
900b333241
eth/tracers: add support for block overrides in debug_traceCall #24871 (#1288) 2025-09-08 21:22:09 +08:00
Daniel Liu
1b561493fb
eth/tracers: fix typo and linter #25020 #24783 #25551 (#1286) 2025-09-08 21:15:42 +08:00
Daniel Liu
88d703180c
eth/tracers/js: drop duktape engine #24934 (#1283) 2025-09-08 21:11:27 +08:00
Daniel Liu
b27c8d23b2
eth/tracers/js: add memory.length method #24887 (#1284) 2025-09-08 21:08:16 +08:00
Daniel Liu
5226fa2cbf
eth/tracers/js: goja tracer #23773 (#1282) 2025-09-08 20:59:29 +08:00
Daniel Liu
ba2d72e8d8
eth/tracers: migrate go-bindata to embed #24744 (#1279) 2025-09-08 20:57:23 +08:00
Daniel Liu
44bd05a732
eth/tracers: refactor traceTx to separate out struct logging #24326 (#1278)
* eth/tracers: refactor traceTx to separate out struct logging

review fix

Update eth/tracers/api.go

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

Mv ExecutionResult type to logger package

review fix

impl GetResult for StructLogger

make formatLogs private

confused exit and end..

account for intrinsicGas in structlogger, fix TraceCall test

Add Stop method to logger

Simplify traceTx

Fix test

rm logger from blockchain test

account for refund in structLogger

* use tx hooks in struct logger

* minor

* avoid executionResult in struct logger

* revert blockchain test changes

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-09-08 20:55:06 +08:00
Daniel Liu
0bc25c35b4
core,eth: implement tx-level hooks for tracers #24510 (#1277)
* 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

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-09-08 17:53:21 +08:00
Daniel Liu
001bc5a4d8
eth/tracers/logger: use omitempty to reduce log bloat #24547 (#1276) 2025-09-08 17:50:58 +08:00
Daniel Liu
8712fec2b5
eth/tracers: use hex encoding for debug_traceBlock argument #24517 (#1275)
Co-authored-by: Guifel <toowik@gmail.com>
2025-09-08 17:49:26 +08:00
Daniel Liu
4f738d2191
eth/tracers: clean-up tracer collection #24320 (#1274) 2025-09-08 17:47:33 +08:00
Daniel Liu
0c293e5c34
eth/tracers: native prestate tracer #24268 (#1273) 2025-09-08 17:45:28 +08:00
Daniel Liu
060642e619
eth/tracers/js: add support for REVERT/SELFDESTRUCT in evmdis_tracer #24016 (#1271)
* eth/tracers: Add support for REVERT in evmdis_tracer

* evm/tracers: Fix evmdis_tracer to use SELFDESTRUCT instead of SUICIDE

* eth/tracers: Regenerate tracer library

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
2025-09-08 17:28:59 +08:00
Daniel Liu
5d64f3b32f
eth/tracers: avoid using blockCtx concurrently #24286 (#1272) 2025-09-08 17:28:18 +08:00
Daniel Liu
95d06d0f15
eth/tracers: capture fault states in logger #23970 (#1270) 2025-09-08 17:27:13 +08:00
Daniel Liu
58184f0212
ethstats: fix full node interface post 1559 #23159 (#1451) 2025-09-08 15:41:16 +08:00
Daniel Liu
84e19a7b7f
ethstats: set readlimit on ethstats server connection #26207 (#1450)
This prevents DoS when connected to a malicious ethstats server.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-09-08 15:40:41 +08:00
Daniel Liu
1bd4eaab88
ethstats: fix function comments #25726 (#1449) 2025-09-08 15:40:07 +08:00
Daniel Liu
bf6011fc06
ethstats: fix typo in comment #22952 (#1447)
Trivial but helpful to understanding.

Co-authored-by: Mike Burr <mburr@nightmare.com>
2025-09-08 15:39:30 +08:00
Daniel Liu
c1e02cb232
ethstats: fix URL parser for '@' or ':' in node name/password #21640 (#1446)
Fixes the case (example below) where the value passed
to --ethstats flag would be parsed wrongly because the
node name and/or password value contained the special
characters '@' or ':'

    --ethstats "ETC Labs Metrics @meowsbits":mypass@ws://mordor.dash.fault.dev:3000

Co-authored-by: meowsbits <b5c6@protonmail.com>
2025-09-08 15:38:54 +08:00
Daniel Liu
24a1f37892
ethstats: avoid creating subscriptions on background goroutine #22587 (#1445) 2025-09-08 15:38:18 +08:00
Daniel Liu
3d59a3930f
ethstats: use timer instead of time.Sleep #20924 #21404 (#1442)
* ethstats: use timer instead of time.Sleep #20924

* ethstats: avoid concurrent write on websocket, fixes #21403 #21404
2025-09-08 15:37:36 +08:00
Daniel Liu
343cd1021a
accounts/abi: precompile regex #32301 (#1427)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-08 15:36:33 +08:00
Daniel Liu
4fd1e0b04d
accounts/abi/abigen: fix a flaky bind test case NewSingleStructArgument #31501 (#1418)
Co-authored-by: Delweng <delweng@gmail.com>
2025-09-08 15:34:39 +08:00
Daniel Liu
8e8a04d9ce
accounts/abi: include access-list in gas estimation #31394 (#1417)
Simple bugfix to include the access-list in the gas-estimation step of
the ABI bindings code.

Co-authored-by: protolambda <proto@protolambda.com>
2025-09-08 15:33:31 +08:00
wit765
81f84b79ce
ethclient/gethclient: remove unused function GetProof (#1448)
Co-authored-by: Wit Liu <wit765765346@gmail>
2025-09-08 14:39:41 +08:00
Daniel Liu
0a1bcdcbff
ethstats: avoid blocking chan when received invalid stats request #21073 (#1441)
* ethstats: avoid blocking chan when received invalid stats request

* ethstats: minor code polishes

Co-authored-by: Hao Duan <duanhao0814@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2025-09-06 17:18:22 +08:00
Daniel Liu
65c7f4418f
ethstats: stop report ticker in each loop cycle #21071 (#1440)
Co-authored-by: Hao Duan <duanhao0814@gmail.com>
2025-09-06 17:17:40 +08:00
Daniel Liu
3032fb1fca
ethstats: fix comment typo #17102 (#1439) 2025-09-06 17:17:03 +08:00
Daniel Liu
04f6f697c9
ethstats: fix golint warning #16837 (#1438) 2025-09-06 17:16:29 +08:00
Daniel Liu
f852b21b44
ethstats: add missing Ticker.Stop call #20867 (#1437) 2025-09-06 17:15:52 +08:00
Daniel Liu
c7f17cb300
crypto/bn256: refactor to use bitutil.TestBytes #32435 (#1436)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-06 17:15:07 +08:00