Skip to content

Commit

Permalink
Fix prestate tracer for simple transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
palango committed Apr 26, 2023
1 parent ced80e4 commit fad7939
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eth/tracers/internal/tracers/prestate_tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
// result is invoked when all the opcodes have been iterated over and returns
// the final result of the tracing.
result: function(ctx, db) {
if (this.prestate === null) {
this.prestate = {};
// If tx is transfer-only, the recipient account
// hasn't been populated.
this.lookupAccount(ctx.to, db);
}
// At this point, we need to deduct the 'value' from the
// outer transaction, and move it back to the origin
this.lookupAccount(ctx.from, db);
Expand Down Expand Up @@ -79,7 +85,7 @@
}
// Whenever new state is accessed, add it to the prestate
switch (log.op.toString()) {
case "EXTCODECOPY": case "EXTCODESIZE": case "BALANCE":
case "EXTCODECOPY": case "EXTCODESIZE": case "EXTCODEHASH": case "BALANCE":
this.lookupAccount(toAddress(log.stack.peek(0).toString(16)), db);
break;
case "CREATE":
Expand Down

0 comments on commit fad7939

Please sign in to comment.