From bb55307a9d8fa73b0fbc0727f8b80925a87627b7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 20:31:31 +0100 Subject: Updated tests --- core/execution.go | 15 ++++-- .../201501131326STACKUNDERFLOW_CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131330CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131331CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131414CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131452CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131453CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131627CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131628CPPJIT.json | 31 +++++++++++++ ...131655CREATE_RETURNS_DIFFERENT_ADDREESS_GO.json | 53 ++++++++++++++++++++++ .../VMTests/RandomTests/201501131811CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131818CPPJIT.json | 46 +++++++++++++++++++ .../VMTests/RandomTests/201501131820CPPJIT.json | 47 +++++++++++++++++++ .../VMTests/RandomTests/201501131821CPPJIT.json | 47 +++++++++++++++++++ .../VMTests/RandomTests/201501131823CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131824CPPJIT.json | 31 +++++++++++++ .../VMTests/RandomTests/201501131826CPPJIT.json | 31 +++++++++++++ vm/vm_debug.go | 24 +++------- 18 files changed, 584 insertions(+), 20 deletions(-) create mode 100644 tests/files/VMTests/RandomTests/201501131326STACKUNDERFLOW_CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131330CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131331CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131414CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131452CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131453CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131627CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131628CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131655CREATE_RETURNS_DIFFERENT_ADDREESS_GO.json create mode 100644 tests/files/VMTests/RandomTests/201501131811CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131818CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131820CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131821CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131823CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131824CPPJIT.json create mode 100644 tests/files/VMTests/RandomTests/201501131826CPPJIT.json diff --git a/core/execution.go b/core/execution.go index 1057089f1..756a3ed03 100644 --- a/core/execution.go +++ b/core/execution.go @@ -5,6 +5,7 @@ import ( "math/big" "time" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" ) @@ -40,14 +41,22 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ContextRef) (ret return nil, vm.DepthError{} } + vsnapshot := env.State().Copy() + if len(self.address) == 0 { + // Generate a new address + nonce := env.State().GetNonce(caller.Address()) + self.address = crypto.CreateAddress(caller.Address(), nonce) + env.State().SetNonce(caller.Address(), nonce+1) + } + from, to := env.State().GetStateObject(caller.Address()), env.State().GetOrNewStateObject(self.address) - // Skipping transfer is used on testing for the initial call err = env.Transfer(from, to, self.value) if err != nil { + env.State().Set(vsnapshot) + caller.ReturnGas(self.Gas, self.price) - err = fmt.Errorf("insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance()) - return + return nil, fmt.Errorf("insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance()) } snapshot := env.State().Copy() diff --git a/tests/files/VMTests/RandomTests/201501131326STACKUNDERFLOW_CPPJIT.json b/tests/files/VMTests/RandomTests/201501131326STACKUNDERFLOW_CPPJIT.json new file mode 100644 index 000000000..a671ea90b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131326STACKUNDERFLOW_CPPJIT.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" : "0x10375807f18320838f51427932", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x10375807f18320838f51427932", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131330CPPJIT.json b/tests/files/VMTests/RandomTests/201501131330CPPJIT.json new file mode 100644 index 000000000..8451f902b --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131330CPPJIT.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" : "0x8f06058888984060113c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x8f06058888984060113c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131331CPPJIT.json b/tests/files/VMTests/RandomTests/201501131331CPPJIT.json new file mode 100644 index 000000000..9059f4aa6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131331CPPJIT.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" : "0x60023c", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x60023c", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131414CPPJIT.json b/tests/files/VMTests/RandomTests/201501131414CPPJIT.json new file mode 100644 index 000000000..f1bddac84 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131414CPPJIT.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" : "0x98a15260977a64", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x98a15260977a64", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131452CPPJIT.json b/tests/files/VMTests/RandomTests/201501131452CPPJIT.json new file mode 100644 index 000000000..2a8224392 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131452CPPJIT.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" : "0x5982", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x5982", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131453CPPJIT.json b/tests/files/VMTests/RandomTests/201501131453CPPJIT.json new file mode 100644 index 000000000..9fb97d403 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131453CPPJIT.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" : "0x4386735568", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4386735568", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131627CPPJIT.json b/tests/files/VMTests/RandomTests/201501131627CPPJIT.json new file mode 100644 index 000000000..1b5924e26 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131627CPPJIT.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x41414544454545408a85836e9408689355", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x41414544454545408a85836e9408689355", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131628CPPJIT.json b/tests/files/VMTests/RandomTests/201501131628CPPJIT.json new file mode 100644 index 000000000..c40fac911 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131628CPPJIT.json @@ -0,0 +1,31 @@ +{ + "randomVMtest" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x45894544404042411955", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x45894544404042411955", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131655CREATE_RETURNS_DIFFERENT_ADDREESS_GO.json b/tests/files/VMTests/RandomTests/201501131655CREATE_RETURNS_DIFFERENT_ADDREESS_GO.json new file mode 100644 index 000000000..a65f82f69 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131655CREATE_RETURNS_DIFFERENT_ADDREESS_GO.json @@ -0,0 +1,53 @@ +{ + "randomVMtest" : { + "callcreates" : [ + { + "data" : "0x", + "destination" : "", + "gasLimit" : "9792", + "value" : "0" + } + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x4342404343424041f0f0627ea30555", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9491", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4342404343424041f0f0627ea30555", + "nonce" : "0", + "storage" : { + "0x7ea305" : "0x945304eb96065b2a98b57a48a06ae28d285a71b5" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4342404343424041f0f0627ea30555", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131811CPPJIT.json b/tests/files/VMTests/RandomTests/201501131811CPPJIT.json new file mode 100644 index 000000000..1368e9976 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131811CPPJIT.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" : "0x42451a455342ee4255", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42451a455342ee4255", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131818CPPJIT.json b/tests/files/VMTests/RandomTests/201501131818CPPJIT.json new file mode 100644 index 000000000..cce35b4fe --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131818CPPJIT.json @@ -0,0 +1,46 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "300", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x414543434242411a3578f7d99a9a5afe", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9990", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x414543434242411a3578f7d99a9a5afe", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x414543434242411a3578f7d99a9a5afe", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131820CPPJIT.json b/tests/files/VMTests/RandomTests/201501131820CPPJIT.json new file mode 100644 index 000000000..3c09d43c6 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131820CPPJIT.json @@ -0,0 +1,47 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "300", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x42454045414440455755", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9691", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42454045414440455755", + "nonce" : "0", + "storage" : { + "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : "0x0f4240" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x42454045414440455755", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131821CPPJIT.json b/tests/files/VMTests/RandomTests/201501131821CPPJIT.json new file mode 100644 index 000000000..9d896a438 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131821CPPJIT.json @@ -0,0 +1,47 @@ +{ + "randomVMtest" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "currentGasLimit" : "1000000", + "currentNumber" : "300", + "currentTimestamp" : "2", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x434341434182404557459142556955", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "gas" : "9687", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x434341434182404557459142556955", + "nonce" : "0", + "storage" : { + "0x02" : "0x012c" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x434341434182404557459142556955", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131823CPPJIT.json b/tests/files/VMTests/RandomTests/201501131823CPPJIT.json new file mode 100644 index 000000000..367511cac --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131823CPPJIT.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" : "0x43454545451a80a96139e64693a255", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x43454545451a80a96139e64693a255", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131824CPPJIT.json b/tests/files/VMTests/RandomTests/201501131824CPPJIT.json new file mode 100644 index 000000000..a9aeff36a --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131824CPPJIT.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" : "0x45444443414144451a86fa55", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x45444443414144451a86fa55", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/tests/files/VMTests/RandomTests/201501131826CPPJIT.json b/tests/files/VMTests/RandomTests/201501131826CPPJIT.json new file mode 100644 index 000000000..278b6a440 --- /dev/null +++ b/tests/files/VMTests/RandomTests/201501131826CPPJIT.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" : "0x4245411a40444542c1505b7855", + "data" : "0x", + "gas" : "10000", + "gasPrice" : "100000000000000", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "code" : "0x4245411a40444542c1505b7855", + "nonce" : "0", + "storage" : { + } + } + } + } +} diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 5949ea5d9..44137568e 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -643,32 +643,21 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price * case CREATE: var ( - err error value = stack.Pop() size, offset = stack.Popn() input = mem.Get(offset.Int64(), size.Int64()) gas = new(big.Int).Set(context.Gas) - - // Snapshot the current stack so we are able to - // revert back to it later. - //snapshot = self.env.State().Copy() + addr []byte ) - // Generate a new address - n := statedb.GetNonce(context.Address()) - addr := crypto.CreateAddress(context.Address(), n) - statedb.SetNonce(context.Address(), n+1) - - self.Printf(" (*) %x", addr).Endl() - context.UseGas(context.Gas) - - ret, suberr, ref := self.env.Create(context, addr, input, gas, price, value) + ret, suberr, ref := self.env.Create(context, nil, input, gas, price, value) if suberr != nil { stack.Push(ethutil.BigFalse) - self.Printf("CREATE err %v", err) + self.Printf(" (*) 0x0 %v", suberr) } else { + // gas < len(ret) * CreateDataGas == NO_CODE dataGas := big.NewInt(int64(len(ret))) dataGas.Mul(dataGas, GasCreateByte) @@ -676,11 +665,12 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price * ref.SetCode(ret) msg.Output = ret } + addr = ref.Address() stack.Push(ethutil.BigD(addr)) - } - self.Endl() + self.Printf(" (*) %x", addr) + } // Debug hook if self.Dbg != nil { -- cgit v1.2.3