Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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: [#5663](https://github.com/ethereum/aleth/pull/5663) Behavior in corner case tests about touching empty Precompiles now agrees with geth's results.


## [1.6.0] - 2019-04-16
Expand Down
7 changes: 6 additions & 1 deletion libethereum/Account.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class Account
bool isAlive() const { return m_isAlive; }

/// @returns true if the account is unchanged from creation.
bool isDirty() const { return !m_isUnchanged; }
bool isDirty() const { return !m_isUnchanged || m_isUnrevertablyTouched; }

void unrevertableTouch() { m_isUnrevertablyTouched = true; }

void untouch() { m_isUnchanged = true; }

Expand Down Expand Up @@ -206,6 +208,9 @@ class Account
/// True if we've not made any alteration to the account having been given it's properties directly.
bool m_isUnchanged = false;

/// True if account's touch status shouldn't be rolled back in case of revert
bool m_isUnrevertablyTouched = false;

/// True if new code was deployed to the account
bool m_hasNewCode = false;

Expand Down
20 changes: 12 additions & 8 deletions libethereum/Executive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ using namespace dev::eth;

namespace
{
Address const c_RipemdPrecompiledAddress{0x03};

std::string dumpStackAndMemory(LegacyVM const& _vm)
{
ostringstream o;
Expand Down Expand Up @@ -304,19 +306,21 @@ bool Executive::call(CallParameters const& _p, u256 const& _gasPrice, Address co

if (m_sealEngine.isPrecompiled(_p.codeAddress, m_envInfo.number()))
{
// Empty RIPEMD contract needs to be deleted even in case of OOG
// because of the anomaly on the main net caused by buggy behavior by both Geth and Parity
// https://github.com/ethereum/go-ethereum/pull/3341/files#diff-2433aa143ee4772026454b8abd76b9dd
// https://github.com/ethereum/EIPs/issues/716
// https://github.com/ethereum/aleth/pull/5663
// We mark the account as touched here, so that is can be removed among other touched empty
// accounts (after tx finalization)
if (_p.receiveAddress == c_RipemdPrecompiledAddress)
m_s.unrevertableTouch(_p.codeAddress);

bigint g = m_sealEngine.costOfPrecompiled(_p.codeAddress, _p.data, m_envInfo.number());
if (_p.gas < g)
{
m_excepted = TransactionException::OutOfGasBase;
// Bail from exception.

// Empty precompiled contracts need to be deleted even in case of OOG
// because the bug in both Geth and Parity led to deleting RIPEMD precompiled in this case
// see https://github.com/ethereum/go-ethereum/pull/3341/files#diff-2433aa143ee4772026454b8abd76b9dd
// We mark the account as touched here, so that is can be removed among other touched empty accounts (after tx finalization)
if (m_envInfo.number() >= m_sealEngine.chainParams().EIP158ForkBlock)
m_s.addBalance(_p.codeAddress, 0);

return true; // true actually means "all finished - nothing more to be done regarding go().
}
else
Expand Down
6 changes: 6 additions & 0 deletions libethereum/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,12 @@ u256 State::version(Address const& _a) const
return a ? a->version() : 0;
}

void State::unrevertableTouch(Address const& _address)
{
if (Account* a = account(_address))
a->unrevertableTouch();
}

size_t State::savepoint() const
{
return m_changeLog.size();
Expand Down
3 changes: 3 additions & 0 deletions libethereum/State.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ class State
u256 const& requireAccountStartNonce() const;
void noteAccountStartNonce(u256 const& _actual);

/// Mark account as touched and keep it touched even in case of rollback
void unrevertableTouch(Address const& _addr);

/// Create a savepoint in the state changelog.
/// @return The savepoint index that can be used in rollback() function.
size_t savepoint() const;
Expand Down
2 changes: 1 addition & 1 deletion test/jsontests
Submodule jsontests updated 6291 files