Browse Source

Merge branch 'develop' into p2p

cl-refactor
subtly 10 years ago
parent
commit
817d8be5bd
  1. 2
      libethcore/Common.cpp
  2. 2
      libevm/VM.h
  3. 1
      mix/qml.qrc
  4. 27
      mix/qml/Debugger.qml
  5. 71
      mix/qml/LogsPane.qml
  6. 4
      mix/qml/LogsPaneStyle.qml
  7. 260
      mix/qml/StatesComboBox.qml
  8. 4
      mix/qml/StatusPane.qml
  9. 59
      mix/qml/TransactionLog.qml
  10. BIN
      mix/qml/img/edit_combox.png
  11. BIN
      mix/qml/img/pause_button.png
  12. BIN
      mix/qml/img/pause_button2x.png
  13. BIN
      mix/qml/img/play_button.png
  14. BIN
      mix/qml/img/play_button2x.png
  15. BIN
      mix/qml/img/searchicon.png
  16. BIN
      mix/qml/img/stop_button2x.png
  17. 7
      mix/res.qrc
  18. 114
      test/stMemoryTestFiller.json

2
libethcore/Common.cpp

@ -34,7 +34,7 @@ namespace eth
{
const unsigned c_ethashVersion = c_ethashRevision;
const unsigned c_protocolVersion = 59;
const unsigned c_protocolVersion = 60;
const unsigned c_databaseBaseVersion = 8;
#if ETH_FATDB
const unsigned c_databaseVersionModifier = 1;

2
libevm/VM.h

@ -56,7 +56,7 @@ public:
virtual bytesConstRef go(ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) override final;
void require(u256 _n, u256 _d) { if (m_stack.size() < _n) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(StackUnderflow() << RequirementError((bigint)_n, (bigint)m_stack.size())); } if (m_stack.size() - _n + _d >= c_stackLimit) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(OutOfStack() << RequirementError((bigint)(_d - _n), (bigint)m_stack.size())); } }
void require(u256 _n, u256 _d) { if (m_stack.size() < _n) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(StackUnderflow() << RequirementError((bigint)_n, (bigint)m_stack.size())); } if (m_stack.size() - _n + _d > c_stackLimit) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(OutOfStack() << RequirementError((bigint)(_d - _n), (bigint)m_stack.size())); } }
void requireMem(unsigned _n) { if (m_temp.size() < _n) { m_temp.resize(_n); } }
u256 curPC() const { return m_curPC; }

1
mix/qml.qrc

@ -61,5 +61,6 @@
<file>qml/js/TransactionHelper.js</file>
<file>qml/main.qml</file>
<file>qml/qmldir</file>
<file>qml/StatesComboBox.qml</file>
</qresource>
</RCC>

27
mix/qml/Debugger.qml

@ -219,6 +219,33 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
id: jumpButtons
spacing: 3
StepActionImage
{
id: playAction
enabledStateImg: "qrc:/qml/img/play_button.png"
disableStateImg: "qrc:/qml/img/play_button.png"
onClicked: projectModel.stateListModel.runState(transactionLog.selectedStateIndex)
width: 30
height: 30
buttonShortcut: "Ctrl+Shift+F8"
buttonTooltip: qsTr("Start Debugging")
visible: true
}
StepActionImage
{
id: pauseAction
enabledStateImg: "qrc:/qml/img/stop_button2x.png"
disableStateImg: "qrc:/qml/img/stop_button2x.png"
onClicked: Debugger.init(null);
width: 30
height: 30
buttonShortcut: "Ctrl+Shift+F9"
buttonTooltip: qsTr("Stop Debugging")
visible: true
}
StepActionImage
{
id: runBackAction;

71
mix/qml/LogsPane.qml

@ -37,7 +37,6 @@ Rectangle
height: parent.height - rowAction.height
width: parent.width
spacing: 0
ListModel {
id: logsModel
}
@ -100,7 +99,7 @@ Rectangle
Rectangle
{
width: 750
width: LogsPaneStyle.generic.layout.dateWidth + LogsPaneStyle.generic.layout.contentWidth + LogsPaneStyle.generic.layout.typeWidth
height: 30
color:
{
@ -171,7 +170,7 @@ Rectangle
anchors.verticalCenter: parent.verticalCenter
elide: Text.ElideRight
anchors.left: parent.left
anchors.leftMargin: 190
anchors.leftMargin: 230
color: {
parent.getColor(level);
}
@ -486,39 +485,59 @@ Rectangle
}
}
DefaultTextField
Rectangle
{
id: searchBox
width: 120
radius: 10
height: 25
color: "white"
anchors.verticalCenter: parent.verticalCenter
width: LogsPaneStyle.generic.layout.headerInputWidth - 50
font.family: LogsPaneStyle.generic.layout.logLabelFont
font.pointSize: Style.absoluteSize(-3)
font.italic: true
text: qsTr(" - Search - ")
onFocusChanged:
Image
{
if (!focus && text === "")
text = qsTr(" - Search - ");
else if (focus && text === qsTr(" - Search - "))
text = "";
id: searchImg
source: "qrc:/qml/img/searchicon.png"
fillMode: Image.PreserveAspectFit
width: 20
height: 25
z: 3
}
onTextChanged: {
if (text === qsTr(" - Search - "))
proxyModel.search("");
else
proxyModel.search(text);
}
DefaultTextField
{
id: searchBox
z: 2
width: 100
anchors.left: searchImg.right
anchors.leftMargin: -7
font.family: LogsPaneStyle.generic.layout.logLabelFont
font.pointSize: Style.absoluteSize(-3)
font.italic: true
text: qsTr(" - Search - ")
onFocusChanged:
{
if (!focus && text === "")
text = qsTr(" - Search - ");
else if (focus && text === qsTr(" - Search - "))
text = "";
}
style:
TextFieldStyle {
background: Rectangle {
radius: 10
onTextChanged: {
if (text === qsTr(" - Search - "))
proxyModel.search("");
else
proxyModel.search(text);
}
style:
TextFieldStyle {
background: Rectangle {
radius: 10
}
}
}
}
Rectangle
{
height: LogsPaneStyle.generic.layout.headerButtonHeight

4
mix/qml/LogsPaneStyle.qml

@ -18,8 +18,8 @@ QtObject {
property string logLabelColor: "#4a4a4a"
property string logLabelFont: "sans serif"
property int headerInputWidth: 200
property int dateWidth: 70
property int typeWidth: 90
property int dateWidth: 150
property int typeWidth: 150
property int contentWidth: 560
property string logAlternateColor: "#f6f5f6"
property string errorColor: "#fffcd5"

260
mix/qml/StatesComboBox.qml

@ -0,0 +1,260 @@
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file StatesComboBox.qml
* @author Ali Mashatan ali@ethdev.com
* @date 2015
* Ethereum IDE client.
*/
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
Rectangle {
id: statesComboBox
width: 200
height: 23
Component.onCompleted: {
var top = dropDownList
while (top.parent) {
top = top.parent
if (top.objectName == "debugPanel")
break
}
var coordinates = dropDownList.mapToItem(top, 0, 0)
//the order is important
dropDownShowdowList.parent = top
dropDownList.parent = top
dropDownShowdowList.x = coordinates.x
dropDownShowdowList.y = coordinates.y
dropDownList.x = coordinates.x
dropDownList.y = coordinates.y
}
signal selectItem(real item)
signal editItem(real item)
signal selectCreate
property int rowHeight: 25
property variant items
property alias selectedItem: chosenItemText.text
property alias selectedIndex: listView.currentRow
function setSelectedIndex(index) {
listView.currentRow = index
chosenItemText.text = statesComboBox.items.get(index).title
}
signal comboClicked
property variant colorItem
property variant colorSelect
SourceSansProRegular
{
id: regularFont
}
SourceSansProBold
{
id: boldFont
}
smooth: true
Rectangle {
id: chosenItem
width: parent.width
height: statesComboBox.height
color: statesComboBox.color
Text {
id: chosenItemText
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
color: statesComboBox.colorItem
text: ""
font.family: regularFont.name
}
MouseArea {
anchors.fill: parent
onClicked: {
statesComboBox.state = statesComboBox.state === "dropDown" ? "" : "dropDown"
}
}
}
Rectangle {
id: dropDownShowdowList
width: statesComboBox.width
opacity: 0.3
height: 0
clip: true
radius: 4
anchors.top: chosenItem.top
anchors.margins: 2
color: "gray"
}
//ToDo: We need scrollbar for items
Rectangle {
id: dropDownList
width: statesComboBox.width
height: 0
clip: true
radius: 4
anchors.top: chosenItem.top
anchors.topMargin: 23
color: statesComboBox.color
ColumnLayout {
spacing: 2
TableView {
id: listView
height: 20
implicitHeight: 0
width: statesComboBox.width
model: statesComboBox.items
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
currentRow: -1
headerVisible: false
backgroundVisible: false
alternatingRowColors: false
frameVisible: false
TableViewColumn {
role: "title"
title: ""
width: statesComboBox.width
delegate: mainItemDelegate
}
rowDelegate: Rectangle {
width: statesComboBox.width
height: statesComboBox.rowHeight
}
Component {
id: mainItemDelegate
Rectangle {
id: itemDelegate
width: statesComboBox.width
height: statesComboBox.height
Text {
id: textItemid
text: styleData.value
color: statesComboBox.colorItem
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 10
anchors.topMargin: 5
font.family: regularFont.name
}
Image {
id: imageItemid
height: 20
width: 20
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 5
visible: false
fillMode: Image.PreserveAspectFit
source: "img/edit_combox.png"
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
imageItemid.visible = true
textItemid.color = statesComboBox.colorSelect
}
onExited: {
imageItemid.visible = false
textItemid.color = statesComboBox.colorItem
}
onClicked: {
if (mouseX > imageItemid.x
&& mouseX < imageItemid.x + imageItemid.width
&& mouseY > imageItemid.y
&& mouseY < imageItemid.y + imageItemid.height)
statesComboBox.editItem(styleData.row)
else {
statesComboBox.state = ""
var prevSelection = chosenItemText.text
chosenItemText.text = styleData.value
listView.currentRow = styleData.row
statesComboBox.selectItem(styleData.row)
}
}
}
} //Item
} //Component
} //Table View
RowLayout {
anchors.top: listView.bottom
anchors.topMargin: 4
anchors.left: parent.left
anchors.leftMargin: 10
Text {
id: createStateText
width: statesComboBox.width
height: statesComboBox.height
font.family: boldFont.name
color: "#808080"
text: qsTr("Create State ...")
font.weight: Font.DemiBold
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
createStateText.color = statesComboBox.colorSelect
}
onExited: {
createStateText.color = statesComboBox.colorItem
}
onClicked: {
statesComboBox.state = ""
statesComboBox.selectCreate()
}
}
}
}
}
}
states: State {
name: "dropDown"
PropertyChanges {
target: dropDownList
height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1))
}
PropertyChanges {
target: dropDownShowdowList
width: statesComboBox.width + 3
height: (statesComboBox.rowHeight * (statesComboBox.items.count + 1)) + 3
}
PropertyChanges {
target: listView
height: 20
implicitHeight: (statesComboBox.rowHeight * (statesComboBox.items.count))
}
}
}

4
mix/qml/StatusPane.qml

@ -227,7 +227,7 @@ Rectangle {
top = top.parent
var coordinates = logsContainer.mapToItem(top, 0, 0);
logsContainer.parent = top;
logsContainer.x = status.x + statusContainer.x - LogsPaneStyle.generic.layout.dateWidth - LogsPaneStyle.generic.layout.typeWidth - 30
logsContainer.x = status.x + statusContainer.x - LogsPaneStyle.generic.layout.dateWidth - LogsPaneStyle.generic.layout.typeWidth + 70
}
LogsPane
@ -239,7 +239,6 @@ Rectangle {
State {
name: "opened";
PropertyChanges { target: logsContainer; height: 500; visible: true }
PropertyChanges { target: statusContainer; width: 100; height: 25 }
},
State {
name: "closed";
@ -250,7 +249,6 @@ Rectangle {
transitions: Transition {
NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 }
NumberAnimation { target: logsContainer; properties: "visible"; easing.type: Easing.InOutQuad; duration: 200 }
NumberAnimation { target: statusContainer; properties: "width"; easing.type: Easing.InOutQuad; duration: 500 }
}
}
}

59
mix/qml/TransactionLog.qml

@ -6,30 +6,16 @@ import QtQuick.Layouts 1.1
import org.ethereum.qml.RecordLogEntry 1.0
Item {
property ListModel fullModel: ListModel{}
property ListModel transactionModel: ListModel{}
property ListModel callModel: ListModel{}
Action {
id: addStateAction
text: "Add State"
shortcut: "Ctrl+Alt+T"
enabled: codeModel.hasContract && !clientModel.running;
onTriggered: projectModel.stateListModel.addState();
}
Action {
id: editStateAction
text: "Edit State"
shortcut: "Ctrl+Alt+T"
enabled: codeModel.hasContract && !clientModel.running && statesCombo.currentIndex >= 0 && projectModel.stateListModel.count > 0;
onTriggered: projectModel.stateListModel.editState(statesCombo.currentIndex);
}
property int selectedStateIndex: statesCombo.selectedIndex
ColumnLayout {
anchors.fill: parent
RowLayout {
anchors.right: parent.right
anchors.left: parent.left
Connections
{
id: compilationStatus
@ -61,36 +47,24 @@ Item {
}
}
ComboBox {
StatesComboBox
{
id: statesCombo
model: projectModel.stateListModel
width: 150
editable: false
textRole: "title"
onActivated: {
model.runState(index);
}
items: projectModel.stateListModel
onSelectCreate: projectModel.stateListModel.addState();
onEditItem: projectModel.stateListModel.editState(item)
colorItem: "#808080"
colorSelect: "#4a90e2"
color: "white"
Connections {
target: projectModel.stateListModel
onStateRun: {
if (statesCombo.currentIndex !== index)
statesCombo.currentIndex = index;
if (statesCombo.selectedIndex !== index)
statesCombo.setSelectedIndex( index );
}
}
}
Button
{
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
action: editStateAction
}
Button
{
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
action: addStateAction
}
Button
{
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
@ -163,16 +137,11 @@ Item {
Keys.onPressed: {
if ((event.modifiers & Qt.ControlModifier) && event.key === Qt.Key_C && currentRow >=0 && currentRow < logTable.model.count) {
var item = logTable.model.get(currentRow);
clipboard.text = item.returned;
appContext.toClipboard(item.returned);
}
}
}
Rectangle {
height: 6
color: "transparent"
}
}
Connections {
target: clientModel
onStateCleared: {

BIN
mix/qml/img/edit_combox.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

BIN
mix/qml/img/pause_button.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
mix/qml/img/pause_button2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

BIN
mix/qml/img/play_button.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
mix/qml/img/play_button2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

BIN
mix/qml/img/searchicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
mix/qml/img/stop_button2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

7
mix/res.qrc

@ -48,13 +48,20 @@
<file>qml/img/projecticon.png</file>
<file>qml/img/run.png</file>
<file>qml/img/search_filled.png</file>
<file>qml/img/play_button2x.png</file>
<file>qml/img/play_button.png</file>
<file>qml/img/pause_button2x.png</file>
<file>qml/img/pause_button.png</file>
<file>res/mix_256x256x32.png</file>
<file>stdc/config.sol</file>
<file>stdc/namereg.sol</file>
<file>stdc/std.sol</file>
<file>qml/img/edit_combox.png</file>
<file>qml/img/clearicon.png</file>
<file>qml/img/cleariconactive.png</file>
<file>qml/img/copyicon.png</file>
<file>qml/img/copyiconactive.png</file>
<file>qml/img/searchicon.png</file>
<file>qml/img/stop_button2x.png</file>
</qresource>
</RCC>

114
test/stMemoryTestFiller.json

@ -1461,7 +1461,7 @@
}
},
"stackLimitPush32_1024": {
"stackLimitPush32_1023": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
@ -1495,7 +1495,7 @@
}
},
"stackLimitPush32_1025": {
"stackLimitPush32_1024": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
@ -1529,7 +1529,41 @@
}
},
"stackLimitPush31_1024": {
"stackLimitPush32_1025": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "42949672960",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 1023 0x00 MSTORE JUMPDEST 0x0102030405060708090a0102030405060708090a0102030405060708090a0102 0x01 0x00 MLOAD SUB 0x00 MSTORE 0x00 MLOAD 0x06 JUMPI STOP )",
"storage": {}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "429496729600",
"nonce" : "0",
"code" : "",
"storage": {}
}
},
"transaction" : {
"nonce" : "0",
"gasPrice" : "1",
"gasLimit" : "100000",
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"value" : "10",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"data" : ""
}
},
"stackLimitPush31_1023": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
@ -1563,7 +1597,7 @@
}
},
"stackLimitPush31_1025": {
"stackLimitPush31_1024": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
@ -1597,7 +1631,41 @@
}
},
"stackLimitGas_1024": {
"stackLimitPush31_1025": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "42949672960",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 1023 0x00 MSTORE JUMPDEST 0x0102030405060708090a0102030405060708090a0102030405060708090a01 0x01 0x00 MLOAD SUB 0x00 MSTORE 0x00 MLOAD 0x06 JUMPI STOP )",
"storage": {}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "429496729600",
"nonce" : "0",
"code" : "",
"storage": {}
}
},
"transaction" : {
"nonce" : "0",
"gasPrice" : "1",
"gasLimit" : "100000",
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"value" : "10",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"data" : ""
}
},
"stackLimitGas_1023": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
@ -1631,7 +1699,7 @@
}
},
"stackLimitGas_1025": {
"stackLimitGas_1024": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
@ -1665,6 +1733,40 @@
}
},
"stackLimitGas_1025": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "42949672960",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 1023 0x00 MSTORE JUMPDEST GAS 0x01 0x00 MLOAD SUB 0x00 MSTORE 0x00 MLOAD 0x06 JUMPI STOP )",
"storage": {}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "429496729600",
"nonce" : "0",
"code" : "",
"storage": {}
}
},
"transaction" : {
"nonce" : "0",
"gasPrice" : "1",
"gasLimit" : "100000",
"to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"value" : "10",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"data" : ""
}
},
"mstroe8_dejavu": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",

Loading…
Cancel
Save