Skip to content

Commit

Permalink
Merge pull request #2923 from Taraxa-project/fix-problematic-trxs
Browse files Browse the repository at this point in the history
fix(storage): fix problematic trx in storage berfore HF happens
  • Loading branch information
MatusKysel authored Jan 9, 2025
2 parents 4fef314 + b67db00 commit ee235d9
Show file tree
Hide file tree
Showing 43 changed files with 195 additions and 381 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(TARAXA_PATCH_VERSION 1)
set(TARAXA_VERSION ${TARAXA_MAJOR_VERSION}.${TARAXA_MINOR_VERSION}.${TARAXA_PATCH_VERSION})

# Any time a change in the network protocol is introduced this version should be increased
set(TARAXA_NET_VERSION 5)
set(TARAXA_NET_VERSION 4)
# Major version is modified when DAG blocks, pbft blocks and any basic building blocks of our blockchain is modified
# in the db
set(TARAXA_DB_MAJOR_VERSION 1)
Expand Down
174 changes: 10 additions & 164 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ will build out of the box without further effort:
autoconf \
ccache \
cmake \
clang \
clang-format-17 \
clang-tidy-17 \
llvm-17 \
golang-go \
python3-full \
# this libs are required for arm build by go part. you can skip it for amd64 build
libzstd-dev \
libsnappy-dev \
rapidjson-dev \
Expand All @@ -47,7 +47,7 @@ will build out of the box without further effort:

### Clone the Repository

git clone https://github.com/Taraxa-project/taraxa-node.git --branch testnet
git clone https://github.com/Taraxa-project/taraxa-node.git
cd taraxa-node
git submodule update --init --recursive

Expand All @@ -62,180 +62,26 @@ will build out of the box without further effort:
&& conan profile update settings.compiler.libcxx=libstdc++11 clang \
&& conan profile update settings.build_type=RelWithDebInfo clang \
&& conan profile update env.CC=clang-17 clang \
&& conan profile update env.CXX=clang++-17 clang \
&& conan install --build missing -pr=clang .
&& conan profile update env.CXX=clang++-17 clang

# Compile project using cmake
mkdir cmake-build
cd cmake-build
cmake -DCONAN_PROFILE=clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTARAXA_ENABLE_LTO=OFF -DTARAXA_STATIC_BUILD=OFF ../
make -j$(nproc)

## Building on Ubuntu 22.04
For Ubuntu 22.04 users, after installing the right packages with `apt` taraxa-node
will build out of the box without further effort:

### Install taraxa-node dependencies:

# Required packages
sudo apt-get install -y \
libtool \
autoconf \
ccache \
cmake \
clang-format-14 \
clang-tidy-14 \
golang-go \
python3-pip \
# this libs are required for arm build by go part. you can skip it for amd64 build
libzstd-dev \
libsnappy-dev \
rapidjson-dev \
libgmp-dev \
libmpfr-dev \
libmicrohttpd-dev

# Optional. Needed to run py_test. This won't install on arm64 OS because package is missing in apt
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt install solc

# Install conan package manager
sudo python3 -m pip install conan==1.64.1

# Setup clang as default compiler either in your IDE or by env. variables"
export CC="clang-14"
export CXX="clang++-14"

### Clone the Repository

git clone https://github.com/Taraxa-project/taraxa-node.git --branch testnet
cd taraxa-node
git submodule update --init --recursive

### Compile

# Optional - one time action
# Create clang profile
# It is recommended to use clang because on other compilers you could face some errors
conan profile new clang --detect && \
conan profile update settings.compiler=clang clang && \
conan profile update settings.compiler.version=14 clang && \
conan profile update settings.compiler.libcxx=libstdc++11 clang && \
conan profile update env.CC=clang-14 clang && \
conan profile update env.CXX=clang++-14 clang

# Export needed var for conan
export CONAN_REVISIONS_ENABLED=1

# Compile project using cmake
mkdir cmake-build
cd cmake-build
cmake -DCONAN_PROFILE=clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTARAXA_ENABLE_LTO=OFF -DTARAXA_STATIC_BUILD=OFF ../
make -j$(nproc)

## Building on Ubuntu 20.04
For Ubuntu 20.04 users, after installing the right packages with `apt` taraxa-node
will build out of the box without further effort:

### Install taraxa-node dependencies:

# Required packages
sudo apt-get install -y \
libtool \
autoconf \
ccache cmake gcc g++ clang-format clang-tidy cppcheck \
libgflags-dev\
libjsoncpp-dev \
libjsonrpccpp-dev \
python3-pip \
rapidjson-dev \
libgmp-dev \
libmpfr-dev \
libmicrohttpd-dev


# Install conan package manager
# >= 1.36.0 version is required to work properly with clang-14
sudo python3 -m pip install conan==1.60.0

# Install cmake
# >= 3.20 version is required for JSON subcommand
# Setup your IDE accordingly to use this version
sudo python3 -m pip install cmake

# Go (required)
curl -LO https://go.dev/dl/go1.22.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz
rm -rf go1.22.2.linux-amd64.tar.gz

# Add go to PATH
# Add these env. variables to the ~/.profile to persist go settings even after restart
export GOROOT=/usr/local/go
export GOPATH=$HOME/.go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

# Optional
# We are using clang from llvm toolchain as default compiler as well as clang-format and clang-tidy
# It is possible to build taraxa-node also with other C++ compilers but to contribute to the official repo,
# changes must pass clang-format/clang-tidy checks for which we internally use llvm version=13
# To install llvm:
sudo su

curl -SL -o llvm.sh https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh 14 && \
apt-get install -y clang-format-14 clang-tidy-14 && \
rm -f llvm.sh

# Setup clang as default compiler either in your IDE or by env. variables"
export CC="clang-14"
export CXX="clang++-14"

### Clone the Repository

git clone https://github.com/Taraxa-project/taraxa-node.git --branch testnet
cd taraxa-node
git submodule update --init --recursive

### Compile

# Optional - one time action
# Create clang profile
# It is recommended to use clang because on other compilers you could face some errors
conan profile new clang --detect && \
conan profile update settings.compiler=clang clang && \
conan profile update settings.compiler.version=14 clang && \
conan profile update settings.compiler.libcxx=libstdc++11 clang && \
conan profile update env.CC=clang-14 clang && \
conan profile update env.CXX=clang++-14 clang

# Export needed var for conan
export CONAN_REVISIONS_ENABLED=1

# Compile project using cmake
mkdir cmake-build
cd cmake-build
cmake -DCONAN_PROFILE=clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTARAXA_ENABLE_LTO=OFF -DTARAXA_STATIC_BUILD=OFF ../
make -j$(nproc)

And optional:

# optional
make install # defaults to /usr/local

## Building on MacOS

### Install taraxa-node dependencies:

First you need to get (Brew)[https://brew.sh/] package manager. After that you need tot install dependencies with it. Clang-14 is used for compilation.
First you need to get (Brew)[https://brew.sh/] package manager. After that you need tot install dependencies with it. Clang-17 is used for compilation.

brew update
brew install coreutils go autoconf automake gflags git libtool llvm@14 make pkg-config cmake conan snappy zstd rapidjson gmp mpfr libmicrohttpd
brew install coreutils go autoconf automake gflags git libtool llvm@17 make pkg-config cmake conan snappy zstd rapidjson gmp mpfr libmicrohttpd

### Clone the Repository

git clone https://github.com/Taraxa-project/taraxa-node.git --branch testnet
git clone https://github.com/Taraxa-project/taraxa-node.git
cd taraxa-node
git submodule update --init --recursive

Expand All @@ -245,8 +91,8 @@ First you need to get (Brew)[https://brew.sh/] package manager. After that you n
# It is recommended to use clang because on other compilers you could face some errors
conan profile new clang --detect && \
conan profile update settings.compiler=clang clang && \
conan profile update settings.compiler.version=14 clang && \
conan profile update settings.compiler.compiler.cppstd=14
conan profile update settings.compiler.version=17 clang && \
conan profile update settings.compiler.compiler.cppstd=17
conan profile update settings.compiler.libcxx=libc++ clang && \
conan profile update env.CC=clang clang && \
conan profile update env.CXX=clang++ clang
Expand Down Expand Up @@ -304,7 +150,7 @@ You should be able to build project following default MacOS building process. Bu

### Clone the Repository

git clone https://github.com/Taraxa-project/taraxa-node.git --branch testnet
git clone https://github.com/Taraxa-project/taraxa-node.git
cd taraxa-node
git submodule update --init --recursive

Expand All @@ -316,7 +162,7 @@ You should be able to build project following default MacOS building process. Bu
# It output should be equal to `i386`
conan profile new clang --detect && \
conan profile update settings.compiler=clang clang && \
conan profile update settings.compiler.version=14 clang && \
conan profile update settings.compiler.version=17 clang && \
conan profile update settings.compiler.libcxx=libc++ clang && \
conan profile update env.CC=/usr/local/opt/llvm/bin/clang clang && \
conan profile update env.CXX=/usr/local/opt/llvm/bin/clang++ clang
Expand Down
2 changes: 1 addition & 1 deletion libraries/common/include/common/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ constexpr uint32_t kDefaultTransactionPoolSize{200000};
constexpr uint32_t kMaxNonFinalizedTransactions{1000000};
constexpr uint32_t kMaxNonFinalizedDagBlocks{100};

const size_t kV4NetworkVersion = 4;
const size_t kV3NetworkVersion = 3;

const uint32_t kRecentlyFinalizedTransactionsFactor = 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FinalChain;

} // namespace taraxa

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

class ExtPillarVotePacketHandler : public PacketHandler {
public:
Expand All @@ -32,4 +32,4 @@ class ExtPillarVotePacketHandler : public PacketHandler {
std::shared_ptr<pillar_chain::PillarChainManager> pillar_chain_manager_;
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace taraxa::network::tarcap {
class PbftSyncingState;
}

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

/**
* @brief ExtSyncingPacketHandler is extended abstract PacketHandler with added functions that are used in packet
Expand Down Expand Up @@ -63,4 +63,4 @@ class ExtSyncingPacketHandler : public PacketHandler {
std::shared_ptr<DbStorage> db_{nullptr};
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class VoteManager;
class SlashingManager;
} // namespace taraxa

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

/**
* @brief ExtVotesPacketHandler is extended abstract PacketHandler with added functions that are used in packet
Expand Down Expand Up @@ -88,4 +88,4 @@ class ExtVotesPacketHandler : public PacketHandler {
std::shared_ptr<SlashingManager> slashing_manager_;
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "network/tarcap/taraxa_peer.hpp"
#include "network/threadpool/packet_data.hpp"

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

// class TimePeriodPacketsStats;

Expand Down Expand Up @@ -83,4 +83,4 @@ class PacketHandler : public BasePacketHandler {
LOG_OBJECTS_DEFINE
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace taraxa {
class TransactionManager;
} // namespace taraxa

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

class DagBlockPacketHandler : public ExtSyncingPacketHandler {
public:
Expand Down Expand Up @@ -34,4 +34,4 @@ class DagBlockPacketHandler : public ExtSyncingPacketHandler {
std::shared_ptr<TransactionManager> trx_mgr_{nullptr};
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace taraxa {
class TransactionManager;
} // namespace taraxa

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

class DagSyncPacketHandler : public ExtSyncingPacketHandler {
public:
Expand All @@ -28,4 +28,4 @@ class DagSyncPacketHandler : public ExtSyncingPacketHandler {
std::shared_ptr<TransactionManager> trx_mgr_{nullptr};
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DbStorage;
class TransactionManager;
} // namespace taraxa

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

class GetDagSyncPacketHandler : public PacketHandler {
public:
Expand All @@ -35,4 +35,4 @@ class GetDagSyncPacketHandler : public PacketHandler {
std::shared_ptr<DbStorage> db_;
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PbftManager;
class VoteManager;
} // namespace taraxa

namespace taraxa::network::tarcap::v4 {
namespace taraxa::network::tarcap::v3 {

class GetNextVotesBundlePacketHandler : public ExtVotesPacketHandler {
public:
Expand All @@ -26,4 +26,4 @@ class GetNextVotesBundlePacketHandler : public ExtVotesPacketHandler {
virtual void process(const threadpool::PacketData& packet_data, const std::shared_ptr<TaraxaPeer>& peer) override;
};

} // namespace taraxa::network::tarcap::v4
} // namespace taraxa::network::tarcap::v3
Loading

0 comments on commit ee235d9

Please sign in to comment.