-
Notifications
You must be signed in to change notification settings - Fork 3
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
Possibility to print initial state and final state #2
Comments
Hi, I see in your previous issue you mentioned more examples, actually all my use cases were about predicting nft, tracing the sha3 parameters, they are all the same, I guess your use case is a bit different. In most cases, the balance is not used in sha3, so it's not handled at all, see: Line 881 in 5a4f5d3
But maybe add some lines to make it work (not tested): func opCall(ctx *Context) error {
stack := ctx.Stack()
gas, addr, value, inOffset, inSize, retOffset, retSize :=
stack.Pop(), stack.Pop(), stack.Pop(), stack.Pop(), stack.Pop(), stack.Pop(), stack.Pop()
// when input is empty, it's transfer: `addr.call{value:xxx}("")`
if inSize.IsZero() {
fromAddr := ctx.Call().This
toAddr := common.Address(addr.Bytes20())
fromBalance := ctx.Contracts[fromAddr].Balance
toBalance := ctx.Contracts[toAddr].Balance
fromBalance.Sub(fromBalance, value.ToBig())
toBalance.Sub(toBalance, value.ToBig())
// just assume it succeeded
stack.Push(*uint256.NewInt(1))
return nil
}
return do_opcall(ctx,
gas, addr, value, inOffset, inSize, retOffset, retSize)
} And modify Line 448 in 5a4f5d3
func opBalance(ctx *Context) error {
slot := ctx.Stack().Peek()
address := common.Address(slot.Bytes20())
bal, e := ensure_balance(ctx, address)
if e != nil {
return e
}
slot.SetFromBig(bal)
return nil
} About printing, there is command |
my use case is the following: Im tracing a contract call, specifically Im after the call trace, my problem is that the trace call results are different than the result you get after the transaction is mined, so I want to figure out why is that |
@aj3423 thank you for tips! I actually need selfbalance which I see is already implemented correct? I only have to edit the opCall procedure? |
The |
Thank you, your tool is super cool |
Hello is it possible to print in the final high level output the state at the start of the transaction and the state at the end?
For example initial balance and final balance
The text was updated successfully, but these errors were encountered: