Commit Graph

289 Commits

Author SHA1 Message Date
moneromooo-monero a110e6aa18
multiexp: tune which variants to use for which number of points 2018-10-22 16:07:44 +00:00
moneromooo-monero 8b4767221c
bulletproofs: speedup prover 2018-10-22 16:07:44 +00:00
moneromooo-monero 6f9ae5b6eb
multiexp: handle pippenger multiexps with part precalc 2018-10-22 16:07:44 +00:00
moneromooo-monero 10e5a92769
bulletproofs: maintain -z4, -z5, and -y0 to avoid subtractions 2018-10-22 16:07:44 +00:00
moneromooo-monero 8629a42cf6
bulletproofs: rework flow to use sarang's fast batch inversion code 2018-10-22 16:07:44 +00:00
moneromooo-monero fc9f7d9c81
bulletproofs: merge multiexps as per sarang's new python code 2018-10-22 16:07:44 +00:00
moneromooo-monero 4061960a16
multiexp: pack the digits table when STRAUS_C is 4
Spotted by stoffu
2018-10-22 16:07:44 +00:00
moneromooo-monero bf8e4b9870
bulletproofs: some more minor speedup 2018-10-22 16:07:44 +00:00
moneromooo-monero a281b950bf
bulletproofs: remove single value prover
It is now expressed in terms of the array prover
2018-10-22 16:07:44 +00:00
moneromooo-monero 484155d043
bulletproofs: some more speedup 2018-10-22 16:07:44 +00:00
moneromooo-monero a621d6c8b4
bulletproofs: random minor speedups 2018-10-22 16:07:44 +00:00
moneromooo-monero a49a17618f
bulletproofs: shave off a lot of scalar muls from the g/h construction 2018-10-22 16:07:44 +00:00
moneromooo-monero 4564a5d17b
bulletproofs: speedup PROVE 2018-10-22 16:07:44 +00:00
moneromooo-monero 1dd5c73f62
bulletproofs: multiply points by 8 first thing in verification
instead of merging that with other scalar multiplications
where possible for speed, since this is not actually safe
2018-09-24 14:02:51 +00:00
Riccardo Spagni 4a652d6b52
Merge pull request #4379
607301bf rct: avoid repeated unnecessary conversions when accummulating (moneromooo-monero)
2018-09-21 20:42:41 +02:00
moneromooo-monero 607301bf6d
rct: avoid repeated unnecessary conversions when accummulating 2018-09-14 10:18:01 +00:00
stoffu 67a56a9f8b
rctTypes: fix incorrect serialization 2018-09-12 20:33:10 +09:00
moneromooo-monero 8f418a6db0
bulletproofs: #include <openssl/bn.h>
Apparently needed for openssl 1.1.x
2018-09-11 13:38:34 +00:00
moneromooo-monero 2bf636503f
bulletproofs: speed up the latest changes a bit 2018-09-11 13:38:32 +00:00
moneromooo-monero 044dff5a30
bulletproofs: scale points by 8 to ensure subgroup validity 2018-09-11 13:38:31 +00:00
moneromooo-monero c83012c476
bulletproofs: match aggregated verification to sarang's latest prototype 2018-09-11 13:38:30 +00:00
moneromooo-monero 463434d1f7
more comprehensive test for ge_p3 comparison to identity/point at infinity
Reported by QuarksLab.
2018-09-11 13:38:20 +00:00
moneromooo-monero a129bbd944
multiexp: fix maxscalar off by one
Reported by QuarksLab.
2018-09-11 13:38:17 +00:00
moneromooo-monero 7ed496cc78
ringct: error out when hashToPoint* returns the point at infinity
Reported by QuarksLab.
2018-09-11 13:38:16 +00:00
moneromooo-monero 61632dc166
ringct: prevent a potential very large allocation
Reported by QuarksLab.
2018-09-11 13:38:14 +00:00
moneromooo-monero 0825e97436
multiexp: fix wrong Bos-Coster result for 1 non trivial input
Reported by QuarksLab.
2018-09-11 13:38:10 +00:00
moneromooo-monero a1359ad43c
Check inputs to addKeys are in range
Reported by QuarksLab.
2018-09-11 13:38:09 +00:00
moneromooo-monero fe0fa3b9c5
bulletproofs: reject x, y, z, or w[i] being zero
Also try again when we're generate a proof with those characteristics

Reported by QuarksLab.
2018-09-11 13:38:08 +00:00
moneromooo-monero 5ffb2ff9b7
v8: per byte fee, pad bulletproofs, fixed 11 ring size 2018-09-11 13:38:07 +00:00
moneromooo-monero 869b3bf824
bulletproofs: a few fixes from the Kudelski review
- fix integer overflow in n_bulletproof_amounts
- check input scalars are in range
- remove use of environment variable to tweak straus performance
- do not use implementation defined signed shift for signum
2018-09-11 13:38:05 +00:00
moneromooo-monero c429176248
bulletproofs: reject points not in the main subgroup 2018-09-11 13:38:04 +00:00
moneromooo-monero 1569717718
bulletproofs: speed up a few multiplies using existing Hi cache 2018-09-11 13:38:03 +00:00
moneromooo-monero 0b05a0fa74
Add Pippenger cache and limit Straus cache size 2018-09-11 13:38:02 +00:00
moneromooo-monero 263431c486
Pippenger multiexp
Based on sarang's python code
2018-09-11 13:37:45 +00:00
moneromooo-monero 1ed0ed4de4
multiexp: cut down on memory allocations 2018-09-11 13:37:44 +00:00
moneromooo-monero 1b867e7f40
precalc the ge_p3 representation of H 2018-09-11 13:37:42 +00:00
moneromooo-monero 7e67c52fa2
Add a define for the max number of bulletproof multi-outputs 2018-09-11 13:37:38 +00:00
moneromooo-monero 2a8fcb421b
Bulletproof aggregated verification and tests
Also constrains bulletproofs to simple rct, for simplicity
2018-09-11 13:37:37 +00:00
moneromooo-monero 126196b017
multiexp: some speedups
- use a raw memory block to store cache
- use aligned memory
- use doubling API where appropriate
- calculate straus in bands
2018-09-11 13:37:35 +00:00
moneromooo-monero bacf0a1e2f
bulletproofs: add aggregated verification
Ported from sarang's java code
2018-09-11 13:37:32 +00:00
moneromooo-monero e895c3def1
make straus cached mode thread safe, and add tests for it 2018-09-11 13:37:31 +00:00
moneromooo-monero 7f48bf05d7
multiexp: bos coster now works for just one point 2018-09-11 13:37:30 +00:00
moneromooo-monero 9ce9f8caf6
bulletproofs: add multi output bulletproofs to rct 2018-09-11 13:37:28 +00:00
moneromooo-monero 939bc22332
add Straus multiexp 2018-09-11 13:37:25 +00:00
moneromooo-monero 9ff6e6a0a7
ringct: add bos coster multiexp 2018-09-11 13:37:24 +00:00
moneromooo-monero e9164bb38b
bulletproofs: misc optimizations
Use double mults where possible, avoid conversions, simplify
2018-09-11 13:37:23 +00:00
moneromooo-monero aacfd6e370
bulletproofs: multi-output bulletproofs 2018-09-11 13:37:17 +00:00
moneromooo-monero 7c8f95d3e2
ringct: make conversion functions return const refs
This might avoid unnecessary copies.

Reported by stoffu
2018-09-04 18:28:20 +00:00
luigi1111 5f1bbe3bce
Merge pull request #4268
1f2409e Do memwipe for critical secret keys copied to rct::key (stoffu)
2018-09-04 13:16:04 -05:00
moneromooo-monero d2e26c23f3
add and use constant time 32 byte equality function 2018-08-23 07:56:51 +00:00
luigi1111 a5d21be843
Merge pull request #4210
4616cf2 Fixed ZMQ-RPC for transactions and GET_BLOCKS_FAST (vtnerd)
2018-08-22 20:47:28 -05:00
stoffu 1f2409e9e2
Do memwipe for critical secret keys copied to rct::key 2018-08-16 22:26:30 +09:00
Lee Clagett 4616cf2641 Fixed ZMQ-RPC for transactions and GET_BLOCKS_FAST 2018-08-02 07:30:20 +00: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
luigi1111 94ed562148
Merge pull request #4045
7cdd147 Changed URLs to HTTPS (einsteinsfool)
2018-07-19 13:56:38 -05:00
moneromooo-monero 61caab8a8c
crypto: remove slight bias in key generation due to modulo 2018-07-05 09:18:01 +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
einsteinsfool 7cdd147da5 Changed URLs to HTTPS 2018-06-23 21:15:29 +02:00
moneromooo-monero 01cc978722
ringct: remove an unnecessary scalarmultBase in zeroCommit 2018-06-06 10:14:36 +01:00
moneromooo-monero 5f19384729
ringct: do not show verification errors with default settings 2018-05-04 08:27:55 +01:00
Riccardo Spagni cb72b85bbf
Merge pull request #3372
c3e23b2d ringct: 17% improvement in Borromean signature verification (moneromooo-monero)
2018-03-14 16:06:16 +02: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
moneromooo-monero c3e23b2dce
ringct: 17% improvement in Borromean signature verification 2018-03-08 00:41:54 +00:00
Riccardo Spagni 98acbe83fc
Merge pull request #3348
c95dddd2 remove unused function keyImageV (h908714124)
2018-03-05 19:13:52 +02:00
Riccardo Spagni 5950d356b6
Merge pull request #3301
34a2a085 rctSigs - loop invariant code removed from the loop (Dusan Klinec)
2018-03-05 19:11:35 +02:00
h908714124 c95dddd2d2 remove unused function keyImageV 2018-03-05 09:21:44 +01: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
Dusan Klinec 34a2a08530 rctSigs - loop invariant code removed from the loop 2018-02-21 16:35:06 +01: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 589a53f479
Merge pull request #2959
3f1a3fac bulletproofs: more robust challenge computation (moneromooo-monero)
2018-02-14 12:08:52 +01:00
moneromooo-monero 9af6b2d1b8
ringct: fix infinite loop in unused h2b function
Coverity 146775
2018-02-02 16:44:28 +00:00
moneromooo-monero 3f1a3fac00
bulletproofs: more robust challenge computation
Changes from sarang, from a recommendation by an anonymous reviewer
2018-01-31 15:57:01 +00:00
moneromooo-monero b809058993
ringct: pseudoOuts moved to prunable in the simple bulletproof case
Saves 64 bytes non prunable data per typical tx

This breaks v7 consensus, will require a testnet reorg from v6
2018-01-31 15:56:26 +00:00
xmr-eric 84a7f6a482 Readd copyright starting date 2018-01-26 10:03:20 -05:00
xmr-eric 18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
moneromooo-monero ff5626d785
ringct: handle exceptions verifying bulletproofs in worker threads 2018-01-15 11:48:23 +00:00
Riccardo Spagni f9c66ba67c
Merge pull request #2990
2d17feb0 factor STL container serialization (moneromooo-monero)
2018-01-10 11:53:05 +01:00
moneromooo-monero 2d17feb060
factor STL container serialization 2017-12-22 19:47:12 +00:00
moneromooo-monero b49ddc766d
check accessing an element past the end of a container 2017-12-18 15:15:49 +00:00
moneromooo-monero f4eda44ce3
N-1/N multisig 2017-12-17 16:12:12 +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
moneromooo-monero 09ce03d612
move includes around to lessen overall load 2017-12-16 22:46:38 +00:00
moneromooo-monero 46eaaae79b
ringct: always use outPk.mask to decode amounts 2017-12-09 18:02:55 +00:00
moneromooo-monero 8d4469a0ac
ringct: do not include bulletproof commitments in signed message
Those are not serialized, but are restored from the outPk masks,
so depending on what tries to validate the tx, those commitments
may or may not be filled with valid data at the time. The outPk
masks are already hashed as part of the rctSigBase field.
2017-12-09 15:30:15 +00:00
moneromooo-monero c83d0b3ee2
add bulletproofs from v7 on testnet 2017-12-08 13:50:45 +00:00
moneromooo-monero 8620ef0a0d
bulletproofs: switch H/G in Pedersen commitments to match rct
Changes from sarang
2017-12-08 13:48:18 +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 ada4291469
add a version of ge_double_scalarmult_precomp_vartime with A precomp 2017-12-07 19:23:10 +00:00
moneromooo-monero d43eef6def
ringct: add a version of addKeys which returns the result 2017-12-07 19:23:08 +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
kenshi84 53ad5a0f42
Subaddresses 2017-10-07 13:06:21 +09:00
Howard Chu 510d0d4753
Use a threadpool
Instead of constantly creating and destroying threads
2017-09-14 21:42:48 +01:00
Gentian 4b932ff314 changed crypto to cncrypto so it generated libcncrypto
fix a cmakelist
2017-05-23 07:45:40 -04: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
moneromooo-monero 00cbf72064
ringct: move ge_frombytes_vartime failure error to warning
Avoids scaring people when seeing some invalid txes
2017-03-22 21:26:38 +00:00
moneromooo-monero da18898f0e
ringct: do not require range proof in decodeRct/decodeRctSimple
These fields aren't used, and they'll actually be pruned in
some cases
2017-02-27 22:28:45 +00:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
moneromooo-monero d282cfcc46
core: test key images against validity domain 2017-02-20 22:58:25 +00:00
kenshi84 8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Timothy D. Prime 6b145763f7 Fix clang build failure, caused by mixing C and C++
Easily fixed by moving a C++ header out of 'extern "C" {...}'.

When building with CC=clang CXX=clang++ make,
[ 21%] Building CXX object src/ringct/CMakeFiles/obj_ringct.dir/rctTypes.cpp.o
In file included from /home/tdprime/bitmonero/src/ringct/rctTypes.cpp:31:
In file included from /home/tdprime/bitmonero/src/ringct/rctTypes.h:43:
In file included from /home/tdprime/bitmonero/src/crypto/generic-ops.h:34:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/cstring💯3: error: conflicting types for 'memchr'
  memchr(void* __s, int __c, size_t __n)
    ^
	/usr/include/string.h:92:14: note: previous declaration is here
	extern void *memchr (const void *__s, int __c, size_t __n)
	             ^
... and 4 more similar errors
2017-01-26 17:30:00 -08:00
moneromooo-monero 6cc7d26140
ringct: reorder a bit to check quicker tests first 2017-01-21 20:29:22 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
Riccardo Spagni ec323d8c3f
Merge pull request #1561
d561f4ad enable clang checks that were disabled (Chris Vickio)
0aefb2f6 remove std::move from return statements (pessimizing-move warning) (Chris Vickio)
629d5b76 change counter from bool to int (deprecated-increment-bool warning) (Chris Vickio)
fb76d439 add extra braces around subobjects (missing-braces warning) (Chris Vickio)
3b6d5f25 make struct/class declarations consistent (mismatched-tags warning) (Chris Vickio)
fcf66925 remove unused fields from network_throttle (unused-private-field warning) (Chris Vickio)
296f8c16 inline unused function (for unused-function warning) (Chris Vickio)
2017-01-15 19:01:08 -05:00
moneromooo-monero ba3968f6ce
rct: split rct checks between semantics and other
Semantics can be checked early
2017-01-14 21:17:32 +00:00
Chris Vickio fb76d43980 add extra braces around subobjects (missing-braces warning) 2017-01-14 15:06:07 +03:00
Lee Clagett e3639f5cc3 Removed unused functions 2016-12-19 14:47:26 -05:00
moneroexamples 374b58d131 fix MGs json 2016-12-14 09:27:37 +08:00
luigi1111 9d906159c3
Tx verification failing is not an error
And rangeProofs are on outputs...
2016-12-12 17:01:20 -06:00
Riccardo Spagni e6b05ed95a
Merge pull request #1414
3b005275 ringct: add sc_check calls in MLSAG_Ver for ss and cc (moneromooo-monero)
2f1732a7 ringct: guard against bad data exceptions in worker threads (moneromooo-monero)
2016-12-08 23:44:09 +02:00
moneromooo-monero 3b00527500
ringct: add sc_check calls in MLSAG_Ver for ss and cc
luigi1111's recommendation
2016-12-07 22:41:21 +00:00
moneromooo-monero 2f1732a7e5
ringct: guard against bad data exceptions in worker threads
If purported pubkeys aren't actually valid pubkeys, exceptions
will fly. These will terminate if thrown in a worker thread.
Guard against this.
2016-12-07 22:09:43 +00:00
luigi1111 46a0dcc1d2
ringct: luigi1111's changes to fix and speedup Borromean sigs 2016-12-04 21:54:16 +00:00
Shen Noether 76958fc75a
ringct: switch to Borromean signatures 2016-12-04 21:54:11 +00:00
moneromooo-monero 59443bf9df
ringct: fix MGs serialization to JSON 2016-12-02 13:16:19 +00:00
Lee Clagett f025198f19 Added task_region - a fork/join task implementation 2016-11-23 14:41:25 -05:00
Lee Clagett 64094e5f4e adding thread_group for managing async tasks 2016-11-02 19:21:55 -04:00
Riccardo Spagni d51f1af75f
Merge pull request #1272
48b57d8 monero.supp: valgrind suppressions file (moneromooo-monero)
ffd8c41 ringct: check the size of amount_keys is the same as destinations (moneromooo-monero)
836669d ringct: always shutdown the boost io service (moneromooo-monero)
2016-11-01 21:49:30 +02:00
moneromooo-monero ffd8c41f36
ringct: check the size of amount_keys is the same as destinations 2016-10-29 13:33:48 +01:00
moneromooo-monero 836669d276
ringct: always shutdown the boost io service
Even if no worker threads were started, it needs shutting down
or it will cause an invalid access in the io service thread
2016-10-29 13:31:53 +01:00
moneromooo-monero 59f0d4b574
ringct: some more small optimizations 2016-10-23 16:10:17 +01:00
moneromooo-monero 3429bfb71d
ringct: thread verRct and verRctSimple 2016-10-15 13:32:13 +01:00
moneromooo-monero e06a4daf33
ringct: remove unneeded type conversions 2016-10-15 11:58:39 +01:00
moneromooo-monero afc70df7ea
ringct: reserve space in vectors to avoid excessive reallocation 2016-10-15 11:58:34 +01:00
moneromooo-monero 9ebf7b6dcf
ringct: avoid unnecessary memcpy 2016-10-15 11:58:29 +01:00
moneromooo-monero 1fe75c1ea7
ringct: add a few consts where possible 2016-10-15 11:58:24 +01:00
moneromooo-monero ab002a1d97
ringct: pass vectors by const ref where possible 2016-10-15 11:58:18 +01:00
moneromooo-monero 4038e86527
Add performance timers for ringct tx verification 2016-10-10 21:24:21 +01:00
moneromooo-monero 3126ba7425
ringct: use const refs as parameters where appropriate 2016-10-08 22:16:23 +01:00
Randi Joseph 9e54616924 Dropped "bit" from bitmonero. 2016-09-26 17:22:30 -04:00
redfish e1c7af35d4 cmake: transitive deps and remove deprecated LINK_*
Keep the immediate direct deps at the library that depends on them,
declare deps as PUBLIC so that targets that link against that library
get the library's deps as transitive deps.

Break dep cycle between blockchain_db <-> crytonote_core.
No code refactoring, just hide cycle from cmake so that
it doesn't complain (cycles are allowed only between
static libs, not shared libs).

This is in preparation for supproting BUILD_SHARED_LIBS cmake
built-in option for building internal libs as shared.
2016-09-18 02:56:26 -04:00
moneromooo-monero 7d413f635f
rct: rework serialization to avoid storing vector sizes 2016-09-14 20:23:06 +01:00
moneromooo-monero f24ab58d18
ringct: remove unused code 2016-08-28 21:30:53 +01:00
moneromooo-monero b38452bd55
ringct: pass structure by const ref, not value 2016-08-28 21:30:51 +01:00
moneromooo-monero fd11271eea
ringct: use memcpy/memset instead of handwritten loop where appropriate 2016-08-28 21:30:49 +01:00
moneromooo-monero 5d38206fcc
ringct: remove spurious copies 2016-08-28 21:30:47 +01:00
moneromooo-monero 16732a85d7
rct: faster Cryptonote/rct conversions 2016-08-28 21:30:45 +01:00
moneromooo-monero 94fd881f74
rct: early out on failure on verRange 2016-08-28 21:30:38 +01:00
moneromooo-monero 074e602609
ringct: use Cryptonote serialization to hash non prunable data 2016-08-28 21:30:28 +01:00
moneromooo-monero c3b3260ae5
New "Halfway RingCT" outputs for coinbase transactions
When RingCT is enabled, outputs from coinbase transactions
are created as a single output, and stored as RingCT output,
with a fake mask. Their amount is not hidden on the blockchain
itself, but they are then able to be used as fake inputs in
a RingCT ring. Since the output amounts are hidden, their
"dustiness" is not an obstacle anymore to mixing, and this
makes the coinbase transactions a lot smaller, as well as
helping the TXO set to grow more slowly.

Also add a new "Null" type of rct signature, which decreases
the size required when no signatures are to be stored, as
in a coinbase tx.
2016-08-28 21:30:26 +01:00
moneromooo-monero 6f526cdff8
rct: log why verification fails
and remove some unnecessary variables in the checking code
2016-08-28 21:30:23 +01:00
moneromooo-monero d4b8991e44
rct: serialize txnFee as varint 2016-08-28 21:30:21 +01:00
moneromooo-monero d4b62a1e29
rct amount key modified as per luigi1111's recommendations
This allows the key to be not the same for two outputs sent to
the same address (eg, if you pay yourself, and also get change
back). Also remove the key amounts lists and return parameters
since we don't actually generate random ones, so we don't need
to save them as we can recalculate them when needed if we have
the correct keys.
2016-08-28 21:30:19 +01:00
moneromooo-monero 93f5c625f0
rct: rework v2 txes into prunable and non prunable data
Nothing is pruned, but this allows easier changes later.
2016-08-28 21:30:18 +01:00
moneromooo-monero d93746b6d3
rct: rework the verification preparation process
The whole rct data apart from the MLSAGs is now included in
the signed message, to avoid malleability issues.

Instead of passing the data that's not serialized as extra
parameters to the verification API, the transaction is modified
to fill all that information. This means the transaction can
not be const anymore, but it cleaner in other ways.
2016-08-28 21:30:16 +01:00
moneromooo-monero 3ab2ab3e76
rct: change the simple flag to a type
for future expansion
2016-08-28 21:30:14 +01:00
Shen Noether c5be4b0bea
rct: avoid the need for the last II element
This element is used in the generation of the MLSAG, but isn't
needed in verification.
Also misc changes in the cryptonote code to match, by mooo.
2016-08-28 21:30:12 +01:00
moneromooo-monero b337aea6cc
rct: do not serialize senderPk - it is not used anymore 2016-08-28 21:30:01 +01:00
moneromooo-monero 9b70856ccb
rct: make the amount key derivable by a third party with the tx key
Scheme design from luigi1114.
2016-08-28 21:29:46 +01:00