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

chore: fix commision rewards #2662

Merged
merged 9 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.20)

# Set current version of the project
set(TARAXA_MAJOR_VERSION 1)
set(TARAXA_MINOR_VERSION 5)
set(TARAXA_PATCH_VERSION 3)
set(TARAXA_MINOR_VERSION 6)
set(TARAXA_PATCH_VERSION 0)
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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang
RUN ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++

# Install conan
RUN pip3 install conan==1.59.0
RUN pip3 install conan==1.60.0

ENV CONAN_REVISIONS_ENABLED=1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
},
"hardforks": {
"fix_redelegate_block_num": 0,
"phalaenopsis_hf_block_num": 0,
"rewards_distribution_frequency": {
"0" : 100
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
},
"hardforks": {
"fix_redelegate_block_num": 0,
"phalaenopsis_hf_block_num": 1000,
"rewards_distribution_frequency": {
"0": 100
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,7 @@
},
"hardforks": {
"fix_redelegate_block_num": 3091000,
"phalaenopsis_hf_block_num": 6943000,
"redelegations": [
{
"validator": "0x6671df8b597c0A14a9361b4B98F97AF1360e4352",
Expand All @@ -1635,10 +1636,10 @@
}
],
"rewards_distribution_frequency": {
"5730000" : 100
"5730000": 100
},
"magnolia_hf" : {
"block_num" : 5730000,
"magnolia_hf": {
"block_num": 5730000,
"jail_time": 163459
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
},
"hardforks": {
"fix_redelegate_block_num": 0,
"phalaenopsis_hf_block_num": 0,
"redelegations": [],
"rewards_distribution_frequency": {
"297000": 100
Expand Down
2 changes: 2 additions & 0 deletions libraries/config/include/config/hardfork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void dec_json(const Json::Value& json, MagnoliaHardfork& obj);
struct HardforksConfig {
// disable it by default (set to max uint64)
uint64_t fix_redelegate_block_num = -1;
// disable it by default (set to max uint64)
uint64_t phalaenopsis_hf_block_num = -1;
kstdl marked this conversation as resolved.
Show resolved Hide resolved
std::vector<Redelegation> redelegations;
/*
* @brief key is block number at which change is applied and value is new distribution interval.
Expand Down
5 changes: 4 additions & 1 deletion libraries/config/src/hardfork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ RLP_FIELDS_DEFINE(MagnoliaHardfork, block_num, jail_time)
Json::Value enc_json(const HardforksConfig& obj) {
Json::Value json(Json::objectValue);
json["fix_redelegate_block_num"] = dev::toJS(obj.fix_redelegate_block_num);
json["phalaenopsis_hf_block_num"] = dev::toJS(obj.phalaenopsis_hf_block_num);
json["initial_validators"] = Json::Value(Json::arrayValue);
for (const auto& v : obj.redelegations) {
json["redelegations"].append(enc_json(v));
Expand All @@ -50,6 +51,7 @@ Json::Value enc_json(const HardforksConfig& obj) {

void dec_json(const Json::Value& json, HardforksConfig& obj) {
obj.fix_redelegate_block_num = dev::getUInt(json["fix_redelegate_block_num"]);
obj.phalaenopsis_hf_block_num = dev::getUInt(json["phalaenopsis_hf_block_num"]);

const auto& redelegations_json = json["redelegations"];
obj.redelegations = std::vector<Redelegation>(redelegations_json.size());
Expand All @@ -70,4 +72,5 @@ void dec_json(const Json::Value& json, HardforksConfig& obj) {
}
}

RLP_FIELDS_DEFINE(HardforksConfig, fix_redelegate_block_num, redelegations, rewards_distribution_frequency, magnolia_hf)
RLP_FIELDS_DEFINE(HardforksConfig, fix_redelegate_block_num, phalaenopsis_hf_block_num, redelegations,
rewards_distribution_frequency, magnolia_hf)
2 changes: 1 addition & 1 deletion tests/rewards_stats_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct RewardsStatsTest : NodesTest {};
class TestableRewardsStats : public rewards::Stats {
public:
TestableRewardsStats(const HardforksConfig::RewardsDistributionMap& rdm, std::shared_ptr<DB> db)
: rewards::Stats(100, HardforksConfig{0, {}, rdm, MagnoliaHardfork{0, 0}}, db, [](auto) { return 100; }) {}
: rewards::Stats(100, HardforksConfig{0, 0, {}, rdm, MagnoliaHardfork{0, 0}}, db, [](auto) { return 100; }) {}
auto getStats() { return blocks_stats_; }
};

Expand Down
Loading