mirror of https://github.com/oxen-io/oxen-core.git
Add a grace period to deregistrations after a hardfork
It is not uncommon to have nodes get decommissioned after a hardfork, either due to lack of updating or issues with the release. This implements a 7 day grace period where nodes that do get decommissioned will not progress into a deregistration (and being hit with the 30 day funds locked penalty).
This commit is contained in:
parent
c7deef4ac3
commit
76a585eb41
|
@ -117,7 +117,6 @@ std::pair<const hard_fork*, const hard_fork*> get_hard_forks(network_type type)
|
|||
return {nullptr, nullptr};
|
||||
}
|
||||
|
||||
|
||||
std::pair<std::optional<uint64_t>, std::optional<uint64_t>>
|
||||
get_hard_fork_heights(network_type nettype, hf version) {
|
||||
std::pair<std::optional<uint64_t>, std::optional<uint64_t>> found;
|
||||
|
|
|
@ -321,6 +321,8 @@ namespace config
|
|||
"LDBEN6Ut4NkMwyaXWZ7kBEAx8X64o6YtDhLXUP26uLHyYT4nFmcaPU2Z2fauqrhTLh4Qfr61pUUZVLaTHqAdycETKM1STrz"sv, // hardfork v11
|
||||
};
|
||||
|
||||
inline constexpr uint64_t HARDFORK_DEREGISTRATION_GRACE_PERIOD = 7 * cryptonote::BLOCKS_PER_DAY; // After a hardfork we will decommission sns but wont dereg, allowing time to update
|
||||
|
||||
inline constexpr auto UPTIME_PROOF_TOLERANCE = 5min; // How much an uptime proof timestamp can deviate from our timestamp before we refuse it
|
||||
inline constexpr auto UPTIME_PROOF_STARTUP_DELAY = 30s; // How long to wait after startup before broadcasting a proof
|
||||
inline constexpr auto UPTIME_PROOF_CHECK_INTERVAL = 30s; // How frequently to check whether we need to broadcast a proof
|
||||
|
@ -432,6 +434,8 @@ struct network_config
|
|||
uint64_t LIMIT_BATCH_OUTPUTS;
|
||||
uint64_t SERVICE_NODE_PAYABLE_AFTER_BLOCKS;
|
||||
|
||||
uint64_t HARDFORK_DEREGISTRATION_GRACE_PERIOD;
|
||||
|
||||
|
||||
inline constexpr std::string_view governance_wallet_address(hf hard_fork_version) const {
|
||||
const auto wallet_switch =
|
||||
|
@ -466,6 +470,7 @@ inline constexpr network_config mainnet_config{
|
|||
config::MIN_BATCH_PAYMENT_AMOUNT,
|
||||
config::LIMIT_BATCH_OUTPUTS,
|
||||
config::SERVICE_NODE_PAYABLE_AFTER_BLOCKS,
|
||||
config::HARDFORK_DEREGISTRATION_GRACE_PERIOD,
|
||||
};
|
||||
inline constexpr network_config testnet_config{
|
||||
network_type::TESTNET,
|
||||
|
@ -492,6 +497,7 @@ inline constexpr network_config testnet_config{
|
|||
config::MIN_BATCH_PAYMENT_AMOUNT,
|
||||
config::LIMIT_BATCH_OUTPUTS,
|
||||
config::testnet::SERVICE_NODE_PAYABLE_AFTER_BLOCKS,
|
||||
config::HARDFORK_DEREGISTRATION_GRACE_PERIOD,
|
||||
};
|
||||
inline constexpr network_config devnet_config{
|
||||
network_type::DEVNET,
|
||||
|
@ -518,6 +524,7 @@ inline constexpr network_config devnet_config{
|
|||
config::MIN_BATCH_PAYMENT_AMOUNT,
|
||||
config::LIMIT_BATCH_OUTPUTS,
|
||||
config::testnet::SERVICE_NODE_PAYABLE_AFTER_BLOCKS,
|
||||
config::HARDFORK_DEREGISTRATION_GRACE_PERIOD,
|
||||
};
|
||||
inline constexpr network_config fakenet_config{
|
||||
network_type::FAKECHAIN,
|
||||
|
@ -544,6 +551,7 @@ inline constexpr network_config fakenet_config{
|
|||
config::MIN_BATCH_PAYMENT_AMOUNT,
|
||||
config::LIMIT_BATCH_OUTPUTS,
|
||||
config::testnet::SERVICE_NODE_PAYABLE_AFTER_BLOCKS,
|
||||
config::HARDFORK_DEREGISTRATION_GRACE_PERIOD,
|
||||
};
|
||||
|
||||
inline constexpr const network_config& get_config(network_type nettype)
|
||||
|
|
|
@ -403,6 +403,13 @@ namespace service_nodes
|
|||
}
|
||||
}
|
||||
|
||||
if (vote_for_state == new_state::deregister && height - *cryptonote::get_hard_fork_heights(m_core.get_nettype(), hf_version).first < netconf.HARDFORK_DEREGISTRATION_GRACE_PERIOD) {
|
||||
LOG_PRINT_L2("Decommissioned service node "
|
||||
<< quorum->workers[node_index]
|
||||
<< " is still not passing required checks, and has no remaining credits left. However it is within the grace period of a hardfork so has not been deregistered.");
|
||||
continue;
|
||||
}
|
||||
|
||||
quorum_vote_t vote = service_nodes::make_state_change_vote(m_obligations_height, static_cast<uint16_t>(index_in_group), node_index, vote_for_state, reason, my_keys);
|
||||
cryptonote::vote_verification_context vvc;
|
||||
if (!handle_vote(vote, vvc))
|
||||
|
|
Loading…
Reference in New Issue