This commit is contained in:
obscuren
2014-12-03 13:50:51 +01:00
20 changed files with 124 additions and 82 deletions

View File

@ -41,7 +41,7 @@ func NewDebugVm(env Environment) *DebugVm {
lt = LogTyDiff
}
return &DebugVm{env: env, logTy: lt, Recoverable: true}
return &DebugVm{env: env, logTy: lt, Recoverable: false}
}
//func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
@ -177,10 +177,13 @@ func (self *DebugVm) Run(call Options) (ret []byte, gas *big.Int, err error) {
n := int(op - LOG0)
require(n + 2)
mSize, mStart := stack.Peekn()
reqGs.Set(GasLog)
gas.Set(GasLog)
addStepGasUsage(new(big.Int).Mul(big.NewInt(int64(n)), GasLog))
addStepGasUsage(new(big.Int).Add(mSize, mStart))
mSize, mStart := stack.Peekn()
addStepGasUsage(mSize)
newMemSize = calcMemSize(mStart, mSize)
case EXP:
require(2)
@ -762,10 +765,10 @@ func (self *DebugVm) Run(call Options) (ret []byte, gas *big.Int, err error) {
case LOG0, LOG1, LOG2, LOG3, LOG4:
n := int(op - LOG0)
topics := make([][]byte, n)
mStart, mSize := stack.Pop().Int64(), stack.Pop().Int64()
mSize, mStart := stack.Pop().Int64(), stack.Pop().Int64()
data := mem.Geti(mStart, mSize)
for i := 0; i < n; i++ {
topics[i] = stack.Pop().Bytes()
topics[i] = ethutil.LeftPadBytes(stack.Pop().Bytes(), 32)
}
//log := &state.Log{closure.Address(), topics, data}