beldex version 7.0.3 - #211
Merged
Merged
Conversation
…rence In tx_pool::add_tx, the key_image_unlock handler calls get_master_node_details(mnode_key) without first verifying that mnode_key is a registered master node. The accessor dereferences the iterator returned by find() unconditionally, so an unknown mnode_key causes a segfault. mnode_key is read from the incoming transactions tx_extra, so it is attacker-controlled. Patch (a) checks existence at the caller via is_master_node() before the lookup, and (b) makes the accessor throw on a missing key so other callsites of get_master_node_details cant hit the same shape. The caller already handles thrown exceptions as failed verification.
The Proof deserializer at uptime_proof.cpp:44-89 reads three version lists (v, sv, lv) from a peer-supplied bt-encoded blob and writes each into a fixed-size array (version[], storage_server_version[], belnet_version[]) without checking the list size first. A peer that sends a list with more entries than the array can hold writes past the end of the struct. This deserializer runs on every incoming uptime proof before any signature check downstream, so a malformed proof reaches this loop without prior validation. Adds an exact-size check before each write loop. The constructor already wraps everything in try/catch, so the throw becomes a cleanly-rejected proof rather than a corruption.
…egister tx_extra_master_node_register carries three parallel vectors (m_public_spend_keys, m_public_view_keys, m_portions) that are intended to be index-aligned. The serializer reads each as an independent vector with no cross-field invariant, so a malformed field with desynchronized lengths deserializes successfully and exposes consumers to out-of-bounds reads. Two consumers index by one vector size and read another: master_node_list.cpp:305-309 (block-include path) and core_rpc_server.cpp:711-720 (mempool-staged + RPC tx_extra=true). Enforces the equal-length invariant in the deserializer, matching the tx_extra_padding pattern at tx_extra.h:195-210. Adds defensive guards at both consumers so the call sites stay safe if the invariant drifts in a future change.
The invalid_argument throw added in the previous commit propagates out of std::make_unique<uptime_proof::Proof>. Wrap at the caller in core::handle_btencoded_uptime_proof so a malformed proof becomes a rejected proof rather than a propagating exception.
Introduce the ability to sync the chain in the background using only the view key, keeping the spend key encrypted at rest. When background sync stops, the spend key is restored and background-synced txs are processed. Background sync (core): - account: add set_spend_key() to restore the spend key with a derived public-key check - wallet2: setup/start/stop_background_sync, background_sync_data_t cache, store/load/process_background_cache, and key re-encryption via a shared scope-leave handler - serialization: add std::unordered_map / std::map value() serializers and supporting infrastructure for the background cache - cryptonote_config: add BACKGROUND_CACHE / BACKGROUND_KEYS_FILE hashkeys - wallet_rpc_server: expose background sync + IS_BACKGROUND_WALLET / IS_BACKGROUND_SYNCING error codes - wallet2_api: BackgroundSyncType enum and setup/start/stop/isBackgroundSyncing/ isBackgroundWallet, plus checkBackgroundSync() guards on state-changing ops Wallet API enhancements: - proxy, offline toggle, default mixin, deterministic check, device reconnect, byte counters, output import/export, password getter, stop() - TransactionInfo isCoinbase()/description(), TransactionHistory setTxNote(), AddressBook setDescription() - WalletManager networkDifficulty()/setProxy() - simplewallet: `address mnew <N>` and `address one-off <major> <minor>`
…th-viewkey wallet: add background sync with view key + wallet API enhancements
Replace implicit nlohmann::json conversions with explicit typed get<T>() calls across wallet, simplewallet, wallet API, and node RPC proxy code. This keeps JSON handling compatible with stricter conversion rules.
…th-viewkey Fix explicit JSON value extraction in wallet flow
The txs_hashes field in the get_transactions RPC parameters was wrapped in
an extra pair of braces ({{"txs_hashes", hex_hashes}}), making it one level
deeper than the other object members. This caused nlohmann::json to
serialize the parameters incorrectly, so the daemon rejected every pool
transaction request with "Invalid params" ("Failed to retrieve
transactions" in the wallet log), preventing wallet synchronization.
…th-viewkey wallet2: fix malformed get_transactions params in pool tx fetch
Fixed several wallet and functional test issues by guarding optional JSON field access, correcting background key derivation and background-wallet detection logic, and tightening functional-test transfer assertions/imports.
…th-viewkey Feat/background sync just with viewkey
fix(tx_pool): guard master node lookup before key_image_unlock dereference
fix(uptime_proof): validate version-list sizes before fixed-array writes
…nvariant fix(tx_extra): enforce equal vector lengths in tx_extra_master_node_register
The POS state machine previously detected staleness by comparing
heights only. An equal-height fork switch (pop block N, adopt the competing
block N) leaves the chain height unchanged, so the state machine kept using
`wait_for_next_block.top_hash`, which by then referred to a block deleted
from both the main and the alt DB (switch_to_alternative_blockchain() is
called with keep_disconnected_chain=false on the POS weight/checkpoint
reorg paths). The next entropy lookup then failed with:
"Failed to find block <hash>"
"Failed to get quorum entropy for POS, next block parent <hash>"
and the node sat out POS participation until the next height. Comparing the
top hash as well restarts the POS stages against the new tip immediately.
Fix POS round state logic
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.