Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Simplify LegacyVM's SUICIDE logic
Browse files Browse the repository at this point in the history
  • Loading branch information
halfalicious committed Aug 28, 2019
1 parent 1aad58d commit e18ecad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion libethcore/EVMSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct EVMSchedule
boost::optional<u256> blockRewardOverwrite;

bool staticCallDepthLimit() const { return !eip150Mode; }
bool suicideChargesNewAccountGas() const { return eip150Mode; }
bool emptinessIsNonexistence() const { return eip158Mode; }
bool zeroValueTransferChargesNewAccountGas() const { return !eip158Mode; }
};
Expand Down
12 changes: 6 additions & 6 deletions libevm/LegacyVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ void LegacyVM::interpretCases()
// Starting with EIP150, self-destructs need to pay both gas cost and account creation
// gas cost. Starting with EIP158, 0-value self-destructs don't need to pay this account
// creation cost.
if (m_schedule->zeroValueTransferChargesNewAccountGas() ||
m_schedule->suicideChargesNewAccountGas())
if (m_schedule->zeroValueTransferChargesNewAccountGas() ||
m_ext->balance(m_ext->myAddress) > 0)
if (m_schedule->suicideChargesNewAccountGas() && !m_ext->exists(dest))
m_runGas += m_schedule->callNewAccountGas;
if (m_schedule->eip150Mode &&
(!m_schedule->eip158Mode || m_ext->balance(m_ext->myAddress) > 0))
{
if (!m_ext->exists(dest))
m_runGas += m_schedule->callNewAccountGas;
}

updateIOGas();
m_ext->suicide(dest);
Expand Down

0 comments on commit e18ecad

Please sign in to comment.