Skip to content

Commit

Permalink
Bump minor patch to 1 and enforce uptime proof minor version (#881)
Browse files Browse the repository at this point in the history
* Bump minor patch to 1 in preparation for release

* Hardfork 13 date for mainnet
  • Loading branch information
Doy-lee committed Oct 9, 2019
1 parent a2015a1 commit fbd5c5e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
13 changes: 7 additions & 6 deletions src/cryptonote_basic/hardfork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ static uint8_t get_block_version(const cryptonote::block &b)
// version 7 from the start of the blockchain, inhereted from Monero mainnet
static constexpr HardFork::Params mainnet_hard_forks[] =
{
{ network_version_7, 1, 0, 1503046577 },
{ network_version_8, 64324, 0, 1533006000 },
{ network_version_9_service_nodes, 101250, 0, 1537444800 },
{ network_version_10_bulletproofs, 161849, 0, 1544743800 }, // 2018-12-13 23:30UTC
{ network_version_11_infinite_staking, 234767, 0, 1554170400 }, // 2019-03-26 13:00AEDT
{ network_version_12_checkpointing, 321467, 0, 1563940800 }, // 2019-07-24 14:00AEDT
{ network_version_7, 1, 0, 1503046577 },
{ network_version_8, 64324, 0, 1533006000 },
{ network_version_9_service_nodes, 101250, 0, 1537444800 },
{ network_version_10_bulletproofs, 161849, 0, 1544743800 }, // 2018-12-13 23:30UTC
{ network_version_11_infinite_staking, 234767, 0, 1554170400 }, // 2019-03-26 13:00AEDT
{ network_version_12_checkpointing, 321467, 0, 1563940800 }, // 2019-07-24 14:00AEDT
{ network_version_13_enforce_checkpoints, 385824, 0, 1571850000 }, // 2019-10-23 19:00AEDT
};

static constexpr HardFork::Params testnet_hard_forks[] =
Expand Down
29 changes: 21 additions & 8 deletions src/cryptonote_core/service_node_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1950,11 +1950,16 @@ namespace service_nodes
}
#endif

static constexpr std::pair<uint8_t, uint16_t> hf_min_loki_versions[] = {
{cryptonote::network_version_13_enforce_checkpoints, 5},
{cryptonote::network_version_12_checkpointing, 4},
{cryptonote::network_version_11_infinite_staking, 3},
{cryptonote::network_version_10_bulletproofs, 2},
struct proof_version
{
uint8_t hardfork;
uint8_t major;
uint8_t minor;
};

static constexpr proof_version hf_min_loki_versions[] = {
{cryptonote::network_version_13_enforce_checkpoints, 5 /*major*/, 1 /*minor*/},
{cryptonote::network_version_12_checkpointing, 4 /*major*/, 0 /*minor*/},
};

void service_node_info::derive_x25519_pubkey_from_ed25519() {
Expand All @@ -1976,9 +1981,17 @@ namespace service_nodes
if ((proof.timestamp < now - UPTIME_PROOF_BUFFER_IN_SECONDS) || (proof.timestamp > now + UPTIME_PROOF_BUFFER_IN_SECONDS))
REJECT_PROOF("timestamp is too far from now");

for (auto &hf_major : hf_min_loki_versions)
if (hf_version >= hf_major.first && proof.snode_version_major < hf_major.second)
REJECT_PROOF("v" << hf_major.second << "+ loki version is required for v" << hf_version << "+ network proofs");
for (auto &min : hf_min_loki_versions)
{
if (hf_version >= min.hardfork)
{
if (proof.snode_version_major < min.major ||
(proof.snode_version_major == min.major && proof.snode_version_minor < min.minor))
{
REJECT_PROOF("v" << min.major << "." << min.minor << "+ loki version is required for v" << hf_version << "+ network proofs");
}
}
}

if (!debug_allow_local_ips && !epee::net_utils::is_ip_public(proof.public_ip))
REJECT_PROOF("public_ip is not actually public");
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define DEF_LOKI_VERSION_MAJOR 5
#define DEF_LOKI_VERSION_MINOR 0
#define DEF_LOKI_VERSION_MINOR 1
#define DEF_LOKI_VERSION_PATCH 0

#define LOKI_STRINGIFY2(val) #val
Expand Down

0 comments on commit fbd5c5e

Please sign in to comment.