Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core,eth: call frame tracing #23087

Merged
merged 48 commits into from Sep 17, 2021
Merged

core,eth: call frame tracing #23087

merged 48 commits into from Sep 17, 2021

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jun 22, 2021

Introduces 2 new optional methods enter() and exit() for js tracers which are invoked on stepping in and out a call frame. These methods are not invoked for depth 0. Currently these are the data fields passed to each of them:

  • enter: type (CALL*/CREATE*/SELFDESTRUCT), from, to, input, gas, value
  • exit: output, gasUsed, error

If these methods are not present in the JS script geth will default to only invoking step(). On the other hand, you have the option of only providing enter() and exit(), and not providing step() if call frames are the only thing you care about. This should yield a ~5x tracing speedup because it avoids the go-js barrier on every opcode.

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name callTracerLegacy. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements):

  • In the case where a CALL*/CREATE* fails without having executed any code, i.e. in the initial conditions like whether sender has enough balance, then no call frame will be recorded.
  • gas and gasUsed values are set to 0 instead of nil where they are unavailable. E.g. a simple transfer has a gasUsed of 0. A SELFDESTRUCT has both gas and gasUsed set to 0.
  • The new tracers returns more meaningful error messages in some failure scenarios where it previously returned internal failure

core/vm/logger.go Outdated Show resolved Hide resolved
@s1na s1na marked this pull request as ready for review July 28, 2021 16:09
core/vm/logger.go Outdated Show resolved Hide resolved
core/vm/gen_structframe.go Outdated Show resolved Hide resolved
core/vm/logger.go Outdated Show resolved Hide resolved
core/vm/logger.go Outdated Show resolved Hide resolved
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, it's in the right direction, but a few nitpicky comments

core/vm/evm.go Outdated Show resolved Hide resolved
core/vm/evm.go Outdated Show resolved Hide resolved
core/vm/evm.go Outdated
}
return ret, address, contract.Gas, err
}

// Create creates a new contract using code as deployment code.
func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) {
contractAddr = crypto.CreateAddress(caller.Address(), evm.StateDB.GetNonce(caller.Address()))
return evm.create(caller, &codeAndHash{code: code}, gas, value, contractAddr)
return evm.create(caller, &codeAndHash{code: code}, gas, value, contractAddr, CreateType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this also trigger for a regular create-transaction?

this.callstack[len-1].calls.push(call)
}
},
// finalize recreates a call object using the final desired field oder for json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// finalize recreates a call object using the final desired field oder for json
// finalize recreates a call object using the final desired field order for json

eth/tracers/internal/tracers/callframe_tracer.js Outdated Show resolved Hide resolved
eth/tracers/internal/tracers/callframe_tracer.js Outdated Show resolved Hide resolved
eth/tracers/tracer.go Show resolved Hide resolved
core/vm/evm.go Outdated Show resolved Hide resolved
@s1na
Copy link
Contributor Author

s1na commented Sep 15, 2021

All tests are passing now! I came across two points:

  • Another failure in innerCreateOogOuterThrow was deleting the to field when a CREATE fails, just like output. Probably not very useful to know the contract address if CREATE failed?
  • The new tracer sets the actual gas value for simple value transfer calls (simple testcase). Modified the test case with that value instead of nil

@holiman
Copy link
Contributor

holiman commented Sep 16, 2021

One remaining item (if we want to), rename "call_tracer.js" -> "call_tracer_legacy.js" and "callframe_tracer.js" -> "call_tracer.js". When a user asks to use callTracer, we un-camel it and look it up by filename.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, I could not meaningfully review the js and the test cases though

// about internal messages of a transaction.
{
callstack: [{}],
step: function(log, db) {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to declare this function here? Wouldn't this defeat the purpose of not having to call back into js for every step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof good catch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof! I need to rerun the benches now!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@s1na
Copy link
Contributor Author

s1na commented Sep 16, 2021

Turns out the speedup is much more, it's only that I had forgotten to remove step() from the new tracer (shout-out to @MariusVanDerWijden). It's somewhere between 10-100x for the different test cases!

BenchmarkTracers
BenchmarkTracers/create
BenchmarkTracers/create/legacy
BenchmarkTracers/create/legacy-8            1174           1010835 ns/op           58843 B/op       5229 allocs/op
BenchmarkTracers/create/scoped
BenchmarkTracers/create/scoped-8           37945             31758 ns/op            9128 B/op         99 allocs/op
BenchmarkTracers/deepCalls
BenchmarkTracers/deepCalls/legacy
BenchmarkTracers/deepCalls/legacy-8                   21          52189729 ns/op         2064998 B/op     206257 allocs/op                                                                                                   [5/1358]
BenchmarkTracers/deepCalls/scoped
BenchmarkTracers/deepCalls/scoped-8                  334           3537279 ns/op          115655 B/op       6792 allocs/op
BenchmarkTracers/delegatecall
BenchmarkTracers/delegatecall/legacy
BenchmarkTracers/delegatecall/legacy-8               248           4862125 ns/op          212474 B/op      21103 allocs/op
BenchmarkTracers/delegatecall/scoped
BenchmarkTracers/delegatecall/scoped-8              4270            267605 ns/op           12301 B/op        531 allocs/op
BenchmarkTracers/innerCreateOogOuterThrow
BenchmarkTracers/innerCreateOogOuterThrow/legacy
BenchmarkTracers/innerCreateOogOuterThrow/legacy-8                   364           3233180 ns/op          258185 B/op      16176 allocs/op
BenchmarkTracers/innerCreateOogOuterThrow/scoped
BenchmarkTracers/innerCreateOogOuterThrow/scoped-8                  5018            230887 ns/op          112886 B/op        323 allocs/op
BenchmarkTracers/innerInstafail
BenchmarkTracers/innerInstafail/legacy
BenchmarkTracers/innerInstafail/legacy-8                            1108           1097553 ns/op           36529 B/op       3391 allocs/op
BenchmarkTracers/innerInstafail/scoped
BenchmarkTracers/innerInstafail/scoped-8                          117331             10362 ns/op            3514 B/op         70 allocs/op
BenchmarkTracers/innerThrowOuterRevert
BenchmarkTracers/innerThrowOuterRevert/legacy
BenchmarkTracers/innerThrowOuterRevert/legacy-8                      255           5026361 ns/op          242554 B/op      24391 allocs/op
BenchmarkTracers/innerThrowOuterRevert/scoped
BenchmarkTracers/innerThrowOuterRevert/scoped-8                     7177            154187 ns/op            8677 B/op        298 allocs/op
BenchmarkTracers/oog
BenchmarkTracers/oog/legacy
BenchmarkTracers/oog/legacy-8                                        578           2168466 ns/op          118428 B/op      11868 allocs/op
BenchmarkTracers/oog/scoped
BenchmarkTracers/oog/scoped-8                                      53901             21858 ns/op            4162 B/op         65 allocs/op
BenchmarkTracers/revert
BenchmarkTracers/revert/legacy
BenchmarkTracers/revert/legacy-8                                    2833            394787 ns/op           22595 B/op       2096 allocs/op
BenchmarkTracers/revert/scoped
BenchmarkTracers/revert/scoped-8                                  103143             11486 ns/op            3017 B/op         74 allocs/op
BenchmarkTracers/revertReason
BenchmarkTracers/revertReason/legacy
BenchmarkTracers/revertReason/legacy-8                               841           1416410 ns/op           73777 B/op       7219 allocs/op
BenchmarkTracers/revertReason/scoped
BenchmarkTracers/revertReason/scoped-8                             68222             17631 ns/op            4668 B/op         80 allocs/op
BenchmarkTracers/selfdestruct
BenchmarkTracers/selfdestruct/legacy
BenchmarkTracers/selfdestruct/legacy-8                              5091            227798 ns/op            7308 B/op        327 allocs/op
BenchmarkTracers/selfdestruct/scoped
BenchmarkTracers/selfdestruct/scoped-8                              4786            230334 ns/op            7389 B/op        316 allocs/op
BenchmarkTracers/simple
BenchmarkTracers/simple/legacy
BenchmarkTracers/simple/legacy-8                                     460           2666243 ns/op          121019 B/op      12013 allocs/op
BenchmarkTracers/simple/scoped
BenchmarkTracers/simple/scoped-8                                    4977            229212 ns/op            7343 B/op        313 allocs/op
BenchmarkTracers/throw
BenchmarkTracers/throw/legacy
BenchmarkTracers/throw/legacy-8                                      967           1074886 ns/op           62711 B/op       6133 allocs/op
BenchmarkTracers/throw/scoped
BenchmarkTracers/throw/scoped-8                                    66048             18003 ns/op            4023 B/op         70 allocs/op

@holiman
Copy link
Contributor

holiman commented Sep 16, 2021

BenchmarkTracers/create/legacy-6  	     788	   1593809 ns/op	   58684 B/op	    5229 allocs/op
BenchmarkTracers/create/scoped-6  	   36002	     31989 ns/op	    8974 B/op	      99 allocs/op
BenchmarkTracers/deepCalls/legacy-6         	      15	  68880873 ns/op	 2063596 B/op	  206261 allocs/op
BenchmarkTracers/deepCalls/scoped-6         	     308	   4014269 ns/op	  113494 B/op	    6791 allocs/op
BenchmarkTracers/delegatecall/legacy-6      	     180	   6757309 ns/op	  212290 B/op	   21103 allocs/op
BenchmarkTracers/delegatecall/scoped-6      	    4032	    288492 ns/op	   12065 B/op	     531 allocs/op
BenchmarkTracers/innerCreateOogOuterThrow/legacy-6         	     249	   4902136 ns/op	  257954 B/op	   16176 allocs/op
BenchmarkTracers/innerCreateOogOuterThrow/scoped-6         	    3871	    269911 ns/op	  112664 B/op	     323 allocs/op
BenchmarkTracers/innerInstafail/legacy-6                   	     865	   1366777 ns/op	   36374 B/op	    3391 allocs/op
BenchmarkTracers/innerInstafail/scoped-6                   	   99012	     11082 ns/op	    3417 B/op	      70 allocs/op
BenchmarkTracers/innerThrowOuterRevert/legacy-6            	     166	   7484393 ns/op	  242428 B/op	   24391 allocs/op
BenchmarkTracers/innerThrowOuterRevert/scoped-6            	    6490	    182581 ns/op	    8515 B/op	     298 allocs/op
BenchmarkTracers/oog/legacy-6                              	     356	   3301769 ns/op	  118341 B/op	   11868 allocs/op
BenchmarkTracers/oog/scoped-6                              	   51141	     22268 ns/op	    4073 B/op	      65 allocs/op
BenchmarkTracers/revert/legacy-6                           	    1993	    582907 ns/op	   22509 B/op	    2096 allocs/op
BenchmarkTracers/revert/scoped-6                           	   81780	     13406 ns/op	    2929 B/op	      74 allocs/op
BenchmarkTracers/revertReason/legacy-6                     	     535	   2084429 ns/op	   73681 B/op	    7219 allocs/op
BenchmarkTracers/revertReason/scoped-6                     	   58149	     20394 ns/op	    4577 B/op	      80 allocs/op
BenchmarkTracers/selfdestruct/legacy-6                     	    4898	    248314 ns/op	    7124 B/op	     327 allocs/op
BenchmarkTracers/selfdestruct/scoped-6                     	    4429	    246427 ns/op	    7164 B/op	     316 allocs/op
BenchmarkTracers/simple/legacy-6                           	     314	   3738355 ns/op	  120885 B/op	   12013 allocs/op
BenchmarkTracers/simple/scoped-6                           	    4549	    253089 ns/op	    7181 B/op	     313 allocs/op
BenchmarkTracers/throw/legacy-6                            	     622	   1995229 ns/op	   62629 B/op	    6133 allocs/op
BenchmarkTracers/throw/scoped-6                            	   55233	     21915 ns/op	    3936 B/op	      70 allocs/op

@holiman
Copy link
Contributor

holiman commented Sep 16, 2021

name                                old time/op    new time/op    delta
Tracers/create-6                      1.49ms ± 5%    0.03ms ± 0%  -97.88%  (p=0.008 n=5+5)
Tracers/deepCalls-6                   71.1ms ± 8%     3.7ms ± 3%  -94.75%  (p=0.008 n=5+5)
Tracers/delegatecall-6                6.59ms ± 1%    0.28ms ± 3%  -95.69%  (p=0.008 n=5+5)
Tracers/innerCreateOogOuterThrow-6    4.72ms ± 4%    0.26ms ± 0%  -94.50%  (p=0.008 n=5+5)
Tracers/innerInstafail-6              1.45ms ± 5%    0.01ms ± 7%  -99.21%  (p=0.008 n=5+5)
Tracers/innerThrowOuterRevert-6       7.70ms ± 1%    0.19ms ± 1%  -97.50%  (p=0.008 n=5+5)
Tracers/oog-6                         3.61ms ± 6%    0.02ms ± 5%  -99.33%  (p=0.008 n=5+5)
Tracers/revert-6                       636µs ± 2%      14µs ± 3%  -97.76%  (p=0.008 n=5+5)
Tracers/revertReason-6                2.16ms ± 1%    0.02ms ± 0%  -99.00%  (p=0.008 n=5+5)
Tracers/selfdestruct-6                 255µs ± 4%     269µs ± 5%   +5.36%  (p=0.032 n=5+5)
Tracers/simple-6                      4.07ms ± 3%    0.27ms ± 6%  -93.43%  (p=0.008 n=5+5)
Tracers/throw-6                       1.86ms ± 2%    0.02ms ± 8%  -98.83%  (p=0.008 n=5+5)

name                                old alloc/op   new alloc/op   delta
Tracers/create-6                      58.7kB ± 0%     9.0kB ± 0%  -84.71%  (p=0.008 n=5+5)
Tracers/deepCalls-6                   2.06MB ± 0%    0.11MB ± 0%  -94.50%  (p=0.008 n=5+5)
Tracers/delegatecall-6                 212kB ± 0%      12kB ± 0%  -94.32%  (p=0.008 n=5+5)
Tracers/innerCreateOogOuterThrow-6     258kB ± 0%     113kB ± 0%  -56.32%  (p=0.008 n=5+5)
Tracers/innerInstafail-6              36.4kB ± 0%     3.4kB ± 0%  -90.61%  (p=0.008 n=5+5)
Tracers/innerThrowOuterRevert-6        242kB ± 0%       9kB ± 0%  -96.49%  (p=0.008 n=5+5)
Tracers/oog-6                          118kB ± 0%       4kB ± 0%  -96.56%  (p=0.008 n=5+5)
Tracers/revert-6                      22.5kB ± 0%     2.9kB ± 0%  -86.99%  (p=0.008 n=5+5)
Tracers/revertReason-6                73.7kB ± 0%     4.6kB ± 0%  -93.79%  (p=0.016 n=5+4)
Tracers/selfdestruct-6                7.12kB ± 0%    7.16kB ± 0%   +0.57%  (p=0.016 n=4+5)
Tracers/simple-6                       121kB ± 0%       7kB ± 0%  -94.06%  (p=0.008 n=5+5)
Tracers/throw-6                       62.6kB ± 0%     3.9kB ± 0%  -93.72%  (p=0.016 n=5+4)

name                                old allocs/op  new allocs/op  delta
Tracers/create-6                       5.23k ± 0%     0.10k ± 0%  -98.11%  (p=0.008 n=5+5)
Tracers/deepCalls-6                     206k ± 0%        7k ± 0%     ~     (p=0.079 n=4+5)
Tracers/delegatecall-6                 21.1k ± 0%      0.5k ± 0%  -97.48%  (p=0.008 n=5+5)
Tracers/innerCreateOogOuterThrow-6     16.2k ± 0%      0.3k ± 0%  -98.00%  (p=0.008 n=5+5)
Tracers/innerInstafail-6               3.39k ± 0%     0.07k ± 0%  -97.94%  (p=0.008 n=5+5)
Tracers/innerThrowOuterRevert-6        24.4k ± 0%      0.3k ± 0%  -98.78%  (p=0.008 n=5+5)
Tracers/oog-6                          11.9k ± 0%      0.1k ± 0%  -99.45%  (p=0.008 n=5+5)
Tracers/revert-6                       2.10k ± 0%     0.07k ± 0%  -96.47%  (p=0.008 n=5+5)
Tracers/revertReason-6                 7.22k ± 0%     0.08k ± 0%  -98.89%  (p=0.008 n=5+5)
Tracers/selfdestruct-6                   327 ± 0%       316 ± 0%   -3.36%  (p=0.008 n=5+5)
Tracers/simple-6                       12.0k ± 0%      0.3k ± 0%  -97.39%  (p=0.008 n=5+5)
Tracers/throw-6                        6.13k ± 0%     0.07k ± 0%  -98.86%  (p=0.008 n=5+5)

@holiman holiman merged commit 4013549 into ethereum:master Sep 17, 2021
@holiman holiman added this to the 1.10.9 milestone Sep 17, 2021
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Jan 31, 2022
* eth/tracers: implement debug.intermediateRoots (ethereum#23594)

This PR implements a new debug method, which I've talked briefly about to some other client developers. It allows the caller to obtain the intermediate state roots for a block (which might be either a canon block or a 'bad' block).
Signed-off-by: wenbiao <delweng@gmail.com>

* core, rpc: disable memory output by default in traces (ethereum#23558)

* core: cmd: invert disableMemory

* core: fix missed inversion

* cmd/evm: preserve Flags but change default value

* Apply suggestions from code review

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

Co-authored-by: Martin Holst Swende <martin@swende.se>
Signed-off-by: wenbiao <delweng@gmail.com>

* eth/tracers: abort evm execution when trace is aborted (ethereum#23580)

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

* eth/tracers: avoid unsyncronized mutations on trie database (ethereum#23632)

This PR fixes an issue in traceChain, where the statedb Commit operation was performed asynchronously with dereference-operations agains the underlying trie.Database instance. Due to how the reference counting works within the trie database (where parent count is recursively updated when new parents are added), doing dereferencing in the middle of Commit can cause the refcount to become wrong, leading to an inconsistent state. 

This was fixed by doing Commit/Deref from the same routine.  
Signed-off-by: wenbiao <delweng@gmail.com>

* core,eth: call frame tracing (ethereum#23087)

This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:

    enter: type (opcode), from, to, input, gas, value
    exit: output, gasUsed, error

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.

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

* eth/tracers: re-write of 4byte tracer using enter/exit (ethereum#23622)

* eth/tracers: add re-write of 4byte tracer using enter/exit

* eth/tracers: fix 4byte indent
Signed-off-by: wenbiao <delweng@gmail.com>

* eth/tracers: tx.BaseFee not implemented

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

* eth/tracers: do the JSON serialization via .js to capture C faults

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

* eth/tracers: fix callTracer fault handling (ethereum#23667)

* eth/tracers: fix calltracer fault handling

* eth/tracers: fix calltracer indentation
Signed-off-by: wenbiao <delweng@gmail.com>

* eth/tracers: invoke enter/exit on 0-value calls to inex accounts (ethereum#23828)

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

* eth: make traceChain avoid OOM on long-running tracing (ethereum#23736)

This PR changes long-running chain tracing, so that it at some points releases the memory trie db, and switch over to a fresh disk-backed trie.
Signed-off-by: wenbiao <delweng@gmail.com>

* eth/tracers: expose contextual infos (block hash, tx hash, tx index)

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: redefine Context

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: support for golang tracers + add golang callTracer (ethereum#23708)

* eth/tracers: add basic native loader

* eth/tracers: add GetResult to tracer interface

* eth/tracers: add native call tracer

* eth/tracers: fix call tracer json result

* eth/tracers: minor fix

* eth/tracers: fix

* eth/tracers: fix benchTracer

* eth/tracers: test native call tracer

* eth/tracers: fix

* eth/tracers: rm extra make

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

* eth/tracers: rm extra make

* eth/tracers: make callFrame private

* eth/tracers: clean-up and comments

* eth/tracers: add license

* eth/tracers: rework the model a bit

* eth/tracers: move tracecall tests to subpackage

* cmd/geth: load native tracers

* eth/tracers: minor fix

* eth/tracers: impl stop

* eth/tracers: add native noop tracer

* renamings

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

* eth/tracers: more renamings

* eth/tracers: make jstracer non-exported, avoid cast

* eth/tracers, core/vm: rename vm.Tracer to vm.EVMLogger for clarity

* eth/tracers: minor comment fix

* eth/tracers/testing: lint nitpicks

* core,eth: cancel evm on nativecalltracer stop

* Revert "core,eth: cancel evm on nativecalltracer stop"

This reverts commit 01bb908.

* eth/tracers: linter nits

* eth/tracers: fix output on err

Co-authored-by: Martin Holst Swende <martin@swende.se>
Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: make native calltracer default (ethereum#23867)

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: package restructuring (ethereum#23857)

* eth/tracers: restructure tracer package

* core/vm/runtime: load js tracers

* eth/tracers: mv bigint js code to own file

* eth/tracers: add method docs for native tracers

* eth/tracers: minor doc fix

* core,eth: cancel evm on nativecalltracer stop

* core/vm: fix failing test

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: ethapi.TransactionArgs was not merged

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: fix the api_test with ErrInsufficientFunds to ErrInsufficientFundsForTransfer

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: check posa before statedb.Prepare in IntermiateRoots api

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: make js calltracer default, compatible with old version

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: fix the default callTrace name of callTracerJs

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* Revert "eth/tracers: fix the default callTrace name of callTracerJs"

This reverts commit 62a3bc215d9f07e422a4c659289bb3ba4f9ed2fa.

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* Revert "eth/tracers: make js calltracer default, compatible with old version"

This reverts commit 85ef42c0ea651f0b228d4209b1b2598b24e12f1f.

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

* eth/tracers: fix the variable race condition

Signed-off-by: wenbiao <wenbiao.zheng@ambergroup.io>

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
uprendis pushed a commit to uprendis/go-ethereum that referenced this pull request Feb 15, 2022
This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:

    enter: type (opcode), from, to, input, gas, value
    exit: output, gasUsed, error

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.
uprendis added a commit to Fantom-foundation/go-ethereum that referenced this pull request Mar 4, 2022
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this pull request Dec 3, 2022
This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:

    enter: type (opcode), from, to, input, gas, value
    exit: output, gasUsed, error

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.
@sjnam sjnam mentioned this pull request Oct 12, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants