From 1cdea491fe2dd29e457c13ef63e122a54cd337dc Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Thu, 4 Jul 2019 19:35:06 +0200 Subject: [PATCH 1/2] Change the logic around reverting touched Precompiled contracts to agree with geth. --- libethereum/State.cpp | 17 +++++++++++++++-- test/jsontests | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index 3a9f8e4d91a..6fb9519984c 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -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), @@ -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(); diff --git a/test/jsontests b/test/jsontests index 5018b8f30e9..7da7d745b3c 160000 --- a/test/jsontests +++ b/test/jsontests @@ -1 +1 @@ -Subproject commit 5018b8f30e9e57a0d136ed40bc6ceab51b61e144 +Subproject commit 7da7d745b3cf0dbd944cf909a68bda293e6143c3 From a5a73ff883b4bfa7430e28a1ef1ba8bcc12f1036 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Tue, 9 Jul 2019 17:54:59 +0200 Subject: [PATCH 2/2] Add changelog item. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 380cfa42220..9d1c5ab7ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - Fixed: [#5627](https://github.com/ethereum/aleth/pull/5627) Correct testeth --help log output indentation. - Fixed: [#5644](https://github.com/ethereum/aleth/pull/5644) Avoid attempting to sync with disconnected peers. - Fixed: [#5647](https://github.com/ethereum/aleth/pull/5647) test_importRawBlock RPC method correctly fails in case of import failure. +- Fixed: [#5652](https://github.com/ethereum/aleth/pull/5652) Behavior in corner case tests about touching empty Precompiles now agrees with geth's results. ## [1.6.0] - 2019-04-16