mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
test: Support tracking gas refunds
This commit is contained in:
parent
77a9f8ac43
commit
5a35c50d16
@ -192,7 +192,11 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
|
||||
if (_isCreation)
|
||||
m_contractAddress = EVMHost::convertFromEVMC(result.create_address);
|
||||
|
||||
m_gasUsed = InitialGas - result.gas_left;
|
||||
unsigned const refundRatio = (m_evmVersion >= langutil::EVMVersion::london() ? 5 : 2);
|
||||
auto const totalGasUsed = InitialGas - result.gas_left;
|
||||
auto const gasRefund = min(u256(result.gas_refund), totalGasUsed / refundRatio);
|
||||
|
||||
m_gasUsed = totalGasUsed - gasRefund;
|
||||
m_transactionSuccessful = (result.status_code == EVMC_SUCCESS);
|
||||
|
||||
if (m_showMessages)
|
||||
@ -200,6 +204,9 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
|
||||
cout << " out: " << util::toHex(m_output) << endl;
|
||||
cout << " result: " << static_cast<size_t>(result.status_code) << endl;
|
||||
cout << " gas used: " << m_gasUsed.str() << endl;
|
||||
cout << " gas used (without refund): " << totalGasUsed.str() << endl;
|
||||
cout << " gas refund (total): " << result.gas_refund << endl;
|
||||
cout << " gas refund (bound): " << gasRefund.str() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user