diff --git a/README.md b/README.md index 82655d32c..63a1c4801 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,15 @@ If you have already cloned the repo and forgot to pass `--recurse-submodules`, e ``` sudo apt update -sudo apt install autoconf build-essential cmake libprocps-dev libtool texinfo wget yasm flex bison btrfs-progs +sudo apt install autoconf build-essential cmake libprocps-dev libtool texinfo wget yasm flex bison btrfs-progs python python3-pip gawk git vim doxygen sudo apt install make build-essential cmake pkg-config libgnutls28-dev libssl-dev unzip zlib1g-dev libgcrypt20-dev docker.io gcc-9 g++-9 gperf clang-format-11 gnutls-dev +sudo apt install nettle-dev libhiredis-dev redis-server google-perftools libgoogle-perftools-dev lcov ``` -NB cmake needs to be of version >=3.31, git of version >=2.18 + + + +NB cmake needs to be of version >=3.21, git of version >=2.18 ### (for Ubuntu 20.10 or later) Set gcc-9 as default compiler ``` @@ -74,14 +78,15 @@ sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-to gcc --version ``` -### Build dependencies +# Install latest cmake ``` -cd deps -./build.sh +sudo apt-get purge cmake +sudo snap install cmake --classic ``` -or, if you want to build debug version of skaled + +### Build dependencies ``` cd deps @@ -107,8 +112,6 @@ cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug cmake --build build -- -j$(nproc) ``` -Note: Currently only Debug build is supported. - ## Testing diff --git a/deps/build.sh b/deps/build.sh index f8a184049..16f35d527 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -932,13 +932,8 @@ then cd "$SOURCES_ROOT" if [ ! -d "libiconv-1.15" ]; then - if [ ! -f "libiconv-1.15.tar.gz" ]; - then - echo -e "${COLOR_INFO}downloading it${COLOR_DOTS}...${COLOR_RESET}" - eval "$WGET" --no-check-certificate https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz - fi echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}" - eval tar -xzf libiconv-1.15.tar.gz + eval tar -xzf "$PREDOWNLOADED_ROOT/libiconv-1.15.tar.gz" echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" cd libiconv-1.15 eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" --enable-static --disable-shared --prefix="$INSTALL_ROOT" "${CONF_DEBUG_OPTIONS}" diff --git a/deps/pre_downloaded/libiconv-1.15.tar.gz b/deps/pre_downloaded/libiconv-1.15.tar.gz new file mode 100644 index 000000000..abdb6a4f1 Binary files /dev/null and b/deps/pre_downloaded/libiconv-1.15.tar.gz differ diff --git a/libdevcore/LevelDB.cpp b/libdevcore/LevelDB.cpp index 5b29b04f3..2a67bc5ea 100644 --- a/libdevcore/LevelDB.cpp +++ b/libdevcore/LevelDB.cpp @@ -89,7 +89,7 @@ leveldb::ReadOptions LevelDB::defaultReadOptions() { leveldb::WriteOptions LevelDB::defaultWriteOptions() { leveldb::WriteOptions writeOptions = leveldb::WriteOptions(); - writeOptions.sync = true; + // writeOptions.sync = true; return writeOptions; } diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 8902b8ff0..fcca55c02 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -1263,7 +1263,8 @@ void BlockChain::garbageCollect( bool _force ) { m_lastCollection = chrono::system_clock::now(); - while ( m_lastStats.memTotal() >= c_maxCacheSize ) { + // We subtract memory that blockhashes occupy because it is treated sepaparately + while ( m_lastStats.memTotal() - m_lastStats.memBlockHashes >= c_maxCacheSize ) { Guard l( x_cacheUsage ); for ( CacheID const& id : m_cacheUsage.back() ) { m_inUse.erase( id ); @@ -1316,6 +1317,7 @@ void BlockChain::garbageCollect( bool _force ) { { WriteGuard l( x_blockHashes ); + // This is where block hash memory cleanup is treated // allow only 4096 blockhashes in the cache if ( m_blockHashes.size() > 4096 ) { auto last = m_blockHashes.begin(); diff --git a/libskale/State.cpp b/libskale/State.cpp index 70f32d45f..5bf4433d5 100644 --- a/libskale/State.cpp +++ b/libskale/State.cpp @@ -801,8 +801,19 @@ void State::clearStorage( Address const& _contract ) { for ( auto const& hashPairPair : storage_WITHOUT_LOCK( _contract ) ) { auto const& key = hashPairPair.second.first; auto const& value = hashPairPair.second.first; + // Set storage to zero in state cache clearStorageValue( _contract, key, value ); + // Set storage to zero in the account storage cache + // we have lots of caches, some of them may be unneeded + // will analyze this more in future releases acc->setStorageCache( key, 0 ); + /* The corresponding key/value pair needs to be cleared in database + Inserting ZERO deletes the key during commit + at the end of transaction + see OverlayDB::commitStorageValues() + */ + h256 ZERO( 0 ); + m_db_ptr->insert( _contract, key, ZERO ); } totalStorageUsed_ -= ( accStorageUsed + storageUsage[_contract] );