core/vm: fixup formatting

This commit is contained in:
Felix Lange 2017-06-07 15:23:59 +02:00
parent 0e250abf32
commit 2561ab932a

View file

@ -49,9 +49,10 @@ type LogConfig struct {
Limit int // maximum length of output, but zero means unlimited Limit int // maximum length of output, but zero means unlimited
} }
//go:generate gencodec -type StructLog -field-override structLogMarshaling -out gen_structlog.go
// StructLog is emitted to the EVM each cycle and lists information about the current internal state // StructLog is emitted to the EVM each cycle and lists information about the current internal state
// prior to the execution of the statement. // prior to the execution of the statement.
//go:generate gencodec -type StructLog -field-override structLogMarshaling -out gen_structlog.go
type StructLog struct { type StructLog struct {
Pc uint64 `json:"pc"` Pc uint64 `json:"pc"`
Op OpCode `json:"op"` Op OpCode `json:"op"`
@ -64,14 +65,7 @@ type StructLog struct {
Err error `json:"error"` Err error `json:"error"`
} }
func (s *StructLog) OpName() string { // overrides for gencodec
return s.Op.String()
}
func (s *StructLog) MemorySize() int {
return len(s.Memory)
}
type structLogMarshaling struct { type structLogMarshaling struct {
Stack []*math.HexOrDecimal256 Stack []*math.HexOrDecimal256
Gas math.HexOrDecimal64 Gas math.HexOrDecimal64
@ -81,6 +75,14 @@ type structLogMarshaling struct {
MemorySize int `json:"memSize"` MemorySize int `json:"memSize"`
} }
func (s *StructLog) OpName() string {
return s.Op.String()
}
func (s *StructLog) MemorySize() int {
return len(s.Memory)
}
// Tracer is used to collect execution traces from an EVM transaction // Tracer is used to collect execution traces from an EVM transaction
// execution. CaptureState is called for each step of the VM with the // execution. CaptureState is called for each step of the VM with the
// current VM state. // current VM state.
@ -184,6 +186,7 @@ func (l *StructLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost ui
l.logs = append(l.logs, log) l.logs = append(l.logs, log)
return nil return nil
} }
func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration) error { func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration) error {
fmt.Printf("0x%x", output) fmt.Printf("0x%x", output)
return nil return nil