diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cda425b08..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 0) +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 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" } 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 726b4d0d97..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": "0x658C3F5E", + "timestamp": "0x66827F92", "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, + "block_num": 1000, "pillar_blocks_interval": 100, "pillar_chain_sync_interval": 25, "pbft_inclusion_delay": 6, - "bridge_contract_address": "0x0000000000000000000000000000000000000000" + "bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF" } } } \ No newline at end of file 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/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; } 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( 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) { 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)