Added better address format
This commit is contained in:
parent
969e748dce
commit
891f725909
@ -55,6 +55,7 @@ const (
|
|||||||
|
|
||||||
// 0x50 range - 'storage' and execution
|
// 0x50 range - 'storage' and execution
|
||||||
oPUSH = 0x50
|
oPUSH = 0x50
|
||||||
|
oPUSH20 = 0x80
|
||||||
oPOP = 0x51
|
oPOP = 0x51
|
||||||
oDUP = 0x52
|
oDUP = 0x52
|
||||||
oSWAP = 0x53
|
oSWAP = 0x53
|
||||||
|
@ -301,7 +301,6 @@ func (vm *Vm) RunClosure(closure *Closure) []byte {
|
|||||||
// 0x50 range
|
// 0x50 range
|
||||||
case oPUSH: // Push PC+1 on to the stack
|
case oPUSH: // Push PC+1 on to the stack
|
||||||
pc.Add(pc, ethutil.Big1)
|
pc.Add(pc, ethutil.Big1)
|
||||||
//val := closure.GetMem(pc).BigInt()
|
|
||||||
data := closure.Gets(pc, big.NewInt(32))
|
data := closure.Gets(pc, big.NewInt(32))
|
||||||
val := ethutil.BigD(data.Bytes())
|
val := ethutil.BigD(data.Bytes())
|
||||||
|
|
||||||
@ -309,6 +308,16 @@ func (vm *Vm) RunClosure(closure *Closure) []byte {
|
|||||||
stack.Push(val)
|
stack.Push(val)
|
||||||
|
|
||||||
pc.Add(pc, big.NewInt(31))
|
pc.Add(pc, big.NewInt(31))
|
||||||
|
case oPUSH20:
|
||||||
|
pc.Add(pc, ethutil.Big1)
|
||||||
|
data := closure.Gets(pc, big.NewInt(20))
|
||||||
|
val := ethutil.BigD(data.Bytes())
|
||||||
|
|
||||||
|
// Push value to stack
|
||||||
|
stack.Push(val)
|
||||||
|
|
||||||
|
pc.Add(pc, big.NewInt(19))
|
||||||
|
|
||||||
case oPOP:
|
case oPOP:
|
||||||
stack.Pop()
|
stack.Pop()
|
||||||
case oDUP:
|
case oDUP:
|
||||||
|
@ -114,12 +114,13 @@ func TestRun4(t *testing.T) {
|
|||||||
|
|
||||||
int8 ret = 0
|
int8 ret = 0
|
||||||
int8 arg = 10
|
int8 arg = 10
|
||||||
call(938726394128221156290138488023434115948430767407, 0, 100000000, arg, ret)
|
addr address = "a46df28529eb8aa8b8c025b0b413c5f4b688352f"
|
||||||
|
call(address, 0, 100000000, arg, ret)
|
||||||
`), false)
|
`), false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
asm = append(asm, "LOG")
|
//asm = append(asm, "LOG")
|
||||||
fmt.Println(asm)
|
fmt.Println(asm)
|
||||||
|
|
||||||
callerScript := ethutil.Assemble(asm...)
|
callerScript := ethutil.Assemble(asm...)
|
||||||
|
@ -51,7 +51,10 @@ var OpCodes = map[string]byte{
|
|||||||
"GASLIMIT": 0x45,
|
"GASLIMIT": 0x45,
|
||||||
|
|
||||||
// 0x50 range - 'storage' and execution
|
// 0x50 range - 'storage' and execution
|
||||||
"PUSH": 0x50,
|
"PUSH": 0x50,
|
||||||
|
|
||||||
|
"PUSH20": 0x80,
|
||||||
|
|
||||||
"POP": 0x51,
|
"POP": 0x51,
|
||||||
"DUP": 0x52,
|
"DUP": 0x52,
|
||||||
"SWAP": 0x53,
|
"SWAP": 0x53,
|
||||||
|
Loading…
Reference in New Issue
Block a user