Updated LOG to match proper gas in all cases

This commit is contained in:
obscuren
2014-12-02 17:22:33 +01:00
parent 5ebae82eeb
commit cb4d168ecc
6 changed files with 17 additions and 43 deletions

View File

@ -163,8 +163,8 @@ const (
// 0xf0 range - closures
CREATE OpCode = 0xf0 + iota
CALL
RETURN
CALLCODE
RETURN
// 0x70 range - other
SUICIDE = 0xff
@ -309,12 +309,6 @@ var opCodeToString = map[OpCode]string{
SWAP15: "SWAP15",
SWAP16: "SWAP16",
LOG0: "LOG0",
LOG1: "LOG1",
LOG2: "LOG2",
LOG3: "LOG3",
LOG4: "LOG4",
// 0xf0 range
CREATE: "CREATE",
CALL: "CALL",

View File

@ -165,10 +165,11 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
n := int(op - LOG0)
require(n + 2)
mSize, mStart := stack.Peekn()
gas.Set(GasLog)
addStepGasUsage(new(big.Int).Mul(big.NewInt(int64(n)), GasLog))
addStepGasUsage(new(big.Int).Add(mSize, mStart))
mSize, _ := stack.Peekn()
addStepGasUsage(mSize)
case EXP:
require(2)