diff --git a/libraries/cli/include/cli/default_config.hpp b/libraries/cli/include/cli/default_config.hpp index 5af1f4e98f..d5133af3d2 100644 --- a/libraries/cli/include/cli/default_config.hpp +++ b/libraries/cli/include/cli/default_config.hpp @@ -174,7 +174,7 @@ const char *default_json = R"foo({ "deposit_delay": "0x5", "withdrawal_delay": "0x5", "eligibility_balance_threshold": "0x186A0", - "coins_per_vote": "0x186A0", + "vote_eligibility_balance_step": "0x186A0", "genesis_state": { "0x0274cfffea9fa850e54c93a23042f12a87358a82": { "0x1f8333245650a19a0683891b7afe7787a3ce9f00": "0x989680", @@ -207,7 +207,7 @@ const char *default_json = R"foo({ "111f91441efc8c6c0edf6534970cc887e2fabaa8": "0x24048ce3d000000000000000000" }, "hardforks": { - "fix_genesis_hardfork_block_num": "0x12c" + "fix_genesis_fork_block": "0x12c" } } }, diff --git a/libraries/cli/include/cli/devnet_config.hpp b/libraries/cli/include/cli/devnet_config.hpp index 4933ce2ad0..006e5817c9 100644 --- a/libraries/cli/include/cli/devnet_config.hpp +++ b/libraries/cli/include/cli/devnet_config.hpp @@ -102,7 +102,7 @@ const char *devnet_json = R"foo({ "deposit_delay": "0x5", "withdrawal_delay": "0x5", "eligibility_balance_threshold": "0xf4240", - "coins_per_vote": "0xf4240", + "vote_eligibility_balance_step": "0xf4240", "genesis_state": { "0x7e4aa664f71de4e9d0b4a6473d796372639bdcde": { "0x780fe8b2226cf212c55635de399ee4c2a860810c": "0xf4240", @@ -129,7 +129,7 @@ const char *devnet_json = R"foo({ "7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0x1027e72f1f12813088000000" }, "hardforks": { - "fix_genesis_hardfork_block_num": "0x0" + "fix_genesis_fork_block": "0x0" } } }, diff --git a/libraries/cli/include/cli/testnet_config.hpp b/libraries/cli/include/cli/testnet_config.hpp index 820cd5df94..3ff46d7f97 100644 --- a/libraries/cli/include/cli/testnet_config.hpp +++ b/libraries/cli/include/cli/testnet_config.hpp @@ -102,7 +102,7 @@ const char *testnet_json = R"foo({ "deposit_delay": "0x5", "withdrawal_delay": "0x5", "eligibility_balance_threshold": "0xf4240", - "coins_per_vote": "0xf4240", + "vote_eligibility_balance_step": "0xf4240", "genesis_state": { "0x6c05d6e367a8c798308efbf4cefc1a18921a6f89": { "0x18551e353aa65bc0ffbdf9d93b7ad4a8fe29cf95": "0xf4240", @@ -132,7 +132,7 @@ const char *testnet_json = R"foo({ "f4a52b8f6dc8ab046fec6ad02e77023c044342e4": "0x1027e72f1f12813088000000" }, "hardforks": { - "fix_genesis_hardfork_block_num": "0x0" + "fix_genesis_fork_block": "0x0" } } }, diff --git a/libraries/cli/src/config.cpp b/libraries/cli/src/config.cpp index 9c7d0074bb..0f16fc5d06 100644 --- a/libraries/cli/src/config.cpp +++ b/libraries/cli/src/config.cpp @@ -160,21 +160,24 @@ Config::Config(int argc, const char* argv[]) { Json::Value config_json = Tools::readJsonFromFile(config); Json::Value wallet_json = Tools::readJsonFromFile(wallet); - auto override = [&]() { + auto override_config_file = [&]() { Tools::writeJsonToFile(config, config_json); Tools::writeJsonToFile(wallet, wallet_json); }; - network_id = dev::getUInt(config_json["chain_config"]["chain_id"]); - auto default_config_json = Tools::generateConfig((Config::NetworkIdType)network_id); - // override hardforks data with one from default json - addNewHardforks(config_json, default_config_json); - // add coins_per_vote field if it is missing in the config - if (config_json["chain_config"]["final_chain"]["state"]["dpos"]["coins_per_vote"].isNull()) { - config_json["chain_config"]["final_chain"]["state"]["dpos"]["coins_per_vote"] = - default_config_json["chain_config"]["final_chain"]["state"]["dpos"]["coins_per_vote"]; + // Check that it is not empty, to not create chain config with just overwritten files + if (!config_json["chain_config"].isNull()) { + network_id = dev::getUInt(config_json["chain_config"]["chain_id"]); + auto default_config_json = Tools::generateConfig((Config::NetworkIdType)network_id); + // override hardforks data with one from default json + addNewHardforks(config_json, default_config_json); + // add vote_eligibility_balance_step field if it is missing in the config + if (config_json["chain_config"]["final_chain"]["state"]["dpos"]["vote_eligibility_balance_step"].isNull()) { + config_json["chain_config"]["final_chain"]["state"]["dpos"]["vote_eligibility_balance_step"] = + default_config_json["chain_config"]["final_chain"]["state"]["dpos"]["vote_eligibility_balance_step"]; + } + override_config_file(); } - override(); // Override config values with values from CLI config_json = Tools::overrideConfig(config_json, data_dir, boot_node, boot_nodes, log_channels, boot_nodes_append, @@ -190,7 +193,7 @@ Config::Config(int argc, const char* argv[]) { // or if running config command // This can overwrite secret keys in wallet if (overwrite_config || command[0] == CONFIG_COMMAND) { - override(); + override_config_file(); } // Load config @@ -231,12 +234,12 @@ bool Config::nodeConfigured() { return node_configured_; } FullNodeConfig Config::getNodeConfiguration() { return node_config_; } void Config::addNewHardforks(Json::Value& config, const Json::Value& default_config) { - // network_id is exactly the same thing as chain_id. So get it from config auto& new_hardforks_json = default_config["chain_config"]["final_chain"]["state"]["hardforks"]; auto& local_hardforks_json = config["chain_config"]["final_chain"]["state"]["hardforks"]; if (local_hardforks_json.isNull()) { local_hardforks_json = new_hardforks_json; + return; } for (auto itr = new_hardforks_json.begin(); itr != new_hardforks_json.end(); ++itr) { auto& local = local_hardforks_json[itr.key().asString()]; diff --git a/libraries/config/include/config/hardfork.hpp b/libraries/config/include/config/hardfork.hpp index b869090242..13bd53546c 100644 --- a/libraries/config/include/config/hardfork.hpp +++ b/libraries/config/include/config/hardfork.hpp @@ -5,7 +5,7 @@ #include "common/encoding_rlp.hpp" struct Hardforks { - uint64_t fix_genesis_hardfork_block_num = 0; + uint64_t fix_genesis_fork_block = 0; void processFixGenesisHardfork() const; HAS_RLP_FIELDS }; diff --git a/libraries/config/include/config/state_api_config.hpp b/libraries/config/include/config/state_api_config.hpp index 79093b988a..f22dc13031 100644 --- a/libraries/config/include/config/state_api_config.hpp +++ b/libraries/config/include/config/state_api_config.hpp @@ -31,7 +31,7 @@ void dec_json(Json::Value const& json, BalanceMap& obj); struct DPOSConfig { u256 eligibility_balance_threshold; - u256 coins_per_vote; + u256 vote_eligibility_balance_step; EthBlockNumber deposit_delay = 0; EthBlockNumber withdrawal_delay = 0; std::unordered_map genesis_state; diff --git a/libraries/config/src/chain_config.cpp b/libraries/config/src/chain_config.cpp index 6e619f5fab..78ad21075e 100644 --- a/libraries/config/src/chain_config.cpp +++ b/libraries/config/src/chain_config.cpp @@ -52,7 +52,7 @@ decltype(ChainConfig::predefined_) const ChainConfig::predefined_([] { cfg.final_chain.state.genesis_balances[root_node_addr] = 9007199254740991; auto& dpos = cfg.final_chain.state.dpos.emplace(); dpos.eligibility_balance_threshold = 1000000000; - dpos.coins_per_vote = 1000000000; + dpos.vote_eligibility_balance_step = 1000000000; dpos.genesis_state[root_node_addr][root_node_addr] = dpos.eligibility_balance_threshold; // VDF config cfg.sortition.vrf.threshold_upper = 0x8000; diff --git a/libraries/config/src/hardfork.cpp b/libraries/config/src/hardfork.cpp index ec8c94d0fd..950558fc19 100644 --- a/libraries/config/src/hardfork.cpp +++ b/libraries/config/src/hardfork.cpp @@ -2,14 +2,14 @@ Json::Value enc_json(const Hardforks& obj) { Json::Value json(Json::objectValue); - json["fix_genesis_hardfork_block_num"] = dev::toJS(obj.fix_genesis_hardfork_block_num); + json["fix_genesis_fork_block"] = dev::toJS(obj.fix_genesis_fork_block); return json; } void dec_json(const Json::Value& json, Hardforks& obj) { - if (auto const& e = json["fix_genesis_hardfork_block_num"]) { - obj.fix_genesis_hardfork_block_num = dev::getUInt(e); + if (auto const& e = json["fix_genesis_fork_block"]) { + obj.fix_genesis_fork_block = dev::getUInt(e); } } -RLP_FIELDS_DEFINE(Hardforks, fix_genesis_hardfork_block_num) +RLP_FIELDS_DEFINE(Hardforks, fix_genesis_fork_block) diff --git a/libraries/config/src/state_api_config.cpp b/libraries/config/src/state_api_config.cpp index 42c966b39f..4fd59f124a 100644 --- a/libraries/config/src/state_api_config.cpp +++ b/libraries/config/src/state_api_config.cpp @@ -71,7 +71,7 @@ Json::Value enc_json(DPOSConfig const& obj) { json["eligibility_balance_threshold"] = dev::toJS(obj.eligibility_balance_threshold); json["deposit_delay"] = dev::toJS(obj.deposit_delay); json["withdrawal_delay"] = dev::toJS(obj.withdrawal_delay); - json["coins_per_vote"] = dev::toJS(obj.coins_per_vote); + json["vote_eligibility_balance_step"] = dev::toJS(obj.vote_eligibility_balance_step); auto& genesis_state = json["genesis_state"] = Json::Value(Json::objectValue); for (auto const& [k, v] : obj.genesis_state) { genesis_state[dev::toJS(k)] = enc_json(v); @@ -83,7 +83,7 @@ void dec_json(Json::Value const& json, DPOSConfig& obj) { obj.eligibility_balance_threshold = dev::jsToU256(json["eligibility_balance_threshold"].asString()); obj.deposit_delay = dev::jsToInt(json["deposit_delay"].asString()); obj.withdrawal_delay = dev::jsToInt(json["withdrawal_delay"].asString()); - obj.coins_per_vote = dev::jsToInt(json["coins_per_vote"].asString()); + obj.vote_eligibility_balance_step = dev::jsToInt(json["vote_eligibility_balance_step"].asString()); auto const& genesis_state = json["genesis_state"]; for (auto const& k : genesis_state.getMemberNames()) { dec_json(genesis_state[k], obj.genesis_state[addr_t(k)]); @@ -105,8 +105,8 @@ void dec_json(Json::Value const& json, ExecutionOptions& obj) { RLP_FIELDS_DEFINE(ExecutionOptions, disable_nonce_check, disable_gas_fee) RLP_FIELDS_DEFINE(ETHChainConfig, homestead_block, dao_fork_block, eip_150_block, eip_158_block, byzantium_block, constantinople_block, petersburg_block) -RLP_FIELDS_DEFINE(DPOSConfig, eligibility_balance_threshold, coins_per_vote, deposit_delay, withdrawal_delay, - genesis_state) +RLP_FIELDS_DEFINE(DPOSConfig, eligibility_balance_threshold, vote_eligibility_balance_step, deposit_delay, + withdrawal_delay, genesis_state) RLP_FIELDS_DEFINE(Config, eth_chain_config, disable_block_rewards, execution_options, genesis_balances, dpos, hardforks) RLP_FIELDS_DEFINE(Opts, expected_max_trx_per_block, max_trie_full_node_levels_to_cache) RLP_FIELDS_DEFINE(OptsDB, db_path, disable_most_recent_trie_value_views) diff --git a/libraries/core_libs/consensus/include/final_chain/state_api.hpp b/libraries/core_libs/consensus/include/final_chain/state_api.hpp index 67f0f831a0..41911c7cbf 100644 --- a/libraries/core_libs/consensus/include/final_chain/state_api.hpp +++ b/libraries/core_libs/consensus/include/final_chain/state_api.hpp @@ -44,7 +44,7 @@ class StateAPI { uint64_t dpos_eligible_vote_count(EthBlockNumber blk_num, addr_t const& addr) const; bool dpos_is_eligible(EthBlockNumber blk_num, addr_t const& addr) const; - u256 get_staking_balance(EthBlockNumber blk_num, addr_t const& addr) const; + u256 get_staking_balance(EthBlockNumber blk_num, const addr_t& addr) const; DPOSQueryResult dpos_query(EthBlockNumber blk_num, DPOSQuery const& q) const; static addr_t const& dpos_contract_addr(); diff --git a/libraries/core_libs/consensus/src/final_chain/final_chain.cpp b/libraries/core_libs/consensus/src/final_chain/final_chain.cpp index 463423b013..e08dc2b5ce 100644 --- a/libraries/core_libs/consensus/src/final_chain/final_chain.cpp +++ b/libraries/core_libs/consensus/src/final_chain/final_chain.cpp @@ -161,7 +161,6 @@ class FinalChainImpl final : public FinalChain { precommit_ext(*result, batch); } db_->commitWriteBatch(batch, db_opts_w_); - block_finalized_emitter_.emit(result); state_api_.transition_state_commit(); { unique_lock l(last_block_mu_); @@ -169,6 +168,7 @@ class FinalChainImpl final : public FinalChain { } num_executed_dag_blk_ = num_executed_dag_blk; num_executed_trx_ = num_executed_trx; + block_finalized_emitter_.emit(result); LOG(log_nf_) << " successful finalize block " << result->hash << " with number " << blk_header->number; // Creates snapshot if needed if (db_->createSnapshot(blk_header->number)) { diff --git a/libraries/core_libs/network/rpc/Test.cpp b/libraries/core_libs/network/rpc/Test.cpp index d153975dfa..aa9ac196bc 100644 --- a/libraries/core_libs/network/rpc/Test.cpp +++ b/libraries/core_libs/network/rpc/Test.cpp @@ -281,7 +281,7 @@ Json::Value Test::get_all_nodes() { return res; } -Json::Value Test::get_coins_per_vote(const Json::Value ¶m1) { +Json::Value Test::get_vote_weight(const Json::Value ¶m1) { Json::Value res; try { if (auto node = full_node_.lock()) { diff --git a/libraries/core_libs/network/rpc/Test.h b/libraries/core_libs/network/rpc/Test.h index 0cf73f7591..e99dcdfa22 100644 --- a/libraries/core_libs/network/rpc/Test.h +++ b/libraries/core_libs/network/rpc/Test.h @@ -33,7 +33,7 @@ class Test : public TestFace { virtual Json::Value get_node_count() override; virtual Json::Value get_all_peers() override; virtual Json::Value get_all_nodes() override; - virtual Json::Value get_coins_per_vote(const Json::Value& param1) override; + virtual Json::Value get_vote_weight(const Json::Value& param1) override; virtual Json::Value place_vote(const Json::Value& param1) override; virtual Json::Value get_votes(const Json::Value& param1) override; virtual Json::Value draw_graph(const Json::Value& param1) override; diff --git a/libraries/core_libs/network/rpc/Test.jsonrpc.json b/libraries/core_libs/network/rpc/Test.jsonrpc.json index 7d52b5baec..5525fba072 100644 --- a/libraries/core_libs/network/rpc/Test.jsonrpc.json +++ b/libraries/core_libs/network/rpc/Test.jsonrpc.json @@ -80,7 +80,7 @@ "returns": {} }, { - "name": "get_coins_per_vote", + "name": "get_vote_weight", "params": [ {} ], diff --git a/libraries/core_libs/network/rpc/TestClient.h b/libraries/core_libs/network/rpc/TestClient.h index 31394b5712..1de3ba68bd 100644 --- a/libraries/core_libs/network/rpc/TestClient.h +++ b/libraries/core_libs/network/rpc/TestClient.h @@ -140,10 +140,10 @@ class TestClient : public jsonrpc::Client { else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value get_coins_per_vote(const Json::Value& param1) throw(jsonrpc::JsonRpcException) { + Json::Value get_vote_weight(const Json::Value& param1) throw(jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->CallMethod("get_coins_per_vote", p); + Json::Value result = this->CallMethod("get_vote_weight", p); if (result.isObject()) return result; else diff --git a/libraries/core_libs/network/rpc/TestFace.h b/libraries/core_libs/network/rpc/TestFace.h index ca1ca32e2e..7ff1996cf5 100644 --- a/libraries/core_libs/network/rpc/TestFace.h +++ b/libraries/core_libs/network/rpc/TestFace.h @@ -52,9 +52,9 @@ class TestFace : public ServerInterface { &taraxa::net::TestFace::get_all_peersI); this->bindAndAddMethod(jsonrpc::Procedure("get_all_nodes", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, NULL), &taraxa::net::TestFace::get_all_nodesI); - this->bindAndAddMethod(jsonrpc::Procedure("get_coins_per_vote", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, + this->bindAndAddMethod(jsonrpc::Procedure("get_vote_weight", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1", jsonrpc::JSON_OBJECT, NULL), - &taraxa::net::TestFace::get_coins_per_voteI); + &taraxa::net::TestFace::get_vote_weightI); this->bindAndAddMethod(jsonrpc::Procedure("place_vote", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1", jsonrpc::JSON_OBJECT, NULL), &taraxa::net::TestFace::place_voteI); @@ -140,8 +140,8 @@ class TestFace : public ServerInterface { (void)request; response = this->get_all_nodes(); } - inline virtual void get_coins_per_voteI(const Json::Value &request, Json::Value &response) { - response = this->get_coins_per_vote(request[0u]); + inline virtual void get_vote_weightI(const Json::Value &request, Json::Value &response) { + response = this->get_vote_weight(request[0u]); } inline virtual void place_voteI(const Json::Value &request, Json::Value &response) { response = this->place_vote(request[0u]); @@ -192,7 +192,7 @@ class TestFace : public ServerInterface { virtual Json::Value get_node_version() = 0; virtual Json::Value get_all_peers() = 0; virtual Json::Value get_all_nodes() = 0; - virtual Json::Value get_coins_per_vote(const Json::Value ¶m1) = 0; + virtual Json::Value get_vote_weight(const Json::Value ¶m1) = 0; virtual Json::Value place_vote(const Json::Value ¶m1) = 0; virtual Json::Value get_votes(const Json::Value ¶m1) = 0; virtual Json::Value draw_graph(const Json::Value ¶m1) = 0; diff --git a/libraries/core_libs/node/include/node/node.hpp b/libraries/core_libs/node/include/node/node.hpp index b29a16df5d..c80bb3564f 100644 --- a/libraries/core_libs/node/include/node/node.hpp +++ b/libraries/core_libs/node/include/node/node.hpp @@ -118,14 +118,4 @@ class FullNode : public std::enable_shared_from_this { void rebuildDb(); }; -class HardforkExecutors { - using ForkExecutor = std::function; - - public: - void registerExecutor(uint64_t block, ForkExecutor exec); - - private: - std::map executors; -}; - } // namespace taraxa diff --git a/libraries/core_libs/node/src/node.cpp b/libraries/core_libs/node/src/node.cpp index f85fae19a8..6316d5b9bb 100644 --- a/libraries/core_libs/node/src/node.cpp +++ b/libraries/core_libs/node/src/node.cpp @@ -190,7 +190,7 @@ void FullNode::start() { final_chain_->block_applying.subscribe([&](uint64_t block_num) { // TODO: should have only common hardfork code calling hardfork executor auto &state_conf = conf_.chain.final_chain.state; - if (state_conf.hardforks.fix_genesis_hardfork_block_num == block_num) { + if (state_conf.hardforks.fix_genesis_fork_block == block_num) { for (auto &e : state_conf.dpos->genesis_state) { for (auto &b : e.second) { b.second = b.second * kOneTara; @@ -202,7 +202,7 @@ void FullNode::start() { // we are multiplying it by TARA precision state_conf.dpos->eligibility_balance_threshold *= kOneTara; // amount of stake per vote should be 10 times smaller than eligibility threshold - state_conf.dpos->coins_per_vote = state_conf.dpos->eligibility_balance_threshold; + state_conf.dpos->vote_eligibility_balance_step = state_conf.dpos->eligibility_balance_threshold; state_conf.dpos->eligibility_balance_threshold *= 10; final_chain_->update_state_config(state_conf); diff --git a/submodules/taraxa-evm b/submodules/taraxa-evm index 8dcf7d4c56..329f4b1332 160000 --- a/submodules/taraxa-evm +++ b/submodules/taraxa-evm @@ -1 +1 @@ -Subproject commit 8dcf7d4c5684d6a3bcacd3641bcafa6373431f62 +Subproject commit 329f4b133249710a359148284819f1dbd25ffc45 diff --git a/tests/final_chain_test.cpp b/tests/final_chain_test.cpp index 2c8010a170..962abd2c50 100644 --- a/tests/final_chain_test.cpp +++ b/tests/final_chain_test.cpp @@ -160,7 +160,7 @@ TEST_F(FinalChainTest, genesis_balances) { cfg.state.genesis_balances[addr_t::random()] = 1000; cfg.state.genesis_balances[addr_t::random()] = 100000; init(); - cfg.state.hardforks.fix_genesis_hardfork_block_num = 2222222; + cfg.state.hardforks.fix_genesis_fork_block = 2222222; SUT->update_state_config(cfg.state); } diff --git a/tests/full_node_test.cpp b/tests/full_node_test.cpp index 075f992a42..991f6fa2a9 100644 --- a/tests/full_node_test.cpp +++ b/tests/full_node_test.cpp @@ -1461,7 +1461,7 @@ TEST_F(FullNodeTest, chain_config_json) { "dpos": { "deposit_delay": "0x0", "eligibility_balance_threshold": "0x3b9aca00", - "coins_per_vote": "0x3b9aca00", + "vote_eligibility_balance_step": "0x3b9aca00", "genesis_state": { "0xde2b1203d72d3549ee2f733b00b2789414c7cea5": { "0xde2b1203d72d3549ee2f733b00b2789414c7cea5": "0x3b9aca00" @@ -1486,7 +1486,7 @@ TEST_F(FullNodeTest, chain_config_json) { "0xde2b1203d72d3549ee2f733b00b2789414c7cea5": "0x1fffffffffffff" }, "hardforks": { - "fix_genesis_hardfork_block_num": "0x0" + "fix_genesis_fork_block": "0x0" } } }, @@ -1536,9 +1536,9 @@ TEST_F(FullNodeTest, hardfork_override) { auto default_hardforks = default_json["chain_config"]["final_chain"]["state"]["hardforks"]; Json::Value config = default_json; auto &state_cfg = config["chain_config"]["final_chain"]["state"]; - state_cfg["hardforks"].removeMember("fix_genesis_hardfork_block_num"); + state_cfg["hardforks"].removeMember("fix_genesis_fork_block"); - EXPECT_TRUE(state_cfg["hardforks"]["fix_genesis_hardfork_block_num"].isNull()); + EXPECT_TRUE(state_cfg["hardforks"]["fix_genesis_fork_block"].isNull()); cli::Config::addNewHardforks(config, default_json); EXPECT_EQ(state_cfg["hardforks"], default_hardforks); @@ -1549,19 +1549,19 @@ TEST_F(FullNodeTest, hardfork_override) { EXPECT_EQ(state_cfg["hardforks"], default_hardforks); } -TEST_F(FullNodeTest, fix_genesis_hardfork_block_num_is_zero) { +TEST_F(FullNodeTest, fix_genesis_fork_block_is_zero) { auto node_cfgs = make_node_cfgs(1); auto &cfg = node_cfgs.front().chain.final_chain; - cfg.state.hardforks.fix_genesis_hardfork_block_num = 0; + cfg.state.hardforks.fix_genesis_fork_block = 0; auto node = launch_nodes(node_cfgs).front(); } TEST_F(FullNodeTest, hardfork) { auto node_cfgs = make_node_cfgs(1); auto &cfg = node_cfgs.front().chain.final_chain; - cfg.state.hardforks.fix_genesis_hardfork_block_num = 2; + cfg.state.hardforks.fix_genesis_fork_block = 2; cfg.state.dpos->eligibility_balance_threshold = 100000; - cfg.state.dpos->coins_per_vote = cfg.state.dpos->eligibility_balance_threshold; + cfg.state.dpos->vote_eligibility_balance_step = cfg.state.dpos->eligibility_balance_threshold; for (auto &gs : cfg.state.dpos->genesis_state) { for (auto &b : gs.second) { b.second = 1100000; @@ -1580,7 +1580,7 @@ TEST_F(FullNodeTest, hardfork) { dummy_trx(); node->getFinalChain()->block_finalized_.subscribe([&](const std::shared_ptr &res) { const auto block_num = res->final_chain_blk->number; - if (cfg.state.hardforks.fix_genesis_hardfork_block_num == block_num) { + if (cfg.state.hardforks.fix_genesis_fork_block == block_num) { hardfork_applied = true; return; } diff --git a/tests/state_api_test.cpp b/tests/state_api_test.cpp index 56c37675e1..7aae45e794 100644 --- a/tests/state_api_test.cpp +++ b/tests/state_api_test.cpp @@ -66,9 +66,9 @@ TEST_F(StateAPITest, dpos_integration) { dpos_cfg.deposit_delay = 2; dpos_cfg.withdrawal_delay = 4; dpos_cfg.eligibility_balance_threshold = 1000; - dpos_cfg.coins_per_vote = 1000; + dpos_cfg.vote_eligibility_balance_step = 1000; addr_1_bal_expected -= dpos_cfg.genesis_state[make_addr(1)][make_addr(1)] = dpos_cfg.eligibility_balance_threshold; - chain_cfg.hardforks.fix_genesis_hardfork_block_num = 0; + chain_cfg.hardforks.fix_genesis_fork_block = 0; uint64_t curr_blk = 0; StateAPI SUT([&](auto /*n*/) -> h256 { assert(false); }, //