Skip to content

Commit

Permalink
Merge pull request #1667 from skalenetwork/develop
Browse files Browse the repository at this point in the history
Develop to beta
  • Loading branch information
DmytroNazarenko authored Sep 22, 2023
2 parents 270755d + 99d7035 commit 98e5ea5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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
Expand All @@ -107,8 +112,6 @@ cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug
cmake --build build -- -j$(nproc)
```

Note: Currently only Debug build is supported.


## Testing

Expand Down
7 changes: 1 addition & 6 deletions deps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Binary file added deps/pre_downloaded/libiconv-1.15.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion libdevcore/LevelDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion libethereum/BlockChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
Expand Down
11 changes: 11 additions & 0 deletions libskale/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] );
Expand Down

0 comments on commit 98e5ea5

Please sign in to comment.