Commit Graph

611 Commits

Author SHA1 Message Date
moneromooo-monero 66e34e85b1
add multisig core test and factor multisig building blocks 2017-12-17 16:12:15 +00:00
moneromooo-monero f4eda44ce3
N-1/N multisig 2017-12-17 16:12:12 +00:00
moneromooo-monero fff871a455
gen_multisig: generates multisig wallets if participants trust each other 2017-12-17 16:12:06 +00:00
moneromooo-monero 95a21a793d
wallet2: allow empty wallet filename to avoid saving data
Useful to speed tests up and avoid unnecessary leftover files
2017-12-17 16:12:03 +00:00
moneromooo-monero b84b3565f3
tests: add multisig unit tests 2017-12-17 16:12:00 +00:00
moneromooo-monero 4c313324b1
Add N/N multisig tx generation and signing
Scheme by luigi1111:

    Multisig for RingCT on Monero

    2 of 2

    User A (coordinator):
    Spendkey b,B
    Viewkey a,A (shared)

    User B:
    Spendkey c,C
    Viewkey a,A (shared)

    Public Address: C+B, A

    Both have their own watch only wallet via C+B, a

    A will coordinate spending process (though B could easily as well, coordinator is more needed for more participants)

    A and B watch for incoming outputs

    B creates "half" key images for discovered output D:
    I2_D = (Hs(aR)+c) * Hp(D)

    B also creates 1.5 random keypairs (one scalar and 2 pubkeys; one on base G and one on base Hp(D)) for each output, storing the scalar(k) (linked to D),
    and sending the pubkeys with I2_D.

    A also creates "half" key images:
    I1_D = (Hs(aR)+b) * Hp(D)

    Then I_D = I1_D + I2_D

    Having I_D allows A to check spent status of course, but more importantly allows A to actually build a transaction prefix (and thus transaction).

    A builds the transaction until most of the way through MLSAG_Gen, adding the 2 pubkeys (per input) provided with I2_D
    to his own generated ones where they are needed (secret row L, R).

    At this point, A has a mostly completed transaction (but with an invalid/incomplete signature). A sends over the tx and includes r,
    which allows B (with the recipient's address) to verify the destination and amount (by reconstructing the stealth address and decoding ecdhInfo).

    B then finishes the signature by computing ss[secret_index][0] = ss[secret_index][0] + k - cc[secret_index]*c (secret indices need to be passed as well).

    B can then broadcast the tx, or send it back to A for broadcasting. Once B has completed the signing (and verified the tx to be valid), he can add the full I_D
    to his cache, allowing him to verify spent status as well.

    NOTE:
    A and B *must* present key A and B to each other with a valid signature proving they know a and b respectively.
    Otherwise, trickery like the following becomes possible:
    A creates viewkey a,A, spendkey b,B, and sends a,A,B to B.
    B creates a fake key C = zG - B. B sends C back to A.
    The combined spendkey C+B then equals zG, allowing B to spend funds at any time!
    The signature fixes this, because B does not know a c corresponding to C (and thus can't produce a signature).

    2 of 3

    User A (coordinator)
    Shared viewkey a,A
    "spendkey" j,J

    User B
    "spendkey" k,K

    User C
    "spendkey" m,M

    A collects K and M from B and C
    B collects J and M from A and C
    C collects J and K from A and B

    A computes N = nG, n = Hs(jK)
    A computes O = oG, o = Hs(jM)

    B anc C compute P = pG, p = Hs(kM) || Hs(mK)
    B and C can also compute N and O respectively if they wish to be able to coordinate

    Address: N+O+P, A

    The rest follows as above. The coordinator possesses 2 of 3 needed keys; he can get the other
    needed part of the signature/key images from either of the other two.

    Alternatively, if secure communication exists between parties:
    A gives j to B
    B gives k to C
    C gives m to A

    Address: J+K+M, A

    3 of 3

    Identical to 2 of 2, except the coordinator must collect the key images from both of the others.
    The transaction must also be passed an additional hop: A -> B -> C (or A -> C -> B), who can then broadcast it
    or send it back to A.

    N-1 of N

    Generally the same as 2 of 3, except participants need to be arranged in a ring to pass their keys around
    (using either the secure or insecure method).
    For example (ignoring viewkey so letters line up):
    [4 of 5]
    User: spendkey
    A: a
    B: b
    C: c
    D: d
    E: e

    a -> B, b -> C, c -> D, d -> E, e -> A

    Order of signing does not matter, it just must reach n-1 users. A "remaining keys" list must be passed around with
    the transaction so the signers know if they should use 1 or both keys.
    Collecting key image parts becomes a little messy, but basically every wallet sends over both of their parts with a tag for each.
    Thia way the coordinating wallet can keep track of which images have been added and which wallet they come from. Reasoning:
    1. The key images must be added only once (coordinator will get key images for key a from both A and B, he must add only one to get the proper key actual key image)
    2. The coordinator must keep track of which helper pubkeys came from which wallet (discussed in 2 of 2 section). The coordinator
    must choose only one set to use, then include his choice in the "remaining keys" list so the other wallets know which of their keys to use.

    You can generalize it further to N-2 of N or even M of N, but I'm not sure there's legitimate demand to justify the complexity. It might
    also be straightforward enough to support with minimal changes from N-1 format.
    You basically just give each user additional keys for each additional "-1" you desire. N-2 would be 3 keys per user, N-3 4 keys, etc.

The process is somewhat cumbersome:

To create a N/N multisig wallet:

 - each participant creates a normal wallet
 - each participant runs "prepare_multisig", and sends the resulting string to every other participant
 - each participant runs "make_multisig N A B C D...", with N being the threshold and A B C D... being the strings received from other participants (the threshold must currently equal N)

As txes are received, participants' wallets will need to synchronize so that those new outputs may be spent:

 - each participant runs "export_multisig FILENAME", and sends the FILENAME file to every other participant
 - each participant runs "import_multisig A B C D...", with A B C D... being the filenames received from other participants

Then, a transaction may be initiated:

 - one of the participants runs "transfer ADDRESS AMOUNT"
 - this partly signed transaction will be written to the "multisig_monero_tx" file
 - the initiator sends this file to another participant
 - that other participant runs "sign_multisig multisig_monero_tx"
 - the resulting transaction is written to the "multisig_monero_tx" file again
 - if the threshold was not reached, the file must be sent to another participant, until enough have signed
 - the last participant to sign runs "submit_multisig multisig_monero_tx" to relay the transaction to the Monero network
2017-12-17 16:11:57 +00:00
Riccardo Spagni a3a8343051
Merge pull request #2857
7193b89f Scrub keys from memory just before scope end. (moneromooo-monero)
2017-12-17 13:00:11 +02:00
Riccardo Spagni 066fd7aced
Merge pull request #2877
43f5269f Wallets now do not depend on the daemon rpc lib (moneromooo-monero)
bb89ae8b move connection_basic and network_throttle from src/p2p to epee (moneromooo-monero)
4abf25f3 cryptonote_core does not depend on p2p anymore (moneromooo-monero)
2017-12-17 12:59:44 +02:00
moneromooo-monero 223e3788ac
unit_tests: fix memwipe test comparison
free might overwrite the memory, so we can't expect to see
the NULs we overwrote with, but at least we shouldn't see
the original data.
2017-12-17 09:56:36 +00:00
moneromooo-monero 4abf25f3c9
cryptonote_core does not depend on p2p anymore
As a followon side effect, this makes a lot of inline code
included only in particular cpp files (and instanciated
when necessary.
2017-12-16 23:28:38 +00:00
moneromooo-monero 09ce03d612
move includes around to lessen overall load 2017-12-16 22:46:38 +00:00
moneromooo-monero 7193b89fe5 Scrub keys from memory just before scope end.
Partially implements #74.

Securely erases keys from memory after they are no longer needed. Might have a
performance impact, which I haven't measured (perf measurements aren't
generally reliable on laptops).

Thanks to @stoffu for the suggestion to specialize the pod_to_hex/hex_to_pod
functions. Using overloads + SFINAE instead generalizes it so other types can
be marked as scrubbed without adding more boilerplate.
2017-12-16 15:40:33 -07:00
Riccardo Spagni 6c0953b15a
Merge pull request #2860
3dffe71b new wipeable_string class to replace std::string passphrases (moneromooo-monero)
7a2a5741 utils: initialize easylogging++ in on_startup (moneromooo-monero)
54950829 use memwipe in a few relevant places (moneromooo-monero)
000666ff add a memwipe function (moneromooo-monero)
2017-12-16 23:19:27 +02:00
moneromooo-monero c83d0b3ee2
add bulletproofs from v7 on testnet 2017-12-08 13:50:45 +00:00
moneromooo-monero d58835b2f6
integrate bulletproofs into monero 2017-12-08 13:48:15 +00:00
moneromooo-monero 90b8d9f271
add bulletproofs to the build, with basic unit tests
Based on Java code from Sarang Noether
2017-12-08 13:41:13 +00:00
moneromooo-monero 493f7d0974
util: allow non numeric version parts 2017-12-07 10:32:48 +00:00
moneromooo-monero 3dffe71b72
new wipeable_string class to replace std::string passphrases 2017-11-27 22:25:57 +00:00
moneromooo-monero 000666ff78
add a memwipe function
It's meant to avoid being optimized out

memory_cleanse lifted from bitcoin
2017-11-27 22:15:34 +00:00
moneromooo-monero 37c1ce3b68
tests: disable libwallet_api_tests when BUILD_GUI_DEPS is not set 2017-11-26 08:25:42 +00:00
Riccardo Spagni 2e54e7ff0b
Merge pull request #2824
51895fd7 split wallet and wallet_api (moneromooo-monero)
2017-11-25 19:53:35 +02:00
moneromooo-monero 51895fd7df
split wallet and wallet_api
This speeds up building a lot when wallet2.h (or something it
includes) changes, since all the API includes wallet2.h
2017-11-16 12:10:29 +00:00
moneromooo-monero f493eabba7
unit_tests: fix running without --data-dir
While there, also use the new is_arg_defaulted API instead of
going to poke the internal API directly.
2017-11-15 10:45:14 +00:00
Riccardo Spagni 5c2dfe157b
Merge pull request #2771
e3e838d0 kaccak: remove unused return value (moneromooo-monero)
4877aca2 keccak: some paranoid "can't happen" checks (moneromooo-monero)
2017-11-15 11:22:56 +02:00
Riccardo Spagni 74b699beda
Merge pull request #2812
9ac52127 unit_tests: fix build after wallet2 list/vector change (moneromooo-monero)
2017-11-14 21:33:38 +02:00
Riccardo Spagni edebe4e3b6
Merge pull request #2736
0d9c0db9 Do not build against epee_readline if it was not built (Howard Chu)
178014c9 split off readline code into epee_readline (moneromooo-monero)
a9e14a19 link against readline only for monerod and wallet-wallet-{rpc,cli} (moneromooo-monero)
437421ce wallet: move some scoped_message_writer calls from the libs (moneromooo-monero)
e89994e9 wallet: rejig to avoid prompting in wallet2 (moneromooo-monero)
ec5135e5 move input_line from command_line to simplewallet (moneromooo-monero)
082db75f move cryptonote command line options to cryptonote_core (moneromooo-monero)
2017-11-14 21:31:51 +02:00
Riccardo Spagni 922aaf4e2a
Merge pull request #2644
a17efcb0 make this build on SunOS/Solaris (Pavel Maryanov)
2017-11-14 21:31:09 +02:00
moneromooo-monero 9ac5212775
unit_tests: fix build after wallet2 list/vector change 2017-11-14 18:30:58 +00:00
moneromooo-monero 082db75f28
move cryptonote command line options to cryptonote_core
Those have no reason to be in a generic module
2017-11-14 17:06:19 +00:00
Pavel Maryanov a17efcb039
make this build on SunOS/Solaris 2017-11-14 17:03:48 +00:00
moneromooo-monero 383ff4f689
remove "using namespace std" from headers
It's nasty, and actually breaks on Solaris, where if.h fails to
build due to:

  struct map *if_memmap;
2017-11-14 16:56:10 +00:00
Riccardo Spagni 4754390725
Merge pull request #2720
110339f5 unit_tests: fix data dir determination (moneromooo-monero)
2017-11-14 15:16:23 +02:00
Riccardo Spagni 8df6b010eb
Merge pull request #2696
937e7f8a Initialize openssl on startup (moneromooo-monero)
2017-11-14 15:13:44 +02:00
Riccardo Spagni 8d8032b4c6
Merge pull request #2691
f92f1606 core_tests: do not include chaingen_tests_list.h in all tests (moneromooo-monero)
2017-11-14 15:12:40 +02:00
Riccardo Spagni 0c5872c869
Merge pull request #2686
21b9f6f3 always use core_tests for consistency, not coretests (moneromooo-monero)
2017-11-14 15:12:23 +02:00
Riccardo Spagni 5d52463b57
Merge pull request #2670
4fb77946 unit tests: OOB indexes & adding subaddress (Cole Lightfighter)
4fd6a3d2 Subaddress unit tests (Cole Lightfighter)
2017-11-14 15:01:49 +02:00
Riccardo Spagni 9317c9c57e
Merge pull request #2617
7dbf76d0 Fix an object lifetime bug in net load tests (moneromooo-monero)
2017-11-14 14:54:05 +02:00
moneromooo-monero e3e838d0cf
kaccak: remove unused return value 2017-11-11 11:20:48 +00:00
binaryFate 10013e9434 Protect node privacy by proper filtering in restricted-mode RPC answers
This patch allows to filter out sensitive information for queries that rely on the pool state, when running in restricted mode.
This filtering is only applied to data sent back to RPC queries. Results of inline commands typed locally in the daemon are not affected.
In practice, when running with `--restricted-rpc`:
* get_transaction_pool will list relayed transactions with the fields "last relayed time" and "received time" set to zero.
* get_transaction_pool will not list transaction that have do_not_relay set to true, and will not list key images that are used only for such transactions
* get_transaction_pool_hashes.bin will not list such transaction
* get_transaction_pool_stats will not count such transactions in any of the aggregated values that are computed

The implementation does not make filtering the default, so developers should be mindful of this if they add new RPC functionality.
Fixes #2590.
2017-11-08 13:07:07 +01:00
Riccardo Spagni 9d65a9cc98
Merge pull request #2483
ff7745bb Edited test readme for accuracy and depth (Cole Lightfighter)
c300ae56 Added test documentation & Keccak unit test (Cole Lightfighter)
f6119a8e Added test documentation & Keccak unit test (Cole Lightfighter)
2017-11-06 01:52:08 +02:00
Riccardo Spagni 13a84caa22
Merge pull request #2662
88ebfd64 core_tests: fix for subaddress patch (kenshi84)
e373a203 performance_tests: add master spend pubkey to subaddress hashtable (kenshi84)
2017-11-03 11:58:06 +02:00
Riccardo Spagni 4146f2e202
Merge pull request #2666
8233a24b unit_tests: fix build on windows (moneromooo-monero)
2017-11-02 11:44:36 +02:00
Jaquee d04633121b fix libwallet api test after api change 2017-10-29 15:26:23 +01:00
moneromooo-monero 110339f553
unit_tests: fix data dir determination 2017-10-24 10:22:46 +01:00
moneromooo-monero 937e7f8aa6
Initialize openssl on startup 2017-10-21 10:17:18 +01:00
moneromooo-monero f92f160674
core_tests: do not include chaingen_tests_list.h in all tests
This fixes all tests being annoyingly rebuilt when one changes
2017-10-20 18:53:43 +01:00
Cole Lightfighter 4fb7794651 unit tests: OOB indexes & adding subaddress
Tests for checking proper error throwing for out-of-bounds subaddress
indexes, and proper addition of subaddresses.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
2017-10-19 20:33:58 -06:00
moneromooo-monero 21b9f6f3c7
always use core_tests for consistency, not coretests
Other tests use unit_tests, performance_tests, etc.
This fixes getting it wrong half the time when typing.
2017-10-19 23:11:29 +01:00
Cole Lightfighter 4fd6a3d27f Subaddress unit tests
Basic unit test fixture, and initialization of a subaddress account.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
2017-10-17 10:59:53 -06:00
kenshi84 88ebfd646a
core_tests: fix for subaddress patch 2017-10-17 22:29:01 +09:00
moneromooo-monero 8233a24ba8
unit_tests: fix build on windows
Reported by iDunk on IRC
2017-10-16 09:37:51 +01:00
kenshi84 e373a2037b
performance_tests: add master spend pubkey to subaddress hashtable 2017-10-16 13:08:44 +09:00
moneromooo-monero fddd8d226f
performance_tests: fix build after subaddress patch 2017-10-15 19:58:53 +01:00
Riccardo Spagni b4126266d4
Merge pull request #2610
44c1d160 unit_tests: fix compiling on Windows (iDunk5400)
2017-10-15 18:54:32 +02:00
Riccardo Spagni 6159a83175
Merge pull request #2608
fe484f30 unit_tests: data dir is now overridden with --data-dir (moneromooo-monero)
2017-10-15 18:54:16 +02:00
Riccardo Spagni cb9b1fcc94
Merge pull request #2582
240f769d tests: add sha256sum unit test (moneromooo-monero)
2017-10-15 18:36:38 +02:00
Riccardo Spagni 1c546e0d81
Merge pull request #2565
452d4fae tests: fix hashchain unit tests (moneromooo-monero)
2017-10-15 18:27:08 +02:00
Riccardo Spagni 56ea442fd3
Merge pull request #2555
a4b4651c dns_utils: allow an optional DNS server IP in DNS_PUBLIC (moneromooo-monero)
2017-10-15 17:33:09 +02:00
Riccardo Spagni 5df4ecbb83
Merge pull request #2528
551a8ea6 mnemonics: new Lojban word list (Wei Tang)
2017-10-15 17:27:58 +02:00
Riccardo Spagni 5ea20d6944
Merge pull request #2469
7adceee6 precomputed block hashes are now in blocks of N (currently 256) (moneromooo-monero)
2017-10-15 17:23:50 +02:00
moneromooo-monero a4b4651cb0
dns_utils: allow an optional DNS server IP in DNS_PUBLIC
tcp://a.b.c.d
2017-10-10 12:29:05 +01:00
moneromooo-monero 7dbf76d0da
Fix an object lifetime bug in net load tests
The commands handler must not be destroyed before the config
object, or we'll be accessing freed memory.

An earlier attempt at using boost::shared_ptr to control object
lifetime turned out to be very invasive, though would be a
better solution in theory.
2017-10-09 16:46:42 +01:00
iDunk5400 44c1d160c8
unit_tests: fix compiling on Windows 2017-10-08 23:59:08 +02:00
moneromooo-monero fe484f3049
unit_tests: data dir is now overridden with --data-dir
rather than a raw string without option
2017-10-08 21:19:05 +01:00
kenshi84 53ad5a0f42
Subaddresses 2017-10-07 13:06:21 +09:00
Riccardo Spagni 8661f4e868
Merge pull request #2523
540d6fa3 tests: pass data dir as arg (redfish)
2017-10-06 22:51:22 +04:00
moneromooo-monero 240f769d21
tests: add sha256sum unit test 2017-10-05 17:03:37 +01:00
Lee Clagett 8b00687735 Upgrades to epee::net_utils::network_address
- internal nullptr checks
  - prevent modifications to network_address (shallow copy issues)
  - automagically works with any type containing interface functions
  - removed fnv1a hashing
  - ipv4_network_address now flattened with no base class
2017-10-05 11:57:09 -04:00
moneromooo-monero 452d4fae39
tests: fix hashchain unit tests
and relax the not-empty safety check to stay more intuitiuve
2017-10-03 00:51:53 +01:00
Riccardo Spagni a2041c9874
Merge pull request #2518
6a0fb301 performance_tests: adjust some iterations down a bit (moneromooo-monero)
2017-10-02 23:31:27 +04:00
Cole Lightfighter ff7745bb87 Edited test readme for accuracy and depth
Removed some erroneous instructions, and added information about
different test suites.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
2017-10-01 12:11:59 -06:00
redfish 540d6fa3d5 tests: pass data dir as arg
This fixes test failure on builds that happen
to be built in 'build/' instead of 'build/release'.

Use boost filesystem path type.
2017-09-28 01:41:44 -04:00
Wei Tang 551a8ea60e mnemonics: new Lojban word list
Word list authored by: sorpaas
Sources:
  lo gimste jo'u lo ma'oste (http://guskant.github.io/lojbo/gismu-cmavo.html)
  N-grams of Lojban corpus (https://mw.lojban.org/papri/N-grams_of_Lojban_corpus)
2017-09-26 06:42:17 +08:00
moneromooo-monero 36c3465b98
wallet2: do not keep block hashes below last checkpoint
This saves a lot of space and load/save time for wallet caches
2017-09-25 21:16:40 +01:00
moneromooo-monero 5d65a75b69
move checkpoints in a separate library 2017-09-25 21:16:26 +01:00
moneromooo-monero 06a681cf5b
performance_tests: add a test for is_out_to_acc_precomp 2017-09-25 18:35:55 +01:00
Riccardo Spagni e5a2cdbfad
Merge pull request #2457
d2d8a41c Use actual batch size for resize estimates (Howard Chu)
2017-09-25 16:57:07 +02:00
Riccardo Spagni c2346c6c59
Merge pull request #2424
28b72b6e tx_pool: pre-init tvc.m_verifivation_failed before processing (moneromooo-monero)
50a629b2 core_tests: catch (impossible in practice) tx extra api failure (moneromooo-monero)
fee15ef1 wallet2: catch failure to parse address (moneromooo-monero)
1399e26d net_peerlist: remove dead code (moneromooo-monero)
50e09698 tx_pool: guard against failure getting tx hash (moneromooo-monero)
54cc209a wallet_rpc_server: catch failure to create directory (moneromooo-monero)
3e55099c wallet_rpc_server: init m_vm to NULL in ctor (moneromooo-monero)
7d0dde5e wallet_args: remove redundant default value for --log-file (moneromooo-monero)
ed4a3350 wallet2: catch failure to save keys file (moneromooo-monero)
44434c8a wallet2_api: check whether dynamic_cast returns NULL (moneromooo-monero)
92f2f687 core: check return value from parse_hexstr_to_binbuff (moneromooo-monero)
5475692e wallet2_api: remove an unused, uninitialized, field (moneromooo-monero)
a7ba3de1 libwallet_api_tests: initialize newblock_triggered on reset (moneromooo-monero)
b2763ace wallet2_api: init error code to "no error" in the ctor (moneromooo-monero)
b5faac53 get_blockchain_top now returns void (moneromooo-monero)
2e44d8f2 wallet_rpc_server: guard against exceptions (moneromooo-monero)
4230876b simplewallet: guard against I/O exceptions (moneromooo-monero)
06c1e057 daemon: initialize decode_as_json in RPC request (moneromooo-monero)
11f71af5 http_base: init size_t in http_request_info ctor (moneromooo-monero)
2017-09-25 16:52:27 +02:00
Riccardo Spagni b911130a46
Merge pull request #2442
e29282d2 build: auto update version info without manually deleting version.h (stoffu)
2017-09-25 16:50:35 +02:00
Riccardo Spagni 08ada1fa8b
Merge pull request #2440
6137a0b9 blockchain: reject unsorted ins and outs from v7 (moneromooo-monero)
16afab90 core: sort ins and outs key key image and public key, respectively (moneromooo-monero)
0c36b9f9 common: add apply_permutation file and function (moneromooo-monero)
2017-09-25 16:49:01 +02:00
moneromooo-monero 50a629b2e6
core_tests: catch (impossible in practice) tx extra api failure
CID 175301
2017-09-25 15:48:51 +01:00
moneromooo-monero a7ba3de1d3
libwallet_api_tests: initialize newblock_triggered on reset
CID 161873
2017-09-25 15:48:18 +01:00
moneromooo-monero b5faac5304
get_blockchain_top now returns void
It was always returning true, and could not be foreseen to
usefully return errors in the future. This silences CID 162652
as well as saves some checking code in a few places.
2017-09-25 15:48:13 +01:00
moneromooo-monero 6a0fb301bb
performance_tests: adjust some iterations down a bit 2017-09-24 11:00:31 +01:00
stoffu e29282d208
build: auto update version info without manually deleting version.h 2017-09-21 07:47:37 +09:00
Cole Lightfighter c300ae56ca
Added test documentation & Keccak unit test 2017-09-19 15:09:38 -06:00
Cole Lightfighter f6119a8eaa
Added test documentation & Keccak unit test 2017-09-19 15:08:38 -06:00
moneromooo-monero 7adceee634
precomputed block hashes are now in blocks of N (currently 256)
This shaves a lot of space off binaries
2017-09-18 16:29:00 +01:00
moneromooo-monero 6137a0b94d
blockchain: reject unsorted ins and outs from v7
This ensures no information is leaked by the ordering
2017-09-18 11:23:15 +01:00
Howard Chu d2d8a41c47
Use actual batch size for resize estimates
And optimize import startup:

Remember start_height position during initial count_blocks pass
to avoid having to reread entire file again to arrive at start_height
2017-09-17 22:08:40 +01:00
Howard Chu 510d0d4753
Use a threadpool
Instead of constantly creating and destroying threads
2017-09-14 21:42:48 +01:00
moneromooo-monero 0c36b9f931
common: add apply_permutation file and function
This algorithm is adapted from Raymond Chen's code:
https://blogs.msdn.microsoft.com/oldnewthing/20170109-00/?p=95145
2017-09-13 09:25:01 +01:00
moneromooo-monero 6ac61100a1
Add a --fluffy-blocks option to relay blocks as fluffy blocks
Defaults to off, but fluffy blocks are forced enabled on testnet
2017-09-03 11:11:11 +01:00
Howard Chu 3d19ab7067 Revert "Cleanup test impact of moving blockchain_db_types()"
This reverts commit 3dd34a49ef.
2017-08-29 13:28:16 +01:00
Riccardo Spagni 36b978f50e
Merge pull request #2314
c22d22e2 Cleanup test impact of adding safesyncmode() method (Howard Chu)
9a859844 Toggle SAFE syncmode on and off automatically (Howard Chu)
2017-08-26 23:43:22 +02:00
Howard Chu 3dd34a49ef
Cleanup test impact of moving blockchain_db_types() 2017-08-22 15:11:28 +01:00
Howard Chu c22d22e2db
Cleanup test impact of adding safesyncmode() method 2017-08-22 15:11:09 +01:00
Howard Chu 9a859844f4
Toggle SAFE syncmode on and off automatically
If monerod is started with default sync mode, set it to SAFE after
synchronization completes. Set it back to FAST if synchronization
restarts (e.g. because another peer has a longer blockchain).

If monerod is started with an explicit sync mode, none of this
automation takes effect.
2017-08-20 16:30:28 +01:00
Howard Chu 4c7f8ac04f
DB cleanup
Hide LMDB-specific stuff behind blockchain_db.h. Nobody besides blockchain_db.cpp
should ever be including DB-specific headers any more.
2017-08-19 18:11:38 +01:00
Riccardo Spagni 4466b6d1b0
Merge pull request #2303
5a283078 cryptonote_protocol: large block sync size before v4 (moneromooo-monero)
7b747607 cryptonote_protocol: kick idle synchronizing peers (moneromooo-monero)
2017-08-17 21:39:44 +02:00
Riccardo Spagni 4b2cc123ff
Merge pull request #2287
827afcb7 protocol: pass blockchain cumulative difficulty when syncing (moneromooo-monero)
2017-08-17 21:35:02 +02:00
moneromooo-monero 5a283078ec
cryptonote_protocol: large block sync size before v4 2017-08-17 13:11:52 +01:00
moneromooo-monero 827afcb7ea
protocol: pass blockchain cumulative difficulty when syncing
Not used yet.
2017-08-15 21:03:37 +01:00
Riccardo Spagni 124cbe3cf3
Merge pull request #2292
cb2d5ac7 mnemonics: new Esperanto word list (moneromooo-monero)
2017-08-15 20:56:49 +02:00
Riccardo Spagni 53dde37ceb
Merge pull request #2276
a1891ebe tests: fix tests build (moneromooo-monero)
2017-08-15 20:53:41 +02:00
moneromooo-monero cb2d5ac788
mnemonics: new Esperanto word list
Word list authored by: Engelberg, ProkhorZ
Sources:
  Baza Radikaro Oficiala
  Reta Vortaro (http://www.reta-vortaro.de/revo/)
  Esperanto Panorama - Esperanto-English Dictionary (http://www.esperanto-panorama.net/vortaro/eoen.htm)
  ESPDIC - Paul Denisowski (http://www.denisowski.org/Esperanto/ESPDIC/espdic.txt)
2017-08-14 17:46:46 +01:00
moneromooo-monero 08abb670e1
protocol: fix reorgs while syncing 2017-08-12 11:22:42 +01:00
moneromooo-monero a1891ebea9
tests: fix tests build
Add get_fork_version and add_ideal_fork_version to core so
cryptonote_protocol does not have to need the Blockchain
class directly, as it's not in its dependencies, and add
those to the fake core classes in tests too.
2017-08-10 11:12:56 +01:00
moneromooo-monero 158c3ecff3
core: thread most of handle_incoming_tx 2017-08-07 09:33:20 +01:00
moneromooo-monero 5be43fcdba
cryptonote_protocol_handler: sync speedup
A block queue is now placed between block download and
block processing. Blocks are now requested only from one
peer (unless starved).

Includes a new sync_info coommand.
2017-08-07 09:33:04 +01:00
Riccardo Spagni 8609ed86c4
Merge pull request #2116
841231e5 Add fuzz testing using american fuzzy lop (moneromooo-monero)
2017-07-03 12:28:33 +02:00
moneromooo-monero 841231e5bd
Add fuzz testing using american fuzzy lop
Existing tests: block, transaction, signature, cold outputs,
cold transaction.

Data for these is in tests/data/fuzz.

A convenience shell script is in contrib/fuzz_testing/fuzz.sh, eg:

contrib/fuzz_testing/fuzz.sh signature

The fuzzer will run indefinitely, ^C to stop.

Fuzzing is currently supported for GCC only. I can't get CLANG
to build Monero here as it dies on some system headers, so if
someone wants to make it work on both, that'd be great.
In particular, the __AFL_LOOP construct should be made to work
so that a given run can fuzz multiple inputs, as the C++ load
time is substantial.
2017-06-24 16:46:18 +01:00
moneromooo-monero f4e3dca113
unit_tests: fix build failures after network_address changes 2017-06-19 11:26:02 +01:00
Riccardo Spagni 78f965a9e2
Merge pull request #2082
235df7f4 blockchain_db: add a txpool tx getter which returns existence (moneromooo-monero)
2017-06-18 17:36:12 +02:00
moneromooo-monero 235df7f484
blockchain_db: add a txpool tx getter which returns existence
Avoids exception spam for the "nope, not found" case
2017-06-11 15:36:48 +01:00
moneromooo-monero c3bec61da2
core_tests: fix tests failing due to new txpool code requitring batch transactions 2017-06-09 20:49:59 +01:00
Howard Chu d17c0fc2d0
Don't copy blockchain for coinbase_tx_sum
Changed Blockchain::for_all_blocks() to for_blocks_range()
Operate on blockchain in-place instead of building a copy first.
2017-06-01 14:14:24 +01:00
Riccardo Spagni a4c13ea092
Merge pull request #2039
4b932ff3 changed crypto to cncrypto so it generated libcncrypto (Gentian)
2017-05-30 21:24:11 +02:00
Riccardo Spagni cd13bcb4d2
Merge pull request #2036
89b2f306 tests: fix invalid key image test (moneromooo-monero)
a374a522 wallet2: check key image validity domain in import_key_images (moneromooo-monero)
2017-05-30 21:23:05 +02:00
Riccardo Spagni 40eb22aeb4
Merge pull request #2016
d1db3251 Fix overlooked renaming of Português in the unit tests (Nano Akron)
2017-05-30 21:13:22 +02:00
Riccardo Spagni 545e2b003c
Merge pull request #1982
b52abd13 Move txpool to the database (moneromooo-monero)
2017-05-30 21:12:44 +02:00
moneromooo-monero b52abd1370
Move txpool to the database
Integration could go further (ie, return_tx_to_pool calls should
not be needed anymore, possibly other things).

poolstate.bin is now obsolete.
2017-05-25 22:23:37 +01:00
Gentian 4b932ff314 changed crypto to cncrypto so it generated libcncrypto
fix a cmakelist
2017-05-23 07:45:40 -04:00
moneromooo-monero 89b2f3061b
tests: fix invalid key image test
It was using an invalid key image which wasn't in the key image
domain, so the transaction was rejected earlier than the test
was expecting
2017-05-18 09:19:55 +01:00
Nano Akron d1db32511c Fix overlooked renaming of Português in the unit tests 2017-05-07 16:36:03 +01:00
Nano Akron 12fff108ea
Change Old_English to English_Old - 'Old English' is actually a language 2017-04-24 20:27:12 +01:00
Riccardo Spagni e53dd76a49
Merge pull request #1983
72d113dd Amended software licenses for Portuguese and Spanish (Nano Akron)
54bcd260 Added Simplified Chinese electrum word list (Nano Akron)
2017-04-24 10:49:24 +02:00
Nano Akron 54bcd260ff
Added Simplified Chinese electrum word list 2017-04-16 12:06:53 +01:00
Lee Clagett 93e10f1cc4 Simplified the implementation and features of span 2017-04-11 16:35:14 -04:00
Lee Clagett 4a8f96f95d Improvements for epee binary to hex functions:
- Performance improvements
  - Added `span` for zero-copy pointer+length arguments
  - Added `std::ostream` overload for direct writing to output buffers
  - Removal of unused `string_tools::buff_to_hex`
2017-04-11 16:35:00 -04:00
Randi Joseph 933e08f2f3 Replace deprecated tmpnam function. 2017-03-29 22:32:00 -04:00
moneromooo-monero 6e6794786a
mnemonics: sanity checks for word lists
and a test to go with it

Remember to run the test when changing word lists, or simplewallet
will throw uncaught if that word list is used.
2017-03-25 12:14:01 +00:00
moneromooo-monero f065234b71
core: cache tx and block hashes in the respective classes
An idea from smooth
2017-03-23 09:25:17 +00:00
Lee Clagett 50cd179a60 Removed boost/asio.hpp include from epee/string_tools.h 2017-03-18 22:05:14 -04:00
moneromooo-monero 3396a9f2af
Add intervening v5 fork for increased min block size
Minimum mixin 4 and enforced ringct is moved from v5 to v6.
v5 is now used for an increased minimum block size (from 60000
to 300000) to cater for larger typical/minimum transaction size.

The fee algorithm is also changed to decrease the base per kB
fee, and add a cheap tier for those transactions which we do
not care if they get delayed (or even included in a block).
2017-03-15 08:32:51 +00:00
kenshi84 7d07c64fe5
fix dependency: put HardFork back to cryptonote_basic, made some BlockchainDB functions virtual again to avoid missing symbols error 2017-03-10 11:22:39 +09:00
moneromooo-monero f75477819c
unit_tests: fix fee tests after quantization change 2017-03-04 22:45:49 +00:00
moneromooo-monero 12adb4a3f3
core: move hardfork back to cryptonote_core
should fix a cross dependency betewen cryptonote_basic and
blockchain_db
2017-02-25 16:41:35 +00:00
Riccardo Spagni 700d218c5d
fix broken test data 2017-02-22 23:12:21 +02:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
Riccardo Spagni ecbd3f0798
Merge pull request #1758
5664826a unit_tests: hardfork unit test now needs get_block_blob_from_height (moneromooo-monero)
2017-02-21 17:22:01 +02:00
moneromooo-monero 5664826a84
unit_tests: hardfork unit test now needs get_block_blob_from_height 2017-02-21 14:48:34 +00:00
Howard Chu 80749e59a8
More for PR #1724
Fix unit_tests build (get_output_key API change)
2017-02-21 13:53:13 +00:00
Riccardo Spagni 49efd3add9
Merge pull request #1727
0288310e blockchain_db: add "raw" blobdata getters for block and transaction (moneromooo-monero)
2017-02-21 11:27:15 +02:00
Riccardo Spagni 88c752b476
Merge pull request #1721
2cde2c02 switch to boost::thread for mingw build (Lee Clagett)
2017-02-21 11:26:09 +02:00
Riccardo Spagni 565c99f670
Merge pull request #1731
a427235e core: add a missing newline on a string to be logged (moneromooo-monero)
b6a2230e unit_tests: fix minor blockchain_db regression (moneromooo-monero)
c488eca5 hardfork: tone down some logs (moneromooo-monero)
2017-02-21 11:21:57 +02:00
moneromooo-monero 08c3f38031
util: add a vercmp function to compare version numbers
It is simple, supports simple x.y.z type numeric versions,
and does not attempt any kind of validation
2017-02-20 22:58:04 +00:00
Lee Clagett 2cde2c02ca switch to boost::thread for mingw build 2017-02-16 20:10:23 -05:00
moneromooo-monero b6a2230e6f
unit_tests: fix minor blockchain_db regression
Due to the change in ordering for adding block and tx data
to the database in f2986ccfc1,
adding a block twice now throws TX_EXISTS, not BLOCK_EXISTS.
2017-02-14 18:56:42 +00:00
moneromooo-monero 0288310e3b
blockchain_db: add "raw" blobdata getters for block and transaction
This speeds up operations such as serving blocks to syncing peers
2017-02-13 21:11:37 +00:00