Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #2910

Closed
wants to merge 47 commits into from
Closed

Develop #2910

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
430af47
chore: adds snapshot flag to helm chart
rattrap Oct 17, 2024
3ab7678
Merge pull request #2875 from Taraxa-project/chart/snapshots_flag
rattrap Oct 17, 2024
38bb5b4
feat: add size to the blocks in the rpc
kstdl Nov 11, 2024
6b763a2
Merge pull request #2889 from Taraxa-project/block_size
kstdl Nov 11, 2024
663766d
separate packets parsing from handlers
JakubFornadel Sep 26, 2024
5e4eec7
implement NET VERSION 5 tarcap
JakubFornadel Oct 14, 2024
dd79d79
fix statusPacket rlp parsing
JakubFornadel Oct 15, 2024
a09eef6
fix packets rlp encoding/decoding
JakubFornadel Oct 16, 2024
31696f9
simplify new packets handlers code
JakubFornadel Oct 18, 2024
6558e33
fix tarcap threadpool test
JakubFornadel Oct 21, 2024
b8b3acc
use optimized rlp format for votes bundles
JakubFornadel Oct 29, 2024
c289cfb
refactor periodData getter + fix votes_bundle processing
JakubFornadel Oct 30, 2024
a186423
adjust pillar votes bundle packet
JakubFornadel Nov 2, 2024
1f6ce14
refactor dag blocks processing to work with shared pointers to avoid …
JakubFornadel Nov 2, 2024
18f1967
remove unused constants
JakubFornadel Nov 5, 2024
a9f9cf2
fix dag block packet double sending of txs, optimize packets ctors
JakubFornadel Nov 11, 2024
82cb70b
fix transaction packet
JakubFornadel Nov 8, 2024
846610c
mark received tx as known for the peer
JakubFornadel Nov 11, 2024
1cd58bb
fix transacion packet sending
JakubFornadel Nov 13, 2024
b9a1069
post merge fixes
JakubFornadel Nov 13, 2024
ed975e0
Merge pull request #2862 from Taraxa-project/issue-1830/packets-encoding
JakubFornadel Nov 13, 2024
ed13008
chore: trusted nodes
mfrankovi Nov 22, 2024
154cda3
Merge pull request #2892 from Taraxa-project/trusted_nodes
mfrankovi Nov 25, 2024
980df69
chore: update to latest develop
MatusKysel Nov 26, 2024
ce7c720
Merge pull request #2895 from Taraxa-project/update-evm
MatusKysel Nov 26, 2024
7453615
update evm
MatusKysel Nov 26, 2024
2c4008b
Merge pull request #2897 from Taraxa-project/new-evm
MatusKysel Nov 26, 2024
b1c4ab2
Update version to 1.12.1
mfrankovi Nov 14, 2024
5c8c0f4
fix: state during the tracing
kstdl Nov 22, 2024
010d990
Merge pull request #2899 from Taraxa-project/testnet_dev
kstdl Nov 28, 2024
5da06fb
implement sequoia hardfork
JakubFornadel Nov 26, 2024
0f36f1a
make locking period change part of cornus hardfork
JakubFornadel Nov 28, 2024
1db415f
adjust configs
JakubFornadel Nov 28, 2024
04d8d20
update evm
JakubFornadel Dec 2, 2024
c430fee
Merge remote-tracking branch 'origin/master' into master_develop
kstdl Dec 2, 2024
9cbf49a
Merge pull request #2902 from Taraxa-project/delegation_locking_perio…
JakubFornadel Dec 2, 2024
785b873
Merge branch 'develop' into master_develop
kstdl Dec 2, 2024
2bc913f
chore: increase gas limit
mfrankovi Nov 28, 2024
0855c6e
fix: bug after the merge
kstdl Dec 2, 2024
b4a09bc
Merge pull request #2901 from Taraxa-project/propose_gas_limit
mfrankovi Dec 2, 2024
dec30a8
Merge branch 'develop' into master_develop
kstdl Dec 2, 2024
3ebcd12
Merge pull request #2903 from Taraxa-project/master_develop
MatusKysel Dec 2, 2024
871609d
fix multiple tarcaps
JakubFornadel Dec 3, 2024
94c6ee8
Merge pull request #2906 from Taraxa-project/multiple_tarcaps_support
JakubFornadel Dec 3, 2024
69a4484
fix: propose gas limit validation
mfrankovi Dec 3, 2024
6ac9d82
Merge pull request #2907 from Taraxa-project/propose_gas_limit_fix
mfrankovi Dec 4, 2024
478fc88
chore: new testnet
MatusKysel Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.20)
# Set current version of the project
set(TARAXA_MAJOR_VERSION 1)
set(TARAXA_MINOR_VERSION 12)
set(TARAXA_PATCH_VERSION 0)
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 4)
set(TARAXA_NET_VERSION 5)
# Major version is modified when DAG blocks, pbft blocks and any basic building blocks of our blockchain is modified
# in the db
set(TARAXA_DB_MAJOR_VERSION 1)
Expand Down
2 changes: 1 addition & 1 deletion charts/taraxa-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "1.0"
description: Kubernetes helm chart for Taraxa blockchain full node implementation.
name: taraxa-node
version: 0.3.13
version: 0.3.14
keywords:
- blockchain
- taraxa
Expand Down
6 changes: 6 additions & 0 deletions charts/taraxa-node/templates/consensus-node-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ data:
{{- end }}
{{- end }}

{{ if .Values.config.snapshots.enabled }}
cat $CONFIG_PATH | jq '.db_config.db_max_snapshots = 1' | jq '.db_config.db_snapshot_each_n_pbft_block = 10000' > $CONFIG_PATH.tmp && mv $CONFIG_PATH.tmp $CONFIG_PATH
{{- else }}
cat $CONFIG_PATH | jq '.db_config.db_max_snapshots = 0' | jq '.db_config.db_snapshot_each_n_pbft_block = 0' > $CONFIG_PATH.tmp && mv $CONFIG_PATH.tmp $CONFIG_PATH
{{- end }}

echo "***** $CONFIG_PATH *****"
cat $CONFIG_PATH
echo "***** $CONFIG_PATH *****"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ data:
{{- end }}
{{- end }}

{{ if .Values.config.snapshots.enabled }}
cat $CONFIG_PATH | jq '.db_config.db_max_snapshots = 1' | jq '.db_config.db_snapshot_each_n_pbft_block = 10000' > $CONFIG_PATH.tmp && mv $CONFIG_PATH.tmp $CONFIG_PATH
{{- else }}
cat $CONFIG_PATH | jq '.db_config.db_max_snapshots = 0' | jq '.db_config.db_snapshot_each_n_pbft_block = 0' > $CONFIG_PATH.tmp && mv $CONFIG_PATH.tmp $CONFIG_PATH
{{- end }}

echo "***** $CONFIG_PATH *****"
cat $CONFIG_PATH
echo "***** $CONFIG_PATH *****"
Expand Down
6 changes: 6 additions & 0 deletions charts/taraxa-node/templates/taraxa-node-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ data:
{{- end }}
{{- end }}

{{ if .Values.config.snapshots.enabled }}
cat $CONFIG_PATH | jq '.db_config.db_max_snapshots = 1' | jq '.db_config.db_snapshot_each_n_pbft_block = 10000' > $CONFIG_PATH.tmp && mv $CONFIG_PATH.tmp $CONFIG_PATH
{{- else }}
cat $CONFIG_PATH | jq '.db_config.db_max_snapshots = 0' | jq '.db_config.db_snapshot_each_n_pbft_block = 0' > $CONFIG_PATH.tmp && mv $CONFIG_PATH.tmp $CONFIG_PATH
{{- end }}

echo "***** $CONFIG_PATH *****"
cat $CONFIG_PATH
echo "***** $CONFIG_PATH *****"
Expand Down
2 changes: 2 additions & 0 deletions charts/taraxa-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ config:
# 100 for default helm test
network: "100"
extraArgs: []
snapshots:
enabled: true

# Default keys, VRFs and address for kube testing
node:
Expand Down
7 changes: 5 additions & 2 deletions libraries/aleth/libp2p/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ void Host::startPeerSession(Public const& _id, RLP const& _hello, unique_ptr<RLP
}
}
}
if (!disconnect_reason && !peerSlotsAvailable()) {
auto is_trusted_node = m_netConfig.trustedNodes.contains(peer->address());
if (!disconnect_reason && (!peerSlotsAvailable() && !is_trusted_node)) {
cnetdetails << "Too many peers, can't connect. peer count: " << peer_count_()
<< " pending peers: " << m_pendingPeerConns.size();
disconnect_reason = TooManyPeers;
Expand Down Expand Up @@ -411,7 +412,9 @@ void Host::runAcceptor() {
return;
}
auto socket = make_shared<RLPXSocket>(std::move(_socket));
if (peer_count_() > peerSlots(Ingress)) {
// Since a connecting peer might be a trusted node which should always connect allow up to max number of trusted
// nodes above the limit
if (peer_count_() > (peerSlots(Ingress) + m_netConfig.trustedNodes.size())) {
cnetdetails << "Dropping incoming connect due to maximum peer count (" << Ingress
<< " * ideal peer count): " << socket->remoteEndpoint();
socket->close();
Expand Down
3 changes: 3 additions & 0 deletions libraries/aleth/libp2p/Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ struct NetworkConfig {
std::string listenIPAddress;
uint16_t listenPort = c_defaultListenPort;

/// Trusted Nodes
std::unordered_set<dev::p2p::NodeID> trustedNodes;

/// Preferences

bool traverseNAT = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
"pillar_blocks_interval": 10,
"bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF"
},
"cornus_hf_block_num": 100
"cornus_hf": {
"block_num": 100,
"delegation_locking_period": 5,
"dag_gas_limit": "0x1908B100",
"pbft_gas_limit": "0x7d2b7500"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@
"pillar_blocks_interval": 10,
"bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF"
},
"cornus_hf_block_num": 0
"cornus_hf": {
"block_num": 0,
"delegation_locking_period": 5,
"dag_gas_limit": "0x1908B100",
"pbft_gas_limit": "0x7d2b7500"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,11 @@
"pillar_blocks_interval": 4000,
"bridge_contract_address": "0xe126E0BaeAE904b8Cfd619Be1A8667A173b763a1"
},
"cornus_hf_block_num": -1
"cornus_hf": {
"block_num": -1,
"delegation_locking_period": 163459,
"dag_gas_limit": "0x1908B100",
"pbft_gas_limit": "0x7d2b7500"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"listen_port": 10002,
"transaction_interval_ms": 100,
"ideal_peer_count": 10,
"max_peer_count": 50,
"max_peer_count": 20,
"sync_level_size": 10,
"packets_processing_threads": 14,
"peer_blacklist_timeout": 600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"level": "0x0",
"pivot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"sig": "0xb7e22d46c1ba94d5e8347b01d137b5c428fcbbeaf0a77fb024cbbf1517656ff00d04f7f25be608c321b0d7483c402c294ff46c49b265305d046a52236c0a363701",
"timestamp": "0x669f7f20",
"timestamp": "0x6750605A",
"tips": [],
"transactions": []
},
Expand Down Expand Up @@ -105,13 +105,13 @@
"dag_blocks_size": "0x32",
"ghost_path_move_back": "0x0",
"lambda_ms": "0x5DC",
"gas_limit": "0x7d2b7500"
"gas_limit": "0x12C684C0"
},
"dag": {
"block_proposer": {
"shard": 1
},
"gas_limit": "0x1908B100"
"gas_limit": "0x1E0A6E0"
},
"sortition": {
"changes_count_for_average": 10,
Expand Down Expand Up @@ -154,6 +154,11 @@
"pillar_blocks_interval": 1000,
"bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF"
},
"cornus_hf_block_num": 1668000
"cornus_hf": {
"block_num": 1000,
"delegation_locking_period": 5,
"dag_gas_limit": "0x1908B100",
"pbft_gas_limit": "0x7d2b7500"
}
}
}
2 changes: 1 addition & 1 deletion libraries/common/include/common/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ constexpr uint32_t kDefaultTransactionPoolSize{200000};
constexpr uint32_t kMaxNonFinalizedTransactions{1000000};
constexpr uint32_t kMaxNonFinalizedDagBlocks{100};

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

const uint32_t kRecentlyFinalizedTransactionsFactor = 2;

Expand Down
2 changes: 2 additions & 0 deletions libraries/config/include/config/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ struct FullNodeConfig {
bool enable_test_rpc = false;
bool enable_debug = false;
uint32_t final_chain_cache_in_blocks = 5;
uint64_t propose_dag_gas_limit = 0x1E0A6E0;
uint64_t propose_pbft_gas_limit = 0x12C684C0;

// config values that limits transactions pool
uint32_t transactions_pool_size = kDefaultTransactionPoolSize;
Expand Down
4 changes: 1 addition & 3 deletions libraries/config/include/config/config_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ Json::Value getConfigData(Json::Value root, const std::vector<std::string> &path
std::string getConfigDataAsString(const Json::Value &root, const std::vector<std::string> &path, bool optional = false,
const std::string &value = {});

uint32_t getConfigDataAsUInt(const Json::Value &root, const std::vector<std::string> &path, bool optional = false,
uint64_t getConfigDataAsUInt(const Json::Value &root, const std::vector<std::string> &path, bool optional = false,
uint32_t value = 0);

uint64_t getConfigDataAsUInt64(const Json::Value &root, const std::vector<std::string> &path);

bool getConfigDataAsBoolean(const Json::Value &root, const std::vector<std::string> &path, bool optional = false,
bool value = false);

Expand Down
1 change: 1 addition & 0 deletions libraries/config/include/config/genesis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct GenesisConfig {
bytes rlp() const;
blk_hash_t genesisHash() const;
void updateBlocksPerYear();
std::pair<uint64_t, uint64_t> getGasLimits(uint64_t block_number) const;
};

Json::Value enc_json(GenesisConfig const& obj);
Expand Down
17 changes: 15 additions & 2 deletions libraries/config/include/config/hardfork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ struct FicusHardforkConfig {
Json::Value enc_json(const FicusHardforkConfig& obj);
void dec_json(const Json::Value& json, FicusHardforkConfig& obj);

struct CornusHardforkConfig {
uint64_t block_num = -1;
uint32_t delegation_locking_period = 5; // number of blocks
uint64_t dag_gas_limit = 0;
uint64_t pbft_gas_limit = 0;

HAS_RLP_FIELDS
};
Json::Value enc_json(const CornusHardforkConfig& obj);
void dec_json(const Json::Value& json, CornusHardforkConfig& obj);

// Keeping it for next HF
// struct BambooRedelegation {
// taraxa::addr_t validator;
Expand Down Expand Up @@ -131,9 +142,11 @@ struct HardforksConfig {
FicusHardforkConfig ficus_hf;

// Cornus hf - support multiple undelegations from the same validator at the same time
uint64_t cornus_hf_block_num{0};
// - change of delegation locking period
// - change gas limit
CornusHardforkConfig cornus_hf;

bool isCornusHardfork(uint64_t block_number) const { return block_number >= cornus_hf_block_num; }
bool isOnCornusHardfork(uint64_t block_number) const { return block_number >= cornus_hf.block_num; }

HAS_RLP_FIELDS
};
Expand Down
2 changes: 2 additions & 0 deletions libraries/config/include/config/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>

#include "common/types.hpp"
#include "libp2p/Common.h"

namespace taraxa {

Expand Down Expand Up @@ -82,6 +83,7 @@ struct NetworkConfig {
bool disable_peer_blacklist = false;
uint16_t deep_syncing_threshold = 10;
DdosProtectionConfig ddos_protection;
std::unordered_set<dev::p2p::NodeID> trusted_nodes;

std::optional<ConnectionConfig> rpc;
std::optional<ConnectionConfig> graphql;
Expand Down
7 changes: 5 additions & 2 deletions libraries/config/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ std::vector<logger::Config> FullNodeConfig::loadLoggingConfigs(const Json::Value
output.target = log_path;
output.file_name = (log_path / getConfigDataAsString(o, {"file_name"})).string();
output.format = getConfigDataAsString(o, {"format"});
output.max_size = getConfigDataAsUInt64(o, {"max_size"});
output.rotation_size = getConfigDataAsUInt64(o, {"rotation_size"});
output.max_size = getConfigDataAsUInt(o, {"max_size"});
output.rotation_size = getConfigDataAsUInt(o, {"rotation_size"});
output.time_based_rotation = getConfigDataAsString(o, {"time_based_rotation"});
}
logging.outputs.push_back(output);
Expand Down Expand Up @@ -108,6 +108,9 @@ FullNodeConfig::FullNodeConfig(const Json::Value &string_or_object, const Json::
genesis = GenesisConfig();
}

propose_dag_gas_limit = getConfigDataAsUInt(root, {"propose_dag_gas_limit"}, true, propose_dag_gas_limit);
propose_pbft_gas_limit = getConfigDataAsUInt(root, {"propose_pbft_gas_limit"}, true, propose_pbft_gas_limit);

is_light_node = getConfigDataAsBoolean(root, {"is_light_node"}, true, is_light_node);
const auto min_light_node_history = (genesis.state.dpos.blocks_per_year * kDefaultLightNodeHistoryDays) / 365;
light_node_history = getConfigDataAsUInt(root, {"light_node_history"}, true, min_light_node_history);
Expand Down
13 changes: 3 additions & 10 deletions libraries/config/src/config_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <fstream>

#include "common/config_exception.hpp"
#include "libdevcore/CommonJS.h"

namespace taraxa {

Expand Down Expand Up @@ -44,14 +45,14 @@ std::string getConfigDataAsString(const Json::Value &root, const std::vector<std
}
}

uint32_t getConfigDataAsUInt(const Json::Value &root, const std::vector<std::string> &path, bool optional,
uint64_t getConfigDataAsUInt(const Json::Value &root, const std::vector<std::string> &path, bool optional,
uint32_t value) {
try {
Json::Value ret = getConfigData(root, path, optional);
if (ret.isNull()) {
return value;
} else {
return ret.asUInt();
return dev::getUInt(ret);
}
} catch (Json::Exception &e) {
if (optional) {
Expand All @@ -61,14 +62,6 @@ uint32_t getConfigDataAsUInt(const Json::Value &root, const std::vector<std::str
}
}

uint64_t getConfigDataAsUInt64(const Json::Value &root, const std::vector<std::string> &path) {
try {
return getConfigData(root, path).asUInt64();
} catch (Json::Exception &e) {
throw ConfigException(getConfigErr(path) + e.what());
}
}

bool getConfigDataAsBoolean(const Json::Value &root, const std::vector<std::string> &path, bool optional, bool value) {
try {
Json::Value ret = getConfigData(root, path, optional);
Expand Down
11 changes: 9 additions & 2 deletions libraries/config/src/genesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ GenesisConfig::GenesisConfig() {
pbft.committee_size = 5;
pbft.dag_blocks_size = 100;
pbft.ghost_path_move_back = 1;
pbft.gas_limit = 60000000;
pbft.gas_limit = 315000000;

// DAG config
dag.gas_limit = 10000000;
dag.gas_limit = 315000000;

// DPOS config
auto& dpos = state.dpos;
Expand Down Expand Up @@ -129,4 +129,11 @@ bytes GenesisConfig::rlp() const {

blk_hash_t GenesisConfig::genesisHash() const { return dev::sha3(rlp()); }

std::pair<uint64_t, uint64_t> GenesisConfig::getGasLimits(uint64_t block_number) const {
if (state.hardforks.isOnCornusHardfork(block_number)) {
return {state.hardforks.cornus_hf.dag_gas_limit, state.hardforks.cornus_hf.pbft_gas_limit};
}
return {dag.gas_limit, pbft.gas_limit};
}

} // namespace taraxa
Loading
Loading