-
Notifications
You must be signed in to change notification settings - Fork 441
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
Feature/javascript tracers #6217
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hook-up IWorldTracer. Fix result json serialization
…to JavascriptTracerImplementation
Demuirgos
reviewed
Nov 28, 2023
src/Nethermind/Nethermind.Evm/Tracing/GethStyle/Javascript/Engine.cs
Outdated
Show resolved
Hide resolved
Marchhill
reviewed
Nov 28, 2023
src/Nethermind/Nethermind.Evm/Tracing/GethStyle/Javascript/Engine.cs
Outdated
Show resolved
Hide resolved
Marchhill
reviewed
Nov 28, 2023
src/Nethermind/Nethermind.Evm.Test/Tracing/GethLikeJavaScriptTracerTests.cs
Show resolved
Hide resolved
Marchhill
reviewed
Nov 28, 2023
I've only tested javascript tracers, I will run my script on some old tracers to test them out |
rubo
approved these changes
Nov 28, 2023
… feature/javascript_tracers
Demuirgos
reviewed
Nov 28, 2023
LukaszRozmej
requested review from
emlautarom1,
eliashezron,
Demuirgos and
Marchhill
November 29, 2023 10:00
Demuirgos
approved these changes
Nov 29, 2023
eliashezron
approved these changes
Nov 29, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems good to me
gr8h
pushed a commit
to fuseio/nethermind-client
that referenced
this pull request
Dec 12, 2023
* review * changes * writing tests * Import proper packages for all platforms * Refactoring * Add built-in tracers * Hook-up (with incorrect serialization for now!) javascript tracer to JSON RPC * included more tests * testing builtings * Fix loading built-in tracers from files. Hook-up IWorldTracer. Fix result json serialization * merge feature/jstracer * Writing tests. * builtIns-implementation * More conversions * ready for debug 4byteTracer, Evmdis Tracer, PrestateTrace and Call tracer * fix test submodule * fixes * changes to peek() * fix test * further changes * more changes * fix getValue in GethJavascriptStyleLog * More fixes * fix null * partial address and stack refactoring * Improve stack access, fix ctx.to for contracts * move to TraceMemory * fix BigInteger by using latest js code * more improvements * more changes to make it inline with spec * fix Ethereum Tests * fix merge * Changes and bugfixes * Make stack, memory and contract not nullable * Move BigIntegerJS to own class * Properly hook up Enter & Exit * Refactors * simplify conversions * Move to type arrays * Move to MemoryTrace for simplicity * Call fault on actual errors. Don't call exit for main frame. Geth logic is weird for faults, we decided to ignore it and always CaptureState on begining with empty error and capture error on end if error occurred. Geth logic:�StackOverflow -> CaptureState with error! static OutOfGas -> CaptureState with error! if (dynamicGas) { if memory overflow -> CaptureState with error! else actualy capture state! } else actually capture state! do operation if error Capture Fault * Fix context and lazy parameters * fix memory slice * Make GethLikeTxTrace disposable * fix NullReferenceException * Refactor Engine.cs * Fix db.exist param * Move to V8Runtime * Bunch of fixes * fix slice * fix BigInteger marshaling * Add postStep function * more tests * fix gasPrice and gas * Make error in frameresult undefined if needed * Force serialization of numerals to raw * clear refund before invoking step * Populate context more in BlockTracer based on transaction * fix FrameResult.GasUsed * fixes * fix gasCost * Remove undefined errors * fix contracts * Fix wrong values cached in CallFrame & FrameResult * fix refund as accumulator * fix tests * ignore value in STATICCALL * Allow to access storage slots by hash * fix contract stack * exclude "Data" folder * fix delegate call * fix clearing state array * review fixes * fix * StorageCell optimizations * Handle depth for create transactions * fix DELEGATECALL again * fix * Allign errors more with geth * fix contract address for DELEGATECALL and STATICCALL * Remove traces from test results * fix ToContract2 * fix static call * cosmetic cleanup noticced during review * Fix revert gas and output * rename Javascript -> JavaScript * Change license headers on tracer and link to go-ethereum * Add comments * Temporary rename * Rename `Javascript` to `JavaScript` * Replace .js files with originals * Moving BigIntegerJavaScript to seperate file * Refactor and include .js files in the publishing --------- Co-authored-by: eliashezron <eliashezron23@gmail.com> Co-authored-by: MarekM25 <marekm2504@gmail.com> Co-authored-by: Ruben Buniatyan <rubo@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
TODO:
result
methodstep
methodstep
optionalityfault
methodenter
andexit
methodsframe
parameterresult
parameterdb
parameterlog
parameterstack
parameter in optimized waymemory
parametercontract
parameterctx
parameterblockhash
error
?toWord
functiontoHex
functiontoAddress
functionisPrecompiled
functionslice
functiontoContract
functiontoContract2
functionpostStep
function to tracergasCost
andrefund
before we execute the op-code. To not re-architecture the whole EVM for now we are addingpostStep
function to tracer where those values are available.We currently will not reproduce it, but go with simple:
That means that our
step
will never haveerror
set to true but we will invokefault
if it errors. Lets try that for now and see how it works, in my opinion it shouldn't produce issues as users have to use defensive programming in step due to weird geth behavior.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
https://github.com/Marchhill/jsTracerTest/tree/main
Documentation
Requires documentation update
If yes, link the PR to the docs update or the issue with the details labeled
docs
. Remove if not applicable.Requires explanation in Release Notes
If yes, fill in the details here. Remove if not applicable.
Remarks
This PR will possibly replace #6093
Link to API: https://geth.ethereum.org/docs/developers/evm-tracing/custom-tracer