mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Merge remote-tracking branch 'upstream/develop' into p2p.crypto
This commit is contained in:
commit
6ed5a1fd31
21 changed files with 2167684 additions and 460 deletions
|
|
@ -86,6 +86,11 @@ func (self *JSRepl) Stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *JSRepl) parseInput(code string) {
|
func (self *JSRepl) parseInput(code string) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
fmt.Println("[native] error", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
value, err := self.re.Run(code)
|
value, err := self.re.Run(code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/state"
|
"github.com/ethereum/go-ethereum/state"
|
||||||
"github.com/ethereum/go-ethereum/tests/helper"
|
"github.com/ethereum/go-ethereum/tests/helper"
|
||||||
)
|
)
|
||||||
|
|
@ -119,6 +120,8 @@ func RunVmTest(r io.Reader) (failed int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.1
|
||||||
import QtWebKit 3.0
|
import QtWebKit 3.0
|
||||||
import QtWebKit.experimental 1.0
|
import QtWebKit.experimental 1.0
|
||||||
import QtQuick.Controls 1.0;
|
import QtQuick.Controls 1.0;
|
||||||
|
|
@ -164,6 +164,35 @@ Rectangle {
|
||||||
|
|
||||||
|
|
||||||
experimental.preferences.javascriptEnabled: true
|
experimental.preferences.javascriptEnabled: true
|
||||||
|
experimental.preferences.webGLEnabled: true
|
||||||
|
experimental.itemSelector: MouseArea {
|
||||||
|
// To avoid conflicting with ListView.model when inside Initiator context.
|
||||||
|
property QtObject selectorModel: model
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: selectorModel.reject()
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
visible: true
|
||||||
|
id: itemSelector
|
||||||
|
|
||||||
|
Instantiator {
|
||||||
|
model: selectorModel.items
|
||||||
|
delegate: MenuItem {
|
||||||
|
text: model.text
|
||||||
|
onTriggered: {
|
||||||
|
selectorModel.accept(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onObjectAdded: itemSelector.insertItem(index, object)
|
||||||
|
onObjectRemoved: itemSelector.removeItem(object)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
itemSelector.popup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
experimental.preferences.webAudioEnabled: true
|
||||||
experimental.preferences.navigatorQtObjectEnabled: true
|
experimental.preferences.navigatorQtObjectEnabled: true
|
||||||
experimental.preferences.developerExtrasEnabled: true
|
experimental.preferences.developerExtrasEnabled: true
|
||||||
experimental.userScripts: ["../ext/q.js", "../ext/ethereum.js/lib/web3.js", "../ext/ethereum.js/lib/qt.js", "../ext/setup.js"]
|
experimental.userScripts: ["../ext/q.js", "../ext/ethereum.js/lib/web3.js", "../ext/ethereum.js/lib/qt.js", "../ext/setup.js"]
|
||||||
|
|
@ -362,6 +391,10 @@ Rectangle {
|
||||||
postData(data._id, messages);
|
postData(data._id, messages);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "ssh_newGroup":
|
||||||
|
postData(data._id, "");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(data.call + ": " + e)
|
console.log(data.call + ": " + e)
|
||||||
|
|
|
||||||
|
|
@ -242,8 +242,7 @@ func (sm *BlockProcessor) ValidateBlock(block, parent *types.Block) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
expd := CalcDifficulty(block, parent)
|
expd := CalcDifficulty(block, parent)
|
||||||
if expd.Cmp(block.Header().Difficulty) < 0 {
|
if expd.Cmp(block.Header().Difficulty) != 0 {
|
||||||
fmt.Println("parent\n", parent)
|
|
||||||
return fmt.Errorf("Difficulty check failed for block %v, %v", block.Header().Difficulty, expd)
|
return fmt.Errorf("Difficulty check failed for block %v, %v", block.Header().Difficulty, expd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,11 @@ type StateQuery interface {
|
||||||
func CalcDifficulty(block, parent *types.Block) *big.Int {
|
func CalcDifficulty(block, parent *types.Block) *big.Int {
|
||||||
diff := new(big.Int)
|
diff := new(big.Int)
|
||||||
|
|
||||||
bh, ph := block.Header(), parent.Header()
|
adjust := new(big.Int).Rsh(parent.Difficulty(), 10)
|
||||||
adjust := new(big.Int).Rsh(ph.Difficulty, 10)
|
if block.Time() >= parent.Time()+8 {
|
||||||
if bh.Time >= ph.Time+13 {
|
diff.Sub(parent.Difficulty(), adjust)
|
||||||
diff.Sub(ph.Difficulty, adjust)
|
|
||||||
} else {
|
} else {
|
||||||
diff.Add(ph.Difficulty, adjust)
|
diff.Add(parent.Difficulty(), adjust)
|
||||||
}
|
}
|
||||||
|
|
||||||
return diff
|
return diff
|
||||||
|
|
|
||||||
52
tests/files/VMTests/RandomTests/201501132239PYTHON.json
Normal file
52
tests/files/VMTests/RandomTests/201501132239PYTHON.json
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"randomVMtest" : {
|
||||||
|
"callcreates" : [
|
||||||
|
{
|
||||||
|
"data" : "0x0000",
|
||||||
|
"destination" : "",
|
||||||
|
"gasLimit" : "9890",
|
||||||
|
"value" : "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env" : {
|
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||||
|
"currentGasLimit" : "1000000",
|
||||||
|
"currentNumber" : "300",
|
||||||
|
"currentTimestamp" : "2",
|
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||||
|
},
|
||||||
|
"exec" : {
|
||||||
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
|
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"code" : "0x454041404340424282f0046855",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9888",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x454041404340424282f0046855",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x454041404340424282f0046855",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
tests/files/VMTests/RandomTests/201501132242PYTHON.json
Normal file
52
tests/files/VMTests/RandomTests/201501132242PYTHON.json
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"randomVMtest" : {
|
||||||
|
"callcreates" : [
|
||||||
|
{
|
||||||
|
"data" : "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"destination" : "",
|
||||||
|
"gasLimit" : "9886",
|
||||||
|
"value" : "1000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env" : {
|
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||||
|
"currentGasLimit" : "1000000",
|
||||||
|
"currentNumber" : "300",
|
||||||
|
"currentTimestamp" : "2",
|
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||||
|
},
|
||||||
|
"exec" : {
|
||||||
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
|
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"code" : "0x43434045f0",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9886",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "999999999999000000",
|
||||||
|
"code" : "0x43434045f0",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x43434045f0",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
tests/files/VMTests/RandomTests/201501132304PYTHON.json
Normal file
52
tests/files/VMTests/RandomTests/201501132304PYTHON.json
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"randomVMtest" : {
|
||||||
|
"callcreates" : [
|
||||||
|
{
|
||||||
|
"data" : "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"destination" : "",
|
||||||
|
"gasLimit" : "9875",
|
||||||
|
"value" : "1000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env" : {
|
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||||
|
"currentGasLimit" : "1000000",
|
||||||
|
"currentNumber" : "300",
|
||||||
|
"currentTimestamp" : "2",
|
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||||
|
},
|
||||||
|
"exec" : {
|
||||||
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
|
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"code" : "0x444542434345f04077606c623845110155",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9873",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "999999999999000000",
|
||||||
|
"code" : "0x444542434345f04077606c623845110155",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x444542434345f04077606c623845110155",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
tests/files/VMTests/RandomTests/201501132305PYTHON.json
Normal file
52
tests/files/VMTests/RandomTests/201501132305PYTHON.json
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"randomVMtest" : {
|
||||||
|
"callcreates" : [
|
||||||
|
{
|
||||||
|
"data" : "0x0000",
|
||||||
|
"destination" : "",
|
||||||
|
"gasLimit" : "9892",
|
||||||
|
"value" : "2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env" : {
|
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||||
|
"currentGasLimit" : "1000000",
|
||||||
|
"currentNumber" : "300",
|
||||||
|
"currentTimestamp" : "2",
|
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||||
|
},
|
||||||
|
"exec" : {
|
||||||
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
|
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"code" : "0x41404542424042f0ff6567",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9892",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"945304eb96065b2a98b57a48a06ae28d285a71b5" : {
|
||||||
|
"balance" : "999999999999999998",
|
||||||
|
"code" : "0x",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x41404542424042f0ff6567",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
46
tests/files/VMTests/RandomTests/201501140910CPPJIT.json
Normal file
46
tests/files/VMTests/RandomTests/201501140910CPPJIT.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" : "0x44434345454045411a55",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9891",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x44434345454045411a55",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x44434345454045411a55",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
tests/files/VMTests/RandomTests/201501140911CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501140911CPPJIT.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" : "0x42454542134442451a97749771",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x42454542134442451a97749771",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
tests/files/VMTests/RandomTests/201501140912CPPJIT.json
Normal file
31
tests/files/VMTests/RandomTests/201501140912CPPJIT.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" : "0x4242454042454544531a53660a99321a55",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x4242454042454544531a53660a99321a55",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
46
tests/files/VMTests/RandomTests/201501140914CPPJIT.json
Normal file
46
tests/files/VMTests/RandomTests/201501140914CPPJIT.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" : "0x454045451a4043407352723258639c55",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9991",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x454045451a4043407352723258639c55",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x454045451a4043407352723258639c55",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
54
tests/files/VMTests/RandomTests/201501140918PYTHON.json
Normal file
54
tests/files/VMTests/RandomTests/201501140918PYTHON.json
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"randomVMtest" : {
|
||||||
|
"callcreates" : [
|
||||||
|
{
|
||||||
|
"data" : "0x0000",
|
||||||
|
"destination" : "",
|
||||||
|
"gasLimit" : "9887",
|
||||||
|
"value" : "1000000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"env" : {
|
||||||
|
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||||
|
"currentGasLimit" : "1000000",
|
||||||
|
"currentNumber" : "300",
|
||||||
|
"currentTimestamp" : "2",
|
||||||
|
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||||
|
},
|
||||||
|
"exec" : {
|
||||||
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
|
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"code" : "0x424345f04141454432833458505555",
|
||||||
|
"data" : "0x",
|
||||||
|
"gas" : "10000",
|
||||||
|
"gasPrice" : "100000000000000",
|
||||||
|
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
|
||||||
|
"value" : "1000000000000000000"
|
||||||
|
},
|
||||||
|
"gas" : "9278",
|
||||||
|
"logs" : [
|
||||||
|
],
|
||||||
|
"out" : "0x",
|
||||||
|
"post" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "999999999999000000",
|
||||||
|
"code" : "0x424345f04141454432833458505555",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
"0x0de0b6b3a7640000" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||||
|
"0xcd1722f3947def4cf144679da39c4c32bdc35681" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre" : {
|
||||||
|
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||||
|
"balance" : "1000000000000000000",
|
||||||
|
"code" : "0x424345f04141454432833458505555",
|
||||||
|
"nonce" : "0",
|
||||||
|
"storage" : {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
1414060
tests/files/VMTests/vmInputLimitsTest1.json
Normal file
1414060
tests/files/VMTests/vmInputLimitsTest1.json
Normal file
File diff suppressed because it is too large
Load diff
750705
tests/files/VMTests/vmInputLimitsTest2.json
Normal file
750705
tests/files/VMTests/vmInputLimitsTest2.json
Normal file
File diff suppressed because it is too large
Load diff
1942
tests/files/VMTests/vmSystemOperationsTest.json
Normal file
1942
tests/files/VMTests/vmSystemOperationsTest.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -17,7 +17,7 @@ func ToQMessage(msg *whisper.Message) *Message {
|
||||||
return &Message{
|
return &Message{
|
||||||
ref: msg,
|
ref: msg,
|
||||||
Flags: int32(msg.Flags),
|
Flags: int32(msg.Flags),
|
||||||
Payload: ethutil.Bytes2Hex(msg.Payload),
|
Payload: "0x" + ethutil.Bytes2Hex(msg.Payload),
|
||||||
From: ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())),
|
From: "0x" + ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,16 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
|
||||||
data = append(data, fromHex(d)...)
|
data = append(data, fromHex(d)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pk := crypto.ToECDSAPub(fromHex(from))
|
||||||
|
if key := self.Whisper.GetIdentity(pk); key != nil {
|
||||||
msg := whisper.NewMessage(data)
|
msg := whisper.NewMessage(data)
|
||||||
envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
|
envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
|
||||||
Ttl: time.Duration(ttl) * time.Second,
|
Ttl: time.Duration(ttl) * time.Second,
|
||||||
To: crypto.ToECDSAPub(fromHex(to)),
|
To: crypto.ToECDSAPub(fromHex(to)),
|
||||||
From: crypto.ToECDSA(fromHex(from)),
|
From: key,
|
||||||
Topics: whisper.TopicsFromString(topics...),
|
Topics: whisper.TopicsFromString(topics...),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
qlogger.Infoln(err)
|
qlogger.Infoln(err)
|
||||||
// handle error
|
// handle error
|
||||||
|
|
@ -59,14 +62,20 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
|
||||||
// handle error
|
// handle error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
qlogger.Infoln("unmatched pub / priv for seal")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) NewIdentity() string {
|
func (self *Whisper) NewIdentity() string {
|
||||||
return toHex(self.Whisper.NewIdentity().D.Bytes())
|
key := self.Whisper.NewIdentity()
|
||||||
|
|
||||||
|
return toHex(crypto.FromECDSAPub(&key.PublicKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) HasIdentity(key string) bool {
|
func (self *Whisper) HasIdentity(key string) bool {
|
||||||
return self.Whisper.HasIdentity(crypto.ToECDSA(fromHex(key)))
|
return self.Whisper.HasIdentity(crypto.ToECDSAPub(fromHex(key)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int {
|
func (self *Whisper) Watch(opts map[string]interface{}, view *qml.Common) int {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ type Whisper struct {
|
||||||
|
|
||||||
quit chan struct{}
|
quit chan struct{}
|
||||||
|
|
||||||
keys []*ecdsa.PrivateKey
|
keys map[string]*ecdsa.PrivateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Whisper {
|
func New() *Whisper {
|
||||||
|
|
@ -69,6 +69,7 @@ func New() *Whisper {
|
||||||
filters: filter.New(),
|
filters: filter.New(),
|
||||||
expiry: make(map[uint32]*set.SetNonTS),
|
expiry: make(map[uint32]*set.SetNonTS),
|
||||||
quit: make(chan struct{}),
|
quit: make(chan struct{}),
|
||||||
|
keys: make(map[string]*ecdsa.PrivateKey),
|
||||||
}
|
}
|
||||||
whisper.filters.Start()
|
whisper.filters.Start()
|
||||||
|
|
||||||
|
|
@ -101,18 +102,18 @@ func (self *Whisper) NewIdentity() *ecdsa.PrivateKey {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
self.keys = append(self.keys, key)
|
|
||||||
|
self.keys[string(crypto.FromECDSAPub(&key.PublicKey))] = key
|
||||||
|
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) HasIdentity(key *ecdsa.PrivateKey) bool {
|
func (self *Whisper) HasIdentity(key *ecdsa.PublicKey) bool {
|
||||||
for _, key := range self.keys {
|
return self.keys[string(crypto.FromECDSAPub(key))] != nil
|
||||||
if key.D.Cmp(key.D) == 0 {
|
}
|
||||||
return true
|
|
||||||
}
|
func (self *Whisper) GetIdentity(key *ecdsa.PublicKey) *ecdsa.PrivateKey {
|
||||||
}
|
return self.keys[string(crypto.FromECDSAPub(key))]
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) Watch(opts Filter) int {
|
func (self *Whisper) Watch(opts Filter) int {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue