Commit Graph

7710 Commits

Author SHA1 Message Date
SChernykh ade57b694f JH hash compiler workarounds
- Fixed uninitialized `state->x` warning
- Fixed broken code with `-O3` or `-Ofast`

The old code is known to break GCC 10.1 and GCC 11.4
2023-11-04 21:01:07 +01:00
Lee *!* Clagett 4acae11327 Fix EAGAIN bug in ZMQ-RPC/ZMQ-PUB 2023-11-04 13:42:14 -04:00
tobtoht 1062b172b6
wallet: sign_tx: get tx pubkey from extra 2023-11-02 15:19:05 +01:00
jeffro256 23179a0ba4
wallet: fix multisig key memory leak
Multisig keys per-transfer were being wiped, but not erased, which lead to a ginormous
quadratic bloat the more transfers and exports you performed with the wallet.
2023-11-02 02:58:50 -05:00
selsta 5136974da9
device: boost -> std locks to fix c++17 compilation 2023-10-26 04:02:26 +02:00
luigi1111 e946315627
Merge pull request #9002
932bba3 depends: remove libiconv: unused (tobtoht)
2023-10-25 21:38:32 -04:00
luigi1111 10f208fbc5
Merge pull request #8989
9b231c9 add account_generators for mapping public EC generators to account keys (koe)
2023-10-25 21:37:37 -04:00
luigi1111 fc4397010d
Merge pull request #8974
759293d wallet2: fix version check at hf version 1 (j-berman)
2023-10-25 21:36:36 -04:00
luigi1111 e3d0154b5b
Merge pull request #8969
8190f25 KV_SERIALIZE: remove extraneous semicolons in DSL (jeffro256)
2023-10-25 21:35:43 -04:00
luigi1111 faffe09bdb
Merge pull request #8966
f71e2dc multisig: better errors for small malformed kex msgs (jeffro256)
2023-10-25 21:34:57 -04:00
luigi1111 d5da693866
Merge pull request #8958
b0bf49a blockchain_db: add k-anonymity to txid fetching (jeffro256)
2023-10-25 21:34:06 -04:00
luigi1111 8f0343df16
Merge pull request #8752
c444a7e trezor: support v2.5.2+, add more trezor tests, fix chaingen and tests (Dusan Klinec)
056c996 fix chaingen tests (Dusan Klinec)
2023-10-25 21:30:49 -04:00
jeffro256 e191083bed
epee: remove dead code in math_helper and string_tools 2023-10-25 16:41:21 -05:00
jeffro256 05231400ce
ringct: make `rctSigBase` serialization follow strict aliasing rule
Accessing an object of type `char` thru an lvalue of type `crypto::hash8` is undefined behavior.
https://developers.redhat.com/blog/2020/06/03/the-joys-and-perils-of-aliasing-in-c-and-c-part-2
2023-10-23 16:28:02 -05:00
jeffro256 56dab0fad2
cryptonote_config: include cstdint
Header was using `uint64_t` without including `<cstdint>` which caused some issues downstream for windows builds
2023-10-22 18:02:54 -05:00
jeffro256 b2eb47d875
wallet: mitigate statistical dependence for decoy selection within rings
Since we are required to check for uniqueness of decoy picks within any given
ring, and since some decoy picks may fail due to unlock time or malformed EC points,
the wallet2 decoy selection code was building up a larger than needed *unique* set of
decoys for each ring according to a certain distribution *without replacement*. After
filtering out the outputs that it couldn't use, it chooses from the remaining decoys
uniformly random *without replacement*.

The problem with this is that the picks later in the picking process are not independent
from the picks earlier in the picking process, and the later picks do not follow the
intended decoy distribution as closely as the earlier picks. To understand this
intuitively, imagine that you have 1023 marbles. You label 512 marbles with the letter A,
label 256 with the letter B, so on and so forth, finally labelling one marble with the
letter J. You put them all into a bag, shake it well, and pick 8 marbles from the bag,
but everytime you pick a marble of a certain letter, you remove all the other marbles
from that bag with the same letter. That very first pick, the odds of picking a certain
marble are exactly how you would expect: you are twice as likely to pick A as you are B,
twice as likely to pick B as you are C, etc. However, on the second pick, the odds of
getting the first pick are 0%, and the chances for everything else is higher. As you go
down the line, your picked marbles will have letters that are increasingly more unlikely
to pick if you hadn't remove the other marbles. In other words, the distribution of the
later marbles will be more "skewed" in comparison to your original distribution of marbles.

In Monero's decoy selection, this same statistical effect applies. It is not as dramatic
since the distribution is not so steep, and we have more unique values to choose from,
but the effect *is* measureable. Because of the protocol rules, we cannot have duplicate
ring members, so unless that restriction is removed, we will never have perfectly
independent picking. However, since the earlier picks are less affected by this
statistical effect, the workaround that this commit offers is to store the order that
the outputs were picked and commit to this order after fetching output information over RPC.
2023-10-17 00:53:40 -05:00
jeff 80b5bf8b3d
gcc: fix uninitialized constructor warnings 2023-10-16 16:48:27 -05:00
Boog900 65839b5ac1
Fix: long term block weight cache
The long term block weight cache was doing a wrong calculation when
adding a new block to the cache.
2023-10-01 13:40:06 +01:00
Dusan Klinec c444a7e002
trezor: support v2.5.2+, add more trezor tests, fix chaingen and tests
- passphrase logic: remove backward compatibility for 2.4.3, code cleanup.
- fix LibUSB cmake for static builds on OSX
- tests: all tests now work with passphrase logic enabled. Passphrase test added with different passphrase. no_passphrase test added, Trezor pin test added. Testing wallet opening with correct and incorrect passphrase. Trezor test chain revamp, cleanup. Smaller chain, chain file versioning added.
- tests: Trezor tests support TEST_MINING_ENABLED, TEST_MINING_TIMEOUT env vars to change mining-related tests behaviour.
- requires protobuf@21 on osx for now (c++14), building with unlinked protobuf: `CMAKE_PREFIX_PATH=$(find /opt/homebrew/Cellar/protobuf@21 -maxdepth 1 -type d -name "21.*" -print -quit) \
make debug-test-trezor -j8`
2023-09-30 09:01:10 +02:00
j-berman 47042ce808 wallet2: call on_reorg callback in handle_reorg 2023-09-26 20:37:11 -07:00
tobtoht 932bba3b79
depends: remove libiconv: unused 2023-09-25 14:00:34 +02:00
jeff 9f981ac219
wallet: store watch-only wallet correctly when `change_password()` is called
The Monero GUI code was calling `Monero::wallet::setPassword()` on every open/close for some reason,
and the old `store_to()` code called `store_keys()` with `watch_only=false`, even for watch-only wallets.
This caused a bug where the watch-only keys file got saved with with the JSON field `watch_only` set to 0,
and after saving a watch-only wallet once, a user could never open it back up against because `load()` errored out.
This never got brought up before this because you would have to change the file location of the watch-only
wallet to see this bug, and I guess that didn't happen often, but calling the new `store_to()` function with the
new `force_rewrite` parameter set to `true` triggers key restoring and the bug appeared.
2023-09-21 22:42:16 -05:00
koe 51e40f721b add seraphis_crypto directory 2023-09-10 16:49:58 -05:00
koe 9b231c9ac3 add account_generators for mapping public EC generators to account keys 2023-09-10 16:02:46 -05:00
jeffro256 1bea8ef42a
wallet2: fix `store_to()` and `change_password()`
Resolves #8932 and:
2. Not storing cache when new path is different from old in `store_to()` and
3. Detecting same path when new path contains entire string of old path in `store_to()` and
4. Changing your password / decrypting your keys (in this method or others) and providing a bad original password and getting no error and
5. Changing your password and storing to a new file
2023-08-23 11:48:18 -05:00
j-berman 759293de08 wallet2: fix version check at hf version 1 2023-08-17 13:29:46 -07:00
luigi1111 72211163b8
Merge pull request #8956
f7fb5c7 scan_tx: fix custom comparator for == case; fixes #8951 (j-berman)
2023-08-17 10:26:24 -05:00
luigi1111 e3c990f03a
Merge pull request #8955
192d87c remove more 'using namespace' statements from headers (jeffro256)
2023-08-17 10:25:51 -05:00
luigi1111 1ab593991c
Merge pull request #8950
a0e5c3c wallet2: when checking frozen multisig tx set, don't assume order (jeffro256)
2023-08-17 10:24:53 -05:00
luigi1111 28eca0cb79
Merge pull request #8927
1104b59 Update help for set command in simplewallet Add help for max-reorg-depth and load-deprecated-formats options (MasFlam)
2023-08-17 10:23:10 -05:00
luigi1111 6fc67869a1
Merge pull request #8924
ffbf9f4 blockchain_and_pool: move to crytonote_core and enforce its usage (jeffro256)
d6f86e5 Avoid nullptr dereference when constructing Blockchain and tx_memory_pool (lukas)
2023-08-17 10:21:40 -05:00
luigi1111 3b67d5fc5b
Merge pull request #8914
45b52de wallet-rpc: restore from multisig seed (jeffro256)
2023-08-17 10:20:20 -05:00
luigi1111 fc84506a96
Merge pull request #8913
2a2cf03 blockchain_db: add clarification to get_block_already_generated_coins (jeffro256)
2023-08-17 10:19:26 -05:00
luigi1111 30ba5a5280
Merge pull request #8890
e8cac61 core_rpc_server: return ID of submitted block (jeffro256)
2023-08-17 10:17:46 -05:00
luigi1111 83df9b1429
Merge pull request #8882
a8d2a58 wallet2: ensure transfers and sweeps use same fee calc logic (j-berman)
2023-08-17 10:17:22 -05:00
luigi1111 4cabfe7aba
Merge pull request #8853
6ff87ef net: tor_address: remove support for v2 onion addresses (tobtoht)
2023-08-17 10:11:12 -05:00
luigi1111 c490e38f56
Merge pull request #8840
503c3e0 core: do not force sync the db when finding a block in regtest mode (Crypto City)
2023-08-17 10:10:14 -05:00
jeffro256 8190f2532b
`KV_SERIALIZE`: remove extraneous semicolons in DSL
Prereq of https://github.com/monero-project/monero/pull/8867
2023-08-10 11:13:14 -05:00
jeffro256 f71e2dcdc8
multisig: better errors for small malformed kex msgs
Resolves https://github.com/monero-project/monero/issues/8493
2023-08-08 12:01:40 -05:00
jeffro256 1e2e7035e9
core_rpc_server: silence unused warnings 2023-08-01 17:46:34 -05:00
jeffro256 b0bf49a65a
blockchain_db: add k-anonymity to txid fetching
Read more about k-anonymity [here](https://en.wikipedia.org/wiki/K-anonymity). We implement this feature in the monero daemon for transactions
by providing a "Txid Template", which is simply a txid with all but `num_matching_bits` bits zeroed out, and the number `num_matching_bits`. We add an operation to `BlockchainLMDB` called
`get_txids_loose` which takes a txid template and returns all txids in the database (chain and mempool) that satisfy that template. Thus, a client can
ask about a specific transaction from a daemon without revealing the exact transaction they are inquiring about. The client can control the statistical
chance that other TXIDs (besides the one in question) match the txid template sent to the daemon up to a power of 2. For example, if a client sets their `num_matching_bits`
to 5, then statistically any txid has a 1/(2^5) chance to match. With `num_matching_bits`=10, there is a 1/(2^10) chance, so on and so forth.

Co-authored-by: ACK-J <60232273+ACK-J@users.noreply.github.com>
2023-08-01 17:25:25 -05:00
jeffro256 45b52de28e
wallet-rpc: restore from multisig seed 2023-07-28 12:17:14 -05:00
j-berman f7fb5c7faa scan_tx: fix custom comparator for == case; fixes #8951
Co-authored-by: woodser <woodser@protonmail.com>
2023-07-19 07:48:29 -07:00
jeffro256 192d87cd24
remove more 'using namespace' statements from headers 2023-07-18 22:46:43 -05:00
jeffro256 a0e5c3c326
wallet2: when checking frozen multisig tx set, don't assume order 2023-07-16 13:29:52 -05:00
luigi1111 00fd416a99
Merge pull request #8919
1c20198 Fixup error message. (ComputeryPony)
2023-07-06 21:41:12 -05:00
luigi1111 d5c7d1743f
Merge pull request #8904
369a5a8 wallet: respect frozen key images in multisig wallets (jeffro256)
2023-07-06 21:37:58 -05:00
luigi1111 58c5735af0
Merge pull request #8903
2608b24 Add CLSAG serialization to ZMQ code (Lee Clagett)
2023-07-06 21:36:45 -05:00
luigi1111 e67f82a164
Merge pull request #8902
c138a28 wallet2: take ignored-by-value outputs into account in balance (Crypto City)
2023-07-06 21:36:19 -05:00
luigi1111 cfa4583695
Merge pull request #8894
c589e15 Speed up perf_timer init on x86 (SChernykh)
2023-07-06 21:32:11 -05:00
luigi1111 c34dc5b215
Merge pull request #8854
d9c7cd5 common: do not use DNS to determine if address is local (tobtoht)
2023-07-06 21:30:34 -05:00
luigi1111 770b8fba3d
Merge pull request #8850
d391ac0 blockchain: ensure base fee cannot reach 0 (Crypto City)
2023-07-06 21:30:09 -05:00
luigi1111 00323bae5e
Merge pull request #8747
a668312 wallet: remove CLI code for non default ring sizes (Jeffro256)
2023-07-06 21:29:41 -05:00
luigi1111 7213d33017
Merge pull request #8662
16d17f6 add crypto/generators for direct access to canonical fixed generators (koe)
2023-07-06 21:27:56 -05:00
luigi1111 3a72c47445
Merge pull request #8344
70bbd25 core_rpc_server: new file: rpc_ssl.fingerprint (Jeffrey Ryan)
2023-07-06 21:27:16 -05:00
luigi1111 d80d17fbac
Merge pull request #8250
ce86368 Remove src/platform (Jeffrey)
2023-07-06 21:26:06 -05:00
luigi1111 41735185a8
Merge pull request #8888
a6639df wallet_rpc_server: dedup transfer RPC responses (jeffro256)
Very special PR.
2023-07-06 21:24:46 -05:00
tobtoht d9c7cd5a89
common: do not use DNS to determine if address is local
Co-authored-by: j-berman <justinberman@protonmail.com>
2023-07-03 13:34:39 +02:00
Jeffrey Ryan 70bbd2536b
core_rpc_server: new file: rpc_ssl.fingerprint 2023-07-02 19:38:51 -05:00
Jeffrey ce863683ab
Remove src/platform
All the files in src/platform are currently unused and unnecessary. See below:

* `mingw/alloca.h`: unused throughout project
* `msc/sys/param.h`:
    1. In `fix_darwin.patch`, `sys/param.h` is well-defined to be used only in OpenBSD environment
    2. `int-util.h` already handles when `sys/param.h` is not present and injects its own values
    3. `db_drivers/liblmdb/mdb.c` is a similar situation: already explicity handles different platforms
    4. `src/crypto/chacha.h` uses `int-util.h` for endianness context
* `msc/alloca.h`: unused
* `msc/inline_c.h`: not needed. the `inline` keyword is supported for C99 I believe, and certainly for C11, C14+
* `msc/stdbool.h`: `stdbool.h` is standard since C99, and MSVC has supported it for a long time (~10 years)
2023-07-02 19:29:18 -05:00
jeffro256 ffbf9f4766
blockchain_and_pool: move to crytonote_core and enforce its usage 2023-07-01 07:12:53 -05:00
MasFlam 1104b59c5b
Update help for set command in simplewallet
Add help for max-reorg-depth and load-deprecated-formats options
2023-07-01 12:01:07 +02:00
jeffro256 e8cac61f4b
core_rpc_server: return ID of submitted block 2023-06-30 15:31:35 -05:00
lukas d6f86e58a6
Avoid nullptr dereference when constructing Blockchain and tx_memory_pool 2023-06-30 20:27:05 +02:00
koe 16d17f6707 add crypto/generators for direct access to canonical fixed generators 2023-06-28 09:52:27 -05:00
Jeffro256 a668312cfa
wallet: remove CLI code for non default ring sizes 2023-06-27 20:18:21 +02:00
ComputeryPony 1c20198280
Fixup error message.
Looks like the extra MWARNING was supposed to be guarded by the if statement.
2023-06-27 12:56:35 -05:00
luigi1111 0a1eaf26f9
Merge pull request #8884
eeda4a8 wallet2: do not lose exception in current thread on refresh (Crypto City
 f868768 wallet2: fix missing exceptions from failing wallet refresh (Crypto City)
2023-06-27 11:48:27 -05:00
luigi1111 0fbe21e9e9
Merge pull request #8862
9f80797 protocol: drop peers sending duplicate txes (moneromooo-monero)
2023-06-27 11:44:58 -05:00
luigi1111 b86a620b4d
Merge pull request #8855
bb83eb1 daemon: remove --fluffy-blocks (tobtoht)
2023-06-27 11:41:57 -05:00
luigi1111 1153246b8a
Merge pull request #8848
6b8dfb8 daemon: remove os-version (tobtoht)
2023-06-27 11:39:33 -05:00
luigi1111 794f59b8bd
Merge pull request #8844
7206ef8 cryptonote_basic: fix amount overflow detection on 32-bit systems (jeffro256)
2023-06-27 11:37:54 -05:00
luigi1111 1df7260bd3
Merge pull request #8839
24d56c5 bump lmdb sync threshold for performance (moneromooo-monero)
2023-06-27 11:36:29 -05:00
luigi1111 a897325fcd
Merge pull request #8832
092e964 Fixed RandomX initialization when mining from scratch (SChernykh)
2023-06-27 11:35:22 -05:00
luigi1111 3d9f378ed4
Merge pull request #8804
ca6c42a Message about DNS_PUBLIC to help users with issue #8452 (OrvilleRed)
2023-06-27 11:33:45 -05:00
luigi1111 570fd364aa
Merge pull request #8772
87e2a64 Allow option 'non-interactive' in monerod config file (almalh)
2023-06-27 11:31:27 -05:00
luigi1111 57c58fd5bd
Merge pull request #8703
c90c1c3 Show IPv6 addresses in connection list (Guillaume Le Vaillant)
2023-06-27 11:28:24 -05:00
luigi1111 9480525dd2
Merge pull request #8661
f50b9e3 revisions (koe) e5aa058 vtnerd review comments (koe)
c60b11f add compare_func() method so user-defined comparison functions are easier to use (koe)
7329873 adjust is_sorted_and_unique() (koe)
3d60475 comment updates (koe) acfaaed add container helpers (koe)
2023-06-27 11:27:03 -05:00
luigi1111 e752b609fc
Merge pull request #8660
2a7435e variant: add mutable unwrap and visitation (koe)
bc3cec4 add variant class with cleaner interface than boost::variant<> (koe)
2023-06-27 11:25:52 -05:00
jeffro256 2a2cf03764
blockchain_db: add clarification to get_block_already_generated_coins 2023-06-21 22:08:22 +02:00
j-berman e6b86af931 wallet2: fix rescanning tx via scan_tx
- Detach & re-process txs >= lowest scan height
- ensures that if a user calls scan_tx(tx1) after scanning tx2,
the wallet correctly processes tx1 and tx2
- if a user provides a tx with a height higher than the wallet's
last scanned height, the wallet will scan starting from that tx's
height
- scan_tx requires trusted daemon iff need to re-process existing
txs: in addition to querying a daemon for txids, if a user
provides a txid of a tx with height *lower* than any *already*
scanned txs in the wallet, then the wallet will also query the
daemon for all the *higher* txs as well. This is likely
unexpected behavior to a caller, and so to protect a caller from
revealing txid's to an untrusted daemon in an unexpected way,
require the daemon be trusted.
2023-06-15 02:21:29 -07:00
jeffro256 369a5a8f9a wallet: respect frozen key images in multisig wallets
Before this change, if a multisig peer asked you to sign a transaction with a frozen enote, the wallet will do it without any error or warning. This change makes it
so that wallets will refuse to sign multisig transactions with frozen enotes.

Disclaimer: This PR was generously funded by @LocalMonero.
2023-06-12 16:47:28 -05:00
Lee Clagett 2608b241c8 Add CLSAG serialization to ZMQ code 2023-06-10 11:55:48 -04:00
Crypto City c138a28f51
wallet2: take ignored-by-value outputs into account in balance 2023-06-10 06:41:17 +00:00
SChernykh c589e1549b Speed up perf_timer init on x86
All Monero binaries have 1 second startup delay because of this code. This is especially noticeable and affects UX in Monero GUI wallet with local node where it often starts another monerod instance to run commands and query node status.
2023-06-08 07:56:05 +02:00
moneromooo-monero 9f80797086
protocol: drop peers sending duplicate txes 2023-06-07 06:56:21 +00:00
jeffro256 7206ef8ab8 cryptonote_basic: fix amount overflow detection on 32-bit systems
On systems where `ULONG_MAX` != `ULLONG_MAX` (e.g. most 32-bit systems), the `round_money_up` function will not correctly detect overflows.
2023-06-02 22:14:26 -05:00
jeffro256 a6639df9e4 wallet_rpc_server: dedup transfer RPC responses 2023-06-02 01:07:30 -05:00
Crypto City eeda4a8497
wallet2: do not lose exception in current thread on refresh 2023-05-30 17:08:05 +00:00
Crypto City f8687684e3
wallet2: fix missing exceptions from failing wallet refresh 2023-05-30 16:57:48 +00:00
j-berman a8d2a58190 wallet2: ensure transfers and sweeps use same fee calc logic
Ensures both transfers and sweeps use a fee that's calculated
from the tx's weight. Using different logic could theoretically
enable distinguishability between the two types of txs. We don't
want that.
2023-05-27 07:27:54 -07:00
tobtoht bb83eb151a
daemon: remove --fluffy-blocks 2023-05-12 17:39:38 +02:00
tobtoht 6ff87ef89f
net: tor_address: remove support for v2 onion addresses 2023-05-12 17:09:54 +02:00
Crypto City d391ac0f7e
blockchain: ensure base fee cannot reach 0
reported by sech1
2023-05-11 13:47:57 +00:00
tobtoht 6b8dfb8fb9
daemon: remove os-version 2023-05-10 23:15:03 +02:00
tobtoht c32befe4f8
fix missing <cstdint> includes 2023-05-06 18:13:18 +02:00
Crypto City 503c3e06df
core: do not force sync the db when finding a block in regtest mode
for a slight performance boost in functional tests
2023-05-05 18:11:57 +00:00
moneromooo-monero 24d56c5975
bump lmdb sync threshold for performance
Force sync every 100k blocks instead of every 1k blocks. Bumping this
value is reported to make a big difference in sync performance, eg:
https://github.com/monero-project/monero/issues/8189
2023-05-05 18:07:44 +00:00
SChernykh 092e964a87 Fixed RandomX initialization when mining from scratch 2023-04-27 16:31:21 +02:00
luigi1111 a2e8d1d427
Merge pull request #8760
1698cb1 remove defunct light wallet code (tobtoht)
2023-04-26 14:02:25 -04:00