diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index e372e611a..6dec81b38 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -440,7 +440,7 @@ ExecutionResult Client::call(Address _dest, bytes const& _data, u256 _gas, u256 temp = m_postMine; temp.addBalance(_from, _value + _gasPrice * _gas); Executive e(temp, LastHashes(), 0); - if (!e.call(_dest, _dest, _from, _value, _gasPrice, &_data, _gas, _from)) + if (!e.call(_dest, _from, _value, _gasPrice, &_data, _gas)) e.go(); ret = e.executionResult(); } diff --git a/libethereum/Executive.cpp b/libethereum/Executive.cpp index ca7a5a38a..d7bad0ff9 100644 --- a/libethereum/Executive.cpp +++ b/libethereum/Executive.cpp @@ -120,44 +120,13 @@ bool Executive::execute() if (m_t.isCreation()) return create(m_t.sender(), m_t.value(), m_t.gasPrice(), m_t.gas() - (u256)m_t.gasRequired(), &m_t.data(), m_t.sender()); else - return call(m_t.receiveAddress(), m_t.receiveAddress(), m_t.sender(), m_t.value(), m_t.gasPrice(), bytesConstRef(&m_t.data()), m_t.gas() - (u256)m_t.gasRequired(), m_t.sender()); + return call(m_t.receiveAddress(), m_t.sender(), m_t.value(), m_t.gasPrice(), bytesConstRef(&m_t.data()), m_t.gas() - (u256)m_t.gasRequired()); } -bool Executive::call(Address _receiveAddress, Address _codeAddress, Address _senderAddress, u256 _value, u256 _gasPrice, bytesConstRef _data, u256 _gas, Address _originAddress) +bool Executive::call(Address _receiveAddress, Address _senderAddress, u256 _value, u256 _gasPrice, bytesConstRef _data, u256 _gas) { - m_isCreation = false; -// cnote << "Transferring" << formatBalance(_value) << "to receiver."; - auto it = !(_codeAddress & ~h160(0xffffffff)) ? precompiled().find((unsigned)(u160)_codeAddress) : precompiled().end(); - if (it != precompiled().end()) - { - bigint g = it->second.gas(_data); - if (_gas < g) - { - m_excepted = TransactionException::OutOfGasBase; - // Bail from exception. - return true; // true actually means "all finished - nothing more to be done regarding go(). - } - else - { - m_gas = (u256)(_gas - g); - m_precompiledOut = it->second.exec(_data); - m_out = &m_precompiledOut; - } - } - else - { - m_gas = _gas; - if (m_s.addressHasCode(_codeAddress)) - { - m_vm = VMFactory::create(); - bytes const& c = m_s.code(_codeAddress); - m_ext = make_shared(m_s, m_lastHashes, _receiveAddress, _senderAddress, _originAddress, _value, _gasPrice, _data, &c, m_depth); - } - } - - m_s.transferBalance(_senderAddress, _receiveAddress, _value); - - return !m_ext; + CallParameters params{_senderAddress, _receiveAddress, _receiveAddress, _gas, _value, _data, {}, {}}; + return call(params, _gasPrice, _senderAddress); } bool Executive::call(CallParameters const& _p, u256 const& _gasPrice, Address const& _origin) diff --git a/libethereum/Executive.h b/libethereum/Executive.h index 6f72d0966..04d5857b3 100644 --- a/libethereum/Executive.h +++ b/libethereum/Executive.h @@ -94,7 +94,7 @@ public: bool create(Address _txSender, u256 _endowment, u256 _gasPrice, u256 _gas, bytesConstRef _code, Address _originAddress); /// Set up the executive for evaluating a bare CALL (message call) operation. /// @returns false iff go() must be called (and thus a VM execution in required). - bool call(Address _myAddress, Address _codeAddress, Address _txSender, u256 _txValue, u256 _gasPrice, bytesConstRef _txData, u256 _gas, Address _originAddress); + bool call(Address _receiveAddress, Address _txSender, u256 _txValue, u256 _gasPrice, bytesConstRef _txData, u256 _gas); bool call(CallParameters const& _cp, u256 const& _gasPrice, Address const& _origin); /// Finalise an operation through accruing the substate into the parent context. void accrueSubState(SubState& _parentContext); diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h index fa25fb12c..0f80e9f59 100644 --- a/test/libsolidity/solidityExecutionFramework.h +++ b/test/libsolidity/solidityExecutionFramework.h @@ -155,7 +155,7 @@ protected: else { BOOST_REQUIRE(m_state.addressHasCode(m_contractAddress)); - BOOST_REQUIRE(!executive.call(m_contractAddress, m_contractAddress, m_sender, _value, m_gasPrice, &_data, m_gas, m_sender)); + BOOST_REQUIRE(!executive.call(m_contractAddress, m_sender, _value, m_gasPrice, &_data, m_gas)); } BOOST_REQUIRE(executive.go()); m_state.noteSending(m_sender);