Browse Source

Merge pull request #1663 from arkpar/mix_ux

Mix: more bugfixes
cl-refactor
Arkadiy Paronyan 10 years ago
parent
commit
7ab68f4311
  1. 2
      mix/ClientModel.cpp
  2. 1
      mix/MixClient.cpp
  3. 10
      mix/test/qml/TestMain.qml
  4. 5
      mix/test/qml/js/TestDebugger.js
  5. 10
      mix/test/qml/js/TestMiner.js
  6. 4
      mix/test/qml/js/TestProject.js

2
mix/ClientModel.cpp

@ -498,6 +498,8 @@ QVariant ClientModel::formatStorageValue(SolidityType const& _type, map<u256, u2
bytes slotBytes = toBigEndian(slotValue);
auto start = slotBytes.end() - _type.size - offset;
bytes val(32 - _type.size); //prepend with zeroes
if (_type.type == SolidityType::SignedInteger && (*start & 0x80)) //extend sign
std::fill(val.begin(), val.end(), 0xff);
val.insert(val.end(), start, start + _type.size);
values.append(decoder.decode(_type, val));
offset += _type.size;

1
mix/MixClient.cpp

@ -117,6 +117,7 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state, bool _c
lastHashes[i] = lastHashes[i - 1] ? bc().details(lastHashes[i - 1]).parent : h256();
State execState = _state;
execState.addBalance(t.sender(), t.gas() * t.gasPrice()); //give it enough balance for gas estimation
Executive execution(execState, lastHashes, 0);
execution.initialize(&rlp);
execution.execute();

10
mix/test/qml/TestMain.qml

@ -58,11 +58,20 @@ TestCase
ts.keyPressChar(mainApplication, "S", Qt.ControlModifier, 200); //Ctrl+S
}
function waitForMining()
{
while (mainApplication.clientModel.mining)
ts.waitForSignal(mainApplication.clientModel, "miningComplete()", 5000);
wait(1); //allow events to propagate 2 times for transaction log to be updated
wait(1);
}
function waitForExecution()
{
while (mainApplication.clientModel.running)
ts.waitForSignal(mainApplication.clientModel, "runComplete()", 5000);
wait(1); //allow events to propagate 2 times for transaction log to be updated
wait(1);
}
function editHtml(c)
@ -89,6 +98,7 @@ TestCase
function test_dbg_vm() { TestDebugger.test_vmDebugging(); }
function test_miner_getDefaultiner() { TestMiner.test_getDefaultMiner(); }
function test_miner_selectMiner() { TestMiner.test_selectMiner(); }
function test_miner_mine() { TestMiner.test_mine(); }
function test_project_contractRename() { TestProject.test_contractRename(); }
}

5
mix/test/qml/js/TestDebugger.js

@ -91,17 +91,20 @@ function test_arrayParametersAndStorage()
" {\r" +
" m = x;\r" +
" s = 5;\r" +
" signed = 6534;\r" +
" }\r" +
" \r" +
" function setMV(uint72[5] x) external\r" +
" {\r" +
" mv = x;\r" +
" s = 42;\r" +
" signed = -534;\r" +
" }\r" +
" \r" +
" uint256[] m;\r" +
" uint72[5] mv;\r" +
" uint256 s;\r" +
" int48 signed;\r" +
" }\r");
mainApplication.projectModel.stateListModel.editState(0);
@ -127,11 +130,13 @@ function test_arrayParametersAndStorage()
mainApplication.mainContent.rightPane.debugSlider.value = mainApplication.mainContent.rightPane.debugSlider.maximumValue;
tryCompare(mainApplication.mainContent.rightPane.solStorage.item.value, "m", ["4","5","6","2","10"]);
tryCompare(mainApplication.mainContent.rightPane.solStorage.item.value, "s", "5");
tryCompare(mainApplication.mainContent.rightPane.solStorage.item.value, "signed", "6534");
//debug setMV
mainApplication.clientModel.debugRecord(4);
mainApplication.mainContent.rightPane.debugSlider.value = mainApplication.mainContent.rightPane.debugSlider.maximumValue - 1;
tryCompare(mainApplication.mainContent.rightPane.solStorage.item.value, "mv", ["13","35","1","4","0"]);
tryCompare(mainApplication.mainContent.rightPane.solStorage.item.value, "s", "42");
tryCompare(mainApplication.mainContent.rightPane.solStorage.item.value, "signed", "-534");
tryCompare(mainApplication.mainContent.rightPane.solCallStack.listModel, 0, "setMV");
}

10
mix/test/qml/js/TestMiner.js

@ -18,3 +18,13 @@ function test_selectMiner()
compare(state.miner.secret, account.secret);
}
function test_mine()
{
newProject();
mainApplication.mainContent.startQuickDebugging();
waitForExecution();
mainApplication.clientModel.mine();
waitForMining();
tryCompare(mainApplication.mainContent.rightPane.transactionLog.transactionModel.get(3), "contract", " - Block - ");
}

4
mix/test/qml/js/TestProject.js

@ -1,11 +1,12 @@
function test_contractRename()
{
newProject();
waitForExecution();
tryCompare(mainApplication.mainContent.projectNavigator.sections.itemAt(0).model.get(0), "name", "Contract");
editContract("contract Renamed {}");
mainApplication.mainContent.startQuickDebugging();
waitForExecution();
wait(1000);
tryCompare(mainApplication.mainContent.rightPane.transactionLog.transactionModel.get(2), "contract", "Renamed");
tryCompare(mainApplication.mainContent.projectNavigator.sections.itemAt(0).model.get(0), "name", "Renamed");
mainApplication.projectModel.stateListModel.editState(0);
mainApplication.projectModel.stateDialog.model.editTransaction(2);
@ -14,5 +15,4 @@ function test_contractRename()
tryCompare(transactionDialog, "functionId", "Renamed");
transactionDialog.close();
mainApplication.projectModel.stateDialog.close();
tryCompare(mainApplication.mainContent.rightPane.transactionLog.transactionModel.get(2), "contract", "Renamed");
}

Loading…
Cancel
Save