Skip to content

Commit

Permalink
- fixed gas estimation when storage a null value
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Feb 10, 2016
1 parent 1ac45b0 commit 2747ed0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion qml/TransactionDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ Dialog {
{
if (rbbuttonList.current.objectName === "trTypeSend")
{
var gas = codeModel.txGas + codeModel.callStipend
var gas = codeModel.txGas
estimatedGas.text = qsTr("Estimated cost: ") + gas + " gas"
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/MixClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ ExecutionResult MixClient::debugTransaction(Transaction const& _t, State const&
d.executionCode = std::move(codes);
d.transactionData = std::move(data);
EVMSchedule schedule; // TODO: make relevant to supposed context.
d.gasUsed = er.gasUsed + schedule.callStipend;
d.gasUsed = er.gasUsed;
d.gasRequired = _t.gasRequired(schedule);
d.gasRefunded = er.gasRefunded;
if (_t.isCreation())
Expand All @@ -260,13 +260,12 @@ void MixClient::executeTransaction(Transaction const& _t, Block& _block, bool _c
// execute on a state
if (!_call && d.excepted == TransactionException::None)
{
u256 useGas = min(d.gasUsed, _block.gasLimitRemaining());
t = _gasAuto ? replaceGas(_t, useGas, _secret) : _t;
t = _gasAuto ? replaceGas(_t, _block.gasLimitRemaining(), _secret) : _t;
eth::ExecutionResult const& er = _block.execute(envInfo.lastHashes(), t);
if (t.isCreation() && _block.state().code(d.contractAddress).empty())
BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Not enough gas for contract deployment"));
EVMSchedule schedule; // TODO: make relevant to supposed context.
d.gasUsed = er.gasUsed + schedule.callStipend;
d.gasUsed = er.gasUsed;
d.gasRequired = _t.gasRequired(schedule);
d.gasRefunded = er.gasRefunded;
LocalisedLogEntries logs;
Expand Down

0 comments on commit 2747ed0

Please sign in to comment.