From 551664e493003b5d81ea456be7a7e8bb853b8b17 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 26 Jun 2024 21:04:53 +0200 Subject: [PATCH 01/10] new testnet genesis --- .../cli/config_jsons/testnet/testnet_genesis.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json index 726b4d0d97..05d2e4e7cf 100644 --- a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json +++ b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json @@ -4,7 +4,7 @@ "level": "0x0", "pivot": "0x0000000000000000000000000000000000000000000000000000000000000000", "sig": "0xb7e22d46c1ba94d5e8347b01d137b5c428fcbbeaf0a77fb024cbbf1517656ff00d04f7f25be608c321b0d7483c402c294ff46c49b265305d046a52236c0a363701", - "timestamp": "0x658C3F5E", + "timestamp": "0x667CF1D0", "tips": [], "transactions": [] }, @@ -105,13 +105,13 @@ "dag_blocks_size": "0x32", "ghost_path_move_back": "0x0", "lambda_ms": "0x5DC", - "gas_limit": "0x12C684C0" + "gas_limit": "0x7d2b7500" }, "dag": { "block_proposer": { "shard": 1 }, - "gas_limit": "0x1E0A6E0" + "gas_limit": "0x1908B100" }, "sortition": { "changes_count_for_average": 10, @@ -150,11 +150,11 @@ "generated_rewards": "0x0" }, "ficus_hf": { - "block_num": -1, - "pillar_blocks_interval": 100, - "pillar_chain_sync_interval": 25, + "block_num": 1000, + "pillar_blocks_interval": 16, + "pillar_chain_sync_interval": 8, "pbft_inclusion_delay": 6, - "bridge_contract_address": "0x0000000000000000000000000000000000000000" + "bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF" } } } \ No newline at end of file From f0686bba50509d7102083187b6a2f201625649da Mon Sep 17 00:00:00 2001 From: Leonard Mocanu Date: Thu, 27 Jun 2024 19:28:31 +0300 Subject: [PATCH 02/10] chore: fixes configuration exception --- .../cli/include/cli/config_jsons/testnet/testnet_genesis.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json index 05d2e4e7cf..ebc9152523 100644 --- a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json +++ b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json @@ -150,7 +150,7 @@ "generated_rewards": "0x0" }, "ficus_hf": { - "block_num": 1000, + "block_num": 4096, "pillar_blocks_interval": 16, "pillar_chain_sync_interval": 8, "pbft_inclusion_delay": 6, From 55d38270da9d309dbd6c92238bcf9beb3997269f Mon Sep 17 00:00:00 2001 From: Leonard Mocanu Date: Fri, 28 Jun 2024 00:20:44 +0300 Subject: [PATCH 03/10] chore: fixes taraxa-sign --- scripts/taraxa-sign.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/taraxa-sign.py b/scripts/taraxa-sign.py index 5eb71e10c3..c7da1f86c7 100755 --- a/scripts/taraxa-sign.py +++ b/scripts/taraxa-sign.py @@ -64,7 +64,7 @@ def sign(key, wallet, text): private_key = key account = Account.from_key(private_key) - sig = account.signHash(keccak(hexstr=text)) + sig = account.unsafe_sign_hash(keccak(hexstr=text)) sig_hex = sig.signature.hex() click.echo(sig_hex) From 217355a3b9c15b8352a7511a60ff2a482a96c0d5 Mon Sep 17 00:00:00 2001 From: kstdl Date: Fri, 28 Jun 2024 12:00:08 +0200 Subject: [PATCH 04/10] chore: adjust testnet genesis --- .../cli/include/cli/config_jsons/testnet/testnet_genesis.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json index ebc9152523..a4da9a1db5 100644 --- a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json +++ b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json @@ -4,7 +4,7 @@ "level": "0x0", "pivot": "0x0000000000000000000000000000000000000000000000000000000000000000", "sig": "0xb7e22d46c1ba94d5e8347b01d137b5c428fcbbeaf0a77fb024cbbf1517656ff00d04f7f25be608c321b0d7483c402c294ff46c49b265305d046a52236c0a363701", - "timestamp": "0x667CF1D0", + "timestamp": "0x667E8977", "tips": [], "transactions": [] }, @@ -150,7 +150,7 @@ "generated_rewards": "0x0" }, "ficus_hf": { - "block_num": 4096, + "block_num": 1024, "pillar_blocks_interval": 16, "pillar_chain_sync_interval": 8, "pbft_inclusion_delay": 6, From 52a5c0ee396edd57b66246ea1d9e8605b4e932d8 Mon Sep 17 00:00:00 2001 From: kstdl Date: Mon, 1 Jul 2024 12:37:20 +0200 Subject: [PATCH 05/10] chore: update testnet genesis & config. bump path version --- CMakeLists.txt | 2 +- .../cli/config_jsons/testnet/testnet_config.json | 10 +++++----- .../cli/config_jsons/testnet/testnet_genesis.json | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cda425b08..bd8bf49415 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20) # Set current version of the project set(TARAXA_MAJOR_VERSION 1) set(TARAXA_MINOR_VERSION 9) -set(TARAXA_PATCH_VERSION 0) +set(TARAXA_PATCH_VERSION 2) 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 diff --git a/libraries/cli/include/cli/config_jsons/testnet/testnet_config.json b/libraries/cli/include/cli/config_jsons/testnet/testnet_config.json index 985b388255..1fe0aaaeeb 100644 --- a/libraries/cli/include/cli/config_jsons/testnet/testnet_config.json +++ b/libraries/cli/include/cli/config_jsons/testnet/testnet_config.json @@ -2,7 +2,7 @@ "data_path": "", "is_light_node": false, "final_chain_cache_in_blocks": 5, - "report_malicious_behaviour" : true, + "report_malicious_behaviour": true, "network": { "rpc": { "http_port": 7777, @@ -38,17 +38,17 @@ "boot_nodes": [ { "id": "f36f467529fe91a750dfdc8086fd0d2f30bad9f55a5800b6b4aa603c7787501db78dc4ac1bf3cf16e42af7c2ebb53648653013c3da1987494960d751871d598a", - "ip": "boot-node-0.testnet.taraxa.io", + "ip": "boot-node-3.testnet.taraxa.io", "port": 10002 }, { "id": "d2d445fc3276bdbf2a07628a484baabf45ccb91d6aa078a0dc3aefc11f1941899a923312ec0e664b8e57b63b774c47a006d9d1d16befd2135dcf76067736c688", - "ip": "boot-node-1.testnet.taraxa.io", + "ip": "boot-node-4.testnet.taraxa.io", "port": 10002 }, { "id": "c6e7263f44d88c0d6cc3b0d5ebdc31cf891908e8fa7e545e137d3ed0bfec1810fa24c1379228afbb53df0d59e716e17138115fd096782a84261718ab77665171", - "ip": "boot-node-2.testnet.taraxa.io", + "ip": "boot-node-5.testnet.taraxa.io", "port": 10002 } ] @@ -174,4 +174,4 @@ } ] } -} +} \ No newline at end of file diff --git a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json index a4da9a1db5..7cf900839c 100644 --- a/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json +++ b/libraries/cli/include/cli/config_jsons/testnet/testnet_genesis.json @@ -4,7 +4,7 @@ "level": "0x0", "pivot": "0x0000000000000000000000000000000000000000000000000000000000000000", "sig": "0xb7e22d46c1ba94d5e8347b01d137b5c428fcbbeaf0a77fb024cbbf1517656ff00d04f7f25be608c321b0d7483c402c294ff46c49b265305d046a52236c0a363701", - "timestamp": "0x667E8977", + "timestamp": "0x66827F92", "tips": [], "transactions": [] }, @@ -150,9 +150,9 @@ "generated_rewards": "0x0" }, "ficus_hf": { - "block_num": 1024, - "pillar_blocks_interval": 16, - "pillar_chain_sync_interval": 8, + "block_num": 1000, + "pillar_blocks_interval": 100, + "pillar_chain_sync_interval": 25, "pbft_inclusion_delay": 6, "bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF" } From ecc42cbc9bd0bf93ebccb24a7b4917761b95adbf Mon Sep 17 00:00:00 2001 From: mfrankovi Date: Tue, 2 Jul 2024 14:41:58 +0200 Subject: [PATCH 06/10] fix: null block vote --- libraries/core_libs/consensus/src/pbft/pbft_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/core_libs/consensus/src/pbft/pbft_manager.cpp b/libraries/core_libs/consensus/src/pbft/pbft_manager.cpp index 60df06b9ff..387dde9871 100644 --- a/libraries/core_libs/consensus/src/pbft/pbft_manager.cpp +++ b/libraries/core_libs/consensus/src/pbft/pbft_manager.cpp @@ -1053,7 +1053,7 @@ void PbftManager::secondFinish_() { // Lambda function for next voting 2t+1 next voted null block from previous round auto next_vote_null_block = [this, period = period, round = round]() { - if (already_next_voted_null_block_hash_ || round < 2) { + if (cert_voted_block_for_round_.has_value() || already_next_voted_null_block_hash_ || round < 2) { return; } From ee03a8e89928307925a306b3a9c78e9849da2520 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 3 Jul 2024 13:46:07 +0200 Subject: [PATCH 07/10] chore: fix regossiping for pillarvotes --- libraries/config/src/hardfork.cpp | 3 ++- .../common/ext_pillar_vote_packet_handler.hpp | 2 +- .../latest/common/ext_bls_sig_packet_handler.cpp | 13 ++++++++----- .../latest/pillar_vote_packet_handler.cpp | 5 +++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libraries/config/src/hardfork.cpp b/libraries/config/src/hardfork.cpp index 78b6642f17..60b6119c6d 100644 --- a/libraries/config/src/hardfork.cpp +++ b/libraries/config/src/hardfork.cpp @@ -53,7 +53,8 @@ RLP_FIELDS_DEFINE(AspenHardfork, block_num_part_one, block_num_part_two, max_sup bool FicusHardforkConfig::isFicusHardfork(taraxa::PbftPeriod period) const { return period >= block_num; } bool FicusHardforkConfig::isPillarBlockPeriod(taraxa::PbftPeriod period, bool skip_first_pillar_block) const { - return period >= block_num && period >= firstPillarBlockPeriod() + (skip_first_pillar_block ? 1 : 0) * pillar_blocks_interval && + return period >= block_num && + period >= firstPillarBlockPeriod() + (skip_first_pillar_block ? 1 : 0) * pillar_blocks_interval && period % pillar_blocks_interval == 0; } diff --git a/libraries/core_libs/network/include/network/tarcap/packets_handlers/latest/common/ext_pillar_vote_packet_handler.hpp b/libraries/core_libs/network/include/network/tarcap/packets_handlers/latest/common/ext_pillar_vote_packet_handler.hpp index 66be6ea7fd..91bc38fd27 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets_handlers/latest/common/ext_pillar_vote_packet_handler.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets_handlers/latest/common/ext_pillar_vote_packet_handler.hpp @@ -26,7 +26,7 @@ class ExtPillarVotePacketHandler : public PacketHandler { const addr_t& node_addr, const std::string& log_channel); protected: - void processPillarVote(const std::shared_ptr& vote, const std::shared_ptr& peer); + bool processPillarVote(const std::shared_ptr& vote, const std::shared_ptr& peer); protected: std::shared_ptr pillar_chain_manager_; diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/latest/common/ext_bls_sig_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/latest/common/ext_bls_sig_packet_handler.cpp index dcc17e726d..20e17e1ace 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/latest/common/ext_bls_sig_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/latest/common/ext_bls_sig_packet_handler.cpp @@ -11,23 +11,26 @@ ExtPillarVotePacketHandler::ExtPillarVotePacketHandler( : PacketHandler(conf, std::move(peers_state), std::move(packets_stats), node_addr, log_channel), pillar_chain_manager_{std::move(pillar_chain_manager)} {} -void ExtPillarVotePacketHandler::processPillarVote(const std::shared_ptr &vote, +bool ExtPillarVotePacketHandler::processPillarVote(const std::shared_ptr &vote, const std::shared_ptr &peer) { if (!pillar_chain_manager_->isRelevantPillarVote(vote)) { LOG(log_dg_) << "Drop irrelevant pillar vote " << vote->getHash() << " from peer " << peer->getId(); - return; + return false; } if (!pillar_chain_manager_->validatePillarVote(vote)) { - std::ostringstream err_msg; - err_msg << "Invalid pillar vote " << vote->getHash() << " from peer " << peer->getId(); - throw MaliciousPeerException(err_msg.str()); + // TODO: enable for mainnet + // std::ostringstream err_msg; + // err_msg << "Invalid pillar vote " << vote->getHash() << " from peer " << peer->getId(); + // throw MaliciousPeerException(err_msg.str()); + return false; } pillar_chain_manager_->addVerifiedPillarVote(vote); // Mark pillar vote as known for peer peer->markPillarVoteAsKnown(vote->getHash()); + return true; } } // namespace taraxa::network::tarcap diff --git a/libraries/core_libs/network/src/tarcap/packets_handlers/latest/pillar_vote_packet_handler.cpp b/libraries/core_libs/network/src/tarcap/packets_handlers/latest/pillar_vote_packet_handler.cpp index f4d3da7c38..8def36ac36 100644 --- a/libraries/core_libs/network/src/tarcap/packets_handlers/latest/pillar_vote_packet_handler.cpp +++ b/libraries/core_libs/network/src/tarcap/packets_handlers/latest/pillar_vote_packet_handler.cpp @@ -28,8 +28,9 @@ void PillarVotePacketHandler::process(const threadpool::PacketData &packet_data, throw MaliciousPeerException(err_msg.str()); } - processPillarVote(pillar_vote, peer); - onNewPillarVote(pillar_vote); + if (processPillarVote(pillar_vote, peer)) { + onNewPillarVote(pillar_vote); + } } void PillarVotePacketHandler::onNewPillarVote(const std::shared_ptr &vote, bool rebroadcast) { From 357be880f6f23051afcd250bd1da9e04e4f62515 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 3 Jul 2024 14:09:53 +0200 Subject: [PATCH 08/10] fix pillar vote logs on startup --- .../consensus/src/pillar_chain/pillar_chain_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp b/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp index 8f7f80e9a0..d3bb844e41 100644 --- a/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp +++ b/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp @@ -24,6 +24,8 @@ PillarChainManager::PillarChainManager(const FicusHardforkConfig& ficus_hf_confi current_pillar_block_vote_counts_{}, pillar_votes_{}, mutex_{} { + LOG_OBJECTS_CREATE("PILLAR_CHAIN"); + if (const auto vote = db_->getOwnPillarBlockVote(); vote) { addVerifiedPillarVote(vote); } @@ -39,8 +41,6 @@ PillarChainManager::PillarChainManager(const FicusHardforkConfig& ficus_hf_confi addVerifiedPillarVote(vote); } } - - LOG_OBJECTS_CREATE("PILLAR_CHAIN"); } std::shared_ptr PillarChainManager::createPillarBlock( From 0a31ee3380f3365c8d1caad050d11f01b29f6d89 Mon Sep 17 00:00:00 2001 From: Matus Kysel Date: Wed, 3 Jul 2024 16:31:09 +0200 Subject: [PATCH 09/10] chore: increase the version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd8bf49415..6861fc5dc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20) # Set current version of the project set(TARAXA_MAJOR_VERSION 1) set(TARAXA_MINOR_VERSION 9) -set(TARAXA_PATCH_VERSION 2) +set(TARAXA_PATCH_VERSION 3) 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 From 16437068dd67aa427b8dc7432f630887fe99cea9 Mon Sep 17 00:00:00 2001 From: Jakub Fornadel Date: Wed, 3 Jul 2024 13:51:15 -0700 Subject: [PATCH 10/10] adjust config --- .../config_jsons/default/default_config.json | 67 +++++++++++++++++++ .../config_jsons/default/default_genesis.json | 6 +- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/libraries/cli/include/cli/config_jsons/default/default_config.json b/libraries/cli/include/cli/config_jsons/default/default_config.json index 72e9409c3f..4b177f4a40 100644 --- a/libraries/cli/include/cli/config_jsons/default/default_config.json +++ b/libraries/cli/include/cli/config_jsons/default/default_config.json @@ -44,6 +44,73 @@ }, "logging": { "configurations": [ + { + "channels" : + [ + { + "name" : "SUMMARY", + "verbosity" : "INFO" + }, + { + "name" : "PILLAR_CHAIN", + "verbosity" : "DEBUG" + }, + { + "name" : "PILLAR_VOTE_PH", + "verbosity" : "DEBUG" + }, + { + "name" : "PILLAR_VOTES_BUNDLE_PH", + "verbosity" : "DEBUG" + }, + { + "name" : "PILLAR_CHAIN_SYNC_PH", + "verbosity" : "DEBUG" + }, + { + "name" : "GET_PILLAR_VOTES_BUNDLE_PH", + "verbosity" : "DEBUG" + }, + { + "name" : "GET_PILLAR_CHAIN_SYNC_PH", + "verbosity" : "DEBUG" + }, + { + "name" : "PBFT_MGR", + "verbosity" : "DEBUG" + }, + { + "name" : "PBFT_CHAIN", + "verbosity" : "DEBUG" + }, + { + "name" : "VOTE_MGR", + "verbosity" : "DEBUG" + }, + { + "name" : "EXECUTOR", + "verbosity" : "DEBUG" + } + ], + "name" : "pillar", + "on" : true, + "outputs" : + [ + { + "format" : "%ThreadID% %Channel% [%TimeStamp%] %SeverityStr%: %Message%", + "type" : "console" + }, + { + "file_name" : "Taraxa_N1_%m%d%Y_%H%M%S_%5N.log", + "format" : "%ThreadID% %ShortNodeId% %Channel% [%TimeStamp%] %SeverityStr%: %Message%", + "max_size" : 1000000000, + "rotation_size" : 10000000, + "time_based_rotation" : "0,0,0", + "type" : "file" + } + ], + "verbosity" : "ERROR" + }, { "name": "standard", "on": true, diff --git a/libraries/cli/include/cli/config_jsons/default/default_genesis.json b/libraries/cli/include/cli/config_jsons/default/default_genesis.json index 0d76a3140e..e30c5afa4a 100644 --- a/libraries/cli/include/cli/config_jsons/default/default_genesis.json +++ b/libraries/cli/include/cli/config_jsons/default/default_genesis.json @@ -116,9 +116,9 @@ "generated_rewards": "0x0" }, "ficus_hf": { - "block_num": 200, - "pillar_blocks_interval": 100, - "pillar_chain_sync_interval": 25, + "block_num": 80, + "pillar_blocks_interval": 16, + "pillar_chain_sync_interval": 8, "pbft_inclusion_delay": 6, "bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF" }