aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-12 21:40:40 +0800
committerobscuren <geffobscura@gmail.com>2015-01-12 21:40:40 +0800
commit75cd9cd2de315f8680ff6a382e9b3bd48e17ecad (patch)
tree7bd375c116a705862dfa8a0e32b49e634733d60d /tests
parent00348756bce00c2d19f16ce8df5eff7a62f5cfc6 (diff)
downloadgo-tangerine-75cd9cd2de315f8680ff6a382e9b3bd48e17ecad.tar.gz
go-tangerine-75cd9cd2de315f8680ff6a382e9b3bd48e17ecad.tar.zst
go-tangerine-75cd9cd2de315f8680ff6a382e9b3bd48e17ecad.zip
updated tests
Diffstat (limited to 'tests')
-rw-r--r--tests/files/VMTests/RandomTests/201501121148GO.json31
-rw-r--r--tests/files/VMTests/RandomTests/201501121149GO.json31
-rw-r--r--tests/files/VMTests/RandomTests/201501121151GO.json31
-rw-r--r--tests/files/VMTests/RandomTests/201501121256GO.json46
-rw-r--r--tests/files/VMTests/RandomTests/201501121301GO.json47
-rw-r--r--tests/files/VMTests/RandomTests/201501121303GO.json47
-rw-r--r--tests/helper/vm.go8
7 files changed, 240 insertions, 1 deletions
diff --git a/tests/files/VMTests/RandomTests/201501121148GO.json b/tests/files/VMTests/RandomTests/201501121148GO.json
new file mode 100644
index 000000000..fb72e9c9f
--- /dev/null
+++ b/tests/files/VMTests/RandomTests/201501121148GO.json
@@ -0,0 +1,31 @@
+{
+ "randomVMtest" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "256",
+ "currentGasLimit" : "1000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : "1",
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x0c",
+ "data" : "0x",
+ "gas" : "10000",
+ "gasPrice" : "100000000000000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "1000000000000000000"
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x0c",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ }
+ }
+}
diff --git a/tests/files/VMTests/RandomTests/201501121149GO.json b/tests/files/VMTests/RandomTests/201501121149GO.json
new file mode 100644
index 000000000..bd8a769ae
--- /dev/null
+++ b/tests/files/VMTests/RandomTests/201501121149GO.json
@@ -0,0 +1,31 @@
+{
+ "randomVMtest" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "256",
+ "currentGasLimit" : "1000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : "1",
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x0c0b8a4494328e02",
+ "data" : "0x",
+ "gas" : "10000",
+ "gasPrice" : "100000000000000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "1000000000000000000"
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x0c0b8a4494328e02",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ }
+ }
+}
diff --git a/tests/files/VMTests/RandomTests/201501121151GO.json b/tests/files/VMTests/RandomTests/201501121151GO.json
new file mode 100644
index 000000000..56904da1b
--- /dev/null
+++ b/tests/files/VMTests/RandomTests/201501121151GO.json
@@ -0,0 +1,31 @@
+{
+ "randomVMtest" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "256",
+ "currentGasLimit" : "1000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : "1",
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x590c",
+ "data" : "0x",
+ "gas" : "10000",
+ "gasPrice" : "100000000000000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "1000000000000000000"
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x590c",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ }
+ }
+}
diff --git a/tests/files/VMTests/RandomTests/201501121256GO.json b/tests/files/VMTests/RandomTests/201501121256GO.json
new file mode 100644
index 000000000..156805eb4
--- /dev/null
+++ b/tests/files/VMTests/RandomTests/201501121256GO.json
@@ -0,0 +1,46 @@
+{
+ "randomVMtest" : {
+ "callcreates" : [
+ ],
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
+ "currentGasLimit" : "1000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : "2",
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x4542424283434544f063ff78ff1355",
+ "data" : "0x",
+ "gas" : "10000",
+ "gasPrice" : "100000000000000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "1000000000000000000"
+ },
+ "gas" : "9791",
+ "logs" : [
+ ],
+ "out" : "0x",
+ "post" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x4542424283434544f063ff78ff1355",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x4542424283434544f063ff78ff1355",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ }
+ }
+}
diff --git a/tests/files/VMTests/RandomTests/201501121301GO.json b/tests/files/VMTests/RandomTests/201501121301GO.json
new file mode 100644
index 000000000..b392bedd5
--- /dev/null
+++ b/tests/files/VMTests/RandomTests/201501121301GO.json
@@ -0,0 +1,47 @@
+{
+ "randomVMtest" : {
+ "callcreates" : [
+ ],
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
+ "currentGasLimit" : "1000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : "2",
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x4545434244f04343161755",
+ "data" : "0x",
+ "gas" : "10000",
+ "gasPrice" : "100000000000000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "1000000000000000000"
+ },
+ "gas" : "9591",
+ "logs" : [
+ ],
+ "out" : "0x",
+ "post" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x4545434244f04343161755",
+ "nonce" : "0",
+ "storage" : {
+ "0x" : "0x0f4240"
+ }
+ }
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x4545434244f04343161755",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ }
+ }
+}
diff --git a/tests/files/VMTests/RandomTests/201501121303GO.json b/tests/files/VMTests/RandomTests/201501121303GO.json
new file mode 100644
index 000000000..7e58edbae
--- /dev/null
+++ b/tests/files/VMTests/RandomTests/201501121303GO.json
@@ -0,0 +1,47 @@
+{
+ "randomVMtest" : {
+ "callcreates" : [
+ ],
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
+ "currentGasLimit" : "1000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : "2",
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x4245454345424344f055",
+ "data" : "0x",
+ "gas" : "10000",
+ "gasPrice" : "100000000000000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "1000000000000000000"
+ },
+ "gas" : "9591",
+ "logs" : [
+ ],
+ "out" : "0x",
+ "post" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x4245454345424344f055",
+ "nonce" : "0",
+ "storage" : {
+ "0x" : "0x0f4240"
+ }
+ }
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "1000000000000000000",
+ "code" : "0x4245454345424344f055",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ }
+ }
+}
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index dac279753..797a2acf5 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -1,6 +1,7 @@
package helper
import (
+ "errors"
"math/big"
"github.com/ethereum/go-ethereum/core"
@@ -66,12 +67,16 @@ func (self *Env) AddLog(log state.Log) {
func (self *Env) Depth() int { return self.depth }
func (self *Env) SetDepth(i int) { self.depth = i }
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
+ if self.skipTransfer {
+ if from.Balance().Cmp(amount) < 0 {
+ return errors.New("Insufficient balance in account")
+ }
+ }
return vm.Transfer(from, to, amount)
}
func (self *Env) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution {
exec := core.NewExecution(self, addr, data, gas, price, value)
- exec.SkipTransfer = self.skipTransfer
return exec
}
@@ -104,6 +109,7 @@ func RunVm(state *state.StateDB, env, exec map[string]string) ([]byte, state.Log
)
caller := state.GetOrNewStateObject(from)
+ caller.SetBalance(ethutil.Big("1000000000000000000"))
vmenv := NewEnvFromMap(state, env, exec)
vmenv.skipTransfer = true