From 3f03197daebace568a61bf69c06c97e30080a749 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 4 Feb 2015 07:39:02 -0800 Subject: [PATCH] Updated tests --- .../badBlockChain.json | 0 .../basicBlockChain.json | 0 tests/files/StateTests/stRefundTest.json | 40 +++++++++++++ .../RandomTests/201502031248CPPJIT.json | 31 ++++++++++ .../VMTests/RandomTests/201502032117GO.json | 59 +++++++++++++++++++ tests/files/index.js | 4 +- tests/files/package.json | 2 +- vm/vm.go | 6 +- 8 files changed, 137 insertions(+), 5 deletions(-) rename tests/files/{BlockTests => BlockchainTests}/badBlockChain.json (100%) rename tests/files/{BlockTests => BlockchainTests}/basicBlockChain.json (100%) create mode 100644 tests/files/VMTests/RandomTests/201502031248CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201502032117GO.json diff --git a/tests/files/BlockTests/badBlockChain.json b/tests/files/BlockchainTests/badBlockChain.json similarity index 100% rename from tests/files/BlockTests/badBlockChain.json rename to tests/files/BlockchainTests/badBlockChain.json diff --git a/tests/files/BlockTests/basicBlockChain.json b/tests/files/BlockchainTests/basicBlockChain.json similarity index 100% rename from tests/files/BlockTests/basicBlockChain.json rename to tests/files/BlockchainTests/basicBlockChain.json diff --git a/tests/files/StateTests/stRefundTest.json b/tests/files/StateTests/stRefundTest.json index 08ae1fac83..0aa9d6f275 100644 --- a/tests/files/StateTests/stRefundTest.json +++ b/tests/files/StateTests/stRefundTest.json @@ -1,4 +1,44 @@ { + "RefundOverflow" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "400", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "400", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "5789604461865809771178549250434395392663499233282028201972879200395656482016", + "gasPrice" : "20", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "" + } + }, "refund500" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", diff --git a/tests/files/VMTests/RandomTests/201502031248CPPJIT.json b/tests/files/VMTests/RandomTests/201502031248CPPJIT.json new file mode 100644 index 0000000000..0202bcb03f --- /dev/null +++ b/tests/files/VMTests/RandomTests/201502031248CPPJIT.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "300", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x404544420855", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x404544420855", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201502032117GO.json b/tests/files/VMTests/RandomTests/201502032117GO.json new file mode 100644 index 0000000000..e9ac3a5fc1 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201502032117GO.json @@ -0,0 +1,59 @@ +{ + "randomVMtest" : { + "callcreates" : [ + { + "data" : "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "destination" : "", + "gasLimit" : "9872", + "value" : "2" + }, + { + "data" : "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "destination" : "", + "gasLimit" : "9770", + "value" : "9870" + } + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "300", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x424443444243434383f0155af055", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9470", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "999999999999990128", + "code" : "0x424443444243434383f0155af055", + "nonce" : "0", + "storage" : { + "0x945304eb96065b2a98b57a48a06ae28d285a71b5" : "0x02" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x424443444243434383f0155af055", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/index.js b/tests/files/index.js index aa4cd51e10..47acfdbfbc 100644 --- a/tests/files/index.js +++ b/tests/files/index.js @@ -1,8 +1,8 @@ var tests = module.exports = {}; Object.defineProperties(tests, { - blockTests: { - get: require('require-all').bind(this, __dirname + '/BlockTests') + blockchainTests: { + get: require('require-all').bind(this, __dirname + '/BlockchainTests') }, basicTests: { get: require('require-all').bind(this, __dirname + '/BasicTests/') diff --git a/tests/files/package.json b/tests/files/package.json index 318006032a..6b1446756a 100644 --- a/tests/files/package.json +++ b/tests/files/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-tests", - "version": "0.0.2", + "version": "0.0.3", "description": "tests for ethereum", "main": "index.js", "scripts": { diff --git a/vm/vm.go b/vm/vm.go index 69e061e548..2b8c904289 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -510,7 +510,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I case GASPRICE: stack.Push(context.Price) - self.Printf(" => %v", context.Price) + self.Printf(" => %x", context.Price) // 0x40 range case BLOCKHASH: @@ -643,6 +643,8 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I stack.Push(big.NewInt(int64(mem.Len()))) case GAS: stack.Push(context.Gas) + + self.Printf(" => %x", context.Gas) // 0x60 range case CREATE: @@ -653,6 +655,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I gas = new(big.Int).Set(context.Gas) addr []byte ) + self.Endl() context.UseGas(context.Gas) ret, suberr, ref := self.env.Create(context, nil, input, gas, price, value) @@ -673,7 +676,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I stack.Push(ethutil.BigD(addr)) - self.Printf(" (*) %x", addr) } // Debug hook