Commit Graph

7778 Commits

Author SHA1 Message Date
cuinix 3837bb853f remove repetitive word
Signed-off-by: cuinix <915115094@qq.com>
2024-04-20 19:17:46 +08:00
jeffro256 025021dee0
BlockchainDB: shorter fixup()
Instead of hard-coding all missing key images into the code and inserting if missing,
we simply pop all blocks after height 202611. This makes the `monerod` binary about
0.35% smaller.
2024-04-11 14:34:56 -05:00
jeffro256 262ef473db
BlockchainDB: remove lock/unlock methods 2024-04-11 12:12:35 -05:00
Dusan Klinec 4689ad2d3c
trezor: support c++17 and protobuf v25, libusb fix
- fix If there is no protobuf version installed, if fails
- passphrase test fix, wallet keys init was missing
2024-04-10 18:19:22 +02:00
selsta b27fda269e
src: update checkpoints to match latest release 2024-04-06 00:53:05 +02:00
jeffro256 ff49444ee8
@tobtoht: undo rebase changes tx.dsts -> tx_dsts 2024-04-05 13:12:34 -05:00
SNeedlewoods 18fbe54729 add sum of amounts for unspent_outputs 2024-03-30 13:18:12 +01:00
Lee *!* Clagett 463228b961 Skip privacy networks (on tx sends) that don't have outgoing connections 2024-03-29 13:01:58 -04:00
j-berman 427ba7702f wallet2: ensure transfers and sweeps use same fee calc logic rnd2
Looks like the logic from #8882 was accidentally removed in #8861
(regressing to the behavior noted in the #8882 description).
This commit brings that logic back.
2024-03-22 14:05:17 -07:00
koe e151ff711f update blake2b test vectors 2024-03-21 09:51:40 -05:00
jeffro256 d6609b83d6
serialization: do any N-tuple 2024-03-19 14:49:36 -05:00
jeffro256 c4e1c5a640
ringct: fix trunc_amount field name change
Caused in commit 05231400ce, PR #9035.
2024-03-11 20:21:22 -05:00
jeffro256 9d101d5ea0
serialization: protect blob serialization from undefined behavior
There is currently no compiler protection when someone tries to
do (for example) `BLOB_SERIALIZER(std::vector<int>)`. You just
get runtime allocation errors. This has already eaten up dev time
before, so this PR adds a static assertion that the type must be
trivially copyable, as defined by the C++ standard. Types can
override this if applicable if they use `BLOB_SERIALIZER_FORCED`.
2024-03-10 14:15:48 -05:00
jeffro256 7194506792
Blockchain: remove old fee calc logic 2024-03-10 13:30:46 -05:00
luigi1111 1bec71279e
Merge pull request #9225
a01d7cc Fixed mempool pruning (SChernykh)
2024-03-08 20:27:34 -05:00
luigi1111 769202bc52
Merge pull request #9219
e6f4875 wallet2: adjust fee during backlog, fix set priority (selsta)
2024-03-08 20:26:58 -05:00
SyntheticBird45 9b946ae527 Removed default cryptonote address
- Removed `localhost:8080` default value to address string in wallet rpc
- Added an error response in case string is empty

fixed indentation

removed if and errors, default to localhost and port based on nettype

Forgot ":"

forgot ; and m_

removed wallet_rpc_server_error_codes.h
2024-03-08 21:32:26 +01:00
SChernykh a01d7ccbfd Fixed mempool pruning
- Fixed undefined behavior after a call to `remove_tx_from_transient_lists` (it used an invalid iterator)
- Fixed `txCompare` (it wasn't strictly weak ordered)
2024-03-08 21:04:16 +01:00
luigi1111 d6d55b507a
Merge pull request #9222
66e5081 get_block_template_backlog: better sorting logic (SChernykh)
2024-03-08 13:45:41 -05:00
luigi1111 c23951f339
Merge pull request #9218
7815023 tx_memory_pool: make double spends a no-drop offense (jeffro256)
2024-03-08 10:43:20 -05:00
SChernykh 66e5081eae get_block_template_backlog: better sorting logic
std::sort is unstable, so it can return random sets of transactions when mempool has many transactions with the same fee/byte. It can result in p2pool mining empty blocks sometimes because it doesn't pick up "new" transactions immediately.
2024-03-08 14:50:01 +01:00
selsta e6f4875219
wallet2: adjust fee during backlog, fix set priority 2024-03-08 14:13:58 +01:00
luigi1111 6ade592adf
Merge pull request #9195
2a2da79 free function serialization DSL (jeffro256)
2024-03-07 21:37:05 -05:00
jeffro256 7815023117
tx_memory_pool: make double spends a no-drop offense
Nodes who see different txs in a double spend attack will drop each other, splitting the network.
Issue found by @boog900.
2024-03-07 09:23:51 -06:00
jeffro256 38f354e89f
Enforce Tx unlock_time is Zero by Relay Rule
Related to https://github.com/monero-project/research-lab/issues/78

Added a relay rule that enforces the `unlock_time` field is equal to 0 for non-coinbase transactions.

UIs changed:
* Removed `locked_transfer` and `locked_sweep_all` commands from `monero-wallet-cli`

APIs changed:
* Removed `unlock_time` parameters from `wallet2` transfer methods
* Wallet RPC transfer endpoints send error codes when requested unlock time is not 0
* Removed `unlock_time` parameters from `construct_tx*` cryptonote core functions
2024-02-24 14:27:17 -06:00
jeffro256 2a2da79943
free function serialization DSL
Example usage for Seraphis types (in global or `sp` namespace):

```
BEGIN_SERIALIZE_OBJECT_FN(sp::SpCoinbaseEnoteCore)
    FIELD_F(onetime_address)
    VARINT_FIELD_F(amount)
END_SERIALIZE()

BEGIN_SERIALIZE_OBJECT_FN(sp::SpEnoteCore)
    FIELD_F(onetime_address)
    FIELD_F(amount_commitment)
END_SERIALIZE()
```
2024-02-24 11:24:47 -06:00
tobtoht cdab0d489c
cmake: require libsodium 2024-02-24 16:26:43 +01:00
luigi1111 b12766a652
Merge pull request #9189
f7670c9 cryptonote_core: early out on out of bounds scaling parameter (selsta)
2024-02-24 10:16:54 -05:00
luigi1111 72d87cd10a
Merge pull request #9160
c50ade5 Daemon-specific proxy for the wallet-rpc. (0xFFFC0000)
2024-02-24 10:11:51 -05:00
luigi1111 3078e44847
Merge pull request #9155
ed50938 Zero initialize rctSigBase elements (Lee *!* Clagett)
2024-02-24 10:07:54 -05:00
luigi1111 486ae9f1cf
Merge pull request #9138
cd7ccfb Disable/fix ports with I2P (Lee Clagett)
2024-02-24 10:05:25 -05:00
luigi1111 7904879326
Merge pull request #9137
8d25418 daemon: warn user on specifiying ZMQ args with --no-zmq (jeffro256)
2024-02-24 10:04:56 -05:00
luigi1111 c12ee59ebd
Merge pull request #9125
0c545f6 epee/test: remove levin_protocol_handler and core_proxy tests (jeffro256)
2024-02-24 09:59:50 -05:00
luigi1111 2dc918402c
Merge pull request #9006
47042ce wallet2: call on_reorg callback in handle_reorg (j-berman)
2024-02-24 09:57:55 -05:00
koe fa47c7b7d6 add blake2b to src/crypto 2024-02-21 19:39:11 -06:00
jeffro256 b13c5f6669
wallet: feature: transfer amount with fee included
To transfer ~5 XMR to an address such that your balance drops by exactly 5 XMR, provide a `subtractfeefrom` flag to the `transfer` command. For example:

    transfer 76bDHojqFYiFCCYYtzTveJ8oFtmpNp3X1TgV2oKP7rHmZyFK1RvyE4r8vsJzf7SyNohMnbKT9wbcD3XUTgsZLX8LU5JBCfm 5 subtractfeefrom=all

If my walet balance was exactly 30 XMR before this transaction, it will be exactly 25 XMR afterwards and the destination address will receive slightly
less than 5 XMR. You can manually select which destinations fund the transaction fee and which ones do not by providing the destination index.
For example:

    transfer 75sr8AAr... 3 74M7W4eg... 4 7AbWqDZ6... 5 subtractfeefrom=0,2

This will drop your balance by exactly 12 XMR including fees and will spread the fee cost proportionally (3:5 ratio) over destinations with addresses
`75sr8AAr...` and `7AbWqDZ6...`, respectively.

Disclaimer: This feature was paid for by @LocalMonero.
2024-02-20 17:08:06 -06:00
selsta f7670c9387
cryptonote_core: early out on out of bounds scaling parameter 2024-02-21 00:02:27 +01:00
0xFFFC0000 c50ade514f
Daemon-specific proxy for the wallet-rpc.
1. Daemon-specific proxy is exclusive with global proxy (--proxy).
2. If you set global proxy (--proxy) you cannot set daemon-specific proxy.
3. If you don't set global proxy, you can set proxy (or not set) proxy for
each daemon connection with the proxy field in jsonrpc to the wallet-rpc.
2024-02-18 18:36:52 +00:00
jeffro256 8d25418df0
daemon: warn user on specifiying ZMQ args with --no-zmq
Resolves https://github.com/monero-project/monero/issues/9127
2024-02-07 00:04:46 -06:00
Lee *!* Clagett ed50938af4 Zero initialize rctSigBase elements 2024-02-06 12:47:47 -05:00
Lee Clagett cd7ccfbdab Disable/fix ports with I2P 2024-01-30 13:40:05 -05:00
luigi1111 eb904d709a
Merge pull request #9090
430b102 Cleanup scoped_ptr in src/common/dns_utils.cpp and header include: 	* No need for entire new class (Fix #8732). 	* Fix stdint.h header include in contrib/epee/include/net/http_base.h. (0xFFFC0000)
2024-01-18 18:06:23 -05:00
luigi1111 e9a4deef81
Merge pull request #9079
eed975d Fix missing checks for IsObject in ZMQ jsonrpc reading (Lee Clagett)
2024-01-18 18:03:18 -05:00
luigi1111 8ee57110b0
Merge pull request #9077
2525200 serialization: remove container wrappers and serialize directly (jeffro256)
2024-01-18 18:02:31 -05:00
luigi1111 4b1910af13
Merge pull request #9073
53e632b fix merge mining with more than one merge mined chain (Crypto City)
2024-01-18 18:01:34 -05:00
luigi1111 5d3679c43c
Merge pull request #9069
a11e03a serialization: fix infinite loops and clean up dispatching (jeffro256)
2024-01-18 18:00:25 -05:00
luigi1111 2eed43cef2
Merge pull request #9059
2766d12 MMS: Ignore 2 more API errors thrown by latest PyBitmessage (rbrunner7)
2024-01-18 17:58:57 -05:00
luigi1111 9d7b253263
Merge pull request #9052
4acae11 Fix EAGAIN bug in ZMQ-RPC/ZMQ-PUB (Lee *!* Clagett)
2024-01-18 17:57:30 -05:00
luigi1111 2a6f7efca6
Merge pull request #9049
1062b17 wallet: sign_tx: get tx pubkey from extra (tobtoht)
2024-01-18 17:56:55 -05:00
luigi1111 5f6646020e
Merge pull request #9023
b2eb47d wallet: mitigate statistical dependence for decoy selection within rings (jeffro256)
2024-01-18 17:55:49 -05:00
jeffro256 0c545f614a
epee/test: remove levin_protocol_handler and core_proxy tests 2024-01-17 17:17:16 -06:00
0xFFFC0000 430b102aef Cleanup scoped_ptr in src/common/dns_utils.cpp and header include:
* No need for entire new class (Fix #8732).
	* Fix stdint.h header include in contrib/epee/include/net/http_base.h.
2023-12-19 16:54:37 +03:30
Crypto City 53e632b435
fix merge mining with more than one merge mined chain
reported by sech1
2023-11-30 17:01:52 +00:00
Lee Clagett eed975db5d Fix missing checks for IsObject in ZMQ jsonrpc reading 2023-11-28 18:02:57 -05:00
jeffro256 2525200185
serialization: remove container wrappers and serialize directly
Some downstream code (most notably PR https://github.com/UkoeHB/monero/pull/25) wants to use the src/serialization lib
for storing information persistently. When one builds classes/machines wishing to serialize containers, they must use
the `serializable_*` container classes. In this case, this makes the Seraphis library code unnecessarily tightly coupled
with the src/serialization code since one cannot swap out their type of storage format without major refactoring of class
field types. By serializing STL containers directly, we can abstract the serialization details away, making for much
cleaner design. Also small bonus side effect of this change is that STL containers with custom Comparators, Allocators,
and Hashers are serializable. `std::multimap` is added to the list of serializable containers.

Depends upon https://github.com/monero-project/monero/pull/9069.
2023-11-28 14:06:24 -06:00
jeffro256 a11e03afa6
serialization: fix infinite loops and clean up dispatching
Resolves #8687
2023-11-18 03:47:55 -06:00
luigi1111 ac02af9286
Merge pull request #9050
23179a0 wallet: fix multisig key memory leak (jeffro256)
2023-11-06 09:38:08 -05:00
luigi1111 06cfcb73ae
Merge pull request #9042
ade57b6 JH hash compiler workarounds (SChernykh)
2023-11-06 09:33:35 -05:00
luigi1111 b22ba16dec
Merge pull request #9038
e191083 epee: remove dead code in math_helper and string_tools (jeffro256)
2023-11-06 09:31:33 -05:00
luigi1111 c03e404980
Merge pull request #9035
0523140 ringct: make 
ctSigBase serialization follow strict aliasing rule (jeffro256)
2023-11-06 09:28:18 -05:00
luigi1111 4ea2a194c7
Merge pull request #9033
56dab0f cryptonote_config: include cstdint (jeffro256)
2023-11-06 09:27:26 -05:00
luigi1111 54e8463fe6
Merge pull request #8990
c17f73a add sp_transcript (koe) 51e40f7 add seraphis_crypto directory (koe)
2023-11-06 09:24:37 -05:00
luigi1111 a87f2bdd3f
Merge pull request #8979
80b5bf8 gcc: fix uninitialized constructor warnings (jeff)
2023-11-06 09:23:48 -05:00
luigi1111 476398687d
Merge pull request #8965
1e2e703 core_rpc_server: silence unused  warnings (jeffro256)
2023-11-06 09:23:08 -05:00
rbrunner7 2766d12a62 MMS: Ignore 2 more API errors thrown by latest PyBitmessage 2023-11-05 16:11:52 +01:00
koe c17f73a1a2 add sp_transcript 2023-11-04 21:56:42 -05:00
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
koe 236e5d4623 update TimingsDatabase to support csv format and incremental updating 2023-09-10 15:51:54 -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