mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Merge remote-tracking branch 'upstream/develop' into evmjit
This commit is contained in:
commit
2261660fc2
28 changed files with 646 additions and 60 deletions
|
|
@ -357,7 +357,9 @@ Rectangle {
|
|||
case "shh_getMessages":
|
||||
require(1);
|
||||
|
||||
shh.trigger(data.args[0]);
|
||||
var m = shh.messages(data.args[0]);
|
||||
var messages = JSON.parse(JSON.parse(JSON.stringify(m)));
|
||||
postData(data._id, messages);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func defaultAssetPath() string {
|
|||
}
|
||||
func defaultDataDir() string {
|
||||
usr, _ := user.Current()
|
||||
return path.Join(usr.HomeDir, ".mist")
|
||||
return path.Join(usr.HomeDir, ".ethereum")
|
||||
}
|
||||
|
||||
var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini")
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, paren
|
|||
reward := new(big.Int).Set(BlockReward)
|
||||
|
||||
ancestors := set.New()
|
||||
for _, ancestor := range sm.bc.GetAncestors(block, 6) {
|
||||
for _, ancestor := range sm.bc.GetAncestors(block, 7) {
|
||||
ancestors.Add(string(ancestor.Hash()))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
|
|||
if err == nil {
|
||||
dataGas := big.NewInt(int64(len(ret)))
|
||||
dataGas.Mul(dataGas, vm.GasCreateByte)
|
||||
if err = self.UseGas(dataGas); err == nil {
|
||||
//self.state.SetCode(ref.Address(), ret)
|
||||
if err := self.UseGas(dataGas); err == nil {
|
||||
ref.SetCode(ret)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131330CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131330CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131331CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131331CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131414CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131414CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131452CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131452CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131453CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131453CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131627CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131627CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131628CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131628CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131811CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131811CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
46
tests/files/VMTests/RandomTests/201501131818CPPJIT.json
Normal file
46
tests/files/VMTests/RandomTests/201501131818CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
tests/files/VMTests/RandomTests/201501131820CPPJIT.json
Normal file
47
tests/files/VMTests/RandomTests/201501131820CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
tests/files/VMTests/RandomTests/201501131821CPPJIT.json
Normal file
47
tests/files/VMTests/RandomTests/201501131821CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131823CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131823CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131824CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131824CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
tests/files/VMTests/RandomTests/201501131826CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501131826CPPJIT.json
Normal file
|
|
@ -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" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -79,7 +79,6 @@ func RunVmTest(p string, t *testing.T) {
|
|||
helper.CreateFileTests(t, p, &tests)
|
||||
|
||||
for name, test := range tests {
|
||||
//helper.Log.Infoln("Running", name)
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
statedb := state.New(nil, db)
|
||||
for addr, account := range test.Pre {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import (
|
|||
|
||||
type Message struct {
|
||||
ref *whisper.Message
|
||||
Flags int32
|
||||
Payload string
|
||||
From string
|
||||
Flags int32 `json:"flags"`
|
||||
Payload string `json:"payload"`
|
||||
From string `json:"from"`
|
||||
}
|
||||
|
||||
func ToQMessage(msg *whisper.Message) *Message {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
|
|||
|
||||
msg := whisper.NewMessage(data)
|
||||
envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
|
||||
Ttl: time.Duration(ttl),
|
||||
Ttl: time.Duration(ttl) * time.Second,
|
||||
To: crypto.ToECDSAPub(fromHex(to)),
|
||||
From: crypto.ToECDSA(fromHex(from)),
|
||||
Topics: whisper.TopicsFromString(topics...),
|
||||
|
|
@ -84,8 +84,14 @@ func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int {
|
|||
return i
|
||||
}
|
||||
|
||||
func (self *Whisper) Trigger(id int) {
|
||||
go self.Whisper.Trigger(id)
|
||||
func (self *Whisper) Messages(id int) (messages *ethutil.List) {
|
||||
msgs := self.Whisper.Messages(id)
|
||||
messages = ethutil.EmptyList()
|
||||
for _, message := range msgs {
|
||||
messages.Append(ToQMessage(message))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
|
||||
|
|
|
|||
|
|
@ -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, err, ref := self.env.Create(context, addr, input, gas, price, value)
|
||||
if err != nil {
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package whisper
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/ecdsa"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
|
@ -28,22 +26,6 @@ type Envelope struct {
|
|||
hash Hash
|
||||
}
|
||||
|
||||
func NewEnvelopeFromReader(reader io.Reader) (*Envelope, error) {
|
||||
var envelope Envelope
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(reader)
|
||||
|
||||
h := H(crypto.Sha3(buf.Bytes()))
|
||||
if err := rlp.Decode(buf, &envelope); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
envelope.hash = h
|
||||
|
||||
return &envelope, nil
|
||||
}
|
||||
|
||||
func (self *Envelope) Hash() Hash {
|
||||
if self.hash == EmptyHash {
|
||||
self.hash = H(crypto.Sha3(ethutil.Encode(self)))
|
||||
|
|
@ -126,3 +108,27 @@ func (self *Envelope) withoutNonce() interface{} {
|
|||
func (self *Envelope) RlpData() interface{} {
|
||||
return []interface{}{self.Expiry, self.Ttl, ethutil.ByteSliceToInterface(self.Topics), self.Data, self.Nonce}
|
||||
}
|
||||
|
||||
func (self *Envelope) DecodeRLP(s *rlp.Stream) error {
|
||||
var extenv struct {
|
||||
Expiry uint32
|
||||
Ttl uint32
|
||||
Topics [][]byte
|
||||
Data []byte
|
||||
Nonce uint32
|
||||
}
|
||||
if err := s.Decode(&extenv); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
self.Expiry = extenv.Expiry
|
||||
self.Ttl = extenv.Ttl
|
||||
self.Topics = extenv.Topics
|
||||
self.Data = extenv.Data
|
||||
self.Nonce = extenv.Nonce
|
||||
|
||||
// TODO We should use the stream directly here.
|
||||
self.hash = H(crypto.Sha3(ethutil.Encode(self)))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,11 @@ func (self *Message) Seal(pow time.Duration, opts Opts) (*Envelope, error) {
|
|||
}
|
||||
}
|
||||
|
||||
envelope := NewEnvelope(DefaultTtl, opts.Topics, self)
|
||||
if opts.Ttl == 0 {
|
||||
opts.Ttl = DefaultTtl
|
||||
}
|
||||
|
||||
envelope := NewEnvelope(opts.Ttl, opts.Topics, self)
|
||||
envelope.Seal(pow)
|
||||
|
||||
return envelope, nil
|
||||
|
|
|
|||
|
|
@ -126,18 +126,20 @@ func (self *Whisper) Watch(opts Filter) int {
|
|||
})
|
||||
}
|
||||
|
||||
func (self *Whisper) Trigger(id int) {
|
||||
func (self *Whisper) Messages(id int) (messages []*Message) {
|
||||
filter := self.filters.Get(id)
|
||||
if filter != nil {
|
||||
for _, e := range self.messages {
|
||||
if msg, key := self.open(e); msg != nil {
|
||||
f := createFilter(msg, e.Topics, key)
|
||||
if self.filters.Match(filter, f) {
|
||||
self.filters.Notify(f, msg)
|
||||
messages = append(messages, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Main handler for passing whisper messages to whisper peer objects
|
||||
|
|
@ -158,12 +160,13 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error {
|
|||
return err
|
||||
}
|
||||
|
||||
envelope, err := NewEnvelopeFromReader(msg.Payload)
|
||||
if err != nil {
|
||||
var envelopes []*Envelope
|
||||
if err := msg.Decode(&envelopes); err != nil {
|
||||
peer.Infoln(err)
|
||||
continue
|
||||
}
|
||||
|
||||
for _, envelope := range envelopes {
|
||||
if err := self.add(envelope); err != nil {
|
||||
// TODO Punish peer here. Invalid envelope.
|
||||
peer.Infoln(err)
|
||||
|
|
@ -171,6 +174,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error {
|
|||
wpeer.addKnown(envelope)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// takes care of adding envelopes to the messages pool. At this moment no sanity checks are being performed.
|
||||
func (self *Whisper) add(envelope *Envelope) error {
|
||||
|
|
@ -192,6 +196,8 @@ func (self *Whisper) add(envelope *Envelope) error {
|
|||
go self.postEvent(envelope)
|
||||
}
|
||||
|
||||
wlogger.DebugDetailln("added whisper message")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue