-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fancy tracer mhs #8
Conversation
@@ -354,6 +354,10 @@ func (jst *JavascriptTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, | |||
jst.log["depth"] = depth | |||
jst.log["account"] = contract.Address() | |||
|
|||
//A bit of a hack - should be placed in CaptureStart/CaptureEnd, but there's no evm in those methods | |||
jst.ctx["blocknumber"] = env.BlockNumber.Uint64() | |||
jst.ctx["gasLimit"] = env.GasLimit |
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.
A nicer approach imho would be to add this once to ctx. I.e. place something like this at the top of this function:
if pc == 0 {
jst.ctx["block"] = env.BlockNumber.Uint64()
}
Also please note, the gasLimit
is already part of the context and it's called gas
.
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.
If pc
can be 0
multiple times (unsure how subcalls work with regard to pc
), we can add an inited bool
field to jst
which will be set to true
when entering this method for the first time so we only set the block number once.
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.
Hmm... though, I did mean block gas limit, but transaction gas limit works aswell in my particular usecase.
Yes, pc
can be 0
multiple times
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.
(even without subcalls, since the first opcode can be jumpdest)
e7a333f
to
d2934ef
Compare
I've cherry picked these commits to fix some minor things. |
* added tests for new abi encoding features (#4) * added tests from bytes32[][] and string[] * added offset to other types * formatting * Abi/dynamic types (#5) * Revert "Abi/dynamic types (#5)" (#6) This reverts commit dabca31. * Abi/dynamic types (#7) * some cleanup * Apply suggestions from code review apply suggestions Co-Authored-By: vedhavyas <vedhavyas.singareddi@gmail.com> * added better formatting (#8) * review chnages * better comments
Adds blocknumber, gaslimit to
ctx
, addsdb
to result, and implements three tracers: