Rename gas constants in ExecutionFramework

This commit is contained in:
Kamil Śliwak 2021-11-15 14:42:10 +01:00
parent 077b3a003d
commit f42180ef06
3 changed files with 7 additions and 6 deletions

View File

@ -182,7 +182,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
message.kind = EVMC_CALL; message.kind = EVMC_CALL;
message.destination = EVMHost::convertToEVMC(m_contractAddress); message.destination = EVMHost::convertToEVMC(m_contractAddress);
} }
message.gas = m_gas.convert_to<int64_t>(); message.gas = InitialGas.convert_to<int64_t>();
evmc::result result = m_evmcHost->call(message); evmc::result result = m_evmcHost->call(message);
@ -190,7 +190,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
if (_isCreation) if (_isCreation)
m_contractAddress = EVMHost::convertFromEVMC(result.create_address); m_contractAddress = EVMHost::convertFromEVMC(result.create_address);
m_gasUsed = m_gas - result.gas_left; m_gasUsed = InitialGas - result.gas_left;
m_transactionSuccessful = (result.status_code == EVMC_SUCCESS); m_transactionSuccessful = (result.status_code == EVMC_SUCCESS);
if (m_showMessages) if (m_showMessages)
@ -216,7 +216,7 @@ void ExecutionFramework::sendEther(h160 const& _addr, u256 const& _amount)
message.value = EVMHost::convertToEVMC(_amount); message.value = EVMHost::convertToEVMC(_amount);
message.kind = EVMC_CALL; message.kind = EVMC_CALL;
message.destination = EVMHost::convertToEVMC(_addr); message.destination = EVMHost::convertToEVMC(_addr);
message.gas = m_gas.convert_to<int64_t>(); message.gas = InitialGas.convert_to<int64_t>();
m_evmcHost->call(message); m_evmcHost->call(message);
} }

View File

@ -273,6 +273,9 @@ private:
} }
protected: protected:
u256 const GasPrice = 10 * gwei;
u256 const InitialGas = 100000000;
void selectVM(evmc_capabilities _cap = evmc_capabilities::EVMC_CAPABILITY_EVM1); void selectVM(evmc_capabilities _cap = evmc_capabilities::EVMC_CAPABILITY_EVM1);
void reset(); void reset();
@ -302,8 +305,6 @@ protected:
bool m_transactionSuccessful = true; bool m_transactionSuccessful = true;
util::h160 m_sender = account(0); util::h160 m_sender = account(0);
util::h160 m_contractAddress; util::h160 m_contractAddress;
u256 const m_gasPrice = 10 * gwei;
u256 const m_gas = 100000000;
bytes m_output; bytes m_output;
u256 m_gasUsed; u256 m_gasUsed;
}; };

View File

@ -571,7 +571,7 @@ bool SemanticTest::checkGasCostExpectation(TestFunctionCall& io_test, bool _comp
if ( if (
!m_enforceGasCost || !m_enforceGasCost ||
m_gasUsed < m_enforceGasCostMinValue || m_gasUsed < m_enforceGasCostMinValue ||
m_gasUsed >= m_gas || m_gasUsed >= InitialGas ||
(setting == "ir" && io_test.call().expectations.gasUsed.count(setting) == 0) || (setting == "ir" && io_test.call().expectations.gasUsed.count(setting) == 0) ||
io_test.call().kind == FunctionCall::Kind::Builtin io_test.call().kind == FunctionCall::Kind::Builtin
) )