Changed context and ADDMOD, MULMOD

* Cleaned up VM execution. VM run now takes a context
* ADDMOD/MULMOD - removed incorrect cast
This commit is contained in:
obscuren
2015-03-13 13:44:15 +01:00
parent 80592f244d
commit f76cc6699e
6 changed files with 44 additions and 24 deletions

View File

@ -1,6 +1,7 @@
package vm
import (
"math"
"math/big"
"github.com/ethereum/go-ethereum/ethutil"
@ -117,3 +118,10 @@ func toValue(val *big.Int) interface{} {
return val
}
func getCode(code []byte, start, size uint64) []byte {
x := uint64(math.Min(float64(start), float64(len(code))))
y := uint64(math.Min(float64(x+size), float64(len(code))))
return ethutil.RightPadBytes(code[x:y], int(size))
}