From 825d844fc07f08335d35450e38d968c9e0aeb58d Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Tue, 17 Dec 2024 14:17:23 +0100 Subject: [PATCH 1/8] chore: update evm --- submodules/taraxa-evm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/taraxa-evm b/submodules/taraxa-evm index 0e0aef18d2..bbaa08f3cb 160000 --- a/submodules/taraxa-evm +++ b/submodules/taraxa-evm @@ -1 +1 @@ -Subproject commit 0e0aef18d24caa434290c5a70633067894005dc6 +Subproject commit bbaa08f3cb99e7256c7a6b5c6c6d8cc2c8d4d930 From a5b8fa6d174b316e7b576988281da7af9ec90547 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Tue, 17 Dec 2024 14:23:31 +0100 Subject: [PATCH 2/8] update block number --- .../cli/include/cli/config_jsons/mainnet/mainnet_genesis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json b/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json index d01c8ae861..b00f1234d6 100644 --- a/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json +++ b/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json @@ -1655,7 +1655,7 @@ "bridge_contract_address": "0xe126E0BaeAE904b8Cfd619Be1A8667A173b763a1" }, "cornus_hf": { - "block_num": -1, + "block_num": 15276000, "delegation_locking_period": 163459, "dag_gas_limit": "0x1908B100", "pbft_gas_limit": "0x7d2b7500" From 92005e132b3e60c3a96475c1bfe343aa43bf3875 Mon Sep 17 00:00:00 2001 From: mfrankovi Date: Wed, 18 Dec 2024 12:24:41 +0100 Subject: [PATCH 3/8] chore: merge v4 and v5 network version to same version --- CMakeLists.txt | 2 +- libraries/common/include/common/constants.hpp | 2 +- .../common/ext_pillar_vote_packet_handler.hpp | 4 +- .../common/ext_syncing_packet_handler.hpp | 4 +- .../common/ext_votes_packet_handler.hpp | 4 +- .../{v4 => v3}/common/packet_handler.hpp | 4 +- .../{v4 => v3}/dag_block_packet_handler.hpp | 4 +- .../{v4 => v3}/dag_sync_packet_handler.hpp | 4 +- .../get_dag_sync_packet_handler.hpp | 4 +- .../get_next_votes_bundle_packet_handler.hpp | 4 +- .../get_pbft_sync_packet_handler.hpp | 18 ++---- ...get_pillar_votes_bundle_packet_handler.hpp | 4 +- .../{v4 => v3}/pbft_sync_packet_handler.hpp | 16 +----- .../{v4 => v3}/pillar_vote_packet_handler.hpp | 6 +- .../pillar_votes_bundle_packet_handler.hpp | 6 +- .../{v4 => v3}/status_packet_handler.hpp | 4 +- .../{v4 => v3}/transaction_packet_handler.hpp | 4 +- .../{v4 => v3}/vote_packet_handler.hpp | 4 +- .../votes_bundle_packet_handler.hpp | 4 +- libraries/core_libs/network/src/network.cpp | 44 +++++++-------- .../common/ext_bls_sig_packet_handler.cpp | 6 +- .../common/ext_syncing_packet_handler.cpp | 6 +- .../common/ext_votes_packet_handler.cpp | 6 +- .../{v4 => v3}/common/packet_handler.cpp | 6 +- .../{v4 => v3}/dag_block_packet_handler.cpp | 8 +-- .../{v4 => v3}/dag_sync_packet_handler.cpp | 8 +-- .../get_dag_sync_packet_handler.cpp | 6 +- .../get_next_votes_bundle_packet_handler.cpp | 6 +- .../get_pbft_sync_packet_handler.cpp | 22 ++------ ...get_pillar_votes_bundle_packet_handler.cpp | 8 +-- .../{v4 => v3}/pbft_sync_packet_handler.cpp | 43 ++------------ .../{v4 => v3}/pillar_vote_packet_handler.cpp | 6 +- .../pillar_votes_bundle_packet_handler.cpp | 6 +- .../packets_handlers/{v4 => v3}/readme.md | 0 .../{v4 => v3}/status_packet_handler.cpp | 8 +-- .../{v4 => v3}/transaction_packet_handler.cpp | 6 +- .../{v4 => v3}/vote_packet_handler.cpp | 6 +- .../votes_bundle_packet_handler.cpp | 6 +- .../network/src/tarcap/taraxa_capability.cpp | 56 +++++++++---------- 39 files changed, 150 insertions(+), 215 deletions(-) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/common/ext_pillar_vote_packet_handler.hpp (91%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/common/ext_syncing_packet_handler.hpp (96%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/common/ext_votes_packet_handler.hpp (97%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/common/packet_handler.hpp (97%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/dag_block_packet_handler.hpp (95%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/dag_sync_packet_handler.hpp (93%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/get_dag_sync_packet_handler.hpp (94%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/get_next_votes_bundle_packet_handler.hpp (93%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/get_pbft_sync_packet_handler.hpp (82%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/get_pillar_votes_bundle_packet_handler.hpp (93%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/pbft_sync_packet_handler.hpp (92%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/pillar_vote_packet_handler.hpp (87%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/pillar_votes_bundle_packet_handler.hpp (86%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/status_packet_handler.hpp (94%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/transaction_packet_handler.hpp (97%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/vote_packet_handler.hpp (94%) rename libraries/core_libs/network/include/network/tarcap/packets_handlers/{v4 => v3}/votes_bundle_packet_handler.hpp (94%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/common/ext_bls_sig_packet_handler.cpp (90%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/common/ext_syncing_packet_handler.cpp (97%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/common/ext_votes_packet_handler.cpp (98%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/common/packet_handler.cpp (97%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/dag_block_packet_handler.cpp (98%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/dag_sync_packet_handler.cpp (96%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/get_dag_sync_packet_handler.cpp (96%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/get_next_votes_bundle_packet_handler.cpp (96%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/get_pbft_sync_packet_handler.cpp (95%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/get_pillar_votes_bundle_packet_handler.cpp (95%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/pbft_sync_packet_handler.cpp (98%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/pillar_vote_packet_handler.cpp (94%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/pillar_votes_bundle_packet_handler.cpp (92%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/readme.md (100%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/status_packet_handler.cpp (97%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/transaction_packet_handler.cpp (98%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/vote_packet_handler.cpp (97%) rename libraries/core_libs/network/src/tarcap/packets_handlers/{v4 => v3}/votes_bundle_packet_handler.cpp (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f411985bb6..1209bfbfda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/libraries/common/include/common/constants.hpp b/libraries/common/include/common/constants.hpp index 3a60e60d59..aea008f1ac 100644 --- a/libraries/common/include/common/constants.hpp +++ b/libraries/common/include/common/constants.hpp @@ -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; diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_pillar_vote_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_pillar_vote_packet_handler.hpp similarity index 91% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_pillar_vote_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_pillar_vote_packet_handler.hpp index 8dfea03969..bee00ed59f 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_pillar_vote_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_pillar_vote_packet_handler.hpp @@ -16,7 +16,7 @@ class FinalChain; } // namespace taraxa -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class ExtPillarVotePacketHandler : public PacketHandler { public: @@ -32,4 +32,4 @@ class ExtPillarVotePacketHandler : public PacketHandler { std::shared_ptr pillar_chain_manager_; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_syncing_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_syncing_packet_handler.hpp similarity index 96% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_syncing_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_syncing_packet_handler.hpp index 5019670fde..ce8835ed86 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_syncing_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_syncing_packet_handler.hpp @@ -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 @@ -63,4 +63,4 @@ class ExtSyncingPacketHandler : public PacketHandler { std::shared_ptr db_{nullptr}; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.hpp similarity index 97% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.hpp index 40ca24fb90..827315d441 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.hpp @@ -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 @@ -88,4 +88,4 @@ class ExtVotesPacketHandler : public PacketHandler { std::shared_ptr slashing_manager_; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/packet_handler.hpp similarity index 97% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/packet_handler.hpp index cf33bb23b2..6cd6d92c94 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/common/packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/common/packet_handler.hpp @@ -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; @@ -83,4 +83,4 @@ class PacketHandler : public BasePacketHandler { LOG_OBJECTS_DEFINE }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/dag_block_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/dag_block_packet_handler.hpp similarity index 95% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/dag_block_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/dag_block_packet_handler.hpp index 6de3bb9fcf..8cb9dbec48 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/dag_block_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/dag_block_packet_handler.hpp @@ -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: @@ -34,4 +34,4 @@ class DagBlockPacketHandler : public ExtSyncingPacketHandler { std::shared_ptr trx_mgr_{nullptr}; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/dag_sync_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/dag_sync_packet_handler.hpp similarity index 93% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/dag_sync_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/dag_sync_packet_handler.hpp index f3702a7cb0..2b00fd089b 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/dag_sync_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/dag_sync_packet_handler.hpp @@ -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: @@ -28,4 +28,4 @@ class DagSyncPacketHandler : public ExtSyncingPacketHandler { std::shared_ptr trx_mgr_{nullptr}; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.hpp similarity index 94% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.hpp index a6e7b0b121..c8e3cc9ee3 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.hpp @@ -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: @@ -35,4 +35,4 @@ class GetDagSyncPacketHandler : public PacketHandler { std::shared_ptr db_; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.hpp similarity index 93% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.hpp index e647cab96d..e154d7d418 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.hpp @@ -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: @@ -26,4 +26,4 @@ class GetNextVotesBundlePacketHandler : public ExtVotesPacketHandler { virtual void process(const threadpool::PacketData& packet_data, const std::shared_ptr& peer) override; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.hpp similarity index 82% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.hpp index a736b34c5c..388eef0b6a 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.hpp @@ -1,34 +1,27 @@ #pragma once - -#include "common/packet_handler.hpp" - +#include "../v3/common/packet_handler.hpp" namespace taraxa { class PbftChain; class DbStorage; class VoteManager; } // namespace taraxa - namespace taraxa::network::tarcap { class PbftSyncingState; } - -namespace taraxa::network::tarcap::v4 { - +namespace taraxa::network::tarcap::v3 { class GetPbftSyncPacketHandler : public PacketHandler { public: - GetPbftSyncPacketHandler(const FullNodeConfig& conf, std::shared_ptr peers_state, - std::shared_ptr packets_stats, + GetPbftSyncPacketHandler(const FullNodeConfig& conf, std::shared_ptr peers_state, + std::shared_ptr packets_stats, std::shared_ptr pbft_syncing_state, std::shared_ptr pbft_chain, std::shared_ptr vote_mgr, std::shared_ptr db, const addr_t& node_addr, const std::string& logs_prefix = "GET_PBFT_SYNC_PH"); - // Packet type that is processed by this handler static constexpr SubprotocolPacketType kPacketType_ = SubprotocolPacketType::kGetPbftSyncPacket; private: virtual void validatePacketRlpFormat(const threadpool::PacketData& packet_data) const override; virtual void process(const threadpool::PacketData& packet_data, const std::shared_ptr& peer) override; - virtual void sendPbftBlocks(const std::shared_ptr& peer, PbftPeriod from_period, size_t blocks_to_transfer, bool pbft_chain_synced); @@ -38,5 +31,4 @@ class GetPbftSyncPacketHandler : public PacketHandler { std::shared_ptr vote_mgr_; std::shared_ptr db_; }; - -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 \ No newline at end of file diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.hpp similarity index 93% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.hpp index 0d56947afa..eb48aecc68 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.hpp @@ -3,7 +3,7 @@ #include "common/packet_handler.hpp" #include "pillar_chain/pillar_chain_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class GetPillarVotesBundlePacketHandler : public PacketHandler { public: @@ -28,4 +28,4 @@ class GetPillarVotesBundlePacketHandler : public PacketHandler { std::shared_ptr pillar_chain_manager_; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pbft_sync_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pbft_sync_packet_handler.hpp similarity index 92% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pbft_sync_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pbft_sync_packet_handler.hpp index f00d044f93..25056f8018 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pbft_sync_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pbft_sync_packet_handler.hpp @@ -1,11 +1,8 @@ #pragma once - -#include "common/ext_syncing_packet_handler.hpp" +#include "../v3/common/ext_syncing_packet_handler.hpp" #include "common/thread_pool.hpp" #include "vote_manager/vote_manager.hpp" - -namespace taraxa::network::tarcap::v4 { - +namespace taraxa::network::tarcap::v3 { class PbftSyncPacketHandler : public ExtSyncingPacketHandler { public: PbftSyncPacketHandler(const FullNodeConfig& conf, std::shared_ptr peers_state, @@ -14,9 +11,7 @@ class PbftSyncPacketHandler : public ExtSyncingPacketHandler { std::shared_ptr pbft_mgr, std::shared_ptr dag_mgr, std::shared_ptr vote_mgr, std::shared_ptr db, const addr_t& node_addr, const std::string& logs_prefix = "PBFT_SYNC_PH"); - void handleMaliciousSyncPeer(const dev::p2p::NodeID& id); - // Packet type that is processed by this handler static constexpr SubprotocolPacketType kPacketType_ = SubprotocolPacketType::kPbftSyncPacket; @@ -27,17 +22,12 @@ class PbftSyncPacketHandler : public ExtSyncingPacketHandler { protected: virtual PeriodData decodePeriodData(const dev::RLP& period_data_rlp) const; virtual std::vector> decodeVotesBundle(const dev::RLP& votes_bundle_rlp) const; - void pbftSyncComplete(); void delayedPbftSync(uint32_t counter); - static constexpr uint32_t kDelayedPbftSyncDelayMs = 10; - std::shared_ptr vote_mgr_; util::ThreadPool periodic_events_tp_; - static constexpr size_t kStandardPacketSize = 2; static constexpr size_t kChainSyncedPacketSize = 3; }; - -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 \ No newline at end of file diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pillar_vote_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pillar_vote_packet_handler.hpp similarity index 87% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pillar_vote_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pillar_vote_packet_handler.hpp index a94781ca19..ccec8fc878 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pillar_vote_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pillar_vote_packet_handler.hpp @@ -1,8 +1,8 @@ #pragma once -#include "network/tarcap/packets_handlers/v4/common/ext_pillar_vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/common/ext_pillar_vote_packet_handler.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class PillarVotePacketHandler : public ExtPillarVotePacketHandler { public: @@ -22,4 +22,4 @@ class PillarVotePacketHandler : public ExtPillarVotePacketHandler { virtual void process(const threadpool::PacketData& packet_data, const std::shared_ptr& peer) override; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.hpp similarity index 86% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.hpp index 40cc624119..efa63c4684 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.hpp @@ -1,8 +1,8 @@ #pragma once -#include "network/tarcap/packets_handlers/v4/common/ext_pillar_vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/common/ext_pillar_vote_packet_handler.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class PillarVotesBundlePacketHandler : public ExtPillarVotePacketHandler { public: @@ -22,4 +22,4 @@ class PillarVotesBundlePacketHandler : public ExtPillarVotePacketHandler { constexpr static size_t kMaxPillarVotesInBundleRlp{250}; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/status_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/status_packet_handler.hpp similarity index 94% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/status_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/status_packet_handler.hpp index 7e6978c91e..6e19de6324 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/status_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/status_packet_handler.hpp @@ -2,7 +2,7 @@ #include "common/ext_syncing_packet_handler.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class StatusPacketHandler : public ExtSyncingPacketHandler { public: @@ -30,4 +30,4 @@ class StatusPacketHandler : public ExtSyncingPacketHandler { const h256 kGenesisHash; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/transaction_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/transaction_packet_handler.hpp similarity index 97% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/transaction_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/transaction_packet_handler.hpp index f40167e567..6db64feb81 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/transaction_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/transaction_packet_handler.hpp @@ -8,7 +8,7 @@ class TransactionManager; enum class TransactionStatus; } // namespace taraxa -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class TestState; @@ -75,4 +75,4 @@ class TransactionPacketHandler : public PacketHandler { std::atomic unique_received_trx_count_{0}; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/vote_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/vote_packet_handler.hpp similarity index 94% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/vote_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/vote_packet_handler.hpp index aa24da7787..26796cc6d0 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/vote_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/vote_packet_handler.hpp @@ -2,7 +2,7 @@ #include "common/ext_votes_packet_handler.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class VotePacketHandler : public ExtVotesPacketHandler { public: @@ -36,4 +36,4 @@ class VotePacketHandler : public ExtVotesPacketHandler { const size_t kExtendedVotePacketSize{3}; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/votes_bundle_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/votes_bundle_packet_handler.hpp similarity index 94% rename from libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/votes_bundle_packet_handler.hpp rename to libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/votes_bundle_packet_handler.hpp index e42e33c2d2..972e9e64da 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/v4/votes_bundle_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/v3/votes_bundle_packet_handler.hpp @@ -2,7 +2,7 @@ #include "common/ext_votes_packet_handler.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { class VotesBundlePacketHandler : public ExtVotesPacketHandler { public: @@ -30,4 +30,4 @@ class VotesBundlePacketHandler : public ExtVotesPacketHandler { virtual void process(const threadpool::PacketData& packet_data, const std::shared_ptr& peer) override; }; -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/network.cpp b/libraries/core_libs/network/src/network.cpp index 3fc7f48cf0..5d991f768f 100644 --- a/libraries/core_libs/network/src/network.cpp +++ b/libraries/core_libs/network/src/network.cpp @@ -15,14 +15,14 @@ #include "network/tarcap/packets_handlers/latest/transaction_packet_handler.hpp" #include "network/tarcap/packets_handlers/latest/vote_packet_handler.hpp" #include "network/tarcap/packets_handlers/latest/votes_bundle_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/dag_block_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/pbft_sync_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/pillar_vote_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/status_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/transaction_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/vote_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/dag_block_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/pbft_sync_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/pillar_vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/status_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/transaction_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/votes_bundle_packet_handler.hpp" #include "network/tarcap/shared_states/pbft_syncing_state.hpp" #include "network/tarcap/stats/node_stats.hpp" #include "network/tarcap/stats/time_period_packets_stats.hpp" @@ -82,16 +82,16 @@ Network::Network(const FullNodeConfig &config, const h256 &genesis_hash, std::fi dev::p2p::Host::CapabilitiesFactory constructCapabilities = [&](std::weak_ptr host) { assert(!host.expired()); - assert(kV4NetworkVersion < TARAXA_NET_VERSION); + assert(kV3NetworkVersion < TARAXA_NET_VERSION); dev::p2p::Host::CapabilityList capabilities; // Register old version (V4) of taraxa capability - auto v4_tarcap = std::make_shared( - kV4NetworkVersion, config, genesis_hash, host, key, packets_tp_, all_packets_stats_, pbft_syncing_state_, db, + auto v3_tarcap = std::make_shared( + kV3NetworkVersion, config, genesis_hash, host, key, packets_tp_, all_packets_stats_, pbft_syncing_state_, db, pbft_mgr, pbft_chain, vote_mgr, dag_mgr, trx_mgr, slashing_manager, pillar_chain_mgr, network::tarcap::TaraxaCapability::kInitV4Handlers); - capabilities.emplace_back(v4_tarcap); + capabilities.emplace_back(v3_tarcap); // Register latest version of taraxa capability auto latest_tarcap = std::make_shared( @@ -196,7 +196,7 @@ void Network::registerPeriodicEvents(const std::shared_ptr &pbft_mg auto tx_packet_handler = tarcap.second->getSpecificHandler(); tx_packet_handler->periodicSendTransactions(trx_mgr->getAllPoolTrxs()); } else { - auto tx_packet_handler = tarcap.second->getSpecificHandler(); + auto tx_packet_handler = tarcap.second->getSpecificHandler(); tx_packet_handler->periodicSendTransactions(trx_mgr->getAllPoolTrxs()); } } @@ -211,7 +211,7 @@ void Network::registerPeriodicEvents(const std::shared_ptr &pbft_mg auto status_packet_handler = tarcap.second->getSpecificHandler(); status_packet_handler->sendStatusToPeers(); } else { - auto status_packet_handler = tarcap.second->getSpecificHandler(); + auto status_packet_handler = tarcap.second->getSpecificHandler(); status_packet_handler->sendStatusToPeers(); } } @@ -317,7 +317,7 @@ void Network::gossipDagBlock(const std::shared_ptr &block, bool propos tarcap.second->getSpecificHandler()->onNewBlockVerified(block, proposed, trxs); } else { - tarcap.second->getSpecificHandler()->onNewBlockVerified( + tarcap.second->getSpecificHandler()->onNewBlockVerified( block, proposed, trxs); } } @@ -330,7 +330,7 @@ void Network::gossipVote(const std::shared_ptr &vote, const std::share if (tarcap.first == TARAXA_NET_VERSION) { tarcap.second->getSpecificHandler()->onNewPbftVote(vote, block, rebroadcast); } else { - tarcap.second->getSpecificHandler()->onNewPbftVote(vote, block, + tarcap.second->getSpecificHandler()->onNewPbftVote(vote, block, rebroadcast); } } @@ -343,7 +343,7 @@ void Network::gossipVotesBundle(const std::vector> &vo tarcap.second->getSpecificHandler()->onNewPbftVotesBundle(votes, rebroadcast); } else { - tarcap.second->getSpecificHandler()->onNewPbftVotesBundle( + tarcap.second->getSpecificHandler()->onNewPbftVotesBundle( votes, rebroadcast); } } @@ -355,7 +355,7 @@ void Network::gossipPillarBlockVote(const std::shared_ptr &vote, boo if (tarcap.first == TARAXA_NET_VERSION) { tarcap.second->getSpecificHandler()->onNewPillarVote(vote, rebroadcast); } else { - tarcap.second->getSpecificHandler()->onNewPillarVote(vote, + tarcap.second->getSpecificHandler()->onNewPillarVote(vote, rebroadcast); } } @@ -372,7 +372,7 @@ void Network::handleMaliciousSyncPeer(const dev::p2p::NodeID &node_id) { if (tarcap.first == TARAXA_NET_VERSION) { tarcap.second->getSpecificHandler()->handleMaliciousSyncPeer(node_id); } else { - tarcap.second->getSpecificHandler()->handleMaliciousSyncPeer(node_id); + tarcap.second->getSpecificHandler()->handleMaliciousSyncPeer(node_id); } } } @@ -387,7 +387,7 @@ std::shared_ptr Network::getMaxChainPeer() const { peer = tarcap.second->getSpecificHandler<::taraxa::network::tarcap::PbftSyncPacketHandler>()->getMaxChainPeer(); } else { peer = - tarcap.second->getSpecificHandler<::taraxa::network::tarcap::v4::PbftSyncPacketHandler>()->getMaxChainPeer(); + tarcap.second->getSpecificHandler<::taraxa::network::tarcap::v3::PbftSyncPacketHandler>()->getMaxChainPeer(); } if (!peer) { @@ -413,7 +413,7 @@ void Network::requestPillarBlockVotesBundle(taraxa::PbftPeriod period, const tar peer = tarcap.second->getSpecificHandler<::taraxa::network::tarcap::PbftSyncPacketHandler>()->getMaxChainPeer(); } else { peer = - tarcap.second->getSpecificHandler<::taraxa::network::tarcap::v4::PbftSyncPacketHandler>()->getMaxChainPeer(); + tarcap.second->getSpecificHandler<::taraxa::network::tarcap::v3::PbftSyncPacketHandler>()->getMaxChainPeer(); } if (!peer) { @@ -426,7 +426,7 @@ void Network::requestPillarBlockVotesBundle(taraxa::PbftPeriod period, const tar tarcap.second->getSpecificHandler()->requestPillarVotesBundle( period, pillar_block_hash, peer); } else { - tarcap.second->getSpecificHandler() + tarcap.second->getSpecificHandler() ->requestPillarVotesBundle(period, pillar_block_hash, peer); } } diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/common/ext_bls_sig_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/common/ext_bls_sig_packet_handler.cpp similarity index 90% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/common/ext_bls_sig_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/common/ext_bls_sig_packet_handler.cpp index ff85908beb..e6ce8b8677 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/common/ext_bls_sig_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/common/ext_bls_sig_packet_handler.cpp @@ -1,7 +1,7 @@ -#include "network/tarcap/packets_handlers/v4/common/ext_pillar_vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/common/ext_pillar_vote_packet_handler.hpp" #include "pillar_chain/pillar_chain_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { ExtPillarVotePacketHandler::ExtPillarVotePacketHandler( const FullNodeConfig &conf, std::shared_ptr peers_state, @@ -34,4 +34,4 @@ bool ExtPillarVotePacketHandler::processPillarVote(const std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -164,4 +164,4 @@ void ExtSyncingPacketHandler::requestDagBlocks(const dev::p2p::NodeID &_nodeID, sealAndSend(_nodeID, SubprotocolPacketType::kGetDagSyncPacket, std::move(s)); } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.cpp similarity index 98% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.cpp index 60bf78ca0a..774342ffa7 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.cpp @@ -1,4 +1,4 @@ -#include "network/tarcap/packets_handlers/v4/common/ext_votes_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/common/ext_votes_packet_handler.hpp" #include "network/tarcap/packets_handlers/latest/common/exceptions.hpp" #include "pbft/pbft_manager.hpp" @@ -6,7 +6,7 @@ #include "vote/votes_bundle_rlp.hpp" #include "vote_manager/vote_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { ExtVotesPacketHandler::ExtVotesPacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -222,4 +222,4 @@ void ExtVotesPacketHandler::sendPbftVotesBundle(const std::shared_ptr peers_state, std::shared_ptr packets_stats, const addr_t& node_addr, @@ -141,4 +141,4 @@ void PacketHandler::requestPbftNextVotesAtPeriodRound(const dev::p2p::NodeID& pe std::move(dev::RLPStream(2) << pbft_period << pbft_round)); } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/dag_block_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/dag_block_packet_handler.cpp similarity index 98% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/dag_block_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/dag_block_packet_handler.cpp index 65c1754512..5a707de443 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/dag_block_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/dag_block_packet_handler.cpp @@ -1,11 +1,11 @@ -#include "network/tarcap/packets_handlers/v4/dag_block_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/dag_block_packet_handler.hpp" #include "dag/dag_manager.hpp" -#include "network/tarcap/packets_handlers/v4/transaction_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/transaction_packet_handler.hpp" #include "network/tarcap/shared_states/pbft_syncing_state.hpp" #include "transaction/transaction_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { DagBlockPacketHandler::DagBlockPacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -251,4 +251,4 @@ void DagBlockPacketHandler::onNewBlockVerified(const std::shared_ptr & LOG(log_dg_) << "Send DagBlock " << block->getHash() << " to peers: " << peer_and_transactions_to_log; if (!peers_to_send.empty()) LOG(log_tr_) << "Sent block to " << peers_to_send.size() << " peers"; } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/dag_sync_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/dag_sync_packet_handler.cpp similarity index 96% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/dag_sync_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/dag_sync_packet_handler.cpp index f2b6894921..0bf75ed916 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/dag_sync_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/dag_sync_packet_handler.cpp @@ -1,12 +1,12 @@ -#include "network/tarcap/packets_handlers/v4/dag_sync_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/dag_sync_packet_handler.hpp" #include "dag/dag.hpp" -#include "network/tarcap/packets_handlers/v4/common/ext_syncing_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/common/ext_syncing_packet_handler.hpp" #include "network/tarcap/shared_states/pbft_syncing_state.hpp" #include "transaction/transaction.hpp" #include "transaction/transaction_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { DagSyncPacketHandler::DagSyncPacketHandler(const FullNodeConfig& conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -129,4 +129,4 @@ void DagSyncPacketHandler::process(const threadpool::PacketData& packet_data, co << " Transactions: " << transactions_to_log << " from " << packet_data.from_node_id_; } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.cpp similarity index 96% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.cpp index bcdcb938bd..eedf57a1e9 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.cpp @@ -1,9 +1,9 @@ -#include "network/tarcap/packets_handlers/v4/get_dag_sync_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/get_dag_sync_packet_handler.hpp" #include "dag/dag_manager.hpp" #include "transaction/transaction_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { GetDagSyncPacketHandler::GetDagSyncPacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -86,4 +86,4 @@ void GetDagSyncPacketHandler::sendBlocks(const dev::p2p::NodeID &peer_id, sealAndSend(peer_id, SubprotocolPacketType::kDagSyncPacket, std::move(s)); } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.cpp similarity index 96% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.cpp index 8ca116992b..e0d38453a2 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.cpp @@ -1,9 +1,9 @@ -#include "network/tarcap/packets_handlers/v4/get_next_votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/get_next_votes_bundle_packet_handler.hpp" #include "pbft/pbft_manager.hpp" #include "vote_manager/vote_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { GetNextVotesBundlePacketHandler::GetNextVotesBundlePacketHandler( const FullNodeConfig &conf, std::shared_ptr peers_state, @@ -79,4 +79,4 @@ void GetNextVotesBundlePacketHandler::process(const threadpool::PacketData &pack } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.cpp similarity index 95% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.cpp index d76698ec95..83f0bd45f9 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.cpp @@ -1,14 +1,13 @@ -#include "network/tarcap/packets_handlers/v4/get_pbft_sync_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/get_pbft_sync_packet_handler.hpp" #include "network/tarcap/shared_states/pbft_syncing_state.hpp" #include "pbft/pbft_chain.hpp" +#include "pbft/period_data.hpp" #include "storage/storage.hpp" #include "vote/pbft_vote.hpp" #include "vote/votes_bundle_rlp.hpp" #include "vote_manager/vote_manager.hpp" - -namespace taraxa::network::tarcap::v4 { - +namespace taraxa::network::tarcap::v3 { GetPbftSyncPacketHandler::GetPbftSyncPacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, std::shared_ptr pbft_syncing_state, @@ -21,17 +20,14 @@ GetPbftSyncPacketHandler::GetPbftSyncPacketHandler(const FullNodeConfig &conf, s pbft_chain_(std::move(pbft_chain)), vote_mgr_(std::move(vote_mgr)), db_(std::move(db)) {} - void GetPbftSyncPacketHandler::validatePacketRlpFormat(const threadpool::PacketData &packet_data) const { if (constexpr size_t required_size = 1; packet_data.rlp_.itemCount() != required_size) { throw InvalidRlpItemsCountException(packet_data.type_str_, packet_data.rlp_.itemCount(), required_size); } } - void GetPbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, const std::shared_ptr &peer) { LOG(log_tr_) << "Received GetPbftSyncPacket Block"; - const size_t height_to_sync = packet_data.rlp_[0].toInt(); // Here need PBFT chain size, not synced period since synced blocks has not verified yet. const size_t my_chain_size = pbft_chain_->getPbftChainSize(); @@ -42,14 +38,12 @@ void GetPbftSyncPacketHandler::process(const threadpool::PacketData &packet_data << ". That's bigger than own PBFT chain size " << my_chain_size; throw MaliciousPeerException(err_msg.str()); } - if (kConf.is_light_node && height_to_sync + kConf.light_node_history <= my_chain_size) { std::ostringstream err_msg; err_msg << "Peer " << packet_data.from_node_id_ << " request syncing period start at " << height_to_sync << ". Light node does not have the data " << my_chain_size; throw MaliciousPeerException(err_msg.str()); } - size_t blocks_to_transfer = 0; auto pbft_chain_synced = false; const auto total_period_data_size = my_chain_size - height_to_sync + 1; @@ -60,27 +54,23 @@ void GetPbftSyncPacketHandler::process(const threadpool::PacketData &packet_data blocks_to_transfer = kConf.network.sync_level_size; } LOG(log_tr_) << "Will send " << blocks_to_transfer << " PBFT blocks to " << packet_data.from_node_id_; - sendPbftBlocks(peer, height_to_sync, blocks_to_transfer, pbft_chain_synced); } - // api for pbft syncing void GetPbftSyncPacketHandler::sendPbftBlocks(const std::shared_ptr &peer, PbftPeriod from_period, size_t blocks_to_transfer, bool pbft_chain_synced) { const auto &peer_id = peer->getId(); LOG(log_tr_) << "sendPbftBlocks: peer want to sync from pbft chain height " << from_period << ", will send at most " << blocks_to_transfer << " pbft blocks to " << peer_id; - for (auto block_period = from_period; block_period < from_period + blocks_to_transfer; block_period++) { bool last_block = (block_period == from_period + blocks_to_transfer - 1); auto data = db_->getPeriodDataRaw(block_period); - if (data.size() == 0) { // This can happen when switching from light node to full node setting LOG(log_er_) << "DB corrupted. Cannot find period " << block_period << " PBFT block in db"; return; } - + data = PeriodData::ToOldPeriodData(data); dev::RLPStream s; if (pbft_chain_synced && last_block) { // Latest finalized block cert votes are saved in db as reward votes for new blocks @@ -102,7 +92,6 @@ void GetPbftSyncPacketHandler::sendPbftBlocks(const std::shared_ptr s << last_block; s.appendRaw(data); } - LOG(log_dg_) << "Sending PbftSyncPacket period " << block_period << " to " << peer_id; sealAndSend(peer_id, SubprotocolPacketType::kPbftSyncPacket, std::move(s)); if (pbft_chain_synced && last_block) { @@ -110,5 +99,4 @@ void GetPbftSyncPacketHandler::sendPbftBlocks(const std::shared_ptr } } } - -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 \ No newline at end of file diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.cpp similarity index 95% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.cpp index e3d2086391..8e4fe9c569 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.cpp @@ -1,8 +1,8 @@ -#include "network/tarcap/packets_handlers/v4/get_pillar_votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/get_pillar_votes_bundle_packet_handler.hpp" -#include "network/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { GetPillarVotesBundlePacketHandler::GetPillarVotesBundlePacketHandler( const FullNodeConfig &conf, std::shared_ptr peers_state, @@ -95,4 +95,4 @@ void GetPillarVotesBundlePacketHandler::requestPillarVotesBundle(PbftPeriod peri } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/pbft_sync_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/pbft_sync_packet_handler.cpp similarity index 98% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/pbft_sync_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/pbft_sync_packet_handler.cpp index a7acc54653..8af76978f3 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/pbft_sync_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/pbft_sync_packet_handler.cpp @@ -1,4 +1,4 @@ -#include "network/tarcap/packets_handlers/v4/pbft_sync_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/pbft_sync_packet_handler.hpp" #include "network/tarcap/shared_states/pbft_syncing_state.hpp" #include "pbft/pbft_chain.hpp" @@ -6,9 +6,7 @@ #include "transaction/transaction_manager.hpp" #include "vote/pbft_vote.hpp" #include "vote/votes_bundle_rlp.hpp" - -namespace taraxa::network::tarcap::v4 { - +namespace taraxa::network::tarcap::v3 { PbftSyncPacketHandler::PbftSyncPacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, std::shared_ptr pbft_syncing_state, @@ -21,12 +19,10 @@ PbftSyncPacketHandler::PbftSyncPacketHandler(const FullNodeConfig &conf, std::sh logs_prefix + "PBFT_SYNC_PH"), vote_mgr_(std::move(vote_mgr)), periodic_events_tp_(1, true) {} - void PbftSyncPacketHandler::validatePacketRlpFormat(const threadpool::PacketData &packet_data) const { if (packet_data.rlp_.itemCount() != kStandardPacketSize && packet_data.rlp_.itemCount() != kChainSyncedPacketSize) { throw InvalidRlpItemsCountException(packet_data.type_str_, packet_data.rlp_.itemCount(), kStandardPacketSize); } - // PeriodData rlp parsing cannot be done through util::rlp_tuple, which automatically checks the rlp size so it is // checked here manually if (packet_data.rlp_[1].itemCount() != PeriodData::kBaseRlpItemCount && @@ -35,7 +31,6 @@ void PbftSyncPacketHandler::validatePacketRlpFormat(const threadpool::PacketData PeriodData::kBaseRlpItemCount); } } - void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, const std::shared_ptr &peer) { // Note: no need to consider possible race conditions due to concurrent processing as it is @@ -46,13 +41,11 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, << " but there is no current syncing peer set"; return; } - if (syncing_peer->getId() != packet_data.from_node_id_) { LOG(log_wr_) << "PbftSyncPacket received from unexpected peer " << packet_data.from_node_id_.abridged() << " current syncing peer " << syncing_peer->getId().abridged(); return; } - // Process received pbft blocks // pbft_chain_synced is the flag to indicate own PBFT chain has synced with the peer's PBFT chain const bool pbft_chain_synced = packet_data.rlp_.itemCount() == kChainSyncedPacketSize; @@ -64,13 +57,11 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, } catch (const std::runtime_error &e) { throw MaliciousPeerException("Unable to parse PeriodData: " + std::string(e.what())); } - std::vector> current_block_cert_votes; if (pbft_chain_synced) { current_block_cert_votes = decodeVotesBundle(packet_data.rlp_[2]); } const auto pbft_blk_hash = period_data.pbft_blk->getBlockHash(); - std::string received_dag_blocks_str; // This is just log related stuff for (auto const &block : period_data.dag_blocks) { received_dag_blocks_str += block->getHash().toString() + " "; @@ -78,19 +69,15 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, peer->dag_level_ = block->getLevel(); } } - const auto pbft_block_period = period_data.pbft_blk->getPeriod(); LOG(log_dg_) << "PbftSyncPacket received. Period: " << pbft_block_period << ", dag Blocks: " << received_dag_blocks_str << " from " << packet_data.from_node_id_; - peer->markPbftBlockAsKnown(pbft_blk_hash); // Update peer's pbft period if outdated if (peer->pbft_chain_size_ < pbft_block_period) { peer->pbft_chain_size_ = pbft_block_period; } - LOG(log_tr_) << "Processing pbft block: " << pbft_blk_hash; - if (pbft_chain_->findPbftBlockInChain(pbft_blk_hash)) { LOG(log_wr_) << "PBFT block " << pbft_blk_hash << ", period: " << period_data.pbft_blk->getPeriod() << " from " << packet_data.from_node_id_ << " already present in chain"; @@ -101,12 +88,10 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, pbftSyncComplete(); return; } - LOG(log_er_) << "Block " << pbft_blk_hash << " period unexpected: " << pbft_block_period << ". Expected period: " << pbft_mgr_->pbftSyncingPeriod() + 1; return; } - // Check cert vote matches if final synced block if (pbft_chain_synced) { for (auto const &vote : current_block_cert_votes) { @@ -118,7 +103,6 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, } } } - // Check votes match the hash of previous block in the queue auto last_pbft_block_hash = pbft_mgr_->lastPbftBlockHashFromQueueOrChain(); // Check cert vote matches @@ -131,12 +115,10 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, return; } } - if (!pbft_mgr_->validatePillarDataInPeriodData(period_data)) { handleMaliciousSyncPeer(packet_data.from_node_id_); return; } - auto order_hash = PbftManager::calculateOrderHash(period_data.dag_blocks); if (order_hash != period_data.pbft_blk->getOrderHash()) { { // This is just log related stuff @@ -158,7 +140,6 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, handleMaliciousSyncPeer(packet_data.from_node_id_); return; } - // This is special case when queue is empty and we can not say for sure that all votes that are part of this block // have been verified before if (pbft_mgr_->periodDataQueueEmpty()) { @@ -170,10 +151,8 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, handleMaliciousSyncPeer(packet_data.from_node_id_); return; } - vote_mgr_->addVerifiedVote(v); } - // And now we need to replace it with verified votes if (auto votes = vote_mgr_->checkRewardVotes(period_data.pbft_blk, true); votes.first) { period_data.previous_block_cert_votes = std::move(votes.second); @@ -184,31 +163,25 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, pbft_syncing_state_->setPbftSyncing(false); return; } - LOG(log_er_) << "Invalid reward votes in block " << period_data.pbft_blk->getBlockHash() << " from peer " << packet_data.from_node_id_.abridged() << " received, stop syncing."; handleMaliciousSyncPeer(packet_data.from_node_id_); return; } } - LOG(log_tr_) << "Synced PBFT block hash " << pbft_blk_hash << " with " << period_data.previous_block_cert_votes.size() << " cert votes"; LOG(log_tr_) << "Synced PBFT block " << period_data; pbft_mgr_->periodDataQueuePush(std::move(period_data), packet_data.from_node_id_, std::move(current_block_cert_votes)); } - auto pbft_sync_period = pbft_mgr_->pbftSyncingPeriod(); - // Reset last sync packet received time pbft_syncing_state_->setLastSyncPacketTime(); - if (pbft_chain_synced) { pbftSyncComplete(); return; } - if (last_block) { // If current sync period is actually bigger than the block we just received we are probably synced if (pbft_sync_period > pbft_block_period) { @@ -229,16 +202,13 @@ void PbftSyncPacketHandler::process(const threadpool::PacketData &packet_data, } } } - PeriodData PbftSyncPacketHandler::decodePeriodData(const dev::RLP &period_data_rlp) const { - return PeriodData(period_data_rlp); + return PeriodData::FromOldPeriodData(period_data_rlp); } - std::vector> PbftSyncPacketHandler::decodeVotesBundle( const dev::RLP &votes_bundle_rlp) const { return decodePbftVotesBundleRlp(votes_bundle_rlp); } - void PbftSyncPacketHandler::pbftSyncComplete() { if (pbft_mgr_->periodDataQueueSize()) { LOG(log_tr_) << "Syncing pbft blocks faster than processing. Remaining sync size " @@ -257,7 +227,6 @@ void PbftSyncPacketHandler::pbftSyncComplete() { } } } - void PbftSyncPacketHandler::delayedPbftSync(uint32_t counter) { const uint32_t max_delayed_pbft_sync_count = 60000 / kDelayedPbftSyncDelayMs; auto pbft_sync_period = pbft_mgr_->pbftSyncingPeriod(); @@ -268,7 +237,6 @@ void PbftSyncPacketHandler::delayedPbftSync(uint32_t counter) { LOG(log_tr_) << "Syncing PBFT is stopping"; return; } - if (pbft_syncing_state_->isPbftSyncing()) { if (pbft_sync_period > pbft_chain_->getPbftChainSize() + (10 * kConf.network.sync_level_size)) { LOG(log_tr_) << "Syncing pbft blocks faster than processing " << pbft_sync_period << " " @@ -281,10 +249,8 @@ void PbftSyncPacketHandler::delayedPbftSync(uint32_t counter) { } } } - void PbftSyncPacketHandler::handleMaliciousSyncPeer(const dev::p2p::NodeID &id) { peers_state_->set_peer_malicious(id); - if (auto host = peers_state_->host_.lock(); host) { LOG(log_nf_) << "Disconnect peer " << id; host->disconnect(id, dev::p2p::UserReason); @@ -292,5 +258,4 @@ void PbftSyncPacketHandler::handleMaliciousSyncPeer(const dev::p2p::NodeID &id) LOG(log_er_) << "Unable to handleMaliciousSyncPeer, host == nullptr"; } } - -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 \ No newline at end of file diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/pillar_vote_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/pillar_vote_packet_handler.cpp similarity index 94% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/pillar_vote_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/pillar_vote_packet_handler.cpp index 9676fc736a..a70eabdeff 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/pillar_vote_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/pillar_vote_packet_handler.cpp @@ -1,8 +1,8 @@ -#include "network/tarcap/packets_handlers/v4/pillar_vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/pillar_vote_packet_handler.hpp" #include "vote/pillar_vote.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { PillarVotePacketHandler::PillarVotePacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -61,4 +61,4 @@ void PillarVotePacketHandler::sendPillarVote(const std::shared_ptr & } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.cpp similarity index 92% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.cpp index 032239389d..00178ebcc9 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.cpp @@ -1,8 +1,8 @@ -#include "network/tarcap/packets_handlers/v4/pillar_votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/pillar_votes_bundle_packet_handler.hpp" #include "vote/pillar_vote.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { PillarVotesBundlePacketHandler::PillarVotesBundlePacketHandler( const FullNodeConfig &conf, std::shared_ptr peers_state, @@ -37,4 +37,4 @@ void PillarVotesBundlePacketHandler::process(const threadpool::PacketData &packe } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/readme.md b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/readme.md similarity index 100% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/readme.md rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/readme.md diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/status_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/status_packet_handler.cpp similarity index 97% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/status_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/status_packet_handler.cpp index 8847e0d4aa..97a8a05eec 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/status_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/status_packet_handler.cpp @@ -1,14 +1,14 @@ -#include "network/tarcap/packets_handlers/v4/status_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/status_packet_handler.hpp" #include "config/version.hpp" #include "dag/dag.hpp" -#include "network/tarcap/packets_handlers/v4/common/ext_syncing_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/common/ext_syncing_packet_handler.hpp" #include "network/tarcap/shared_states/pbft_syncing_state.hpp" #include "pbft/pbft_chain.hpp" #include "pbft/pbft_manager.hpp" #include "vote_manager/vote_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { StatusPacketHandler::StatusPacketHandler(const FullNodeConfig& conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -195,4 +195,4 @@ void StatusPacketHandler::sendStatusToPeers() { } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/transaction_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/transaction_packet_handler.cpp similarity index 98% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/transaction_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/transaction_packet_handler.cpp index 8c6d742a26..8cb528826b 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/transaction_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/transaction_packet_handler.cpp @@ -1,11 +1,11 @@ -#include "network/tarcap/packets_handlers/v4/transaction_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/transaction_packet_handler.hpp" #include #include "transaction/transaction.hpp" #include "transaction/transaction_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { TransactionPacketHandler::TransactionPacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -219,4 +219,4 @@ void TransactionPacketHandler::sendTransactions(std::shared_ptr peer } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/vote_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/vote_packet_handler.cpp similarity index 97% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/vote_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/vote_packet_handler.cpp index 8a3771a1bc..184ae41e82 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/vote_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/vote_packet_handler.cpp @@ -1,9 +1,9 @@ -#include "network/tarcap/packets_handlers/v4/vote_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/vote_packet_handler.hpp" #include "pbft/pbft_manager.hpp" #include "vote_manager/vote_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { VotePacketHandler::VotePacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -138,4 +138,4 @@ void VotePacketHandler::sendPbftVote(const std::shared_ptr &peer, co } } -} // namespace taraxa::network::tarcap::v4 +} // namespace taraxa::network::tarcap::v3 diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/votes_bundle_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/votes_bundle_packet_handler.cpp similarity index 97% rename from libraries/core_libs/network/src/tarcap/packets_handlers/v4/votes_bundle_packet_handler.cpp rename to libraries/core_libs/network/src/tarcap/packets_handlers/v3/votes_bundle_packet_handler.cpp index 86c8241a12..1b89bae0cd 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/v4/votes_bundle_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/v3/votes_bundle_packet_handler.cpp @@ -1,10 +1,10 @@ -#include "network/tarcap/packets_handlers/v4/votes_bundle_packet_handler.hpp" +#include "network/tarcap/packets_handlers/v3/votes_bundle_packet_handler.hpp" #include "pbft/pbft_manager.hpp" #include "vote/votes_bundle_rlp.hpp" #include "vote_manager/vote_manager.hpp" -namespace taraxa::network::tarcap::v4 { +namespace taraxa::network::tarcap::v3 { VotesBundlePacketHandler::VotesBundlePacketHandler(const FullNodeConfig &conf, std::shared_ptr peers_state, std::shared_ptr packets_stats, @@ -122,4 +122,4 @@ void VotesBundlePacketHandler::onNewPbftVotesBundle(const std::vector session, u256 auto status_packet_handler = packets_handlers_->getSpecificHandler(); status_packet_handler->sendStatus(node_id, true); } else { - auto status_packet_handler = packets_handlers_->getSpecificHandler(); + auto status_packet_handler = packets_handlers_->getSpecificHandler(); status_packet_handler->sendStatus(node_id, true); } } @@ -124,7 +124,7 @@ void TaraxaCapability::onDisconnect(dev::p2p::NodeID const &_nodeID) { if (version_ == TARAXA_NET_VERSION) { packets_handlers_->getSpecificHandler()->startSyncingPbft(); } else { - packets_handlers_->getSpecificHandler()->startSyncingPbft(); + packets_handlers_->getSpecificHandler()->startSyncingPbft(); } } else { @@ -327,44 +327,44 @@ const TaraxaCapability::InitPacketsHandlers TaraxaCapability::kInitV4Handlers = const addr_t &node_addr) { auto packets_handlers = std::make_shared(); // Consensus packets with high processing priority - packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_mgr, pbft_chain, + packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_mgr, pbft_chain, vote_mgr, slashing_manager, node_addr, logs_prefix); - packets_handlers->registerHandler( + packets_handlers->registerHandler( config, peers_state, packets_stats, pbft_mgr, pbft_chain, vote_mgr, slashing_manager, node_addr, logs_prefix); - packets_handlers->registerHandler( + packets_handlers->registerHandler( config, peers_state, packets_stats, pbft_mgr, pbft_chain, vote_mgr, slashing_manager, node_addr, logs_prefix); // Standard packets with mid processing priority - packets_handlers->registerHandler(config, peers_state, packets_stats, + packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_syncing_state, pbft_chain, pbft_mgr, dag_mgr, trx_mgr, db, node_addr, logs_prefix); - packets_handlers->registerHandler(config, peers_state, packets_stats, trx_mgr, + packets_handlers->registerHandler(config, peers_state, packets_stats, trx_mgr, node_addr, logs_prefix); // Non critical packets with low processing priority - packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_syncing_state, + packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_syncing_state, pbft_chain, pbft_mgr, dag_mgr, db, genesis_hash, node_addr, logs_prefix); - packets_handlers->registerHandler(config, peers_state, packets_stats, trx_mgr, + packets_handlers->registerHandler(config, peers_state, packets_stats, trx_mgr, dag_mgr, db, node_addr, logs_prefix); - packets_handlers->registerHandler(config, peers_state, packets_stats, + packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_syncing_state, pbft_chain, pbft_mgr, dag_mgr, trx_mgr, db, node_addr, logs_prefix); - packets_handlers->registerHandler( + packets_handlers->registerHandler( config, peers_state, packets_stats, pbft_syncing_state, pbft_chain, vote_mgr, db, node_addr, logs_prefix); - packets_handlers->registerHandler(config, peers_state, packets_stats, + packets_handlers->registerHandler(config, peers_state, packets_stats, pbft_syncing_state, pbft_chain, pbft_mgr, dag_mgr, vote_mgr, db, node_addr, logs_prefix); - packets_handlers->registerHandler(config, peers_state, packets_stats, + packets_handlers->registerHandler(config, peers_state, packets_stats, pillar_chain_mgr, node_addr, logs_prefix); - packets_handlers->registerHandler( + packets_handlers->registerHandler( config, peers_state, packets_stats, pillar_chain_mgr, node_addr, logs_prefix); - packets_handlers->registerHandler(config, peers_state, packets_stats, + packets_handlers->registerHandler(config, peers_state, packets_stats, pillar_chain_mgr, node_addr, logs_prefix); return packets_handlers; From 23be1797c68ac43029e707006e85b38b25341cbc Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 18 Dec 2024 15:17:37 +0100 Subject: [PATCH 4/8] chore: update bulding instructions --- doc/building.md | 163 ++---------------------------------------------- 1 file changed, 5 insertions(+), 158 deletions(-) diff --git a/doc/building.md b/doc/building.md index 7af1fedd94..93ad86a9e8 100644 --- a/doc/building.md +++ b/doc/building.md @@ -71,167 +71,14 @@ will build out of the box without further effort: 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 @@ -245,8 +92,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 @@ -316,7 +163,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 From a041af7374353704e6f606b390139dbfdac73c8d Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 18 Dec 2024 15:43:16 +0100 Subject: [PATCH 5/8] remove testnet branch from building instructions --- doc/building.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/building.md b/doc/building.md index 93ad86a9e8..8d4b1e633f 100644 --- a/doc/building.md +++ b/doc/building.md @@ -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 @@ -82,7 +82,7 @@ First you need to get (Brew)[https://brew.sh/] package manager. After that you n ### 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 @@ -151,7 +151,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 From 1bdb67d7d88ffbaf38efffa1a223dbe506bb7357 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Thu, 19 Dec 2024 11:31:55 +0100 Subject: [PATCH 6/8] fix building instructions --- doc/building.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/building.md b/doc/building.md index 8d4b1e633f..ae79c11362 100644 --- a/doc/building.md +++ b/doc/building.md @@ -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 \ @@ -62,8 +62,7 @@ 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 From 28b8ee02437a5f46eae70f0caeb9752a4c9f80d6 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Fri, 20 Dec 2024 17:16:16 +0100 Subject: [PATCH 7/8] Update mainnet_genesis.json --- .../cli/include/cli/config_jsons/mainnet/mainnet_genesis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json b/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json index b00f1234d6..d01c8ae861 100644 --- a/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json +++ b/libraries/cli/include/cli/config_jsons/mainnet/mainnet_genesis.json @@ -1655,7 +1655,7 @@ "bridge_contract_address": "0xe126E0BaeAE904b8Cfd619Be1A8667A173b763a1" }, "cornus_hf": { - "block_num": 15276000, + "block_num": -1, "delegation_locking_period": 163459, "dag_gas_limit": "0x1908B100", "pbft_gas_limit": "0x7d2b7500" From b67db00b659c8f4d4fca1698e955a72059b51999 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 8 Jan 2025 09:19:21 +0100 Subject: [PATCH 8/8] fix(storage): fix problematic trx in storage berfore HF happens --- .../include/storage/problematic_trx.hpp | 28 +++++++++++++++++++ libraries/core_libs/storage/src/storage.cpp | 7 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 libraries/core_libs/storage/include/storage/problematic_trx.hpp diff --git a/libraries/core_libs/storage/include/storage/problematic_trx.hpp b/libraries/core_libs/storage/include/storage/problematic_trx.hpp new file mode 100644 index 0000000000..a8712cd65e --- /dev/null +++ b/libraries/core_libs/storage/include/storage/problematic_trx.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include "transaction/transaction.hpp" + +namespace taraxa { + +//{ +// "blockHash":"0x6722e9c012f783c3d42e0e920b3c446f6c14273662eb063a794b1718da632a42", +// "blockNumber":"0xb31684", +// "from":"0xde2b1203d72d3549ee2f733b00b2789414c7cea5", +// "gas":"0x0", +// "gasPrice":"0x1", +// "hash":"0xdf374602b4f698a5ec6c8b2a9c27ac1b3190c093cd4ab5e624fe21caca6c24a1", +// "input":"0x", +// "nonce":"0x0", +// "r":"0xb48d8b4b64040e4bd585bf638a74a355be589251dc7458c0e5e563e7fe0d630a", +// "s":"0x57726ccf2fd4e97b297a212ed1f82beedd3c7b7326d07e12e50c87b331c60500", +// "to":"0x973ecb1c08c8eb5a7eaa0d3fd3aab7924f2838b0", +// "transactionIndex":"0x6", +// "v":"0x1", +// "value":"0x0" +//} +const static auto kProblematicTrx = std::make_shared(dev::jsToBytes( + "0xf85f80018094973ecb1c08c8eb5a7eaa0d3fd3aab7924f2838b080808206b6a0b48d8b4b64040e4bd585bf638a74a355be589251dc7458c0" + "e5e563e7fe0d630aa057726ccf2fd4e97b297a212ed1f82beedd3c7b7326d07e12e50c87b331c60500")); +} // namespace taraxa \ No newline at end of file diff --git a/libraries/core_libs/storage/src/storage.cpp b/libraries/core_libs/storage/src/storage.cpp index b2c0401e7b..3f8130bc02 100644 --- a/libraries/core_libs/storage/src/storage.cpp +++ b/libraries/core_libs/storage/src/storage.cpp @@ -12,7 +12,7 @@ #include "final_chain/data.hpp" #include "pillar_chain/pillar_block.hpp" #include "rocksdb/utilities/checkpoint.h" -#include "storage/uint_comparator.hpp" +#include "storage/problematic_trx.hpp" #include "transaction/system_transaction.hpp" #include "vote/pbft_vote.hpp" #include "vote/votes_bundle_rlp.hpp" @@ -885,6 +885,11 @@ SharedTransactions DbStorage::getFinalizedTransactions(std::vector c std::map> period_map; trxs.reserve(trx_hashes.size()); for (auto const& tx_hash : trx_hashes) { + // TODO remove after Cornus HF + if (tx_hash == kProblematicTrx->getHash()) { + trxs.emplace_back(kProblematicTrx); + continue; + } auto trx_period = getTransactionLocation(tx_hash); if (trx_period.has_value()) { period_map[trx_period->period].insert(trx_period->position);