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

Commit

Permalink
Merge pull request #5655 from chrisjgf/paranoia-removal
Browse files Browse the repository at this point in the history
Removed PARANOID build option (#5631)
  • Loading branch information
chfast authored Jul 9, 2019
2 parents 85229da + 4417642 commit 007d89a
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 111 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Changed: [#5605](https://github.com/ethereum/aleth/pull/5605) Network logging bugfixes and improvements and add warpcap log channel.
- Changed: [#5628](https://github.com/ethereum/aleth/pull/5628) Don't try to endlessly reconnect to official Ethereum bootnodes.
- Changed: [#5632](https://github.com/ethereum/aleth/pull/5632) RocksDB support is disabled by default. Enable with `-DROCKSB=ON` CMake option.
- Removed: [#5631](https://github.com/ethereum/aleth/pull/5631) Removed PARANOID build option.
- Fixed: [#5562](https://github.com/ethereum/aleth/pull/5562) Don't send header request messages to peers that haven't sent us Status yet.
- Fixed: [#5581](https://github.com/ethereum/aleth/pull/5581) Fixed finding neighbour nodes in Discovery.
- Fixed: [#5599](https://github.com/ethereum/aleth/pull/5600) Prevent aleth from attempting concurrent connection to node which results in disconnect of original connection.
Expand Down
13 changes: 0 additions & 13 deletions cmake/EthOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ macro(configure_project)
# Features:
option(EVM_OPTIMIZE "Enable VM optimizations (can distort tracing)" ON)
option(FATDB "Enable fat state database" ON)
option(PARANOID "Enable additional checks when validating transactions (deprecated)" OFF)
option(MINIUPNPC "Build with UPnP support" OFF)
option(FASTCTEST "Enable fast ctest" OFF)
option(ROCKSDB "Build with rocksdb as optional database implementation" OFF)
Expand All @@ -24,24 +23,13 @@ macro(configure_project)
# components
option(TESTS "Build with tests" ON)
option(TOOLS "Build additional tools" ON)
# Resolve any clashes between incompatible options.
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if (PARANOID)
message(WARNING "Paranoia requires debug - disabling for release build.")
set(PARANOID OFF)
endif ()
endif ()

# FATDB is an option to include the reverse hashes for the trie,
# i.e. it allows you to iterate over the contents of the state.
if (FATDB)
add_definitions(-DETH_FATDB)
endif ()

if (PARANOID)
add_definitions(-DETH_PARANOIA)
endif ()

# CI Builds should provide (for user builds this is totally optional)
# -DBUILD_NUMBER - A number to identify the current build with. Becomes TWEAK component of project version.
# -DVERSION_SUFFIX - A string to append to the end of the version string where applicable.
Expand Down Expand Up @@ -73,7 +61,6 @@ macro(print_config)
message("-- EVM_OPTIMIZE Enable VM optimizations ${EVM_OPTIMIZE}")
message("-- FATDB Full database exploring ${FATDB}")
message("-- ROCKSDB RocksDB as optional DB implementation ${ROCKSDB}")
message("-- PARANOID - ${PARANOID}")
message("-- MINIUPNPC - ${MINIUPNPC}")
message("------------------------------------------------------------- components")
message("-- TESTS Build tests ${TESTS}")
Expand Down
4 changes: 0 additions & 4 deletions libdevcore/OverlayDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ bool OverlayDB::exists(h256 const& _h) const

void OverlayDB::kill(h256 const& _h)
{
#if ETH_PARANOIA || 1
if (!StateCacheDB::kill(_h))
{
if (m_db)
Expand All @@ -157,9 +156,6 @@ void OverlayDB::kill(h256 const& _h)
}
}
}
#else
StateCacheDB::kill(_h);
#endif
}

}
16 changes: 0 additions & 16 deletions libdevcore/StateCacheDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ void StateCacheDB::insert(h256 const& _h, bytesConstRef _v)
}
else
m_main[_h] = make_pair(_v.toString(), 1);
#if ETH_PARANOIA
cdebug << "INST" << _h << "=>" << m_main[_h].second;
#endif
}

bool StateCacheDB::kill(h256 const& _h)
Expand All @@ -106,19 +103,6 @@ bool StateCacheDB::kill(h256 const& _h)
m_main[_h].second--;
return true;
}
#if ETH_PARANOIA
else
{
// If we get to this point, then there was probably a node in the level DB which we need to remove and which we have previously
// used as part of the memory-based StateCacheDB. Nothing to be worried about *as long as the node exists in the DB*.
cdebug << "NOKILL-WAS" << _h;
}
cdebug << "KILL" << _h << "=>" << m_main[_h].second;
}
else
{
cdebug << "NOKILL" << _h;
#endif
}
return false;
}
Expand Down
18 changes: 0 additions & 18 deletions libdevcore/TrieDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,17 +553,8 @@ template <class DB> void GenericTrieDB<DB>::iterator::next(NibbleSlice _key)
}
if (!rlp.isList() || (rlp.itemCount() != 2 && rlp.itemCount() != 17))
{
#if ETH_PARANOIA
cwarn << "BIG FAT ERROR. STATE TRIE CORRUPTED!!!!!";
cwarn << b.rlp.size() << toHex(b.rlp);
cwarn << rlp;
auto c = rlp.itemCount();
cwarn << c;
BOOST_THROW_EXCEPTION(InvalidTrie());
#else
m_that = nullptr;
return;
#endif
}
if (rlp.itemCount() == 2)
{
Expand Down Expand Up @@ -688,17 +679,8 @@ template <class DB> void GenericTrieDB<DB>::iterator::next()
}
if (!(rlp.isList() && (rlp.itemCount() == 2 || rlp.itemCount() == 17)))
{
#if ETH_PARANOIA
cwarn << "BIG FAT ERROR. STATE TRIE CORRUPTED!!!!!";
cwarn << b.rlp.size() << toHex(b.rlp);
cwarn << rlp;
auto c = rlp.itemCount();
cwarn << c;
BOOST_THROW_EXCEPTION(InvalidTrie());
#else
m_that = nullptr;
return;
#endif
}
if (rlp.itemCount() == 2)
{
Expand Down
24 changes: 0 additions & 24 deletions libethereum/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,30 +207,6 @@ bool Block::sync(BlockChain const& _bc, h256 const& _block, BlockHeader const& _
bool ret = false;
// BLOCK
BlockHeader bi = _bi ? _bi : _bc.info(_block);
#if ETH_PARANOIA
if (!bi)
while (1)
{
try
{
auto b = _bc.block(_block);
bi.populate(b);
break;
}
catch (Exception const& _e)
{
// TODO: Slightly nicer handling? :-)
cerr << "ERROR: Corrupt block-chain! Delete your block-chain DB and restart." << endl;
cerr << diagnostic_information(_e) << endl;
}
catch (std::exception const& _e)
{
// TODO: Slightly nicer handling? :-)
cerr << "ERROR: Corrupt block-chain! Delete your block-chain DB and restart." << endl;
cerr << _e.what() << endl;
}
}
#endif
if (bi == m_currentBlock)
{
// We mined the last block.
Expand Down
36 changes: 0 additions & 36 deletions libethereum/BlockChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ unsigned BlockChain::open(fs::path const& _path, WithExisting _we)
assert(isKnown(gb.hash()));
}

#if ETH_PARANOIA
checkConsistency();
#endif

// TODO: Implement ability to rebuild details map from DB.
auto const l = m_extrasDB->lookup(db::Slice("best"));
m_lastBlockHash = l.empty() ? m_genesisHash : h256(l, h256::FromBinary);
Expand Down Expand Up @@ -706,10 +702,6 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
td = pd.totalDifficulty + tdIncrease;

performanceLogger.onStageFinished("enactment");

#if ETH_PARANOIA
checkConsistency();
#endif // ETH_PARANOIA
}
catch (BadRoot& ex)
{
Expand Down Expand Up @@ -919,30 +911,6 @@ ImportRoute BlockChain::insertBlockAndExtras(VerifiedBlockRef const& _block, byt
cwarn << "Fail writing to extras database. Bombing out.";
exit(-1);
}

#if ETH_PARANOIA
if (isKnown(_block.info.hash()) && !details(_block.info.hash()))
{
LOG(m_loggerError) << "Known block just inserted has no details.";
LOG(m_loggerError) << "Block: " << _block.info;
LOG(m_loggerError) << "DATABASE CORRUPTION: CRITICAL FAILURE";
exit(-1);
}

try
{
State canary(_db, BaseState::Empty);
canary.populateFromChain(*this, _block.info.hash());
}
catch (...)
{
LOG(m_loggerError) << "Failed to initialise State object form imported block.";
LOG(m_loggerError) << "Block: " << _block.info;
LOG(m_loggerError) << "DATABASE CORRUPTION: CRITICAL FAILURE";
exit(-1);
}
#endif // ETH_PARANOIA

if (m_lastBlockHash != newLastBlockHash)
DEV_WRITE_GUARDED(x_lastBlockHash)
{
Expand All @@ -962,10 +930,6 @@ ImportRoute BlockChain::insertBlockAndExtras(VerifiedBlockRef const& _block, byt
}
}

#if ETH_PARANOIA
checkConsistency();
#endif // ETH_PARANOIA

_performanceLogger.onStageFinished("checkBest");

unsigned const gasPerSecond = static_cast<double>(_block.info.gasUsed()) / _performanceLogger.stageDuration("enactment");
Expand Down

0 comments on commit 007d89a

Please sign in to comment.