diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-28 00:00:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-28 00:00:38 +0800 |
commit | bf850974f3e1794a3e2aa4ff33b527297cc50f91 (patch) | |
tree | 49aa8f3878cbbc425153458072957c6f0bfd56b6 /ethchain | |
parent | 338b6980915c990c6e6287a7249ddd98e6be20eb (diff) | |
download | dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.tar dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.tar.gz dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.tar.bz2 dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.tar.lz dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.tar.xz dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.tar.zst dexon-bf850974f3e1794a3e2aa4ff33b527297cc50f91.zip |
Using mutan assembler stage
Diffstat (limited to 'ethchain')
-rw-r--r-- | ethchain/vm_test.go | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/ethchain/vm_test.go b/ethchain/vm_test.go index 75a4f5afb..35a7b2e3f 100644 --- a/ethchain/vm_test.go +++ b/ethchain/vm_test.go @@ -82,7 +82,7 @@ func TestRun4(t *testing.T) { db, _ := ethdb.NewMemDatabase() state := NewState(ethutil.NewTrie(db, "")) - asm, err := mutan.Compile(strings.NewReader(` + script, err := mutan.Compile(strings.NewReader(` int32 a = 10 int32 b = 20 if a > b { @@ -90,14 +90,13 @@ func TestRun4(t *testing.T) { } Exit() `), false) - script := ethutil.Assemble(asm...) tx := NewContractCreationTx(ethutil.Big("0"), ethutil.Big("1000"), ethutil.Big("100"), script, nil) addr := tx.Hash()[12:] contract := MakeContract(tx, state) state.UpdateStateObject(contract) fmt.Printf("%x\n", addr) - asm, err = mutan.Compile(strings.NewReader(` + callerScript, err := mutan.Compile(strings.NewReader(` // Check if there's any cash in the initial store if store[1000] == 0 { store[1000] = 10^20 @@ -129,10 +128,7 @@ func TestRun4(t *testing.T) { if err != nil { fmt.Println(err) } - asm = append(asm, "LOG") - fmt.Println(asm) - callerScript := ethutil.Assemble(asm...) callerTx := NewContractCreationTx(ethutil.Big("0"), ethutil.Big("1000"), ethutil.Big("100"), callerScript, nil) // Contract addr as test address @@ -162,17 +158,3 @@ func TestRun4(t *testing.T) { } fmt.Println("account.Amount =", account.Amount) } - -func TestRun5(t *testing.T) { - ethutil.ReadConfig("") - - asm, _ := mutan.Compile(strings.NewReader(` - int32 a = 10 - int32 b = 20 - if a > b { - int32 c = this.caller() - } - exit() - `), false) - ethutil.Assemble(asm...) -} |