Commit Graph

711 Commits

Author SHA1 Message Date
moneromooo-monero 70271fa788
common: add a class to safely wrap mlock/munlock
This class will allow mlocking small objects, of which there
may be several per page. It adds refcounting so pages are only
munlocked when the last object on that page munlocks.
2018-08-16 11:57:46 +00:00
moneromooo-monero e9ffa91257
store secret keys encrypted where possible
The secret spend key is kept encrypted in memory, and
decrypted on the fly when needed.

Both spend and view secret keys are kept encrypted in a JSON
field in the keys file. This avoids leaving the keys in
memory due to being manipulated by the JSON I/O API.
2018-08-16 11:57:43 +00:00
moneromooo-monero ea37614efe
wallet: wipe seed from memory where appropriate 2018-08-16 09:17:52 +00:00
stoffu a64f57fe42
wallet2: make --restricted-rpc available for wallet RPC only 2018-08-16 09:54:23 +09:00
luigi1111 b82bcdea2d
Merge pull request #4186
c8226ad unit_tests: use valid key images, pub keys, etc (moneromooo-monero)
2018-08-15 17:44:34 -05:00
luigi1111 01475c36c0
Merge pull request #4165
68b1197 tests: ringdb: use system's temporary dir path (radfish)
2018-08-15 17:33:06 -05:00
luigi1111 5295e4eb82
Merge pull request #4137
63e342b crypto: move null_pkey/null_skey to the cpp file (moneromooo-monero)
0496c7c crypto: do not use boost::value_initialized to init null skey/pkey (moneromooo-monero)
2018-08-15 17:17:34 -05:00
moneromooo-monero 0c8d8f6b2e
unit_tests: remove std::move in return statement
This actually prevents copy elision
2018-08-15 13:38:47 +00:00
stoffu b21fdaa874
fuzz: set address properly 2018-08-14 20:17:51 +09:00
stoffu bcab579864
wallet: allow adjusting number of rounds for the key derivation function 2018-08-08 01:56:54 +09:00
Maxim Shishmarev 96c1de979a fixed cncrypto tests not passing after the change in random_scalar 2018-08-07 15:58:40 +10:00
Lee Clagett 4616cf2641 Fixed ZMQ-RPC for transactions and GET_BLOCKS_FAST 2018-08-02 07:30:20 +00:00
moneromooo-monero 43f71100bc
blockchain_db: remove unused get_output_key variant
It was actually incorrect, as it would not return commitment
2018-07-30 21:57:47 +00:00
moneromooo-monero c8226ad1f7
unit_tests: use valid key images, pub keys, etc 2018-07-28 19:39:59 +01:00
luigi1111 ff01c3ade4
Merge pull request #4110
639ca3b core_tests: add --filter to select which tests to run (moneromooo-monero)
2018-07-27 14:28:49 -05:00
luigi1111 3fde902394
Merge pull request #4097
61caab8 crypto: remove slight bias in key generation due to modulo (moneromooo-monero)
2018-07-27 14:23:54 -05:00
redfish 68b1197f5d tests: ringdb: use system's temporary dir path
Fixes failing test during Arch package build (due to attempt to write to
~/.bitmonero/...).

Prefix temp dir path with "monero-" because we are not putting it on the
system, so good to identify ourselves in case the dir gets left over due
to crash, etc.
2018-07-22 14:14:54 -04:00
moneromooo-monero 0496c7c91a
crypto: do not use boost::value_initialized to init null skey/pkey 2018-07-20 23:06:22 +01:00
luigi1111 f6d7e87b67
Merge pull request #4075
438d52d remove epee from link lines where it's redundant (moneromooo-monero)
2018-07-19 14:10:20 -05:00
luigi1111 5fad1c505a
Merge pull request #4073
3474154 gtest: use -fPIC with CLANG too (moneromooo-monero)
2018-07-19 14:07:49 -05:00
luigi1111 007b835daa
Merge pull request #4061
e6f4d4a unit_tests: do not recreate the same base rct sig all the time (moneromooo-monero)
2018-07-19 14:03:38 -05:00
luigi1111 94ed562148
Merge pull request #4045
7cdd147 Changed URLs to HTTPS (einsteinsfool)
2018-07-19 13:56:38 -05:00
luigi1111 3e026ff6ed
Merge pull request #4013
e5592c4 rpc: add blockchain disk size to getinfo (moneromooo-monero)
2018-07-19 13:40:42 -05:00
luigi1111 21afa71ba6
Merge pull request #3981
45e419b db: store cumulative rct output distribution in the db for speed (moneromooo-monero)
2018-07-19 13:39:24 -05:00
luigi1111 025187e6c9
Merge pull request #3854
149da42 db_lmdb: enable batch transactions by default (stoffu)
34cb6b4 add --regtest and --fixed-difficulty for regression testing (vicsn)
9e1403e update get_info RPC and bump RPC version (vicsn)
207b66e first new functional tests (vicsn)
2018-07-19 13:35:25 -05:00
luigi1111 33122ab8a6
Merge pull request #3617
4c00a4d unit_tests: add device unit tests (moneromooo-monero)
2018-07-19 13:32:36 -05:00
moneromooo-monero 45e419bd5c
db: store cumulative rct output distribution in the db for speed
This gets rid of the temporary precalc cache.

Also make the RPC able to send data back in binary or JSON,
since there can be a lot of data

This bumps the LMDB database format to v3, with migration.
2018-07-13 11:37:04 +01:00
moneromooo-monero 639ca3b1fa
core_tests: add --filter to select which tests to run 2018-07-07 19:33:35 +01:00
moneromooo-monero 61caab8a8c
crypto: remove slight bias in key generation due to modulo 2018-07-05 09:18:01 +01:00
victorsintnicolaas 207b66ecc2 first new functional tests 2018-06-29 10:06:22 +02:00
victorsintnicolaas 34cb6b4b70 add --regtest and --fixed-difficulty for regression testing
on_generateblocks RPC call combines functionality from the on_getblocktemplate and on_submitblock RPC calls to allow rapid block creation. Difficulty is set permanently to 1 for regtest.
Makes use of FAKECHAIN network type, but takes hard fork heights from mainchain
Default reserve_size in generate_blocks RPC call is now 1. If it is 0, the following error occurs 'Failed to calculate offset for'.
Queries hard fork heights info of other network types
2018-06-29 10:06:11 +02:00
moneromooo-monero 438d52deaf
remove epee from link lines where it's redundant
For some reason, this confuses and kills ASAN on startup
as it thinks const uint8_t ipv4_network_address::ID is
defined multiple times.
2018-06-28 16:45:22 +01:00
moneromooo-monero 3474154b75
gtest: use -fPIC with CLANG too 2018-06-28 16:42:52 +01:00
luigi1111 8a27caeb22
Merge pull request #3998
8db23df wallet: on first refresh, start off with a quantized height (moneromooo-monero)
2018-06-27 16:30:38 -05:00
luigi1111 a844844cda
Merge pull request #3716
a2b557f 6795bd0 209ec96 ed2c81e a830db2 57ea902 31a895e ba8331c f7f1917 41be339 f025ae9 ef2cb63 dcfd299 5d3e702 2704624 2771a18 0e4c7d0 (moneromooo-monero)
2018-06-27 15:33:01 -05:00
moneromooo-monero e6f4d4acf0
unit_tests: do not recreate the same base rct sig all the time
Helps a bit when running with valgrind
2018-06-27 11:11:14 +01:00
moneromooo-monero 2771a18e85
threadpool: allow leaf functions to run concurrently
Decrease the number of worker threads by one to account
for the fact the calling thread acts as a worker thread now
2018-06-26 22:15:22 +01:00
moneromooo-monero ed2c81ed95
replace std::list with std::vector on some hot paths
also use reserve where appropriate
2018-06-26 22:14:21 +01:00
luigi1111 8fad35f8e2
Merge pull request #3962
55c7fb8 epee: adaptive connection timeout system (moneromooo-monero)
2018-06-25 15:12:37 -05:00
einsteinsfool 7cdd147da5 Changed URLs to HTTPS 2018-06-23 21:15:29 +02:00
moneromooo-monero e5592c4bab
rpc: add blockchain disk size to getinfo
This should help new nodes predict how much disk space will be
needed for a full sync
2018-06-20 23:48:37 +01:00
luigi1111 34c57d071f
Merge pull request #3938
01cc978 ringct: remove an unnecessary scalarmultBase in zeroCommit (moneromooo-monero)
2018-06-20 14:51:31 -05:00
luigi1111 c678413a89
Merge pull request #3902
f8dd433 epee: fix detection of 172.16.0.0/172.31.255.255 local IP range (moneromooo-monero)
5db9e3c unit_tests: add tests for local IP range detection (moneromooo-monero)
2018-06-20 14:22:44 -05:00
luigi1111 cfd66dae4b
Merge pull request #3691
db55263 threadpool: allow constructing an object, and misc tweaks (moneromooo-monero)
ce173cb core: remove threadpool dependency from header (moneromooo-monero)
3147468 unit_tests: add threadpool unit test (moneromooo-monero)
2018-06-17 22:04:39 -05:00
moneromooo-monero 8db23df581
wallet: on first refresh, start off with a quantized height
for privacy reasons, so an untrusted node can't easily track
wallets from IP address to IP address, etc. The granularity
is 1024 blocks, which is about a day and a half.
2018-06-13 22:44:27 +01:00
moneromooo-monero 55c7fb87a9
epee: adaptive connection timeout system
a connection's timeout is halved for every extra connection
from the same host.

Also keep track of when we don't need to use a connection
anymore, so we can close it and free the resource for another
connection.

Also use the longer timeout for non routable local addresses.
2018-06-10 19:39:38 +01:00
luigi1111 13d73d9ed6
Merge pull request #3604
54d9fff gtest: Fix compilation on MinGW with pthread /googletest#621 (stoffu)
2018-06-08 14:51:32 -05:00
luigi1111 22c8730261
Merge pull request #3450
3b941be core: add get_earliest_ideal_height_for_version() (stoffu)
2018-06-08 14:31:49 -05:00
luigi1111 5321769b65
Merge pull request #3444
a79fc21 hardfork: fix get_earliest_ideal_height_for_version() to support non-existent versions (stoffu)
7e30ead unit_tests/hardfork: add tests for check_for_height() (stoffu)
98cf62c hardfork: fix get_next_version() (stoffu)
0321d1a unit_tests/hardfork: add tests for get_voting_info() (stoffu)
2018-06-08 14:29:38 -05:00
moneromooo-monero 01cc978722
ringct: remove an unnecessary scalarmultBase in zeroCommit 2018-06-06 10:14:36 +01:00
moneromooo-monero 5db9e3c28e
unit_tests: add tests for local IP range detection 2018-06-01 21:47:25 +01:00
luigi1111 b6eb7484d1
Merge pull request #3592
90a16b1 crypto: fix initialization order issue with random mutex (moneromooo-monero)
6a61f52 unit_tests: add ringdb unit tests (moneromooo-monero)
2018-05-31 14:41:17 -05:00
luigi1111 f0f3157183
Merge pull request #3504
a0a810c performance_tests: fix subaddress expansion test not expanding (moneromooo-monero)
2018-05-30 15:57:42 -05:00
stoffu 0321d1ac79
unit_tests/hardfork: add tests for get_voting_info() 2018-05-30 09:49:58 +09:00
stoffu 98cf62cc45
hardfork: fix get_next_version() 2018-05-30 09:49:57 +09:00
stoffu 7e30eadb32
unit_tests/hardfork: add tests for check_for_height() 2018-05-30 09:49:55 +09:00
stoffu a79fc219b7
hardfork: fix get_earliest_ideal_height_for_version() to support non-existent versions 2018-05-30 09:49:52 +09:00
luigi1111 c534fe8d19
Merge pull request #3251
b9389e5 db_lmdb: save pruned and prunable tx data separately (moneromooo-monero)
2018-05-29 17:56:26 -05:00
moneromooo-monero b9389e582e
db_lmdb: save pruned and prunable tx data separately
This bumps DB version to 2, migration code will run for v1 DBs
2018-05-23 22:48:12 +01:00
moneromooo-monero 64f82e0481
unit_tests: fix build after get_output_didstribution signature change 2018-05-21 20:49:02 +01:00
moneromooo-monero 5f8ffca34d
speed up get_output_distribution (and precalc common case) 2018-05-21 19:51:58 +01:00
Riccardo Spagni 2906a24179
Merge pull request #3809
b88c9a00 unit_tests: set default data dir to the source tree at build time (moneromooo-monero)
2018-05-21 20:44:07 +02:00
Riccardo Spagni ff31611a32 Revert "Merge pull request #3775"
This reverts commit 20ef37bbca, reversing
changes made to 40070a661f.
2018-05-21 20:30:31 +02:00
moneromooo-monero 3147468d35
unit_tests: add threadpool unit test 2018-05-20 12:06:10 +01:00
moneromooo-monero b88c9a003e
unit_tests: set default data dir to the source tree at build time 2018-05-15 21:45:34 +01:00
moneromooo-monero c1886155ed
unit_tests: fix build after get_output_didstribution signature change 2018-04-28 18:02:58 +01:00
Thaer Khawaja dad1077577 Only log an error if fork version is higher AND is not known. 2018-04-22 17:26:44 -07:00
moneromooo-monero 4c00a4d31e
unit_tests: add device unit tests
Annoyingly, its locking semantics are borked since it does not
do any locking
2018-04-12 13:49:05 +01:00
moneromooo-monero 6a61f520e2
unit_tests: add ringdb unit tests 2018-04-11 11:43:39 +01:00
stoffu 54d9fffa10
gtest: Fix compilation on MinGW with pthread /googletest#621 2018-04-11 11:35:45 +09:00
moneromooo-monero a0a810ccd4
performance_tests: fix subaddress expansion test not expanding 2018-03-27 15:06:19 +01:00
stoffu 3b941befae
core: add get_earliest_ideal_height_for_version() 2018-03-21 01:53:24 +09:00
Riccardo Spagni 0f27fc57ac
Merge pull request #3336
57c0b1ed Fix typos in various files (Dimitris Apostolou)
2018-03-16 18:08:07 +02:00
moneromooo-monero 41f727ce42
add RPC to get a histogram of outputs of a given amount 2018-03-16 10:32:26 +00:00
Dimitris Apostolou 57c0b1ed9f Fix typos in various files 2018-03-15 18:25:38 +02:00
AnythingTechPro 843f65cbda
tests/hash: correctly reference crypto HASH_SIZE for less confusion 2018-03-14 11:10:54 -04:00
stoffu 7dfa5e9e6e
chacha: call prehashed version explicitly as generate_chacha_key_prehashed
hash: add prehashed version cn_slow_hash_prehashed
slow-hash: let cn_slow_hash take 4th parameter for deciding prehashed or not
slow-hash: add support for prehashed version for the other 3 platforms
2018-03-14 21:00:17 +09:00
stoffu b2d23b189e
crypto: revert odd namespace changes made in #3303 2018-03-14 21:00:17 +09:00
stoffu 8705beaf51
keypair::generate: always require hw::device to avoid possible mistake 2018-03-14 21:00:16 +09:00
stoffu 27a196b126
device: untangle cyclic depenency
When #3303 was merged, a cyclic dependency chain was generated:

    libdevice <- libcncrypto <- libringct <- libdevice

This was because libdevice needs access to a set of basic crypto operations
implemented in libringct such as scalarmultBase(), while libringct also needs
access to abstracted crypto operations implemented in libdevice such as
ecdhEncode(). To untangle this cyclic dependency chain, this patch splits libringct
into libringct_basic and libringct, where the basic crypto ops previously in
libringct are moved into libringct_basic. The cyclic dependency is now resolved
thanks to this separation:

    libcncrypto <- libringct_basic <- libdevice <- libcryptonote_basic <- libringct

This eliminates the need for crypto_device.cpp and rctOps_device.cpp.

Also, many abstracted interfaces of hw::device such as encrypt_payment_id() and
get_subaddress_secret_key() were previously implemented in libcryptonote_basic
(cryptonote_format_utils.cpp) and were then called from hw::core::device_default,
which is odd because libdevice is supposed to be independent of libcryptonote_basic.
Therefore, those functions were moved to device_default.cpp.
2018-03-14 21:00:15 +09:00
Riccardo Spagni 0f2d6d40b4
Merge pull request #3360
1ff35fda Wallet API: make nettype non-defaulted to disambiguate from deprecated versions (and make libwallet_api_tests compilable) (stoffu)
2018-03-14 13:37:00 +02:00
moneromooo-monero 91d97dd4ab
fuzz_tests: set small subaddress lookahead for speed 2018-03-14 11:34:09 +00:00
stoffu 1ff35fda7c
Wallet API: make nettype non-defaulted to disambiguate from deprecated versions (and make libwallet_api_tests compilable) 2018-03-06 21:14:52 +09:00
Lee Clagett e136bc6b8a
tweaks to the monerov1 cryptonight algorithm 2018-03-05 18:18:45 +00:00
moneromooo-monero 608fd6f14a
Monero Cryptonight variants, and add one for v7
This is the first variant of many, with the intent to improve
Monero's resistance to ASICs and encourage mining decentralization.
2018-03-05 18:18:39 +00:00
Riccardo Spagni 4f93f74528
Merge pull request #3277
0e7ad2e2 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (stoffu)
af773211 Stagenet (stoffu)
cc9a0bee command_line: allow args to depend on more than one args (stoffu)
55f8d917 command_line::get_arg: remove 'required' for dependent args as they're always optional (stoffu)
450306a0 command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 (stoffu)
9f9e095a Use `genesis_tx` parameter in `generate_genesis_block`. #3261 (Jean Pierre Dudey)
2018-03-05 19:11:20 +02:00
Edward Betts fbcc91c2a4 Correct spelling mistakes. 2018-03-05 17:00:40 +00:00
stoffu af773211cb
Stagenet 2018-03-05 11:55:05 +09:00
cslashm e745c1e38d Code modifications to integrate Ledger HW device into monero-wallet-cli.
The basic approach it to delegate all sensitive data (master key, secret
ephemeral key, key derivation, ....) and related operations to the device.
As device has low memory, it does not keep itself the values
(except for view/spend keys) but once computed there are encrypted (with AES
are equivalent) and return back to monero-wallet-cli. When they need to be
manipulated by the device, they are decrypted on receive.

Moreover, using the client for storing the value in encrypted form limits
the modification in the client code. Those values are transfered from one
C-structure to another one as previously.

The code modification has been done with the wishes to be open to any
other hardware wallet. To achieve that a C++ class hw::Device has been
introduced. Two initial implementations are provided: the "default", which
remaps all calls to initial Monero code, and  the "Ledger", which delegates
all calls to Ledger device.
2018-03-04 12:54:53 +01:00
Riccardo Spagni 421ab3119c
Merge pull request #3245
54c256bc unit_tests.serialization: refactored with ASSERT_EQ_MAP (stoffu)
e6a60938 unit_tests: added gtest utility ASSERT_EQ_MAP for easily testing key-value map (stoffu)
2018-02-20 17:53:52 +02:00
whythat 05a12ccc2d options: remove testnet-* options 2018-02-16 22:32:01 +02:00
Riccardo Spagni f4a6bc79d9
Merge pull request #3226
e4646379 keccak: fix mdlen bounds sanity checking (moneromooo-monero)
2e3e90ac pass large parameters by const ref, not value (moneromooo-monero)
61defd89 blockchain: sanity check number of precomputed hash of hash blocks (moneromooo-monero)
9af6b2d1 ringct: fix infinite loop in unused h2b function (moneromooo-monero)
8cea8d0c simplewallet: double check a new multisig wallet is multisig (moneromooo-monero)
9b98a6ac threadpool: catch exceptions in dtor, to avoid terminate (moneromooo-monero)
24803ed9 blockchain_export: fix buffer overflow in exporter (moneromooo-monero)
f3f7da62 perf_timer: rewrite to make it clear there is no division by zero (moneromooo-monero)
c6ea3df0 performance_tests: remove add_arg call stray extra param (moneromooo-monero)
fa6b4566 fuzz_tests: fix an uninitialized var in setup (moneromooo-monero)
03887f11 keccak: fix sanity check bounds test (moneromooo-monero)
ad11db91 blockchain_db: initialize m_open in base class ctor (moneromooo-monero)
bece67f9 miner: restore std::cout precision after modification (moneromooo-monero)
1aabd14c db_lmdb: check hard fork info drop succeeded (moneromooo-monero)
2018-02-16 14:26:58 +01:00
Riccardo Spagni b5b88c2747
Merge pull request #3225
71806327 dns: change default DNS to a worldwide selection (moneromooo-monero)
2018-02-16 14:23:34 +01:00
stoffu 54c256bc26
unit_tests.serialization: refactored with ASSERT_EQ_MAP 2018-02-12 21:56:51 +09:00
stoffu e6a6093871
unit_tests: added gtest utility ASSERT_EQ_MAP for easily testing key-value map 2018-02-12 21:56:36 +09:00
moneromooo-monero 71806327f5
dns: change default DNS to a worldwide selection
DNSSEC aware servers picked from https://wiki.ipfire.org/dns/public-servers
2018-02-08 09:46:16 +00:00
h908714124 5c99608d95 Fix coverity issues in performance_tests/main.cpp 2018-02-07 19:11:29 +01:00
moneromooo-monero 2e3e90acbe
pass large parameters by const ref, not value
Coverity 136394 136397 136409 136526 136529 136533 175302
2018-02-02 19:36:09 +00:00
moneromooo-monero c6ea3df0ae
performance_tests: remove add_arg call stray extra param
Coverity 182572
2018-02-02 15:59:54 +00:00
moneromooo-monero fa6b45665d
fuzz_tests: fix an uninitialized var in setup
and comment it out, it's only used to generate a starting test case

Coverity 182506
2018-02-02 15:56:44 +00:00