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

Commit

Permalink
Change the logic around reverting touched Precompiled contracts to ag…
Browse files Browse the repository at this point in the history
…ree with geth.
  • Loading branch information
gumb0 committed Jul 9, 2019
1 parent fe75b95 commit 1cdea49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions libethereum/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ using namespace dev;
using namespace dev::eth;
namespace fs = boost::filesystem;

namespace
{
Address const c_RipemdPrecompiledAddress{0x03};
}

State::State(u256 const& _accountStartNonce, OverlayDB const& _db, BaseState _bs):
m_db(_db),
m_state(&m_db),
Expand Down Expand Up @@ -589,8 +594,16 @@ void State::rollback(size_t _savepoint)
account.resetCode();
break;
case Change::Touch:
account.untouch();
m_unchangedCacheEntries.emplace_back(change.address);
// Empty RIPEMD contract needs to be deleted even in case of exception.
// This doesn't affect main net, but is needed for some consensus tests.
// https://github.com/ethereum/go-ethereum/pull/3341/files#diff-2433aa143ee4772026454b8abd76b9dd
// https://github.com/ethereum/EIPs/issues/716
// https://github.com/ethereum/aleth/pull/5652
if (change.address != c_RipemdPrecompiledAddress)
{
account.untouch();
m_unchangedCacheEntries.emplace_back(change.address);
}
break;
}
m_changeLog.pop_back();
Expand Down
2 changes: 1 addition & 1 deletion test/jsontests
Submodule jsontests updated 6291 files

0 comments on commit 1cdea49

Please sign in to comment.