aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-11 02:40:12 +0800
committerobscuren <geffobscura@gmail.com>2014-04-11 02:40:12 +0800
commit6a530ea3717e592407737c6cd2ebeba0200c9cd8 (patch)
treebb5063b709a8d4f6f9baea6824807dd2cf0c610b /ethutil
parent0fccbeabcc3b8c110ce3712e5488ad99245f92ee (diff)
downloaddexon-6a530ea3717e592407737c6cd2ebeba0200c9cd8.tar.gz
dexon-6a530ea3717e592407737c6cd2ebeba0200c9cd8.tar.zst
dexon-6a530ea3717e592407737c6cd2ebeba0200c9cd8.zip
Call fixed
Diffstat (limited to 'ethutil')
-rw-r--r--ethutil/parsing.go28
1 files changed, 7 insertions, 21 deletions
diff --git a/ethutil/parsing.go b/ethutil/parsing.go
index a9d50e425..0de396654 100644
--- a/ethutil/parsing.go
+++ b/ethutil/parsing.go
@@ -1,8 +1,8 @@
package ethutil
import (
+ _ "fmt"
"math/big"
- "strconv"
)
// Op codes
@@ -98,11 +98,16 @@ func CompileInstr(s interface{}) ([]byte, error) {
// Assume regular bytes during compilation
if !success {
num.SetBytes([]byte(str))
+ } else {
+ // tmp fix for 32 bytes
+ n := BigToBytes(num, 256)
+ return n, nil
}
return num.Bytes(), nil
case int:
- return big.NewInt(int64(s.(int))).Bytes(), nil
+ num := BigToBytes(big.NewInt(int64(s.(int))), 256)
+ return num, nil
case []byte:
return BigD(s.([]byte)).Bytes(), nil
}
@@ -110,25 +115,6 @@ func CompileInstr(s interface{}) ([]byte, error) {
return nil, nil
}
-func Instr(instr string) (int, []string, error) {
-
- base := new(big.Int)
- base.SetString(instr, 0)
-
- args := make([]string, 7)
- for i := 0; i < 7; i++ {
- // int(int(val) / int(math.Pow(256,float64(i)))) % 256
- exp := BigPow(256, i)
- num := new(big.Int)
- num.Div(base, exp)
-
- args[i] = num.Mod(num, big.NewInt(256)).String()
- }
- op, _ := strconv.Atoi(args[0])
-
- return op, args[1:7], nil
-}
-
// Script compilation functions
// Compiles strings to machine code
func Assemble(instructions ...interface{}) (script []byte) {