Skip to content

Commit

Permalink
Merge branch 'develop' into 1672_add_stats_to_selfdestruct
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex authored Sep 26, 2023
2 parents 6860409 + 99d7035 commit e9a4db5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 21 deletions.
21 changes: 12 additions & 9 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 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
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.
4 changes: 2 additions & 2 deletions libdevcore/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ void ExitHandler::exitHandler( int nSignalNo, ExitHandler::exit_code_t ec ) {
s_ec = ec;
}

// indicate failure if signal is not INT or TERM!
if ( s_ec == ec_success && nSignalNo != SIGINT && nSignalNo != SIGTERM )
// indicate failure if signal is not INT or TERM or internal (-1)
if ( s_ec == ec_success && nSignalNo > 0 && nSignalNo != SIGINT && nSignalNo != SIGTERM )
s_ec = ExitHandler::ec_failure;

s_bStop = true;
Expand Down
2 changes: 1 addition & 1 deletion libdevcore/LevelDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ leveldb::ReadOptions LevelDB::defaultReadOptions() {

leveldb::WriteOptions LevelDB::defaultWriteOptions() {
leveldb::WriteOptions writeOptions = leveldb::WriteOptions();
writeOptions.sync = true;
// writeOptions.sync = true;
return writeOptions;
}

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
2 changes: 1 addition & 1 deletion libskutils/include/skutils/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class element : public skutils::ref_retain_release {
element( const char* strSubSystem, const char* strProtocol, const char* strMethod,
int /*nServerIndex*/, int /*ipVer*/ );
virtual ~element();
void stop() const;
void stop();
void setMethod( const char* strMethod ) const;
void setError() const;
double getDurationInSeconds() const;
Expand Down
4 changes: 2 additions & 2 deletions libskutils/src/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ element::element( const char* strSubSystem, const char* strProtocol, const char*
strProtocol_ = "N/A";
if ( strMethod_.empty() )
strMethod_ = g_strMethodNameUnknown;
do_register();
}
element::~element() {
stop();
Expand All @@ -420,12 +419,13 @@ void element::do_unregister() {
queue::getQueueForSubsystem( strSubSystem_.c_str() ).do_unregister( rttElement );
}

void element::stop() const {
void element::stop() {
lock_type lock( mtx() );
if ( isStopped_ )
return;
isStopped_ = true;
tpEnd_ = skutils::stats::clock::now();
do_register();
}

void element::setMethod( const char* strMethod ) const {
Expand Down

0 comments on commit e9a4db5

Please sign in to comment.