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

Verify presence of value for pubkey_ed25519 in handle_ping() #134

Merged
merged 3 commits into from
Dec 13, 2023
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
2 changes: 1 addition & 1 deletion src/cryptonote_core/cryptonote_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ namespace cryptonote

crypto::public_key pubkey = m_master_node_list.get_random_pubkey();
crypto::x25519_public_key x_pkey{0};
constexpr std::array<uint16_t, 3> MIN_TIMESTAMP_VERSION{9,1,0};
constexpr std::array<uint16_t, 3> MIN_TIMESTAMP_VERSION{5,0,0};
std::array<uint16_t,3> proofversion;
m_master_node_list.access_proof(pubkey, [&](auto &proof) {
x_pkey = proof.pubkey_x25519;
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_core/master_node_quorum_cop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace master_nodes
master_nodes::participation_history<master_nodes::timestamp_participation_entry> timestamp_participation{};
master_nodes::participation_history<master_nodes::timesync_entry> timesync_status{};

constexpr std::array<uint16_t, 3> MIN_TIMESTAMP_VERSION{9,1,0};
constexpr std::array<uint16_t, 3> MIN_TIMESTAMP_VERSION{5,0,0};

const auto unreachable_threshold = netconf.UPTIME_PROOF_VALIDITY - netconf.UPTIME_PROOF_FREQUENCY;

Expand Down
4 changes: 2 additions & 2 deletions src/cryptonote_core/master_node_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ namespace master_nodes {
// blocks out of sync and sending something that it thinks is legit.
constexpr uint64_t VOTE_OR_TX_VERIFY_HEIGHT_BUFFER = 5;

constexpr std::array<uint16_t, 3> MIN_STORAGE_SERVER_VERSION{{2, 0, 7}};
constexpr std::array<uint16_t, 3> MIN_BELNET_VERSION{{0, 8, 0}};
constexpr std::array<uint16_t, 3> MIN_STORAGE_SERVER_VERSION{{2, 3, 0}};
constexpr std::array<uint16_t, 3> MIN_BELNET_VERSION{{0, 9, 7}};

// The minimum accepted version number, broadcasted by Master Nodes via uptime proofs for each hardfork
struct proof_version
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/core_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3259,8 +3259,8 @@ namespace cryptonote { namespace rpc {
if (cur_version < required) {
res.status = fmt::format("Outdated {}. Current: {}.{}.{}, Required: {}.{}.{}",name, cur_version[0], cur_version[1], cur_version[2], required[0], required[1], required[2]);
MERROR(res.status);
} else if (!pubkey_ed25519.empty() // TODO: once belnet & ss are always sending this we can remove this empty bypass
&& pubkey_ed25519 != our_pubkey_ed25519) {
} else if (!pubkey_ed25519.empty() && !(pubkey_ed25519.find_first_not_of('0') == std::string_view::npos) // TODO: once belnet & ss are always sending this we can remove this empty bypass
&& (pubkey_ed25519 != our_pubkey_ed25519)) {
res.status = fmt::format("Invalid {} pubkey: expected {}, received {}", name, our_pubkey_ed25519, pubkey_ed25519);
MERROR(res.status);
} else {
Expand Down