Skip to content

beldex version 7.0.3 - #211

Merged
victor-tucci merged 22 commits into
connection_checkfrom
dev
Aug 6, 2026
Merged

beldex version 7.0.3#211
victor-tucci merged 22 commits into
connection_checkfrom
dev

Conversation

@victor-tucci

Copy link
Copy Markdown
Member

No description provided.

tunacanfinder and others added 22 commits June 3, 2026 16:51
…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.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cda7d0c0-23f4-4143-a4f6-11076afd2bd0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@victor-tucci
victor-tucci merged commit 65b5c9e into connection_check Aug 6, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants