@@ -363,34 +363,44 @@ func (t *mdLogger) OnEnter(depth int, typ byte, from common.Address, to common.A
363363 if depth != 0 {
364364 return
365365 }
366- create := vm .OpCode (typ ) == vm .CREATE
367- if ! create {
368- fmt .Fprintf (t .out , "From: `%v`\n To: `%v`\n Data: `%#x`\n Gas: `%d`\n Value `%v` wei\n " ,
369- from .String (), to .String (),
370- input , gas , value )
366+ if create := vm .OpCode (typ ) == vm .CREATE ; ! create {
367+ fmt .Fprintf (t .out , "Pre-execution info:\n " +
368+ " - from: `%v`\n " +
369+ " - to: `%v`\n " +
370+ " - data: `%#x`\n " +
371+ " - gas: `%d`\n " +
372+ " - value: `%v` wei\n " ,
373+ from .String (), to .String (), input , gas , value )
371374 } else {
372- fmt .Fprintf (t .out , "From: `%v`\n Create at: `%v`\n Data: `%#x`\n Gas: `%d`\n Value `%v` wei\n " ,
373- from .String (), to .String (),
374- input , gas , value )
375+ fmt .Fprintf (t .out , "Pre-execution info:\n " +
376+ " - from: `%v`\n " +
377+ " - create: `%v`\n " +
378+ " - data: `%#x`\n " +
379+ " - gas: `%d`\n " +
380+ " - value: `%v` wei\n " ,
381+ from .String (), to .String (), input , gas , value )
375382 }
376-
377383 fmt .Fprintf (t .out , `
378- | Pc | Op | Cost | Stack | RStack | Refund |
379- |-------|-------------|------|-----------|-----------|---------|
384+ | Pc | Op | Cost | Refund | Stack |
385+ |-------|-------------|------|-----------|-----------|
380386` )
381387}
382388
383389func (t * mdLogger ) OnExit (depth int , output []byte , gasUsed uint64 , err error , reverted bool ) {
384390 if depth == 0 {
385- fmt .Fprintf (t .out , "\n Output: `%#x`\n Consumed gas: `%d`\n Error: `%v`\n " ,
391+ fmt .Fprintf (t .out , "\n Post-execution info:\n " +
392+ " - output: `%#x`\n " +
393+ " - consumed gas: `%d`\n " +
394+ " - error: `%v`\n " ,
386395 output , gasUsed , err )
387396 }
388397}
389398
390399// OnOpcode also tracks SLOAD/SSTORE ops to track storage change.
391400func (t * mdLogger ) OnOpcode (pc uint64 , op byte , gas , cost uint64 , scope tracing.OpContext , rData []byte , depth int , err error ) {
392401 stack := scope .StackData ()
393- fmt .Fprintf (t .out , "| %4d | %10v | %3d |" , pc , vm .OpCode (op ).String (), cost )
402+ fmt .Fprintf (t .out , "| %4d | %10v | %3d |%10v |" , pc , vm .OpCode (op ).String (),
403+ cost , t .env .StateDB .GetRefund ())
394404
395405 if ! t .cfg .DisableStack {
396406 // format stack
@@ -401,7 +411,6 @@ func (t *mdLogger) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracing.
401411 b := fmt .Sprintf ("[%v]" , strings .Join (a , "," ))
402412 fmt .Fprintf (t .out , "%10v |" , b )
403413 }
404- fmt .Fprintf (t .out , "%10v |" , t .env .StateDB .GetRefund ())
405414 fmt .Fprintln (t .out , "" )
406415 if err != nil {
407416 fmt .Fprintf (t .out , "Error: %v\n " , err )
0 commit comments