aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-11 09:03:14 +0800
committerobscuren <geffobscura@gmail.com>2014-04-11 09:03:14 +0800
commit25dd46061fc3b732056ea87fe4a9696e160179cc (patch)
tree214fccc5b3d20bb364bb50e4556c479492a67f0f
parentafc92fb7d799a4085d2256a7106ee9f7b9ea2f9e (diff)
downloadgo-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.tar
go-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.tar.gz
go-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.tar.bz2
go-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.tar.lz
go-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.tar.xz
go-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.tar.zst
go-tangerine-25dd46061fc3b732056ea87fe4a9696e160179cc.zip
Added push20
-rw-r--r--ethchain/stack.go2
-rw-r--r--ethchain/vm_test.go24
2 files changed, 12 insertions, 14 deletions
diff --git a/ethchain/stack.go b/ethchain/stack.go
index 0dadd15e5..d475f2f8e 100644
--- a/ethchain/stack.go
+++ b/ethchain/stack.go
@@ -251,7 +251,7 @@ func (m *Memory) Print() {
if len(m.store) > 0 {
addr := 0
for i := 0; i+32 <= len(m.store); i += 32 {
- fmt.Printf("%03d %v\n", addr, m.store[i:i+32])
+ fmt.Printf("%03d: % x\n", addr, m.store[i:i+32])
addr++
}
} else {
diff --git a/ethchain/vm_test.go b/ethchain/vm_test.go
index 55fb71dbe..4075dfbc6 100644
--- a/ethchain/vm_test.go
+++ b/ethchain/vm_test.go
@@ -98,24 +98,22 @@ func TestRun4(t *testing.T) {
fmt.Printf("%x\n", addr)
asm, err = mutan.Compile(strings.NewReader(`
- int32 a = 10
- int32 b = 10
- if a == b {
- int32 c = 10
- if c == 10 {
- int32 d = 1000
- int32 e = 10
- }
+ // Check if there's any cash in the initial store
+ if store[1000] == 0 {
+ store[1000] = 10^20
}
- store[0] = 20
- store[a] = 20
- store[b] = this.caller()
+ store[1001] = this.value() * 20
+ store[this.origin()] = store[this.origin()] + 1000
+
+ if store[1001] > 20 {
+ store[1001] = 10^50
+ }
int8 ret = 0
int8 arg = 10
- addr address = "a46df28529eb8aa8b8c025b0b413c5f4b688352f"
- call(address, 0, 100000000, arg, ret)
+ store[1002] = "a46df28529eb8aa8b8c025b0b413c5f4b688352f"
+ call(store[1002], 0, 100000000, arg, ret)
`), false)
if err != nil {
fmt.Println(err)