Commit graph

419 commits

Author SHA1 Message Date
redfish f5d03bb22d tests: block reward: disable 64-bit-only tests on 32-bit systems
Issue #1008
2016-09-04 03:36:10 -04:00
Riccardo Spagni df63e0704a
fix remaining bitmonero and simplewallet bits 2016-09-03 22:03:44 +02:00
redfish 3398515dd4 cmake: exclude tests from running
Minimize special cases in cmake script, likely to be forgotten.
2016-09-01 11:17:44 -04:00
Riccardo Spagni d3994f1df0
Merge pull request #1018
6cf8ca2 core: faster find_blockchain_supplement (moneromooo-monero)
2016-09-01 11:29:22 +02:00
moneromooo-monero 6cf8ca2a7f
core: faster find_blockchain_supplement
Since this queries block heights for blocks that may or may not
exist, queries for non existing blocks would throw an exception,
and that would slow down the loop a lot. 7 seconds to go through
a 30 hash list.

Fix this by adding an optional return block height to block_exists
and using this instead. Actual errors will still throw an
exception.

This also cuts down on log exception spam.
2016-08-31 10:03:32 +01:00
redfish 640a934d5f tests: cmake: fix building with system gtest
Issues #980 #983
2016-08-30 23:04:53 -04:00
redfish 4a9e94944c tests: cmake: use a list for enabled tests
Avoid replicating common logic.
2016-08-30 22:56:14 -04:00
redfish dbd9a2606c cmake: tests: gtest target is not always defined #983 2016-08-30 22:55:53 -04:00
Jacob Torrey 57bc33b4d3 Prevent core_tests from building under Travis 2016-08-29 06:14:27 -06:00
Riccardo Spagni e9d4d224e3
Merge pull request #992
f1ba51c remove -Wall from coverage arguments (Jacob Torrey)
f017fec Build the core_tests under Travis (Jacob Torrey)
e0bf02a Streamline release-test target (Jacob Torrey)
baf4574 Update badge to point to monero's coveralls (Jacob Torrey)
d1dc2c3 Re-enable Travis IRC notifications (Jacob Torrey)
9c71b9e Silence coveralls to prevent 4MB logs (Jacob Torrey)
65041fb Disabled libwallet_api_test until Issue #895 resolved (Jacob Torrey)
a450138 Disable core_tests on Travis-CI (Jacob Torrey)
650afac Added -j2 to Makefile and clean up matrix (Jacob Torrey)
256dec0 Streamline test building target (Jacob Torrey)
14915c2 Ensure tests are built prior to testing (Jacob Torrey)
fe4992b Added coverage g++ commands (Jacob Torrey)
497b24f Update .travis.yml (Jacob Torrey)
678467d Update for the current make environment (Jacob Torrey)
abcac26 Fixed tab/space issue on YAML (Jacob Torrey)
7351a11 Converted to a build matrix for testing and release (Jacob Torrey)
342dbfb Prep for coveralls (Jacob Torrey)
2016-08-28 22:44:37 +02:00
moneromooo-monero f782d45827
tests: hard fork list must end with a 0 2016-08-28 21:30:29 +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 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 a47ceee83b
wallet: do not store signatures in the wallet cache
Saves some substantial space.
Also avoid calculating tx hashes we don't need.
2016-08-28 21:30:10 +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 e5a9a4755b
core_tests: fix a couple pre-rct tests using rct 2016-08-28 21:29:58 +01:00
moneromooo-monero 37bdf6ebe3
change fork settings to allow pre-rct txes for one more fork cycle 2016-08-28 21:29:50 +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
moneromooo-monero cf33e1a52a
rct: do not serialize public keys in outPk
They can be reconstructed from vout
2016-08-28 21:29:43 +01:00
moneromooo-monero ce5de8b430
tests: add tests for wallet output selection 2016-08-28 21:29:34 +01:00
moneromooo-monero e81a2b2cfa
port get_tx_key/check_tx_key to rct 2016-08-28 21:29:24 +01:00
moneromooo-monero e06faefde4
tests: add basic tests for simple rct api 2016-08-28 21:29:22 +01:00
moneromooo-monero a4d4d6194b
integrate simple rct api 2016-08-28 21:29:20 +01:00
moneromooo-monero 59a66e209a
move the rct commitments to the output_amounts database
Since these are needed at the same time as the output pubkeys,
this is a whole lot faster, and takes less space. Only outputs
of 0 amount store the commitment. When reading other outputs,
a fake commitment is regenerated on the fly. This avoids having
to rewrite the database to add space for fake commitments for
existing outputs.

This code relies on two things:

- LMDB must support fixed size records per key, rather than
per database (ie, all records on key 0 are the same size, all
records for non 0 keys are same size, but records from key 0
and non 0 keys do have different sizes).

- the commitment must be directly after the rest of the data
in outkey and output_data_t.
2016-08-28 21:29:02 +01:00
moneromooo-monero 6d0e47148b
rct: add the tx prefix hash into the MLSAG
to protect the non-signatures parts of the tx from tampering.
2016-08-28 21:28:58 +01:00
moneromooo-monero 20e50ec7f7
ringct: do not serialize what can be reconstructed
The mixRing (output keys and commitments) and II fields (key images)
can be reconstructed from vin data.
This saves some modest amount of space in the tx.
2016-08-28 21:28:55 +01:00
moneromooo-monero 106e3dc3d4
Add rct core tests 2016-08-28 21:28:53 +01:00
moneromooo-monero 161551e13b
tests: test for ringct rctSig data sizes
ie, more data or less data than expected in various fields
2016-08-28 21:28:42 +01:00
moneromooo-monero dc4aad7eb5
add rct to the protocol
It is not yet constrained to a fork, so don't use on the real network
or you'll be orphaned or rejected.
2016-08-28 21:28:37 +01:00
moneromooo-monero cc7f449d57
make rct tx serialization work
It may be suboptimal, but it's a pain to have to rebuild everything
when some of this changes.
Also, no clue why there seems to be two different code paths for
serializing a tx...
2016-08-28 21:28:31 +01:00
moneromooo-monero 54f7429cf6
ringct: allow no outputs, and add tests for this and fees 2016-08-28 21:28:27 +01:00
Shen Noether f8c04ad94f
ringct: txn fee stuff 2016-08-28 21:28:23 +01:00
moneromooo-monero eb56d0f994
blockchain_db: add functions for adding/removing/getting rct commitments 2016-08-28 21:28:11 +01:00
Shen Noether 53cdf4df5e
tests: new ringct test for checking H2 values
Ported from Shen's RingCT repo
2016-08-28 21:28:01 +01:00
moneromooo-monero 720ac85553
tests: zero inputs/outputs are in fact supposed to be accepted 2016-08-28 21:27:52 +01:00
moneromooo-monero 84948eabae
ringct: add a test for prooveRange being non deterministic 2016-08-28 21:27:50 +01:00
moneromooo-monero 700248f59e
tests: more ringct range proof tests 2016-08-28 21:27:43 +01:00
moneromooo-monero 9e82b694da
remove original Cryptonote blockchain_storage blockchain format 2016-08-28 21:27:32 +01:00
moneromooo-monero 57779abe27
tests: add some more ringct building block tests 2016-08-28 21:27:26 +01:00
moneromooo-monero 2d6303fb2c
tests: add Shen Noether's basic ringct tests 2016-08-28 21:27:19 +01:00
Jacob Torrey f017fecde9 Build the core_tests under Travis 2016-08-27 06:22:57 -06:00
Jacob Torrey 65041fbbf8 Disabled libwallet_api_test until Issue #895 resolved
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey a4501384bf Disable core_tests on Travis-CI
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Ilya Kitaev 99dd57258f libwallet_api: tests: checking for result while opening wallet 2016-08-23 14:13:30 +03:00
Ilya Kitaev bcf7b67cd6 libwallet_api: Wallet::amountFromString fixed 2016-08-23 13:47:21 +03:00
Ilya Kitaev cbe534db1a libwallet_api: tests: removed logged passwords 2016-08-22 23:14:58 +03:00
Ilya Kitaev b1a5a937ff libwallet_api: do not store wallet on close if status is not ok 2016-08-22 22:47:59 +03:00
moneromooo-monero 11dc091464
Fake outs set is now decided by the wallet
This plugs a privacy leak from the wallet to the daemon,
as the daemon could previously see what input is included
as a transaction input, which the daemon hadn't previously
supplied. Now, the wallet requests a particular set of
outputs, including the real one.

This can result in transactions that can't be accepted if
the wallet happens to select too many outputs with non standard
unlock times. The daemon could know this and select another
output, but the wallet is blind to it. It's currently very
unlikely since I don't think anything uses non default
unlock times. The wallet requests more outputs than necessary
so it can use spares if any of the returns outputs are still
locked. If there are not enough spares to reach the desired
mixin, the transaction will fail.
2016-08-11 14:35:27 +01:00
moneromooo-monero 46188734f6
tests: fix a bitflag test typo 2016-07-26 22:40:46 +01:00
moneromooo-monero 89e68d778d
unit_tests: check adding checkpoints succeeded 2016-07-26 22:40:38 +01:00
Riccardo Spagni b582764bd6
Merge pull request #915
d7597c5 refreshing wallet even if error happened (Ilya Kitaev)
6d32a3d wallet_api: async init, Wallet::connected status, log level (Ilya Kitaev)
193d251 libwallet_api cmake: conditionally creating libwallet_merged2 only for STATIC build (Ilya Kitaev)
10c06dd wallet_api: segfault on refresh fixed (Ilya Kitaev)
9d2cb4f WalletListener functionality (Ilya Kitaev)
d27b883 hack to successfull linking for MSYS2 (Ilya Kitaev)
083380c Transaction fee multiplier aka priority integraged (Ilya Kitaev)
00ed12b Wallet::paymentIdValid (Ilya Kitaev)
2016-07-23 09:17:21 +02:00
anonimal 61ed40a618
Tests: fix signed/unsigned comparison in hash-target
* References #886
2016-07-22 22:05:35 +00:00
Ilya Kitaev 6d32a3d16b wallet_api: async init, Wallet::connected status, log level 2016-07-18 23:03:09 +03:00
Ilya Kitaev 9d2cb4f36c WalletListener functionality 2016-07-18 23:02:47 +03:00
Ilya Kitaev 083380cb8f Transaction fee multiplier aka priority integraged 2016-07-18 23:02:18 +03:00
moneromooo-monero d7b681cd65
remove hf_starting_height db
It's not really needed, it used to be an optimization for when
that code was not using the db and needed to recalculate things
fast on startup.
2016-07-13 21:38:34 +01:00
Ilya Kitaev ab61ba0c9b Merge branch 'master' of https://github.com/mbg033/bitmonero 2016-06-23 16:23:09 +03:00
Ilya Kitaev ca61153003 Wallet: payment id and integrated address 2016-06-23 16:01:41 +03:00
Ilya Kitaev 2efec04f74 Wallet::createTransaction: added mixin_count param 2016-06-23 16:01:41 +03:00
Ilya Kitaev 85a632244e double/string to monero integer convertion methods 2016-06-23 16:01:41 +03:00
Ilya Kitaev e7d8f2a085 wallet::default_mixin exposed to public interface as
Wallet::setDefaultMixin, Wallet::defaultMixin;
wallet::create_transaction_2 used in Wallet::createTransaction
2016-06-23 16:01:41 +03:00
Ilya Kitaev a5374897f8 Wallet::filename, Wallet::keysFilename, tests for move wallet 2016-06-23 16:01:41 +03:00
Ilya Kitaev 8390bfa770 Wallet API : WalletManager::findWallets() added 2016-06-23 16:01:41 +03:00
Ilya Kitaev 44cc0ef147 scripts for faster test wallets generation 2016-06-23 16:01:41 +03:00
Ilya Kitaev 2060bfe5ad regenerated test wallets, basic functions got broken 2016-06-23 16:01:41 +03:00
Ilya Kitaev 91eeeb8989 WalletListener::moneyReceived test 2016-06-23 16:01:33 +03:00
Ilya Kitaev 64348a2d11 WalletListener::moneySpent test 2016-06-23 16:01:33 +03:00
Ilya Kitaev e6fdd5dd10 TransactionHistory continued 2016-06-23 16:01:26 +03:00
Ilya Kitaev d500272fa8 Wallet API : transaction history in progress 2016-06-23 15:50:33 +03:00
Ilya Kitaev 951f3b5d83 Wallet::createTransaction API introduced
Transaction API continued

TODOs for Transaction/Transfer interface
2016-06-23 15:49:54 +03:00
Ilya Kitaev 7c51227f88 Wallet::transfer in progress 2016-06-23 15:49:36 +03:00
Ilya Kitaev e04c67ac4c Wallet::refresh + tests 2016-06-23 15:49:36 +03:00
Ilya Kitaev caf0e02787 testnet option, Wallet::balance(), Wallet::unlockedBalance() 2016-06-23 15:49:22 +03:00
Ilya Kitaev 8df820b301 - testnet option added to api; 2016-06-23 15:49:07 +03:00
Ilya Kitaev 94eaeb50b2 wallet2::store() implemented within wallet2::store_to 2016-06-23 15:40:48 +03:00
Ilya Kitaev f1c4a376af Wallet::createTransaction: added mixin_count param 2016-06-20 22:56:30 +03:00
Ilya Kitaev 3318addafa double/string to monero integer convertion methods 2016-06-16 16:42:33 +03:00
Ilya Kitaev 3ac20a46b3 wallet::default_mixin exposed to public interface as
Wallet::setDefaultMixin, Wallet::defaultMixin;
wallet::create_transaction_2 used in Wallet::createTransaction
2016-06-10 13:52:10 +03:00
Ilya Kitaev c554055ce4 Wallet::filename, Wallet::keysFilename, tests for move wallet 2016-06-10 12:51:09 +03:00
Ilya Kitaev 2facbe77e4 Wallet API : WalletManager::findWallets() added 2016-06-03 14:52:58 +03:00
Ilya Kitaev ec949c383c scripts for faster test wallets generation 2016-06-01 17:06:10 +03:00
Ilya Kitaev 7f3d28fe1b regenerated test wallets, basic functions got broken 2016-05-27 13:35:00 +03:00
Ilya Kitaev bc4584c1ff Merge remote-tracking branch 'upstream/master' 2016-05-27 11:33:08 +03:00
moneroexample de030d99a5 fix: error: -Werror=misleading-indentation
Compilation of bitmonero on Arch with gcc 6.1 results in the following
error:

/home/mwo/bitmonero/tests/unit_tests/hardfork.cpp: In member function ‘virtual void TestDB::set_hard_fork_version(uint64_t, uint8_t)’:
/home/mwo/bitmonero/tests/unit_tests/hardfork.cpp:132:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
     if (versions.size() <= height) versions.resize(height+1); versions[height] = version;

This can be fixed by simply unfolding this line into three lines.
2016-05-18 10:54:41 -04:00
Riccardo Spagni e54e4d96a4
Merge pull request #831
9ef8c7b tests: fix tests broken by the removal of the block reward accumulation loop (moneromooo-monero)
a6e717e cn_deserialize: deserialize tx_extra too (moneromooo-monero)
3eff37f unit_tests: add a write_varint/read_varint test (moneromooo-monero)
7a66387 unit_tests: fix UNBOUND_LIBRARIES/UNBOUND_LIBRARY typo (moneromooo-monero)
d6bce4b core: move tx_extra parsing errors to log level 1 (moneromooo-monero)
2016-05-17 19:07:28 +02:00
Ilya Kitaev 9ae4e871a3 WalletListener::moneyReceived test 2016-05-17 12:16:11 +03:00
Ilya Kitaev 40087a745f WalletListener::moneySpent test 2016-05-16 13:11:44 +03:00
Ilya Kitaev 2d799097ca Merge remote-tracking branch 'upstream/master' 2016-05-12 15:14:30 +03:00
moneromooo-monero 9ef8c7b694
tests: fix tests broken by the removal of the block reward accumulation loop
The tests for rejection of unmixable outputs in v2 are commented out,
as there are no unmixable outputs created anymore. This should be
restored at some point.
2016-05-01 20:59:41 +01:00
moneromooo-monero 3eff37f931
unit_tests: add a write_varint/read_varint test 2016-05-01 11:42:31 +01:00
moneromooo-monero 7a663873ce
unit_tests: fix UNBOUND_LIBRARIES/UNBOUND_LIBRARY typo 2016-05-01 11:35:14 +01:00
Riccardo Spagni 30dce45643 Merge branch 'performance' of https://github.com/LMDB/bitmonero 2016-04-29 21:41:43 +02:00
Ilya Kitaev 93119344ec TransactionHistory continued 2016-04-29 16:26:14 +03:00
Ilya Kitaev dce5374660 Merge remote-tracking branch 'upstream/master' into develop 2016-04-26 11:08:40 +03:00
Ilya Kitaev 53a97bdcd3 Wallet API: transaction history in progress 2016-04-22 13:33:09 +03:00
Ilya Kitaev 02c9df5de2 Wallet API : transaction history in progress 2016-04-22 13:21:08 +03:00
moneromooo-monero 672162d9e2
tests: fix compile failure on wallet2::transfer 2016-04-17 11:21:01 +01:00
Riccardo Spagni b52148201b
Merge pull request #786
5092e45 tests: unbound API is only accessible in static builds (moneromooo-monero)
2016-04-14 16:26:29 +09:00
Riccardo Spagni 6bfb8799c3
Merge pull request #783
48d0747 wallet: better output selection for transfer/transfer_new (moneromooo-monero)
2016-04-14 16:25:38 +09:00
Ilya Kitaev 1774d9574b TODOs for Transaction/Transfer interface 2016-04-12 22:30:20 +03:00
Ilya Kitaev d97e9ef8a5 Transaction API continued 2016-04-06 13:56:57 +03:00
Howard Chu d7ea7d9a23 Merge branch 'performance' into master 2016-04-05 21:13:16 +01:00
Howard Chu 372acee723 Cleanup
drop obsolete remove_output()
fix get_output_key(global), fix crash in blockchain_dump
2016-04-05 21:05:24 +01:00
Ilya Kitaev 079fbd3d42 Wallet::createTransaction API introduced 2016-04-05 15:24:44 +03:00
Ilya Kitaev ee5bb17f26 Wallet::transfer() continued 2016-04-04 14:56:17 +03:00
Javier Smooth 17cac41968
tests: fix build with older GCC 2016-04-02 22:05:56 +01:00
moneromooo-monero 5092e45e3f
tests: unbound API is only accessible in static builds 2016-04-02 16:02:18 +01:00
moneromooo-monero 48d0747d00
wallet: better output selection for transfer/transfer_new
This now requests the set of outputs that can be mixed first,
to avoid trying non dust but unmixable outputs, which we know
will fail.
2016-04-02 14:17:02 +01:00
Ilya Kitaev 830c19c934 Wallet::refresh + tests 2016-03-31 16:38:57 +03:00
Ilya Kitaev 2157a9ac48 testnet option, Wallet::balance(), Wallet::unlockedBalance() 2016-03-31 12:48:41 +03:00
Ilya Kitaev df6026182a Merge remote-tracking branch 'upstream/master' 2016-03-31 12:01:19 +03:00
moneromooo-monero 34957fcbb9
tests: add test for needed OpenSSL algorithms in unbound
These can be compiled out of libunbound, leading to failure
to check DNSSEC validity.
2016-03-29 17:56:42 +01:00
moneromooo-monero d5d46e6d6d
tests: obligatory hardfork unit build fix after interface change 2016-03-26 23:44:04 +00:00
moneromooo-monero 600a3cf0c0
New RPC and daemon command to get output histogram
This is a list of existing output amounts along with the number
of outputs of that amount in the blockchain.

The daemon command takes:
- no parameters: all outputs with at least 3 instances
- one parameter: all outputs with at least that many instances
- two parameters: all outputs within that many instances

The default starts at 3 to avoid massive spamming of all dust
outputs in the blockchain, and is the current minimum mixin
requirement.

An optional vector of amounts may be passed, to request
histogram only for those outputs.
2016-03-26 21:10:43 +00:00
Ilya Kitaev 8790904cf9 - testnet option added to api; 2016-03-25 17:06:30 +03:00
moneromooo-monero 4b425a397c
core_tests: fix compile failure with GCC 4.8.4
Reported and tested by smooth
2016-03-21 20:58:07 +00:00
Ilya Kitaev 2cce32995b wallet2::store() implemented within wallet2::store_to 2016-03-21 16:17:03 +03:00
moneromooo-monero f7301c3563
Revert "Print stack trace upon exceptions"
Ain't nobody got time for link/cmake skullduggery.

This reverts commit fff238ec94.
2016-03-21 10:12:23 +00:00
moneromooo-monero fff238ec94
Print stack trace upon exceptions
Useful for debugging users' logs
2016-03-19 21:48:36 +00:00
moneromooo-monero 498ad73729
tests: enable core tests again
They should not have been disabled in the first place
2016-03-17 22:14:08 +00:00
Ilya Kitaev 7df2baf6b0 fixed "undefined reference" for boost::system library 2016-03-16 15:33:39 +03:00
Ilya Kitaev 62606f11f5 Wallet::store_to(path, password) implemented; 2016-03-16 14:29:06 +03:00
Ilya Kitaev 19fcc74912 Wallet::address implemented 2016-03-16 14:29:06 +03:00
Ilya Kitaev 180ac6e438 WalletManager::recoveryWallet implemented 2016-03-16 14:29:06 +03:00
Ilya Kitaev 5a4f099540 Wallet::setPassword() method for wallet2_api 2016-03-16 14:29:06 +03:00
Ilya Kitaev 57d7ffc4d6 changes in wallet2_api + implemented WalletManager::openWallet 2016-03-16 14:27:57 +03:00
Ilya Kitaev f1f9279d90 get_seed() included to interface 2016-03-16 14:27:57 +03:00
Ilya Kitaev 930bed7074 tests for wallet2_api 2016-03-16 14:27:57 +03:00
warptangent dfca2ae1b5
unit_tests: fix hard fork unit test compilation
Match changed BlockchainDB function declaration.
2016-03-05 10:01:10 -08:00
Riccardo Spagni 95b3b09e11
Merge pull request #689
5ab33ca unit_tests: update test openalias address (moneromooo-monero)
2016-02-29 17:31:07 -05:00
moneromooo-monero 5ab33cabf6
unit_tests: update test openalias address
It was recently changed
2016-02-23 23:12:55 +00:00
moneromooo-monero 5e3557d2c3
move g_test_dbg_lock_sleep from a global to a function level static
This avoids the need to define that variable in every program
which uses epee.
2016-02-22 19:34:09 +00:00
Riccardo Spagni 8a6d93be25
Merge pull request #659
d56b2e5 core_tests: fix a compile problem with CLANG (moneromooo-monero)
2016-02-17 17:07:53 +02:00
moneromooo-monero d56b2e5baf
core_tests: fix a compile problem with CLANG
It doesn't like const objects from classes that do not have
a user defined ctor, apparently.

Reported by othe.
2016-02-13 19:49:36 +00:00
moneromooo-monero c7cfc764c4
Add the new test files
Forgot to add them before commit
2016-02-13 17:59:25 +00:00
moneromooo-monero 5cb03a15be
unit_tests: fix blockchain unit test after hard fork import fix 2016-02-08 20:58:43 +00:00
moneromooo-monero a333c42cde
core_tests: add tests for hard fork behaviors (MRL-0004)
We also replace the --fakechain option with an optional structure
containing details about configuration for the core/blockchain,
for test purposes. This seems more future friendly.
2016-02-08 18:52:00 +00:00
moneromooo-monero 945fe90e08
core_tests: allow setting miner tx max_outs when creating a block 2016-02-08 18:50:08 +00:00
moneromooo-monero 8e4c2e6ebe
unit_tests: fix hard fork unit test compilation 2016-02-08 18:44:27 +00:00
Riccardo Spagni cea6f6fb9c
Merge pull request #641
7658ac0 blockchain: revert handle_get_objects adding block id on tx not found (moneromooo-monero)
3a0f4d8 berkeleydb: fix delete/free mismatch (moneromooo-monero)
1642be2 minor bugfixes and refactoring (Thomas Winget)
098dcf2 unit_tests: fix mnemonics unit test testing invalid seeds (moneromooo-monero)
2016-02-08 18:31:42 +02:00
Riccardo Spagni c1378881ef
Merge pull request #639
119eb10 unit_tests: fix hard fork unit tests and add a test for major too (moneromooo-monero)
64a2aa3 hardfork: allow passing chain height in get(height) for convenience (moneromooo-monero)
2016-02-08 18:29:03 +02:00
moneromooo-monero 098dcf2885
unit_tests: fix mnemonics unit test testing invalid seeds
Some word triplets, such as "mugged names nail", are not valid
results from any 32 bit value. If used to decode a 32 bit value,
the result will therefore encode to a different word triplet.

Fix this by using random words converted from an actual random
bitstring, ensuring we always get valid triplets.
2016-02-01 20:47:03 +00:00
moneromooo-monero 119eb10d7c
unit_tests: fix hard fork unit tests and add a test for major too 2016-02-01 20:07:15 +00:00
moneromooo-monero 6827061d5f
tests: fix compilation failure after V1 define rename 2016-01-31 22:11:57 +00:00
Riccardo Spagni 3b0f67c629
updated gtest (added missing files) 2016-01-25 21:19:57 +02:00
Riccardo Spagni 4df6aa5d12
updated gtest 2016-01-25 20:10:10 +02:00
me0wmix 28f95eb001 OpenBSD support for Monero. 2016-01-21 11:18:26 -07:00
Howard Chu 4cf6e2b2c3 Fix 30f92f5630
Needed to add the corresponding (dummy) method to unit test hardfork
2016-01-16 16:10:16 +00:00
moneromooo-monero a8caab1af1
unit_tests: initialize db object in ctor, not open
open isn't actually called in those tests
2016-01-02 11:37:00 +00:00
Riccardo Spagni de03926850
updated copyright year 2015-12-31 08:39:56 +02:00
Riccardo Spagni be7a93f51f
Merge pull request #580
1813736 unit_tests: remove an unused variable (moneromooo-monero)
70dd346 unit_tests: fix hardfork test build (moneromooo-monero)
2015-12-31 08:18:27 +02:00
moneromooo-monero 1813736562
unit_tests: remove an unused variable 2015-12-30 17:30:54 +00:00
moneromooo-monero 70dd34634c
unit_tests: fix hardfork test build
The dummy blockchain class needed to have the newly added
is_read_only virtual function.
2015-12-30 17:30:01 +00:00
moneromooo-monero b245215193
core_tests: deinit core before destroying it
This fixes a use after free by ioservice threads
2015-12-30 16:05:52 +00:00
moneromooo-monero b90e14d927
tests: add a unit test for canonical decomposed amounts 2015-12-26 11:41:50 +00:00
moneromooo-monero 79beed221d
tests: fix various tests by using parameters better suited to monero
Either smaller coin values (as monero has smaller block rewards),
or pre-hard fork values (full reward zone), or post-Bytecoin values
(emission speed).
2015-12-25 22:26:34 +00:00
moneromooo-monero d0a8362b6b
tests: fix some double spending tests
Some tests assume the first output in a transaction goes to the recipient.
However, it can be the change. When it is, the recipient's keys will not
recognize this output. To fix this, we send all we have, to ensure there
is no change, and the first output goes to the recipient.

I'm not sure why this worked with Cryptonote. The tests sent 17 coins,
which seems way smaller than the first Bytecoin block reward, so there
would have been change too. Maybe outputs were not shuffled originally.
2015-12-25 22:23:36 +00:00
moneromooo-monero 2358d0d5be
tests: use 255 as a "too high" block version
While the original cryptonote accepted only the current major
version, we can accept higher ones.
2015-12-25 22:22:12 +00:00
moneromooo-monero 81cb0fcdcc
blockchain: fix bitflipping test with quantized block rewards
Block reward may now be less than the full amount allowed.
This was breaking the bitflipping test.
We now keep track of whether a block which was accepted by the core
has a lower than allowed block reward, and allow this in the test.
2015-12-25 22:07:58 +00:00
moneromooo-monero 6c868595b7
unit_tests: fix hard fork tests
A couple stopped passing when the hard fork code was made
to reject incoming hard fork versions it did not know about.
2015-12-24 16:12:03 +00:00
moneromooo-monero 8b0200adf8
unit_tests: new test for IP blocking 2015-12-24 16:05:19 +00:00
moneromooo-monero 217792351d
Tone down a bit L0 logs during daemon sync 2015-12-14 00:36:37 +00:00
moneromooo-monero cbded439f4
core_tests: fix ring_signature_1 tests
They were trying to send too much monero, and thus failing.
The parameters were set in such a way that the (simple) output
gathering code could fulfill them for 4 block rewards for the
original Bytecoin emission, but that does not work with monero
so we need to use smaller values.
2015-12-13 13:58:13 +00:00
moneromooo-monero c3d208fcbe
core_tests: bump default test fee to 0.02 monero
The current monero consensus uses 0.01 per kB fees, so use enough
for 2 kB transactions for now. It'll probably have to be either
bumped further or changed to calculate the proper fee.
2015-12-13 13:56:15 +00:00
moneromooo-monero 10da0a0b7c
add a --fakechain argument for tests
The core tests use the blockchain, and reset it to be able
to add test data to it. This does not play nice with the
databases, since those will save that data without an explicit
save call.
We add a fakechain flag that the tests will set, which tells
the core and blockchain code to use a separate database, as
well as skip a few things like checkpoints and fixup, which
only make sense for real data.
2015-12-13 11:38:37 +00:00
moneromooo-monero eee44e62bc
unit_tests: fix block reward test using post hard fork settings
This would fail, as the post hard fork settings would yield
different data, and the test expects pre hard fork data.
2015-12-13 11:18:59 +00:00
moneromooo-monero 44f1267a39
tests: fix a typo in test name 2015-12-13 11:10:33 +00:00
moneromooo-monero f141869cac
tests: remove data-dir argument registration
It is already registered in cryptonote::core::init_options,
which we now call
2015-12-09 17:31:15 +00:00
moneromooo-monero a3c5ca077c
blockchain_db: make the indexing base a BlockchainDB virtual function 2015-12-05 18:41:29 +00:00
moneromooo-monero d887c18e33
hardfork: fix more major/minor issues
Also add some more tests, and rename some instances of
"version" and "add" for clarity.

NOTE: the starting height values are sometimes wrong.
I suspect this is due to the hard fork reorg code being
buggy, since they're good when syncing after the fact.
However, they're not actually used by the consensus code,
so I'm ignoring this for now, but this needs debugging.
2015-11-24 20:47:12 +00:00
moneromooo-monero 932994c0cb
Relay transactions when they linger too long in the pool
The last relayed time of a transaction is maintained, and
transactions will be relayed again if they are still in the
pool after a certain amount of time, which increases with
the transaction's age. All such transactions are resent,
whether or not they originated on the local node.
2015-11-21 00:56:21 +00:00
Riccardo Spagni 0d09e15a1c
Merge pull request #490
baf101e More changes for 2-min blocks Use the correct block time for realtime fuzz on locktime Use the correct block time to calculate next_difficulty on alt chains (will not work as-is with voting) Lock unit tests to original block time for now (Javier Smooth)
4fea1a5 Adjust difficulty target (2 min) and full reward zone (60 kbytes) for block version 2 (Javier Smooth)
2015-11-18 10:37:27 +02:00
moneromooo-monero 036d352210
tests: fix build error with CLANG 2015-11-17 16:33:00 +00:00
Javier Smooth baf101ef4a More changes for 2-min blocks
Use the correct block time for realtime fuzz on locktime
Use the correct block time to calculate next_difficulty on alt chains (will not work as-is with voting)
Lock unit tests to original block time for now
2015-11-13 00:37:35 -08:00
Javier Smooth 4fea1a5fe7 Adjust difficulty target (2 min) and full reward zone (60 kbytes) for block version 2 2015-11-13 00:30:45 -08:00
moneromooo-monero 2f254ff599
hardfork: add a get_ideal_version(uint64_t) function
It returns the ideal version for a given height, which is
based on the minimum height for a fork, disregarding votes
2015-11-10 09:45:51 +00:00
moneromooo-monero 4187e569d8
hardfork: allow per-fork voting thresholds
And setup the first fork to not vote
2015-11-08 13:04:41 +00:00
moneromooo-monero ef4c5b5d8e
unit_tests: fix build without berkeleydb 2015-11-03 09:53:09 +00:00
moneromooo-monero 4f873bcbaa
Remove some old/obsolete/unused code
git history's here if needed to get any of this back
2015-10-27 10:01:20 +00:00
moneromooo-monero 3e89df4150
Build fixes for the old blockchain_storage version 2015-10-26 22:36:06 +00:00
moneromooo-monero 6376627530
hardfork: switch voting to block minor version
Using major version would cause older daemons to reject those
blocks as they fail to deserialize blocks with a major version
which is not 1. There is no such restriction on the minor
version, so switching allows older daemons to coexist with
newer ones till the actual fork date, when most will hopefully
have updated already.

Also, for the same reason, we consider a vote for 0 to be a
vote for 1, since older daemons set minor version to 0.
2015-10-21 19:21:14 +01:00
moneromooo-monero 55178aed8c
unit_tests: remove leftover debug traces in hardfork test 2015-10-21 19:17:44 +01:00
moneromooo-monero 0a7421b607
hardfork: rescan speedup
Add a block height before which version 1 is assumed
Use DB transactions
2015-09-27 22:46:41 +01:00
moneromooo-monero 088bc56d79
hardfork: change window semantics to not count the newly added block
This allows knowing the hard fork a block must obey in order to be
added to the blockchain. The previous semantics would use that new
block's version vote to determine this hard fork, which made it
impossible to use the rules to validate transactions entering the
tx pool (and made it impossible to validate a block before adding
it to the blockchain).
2015-09-27 22:46:25 +01:00
moneromooo-monero 5b11a89a76
hardfork: most state now saved to the DB
There will be a delay on first load of an existing blockchain
as it gets reparsed for this state data.
2015-09-20 18:42:52 +01:00
moneromooo-monero 62b1f74116
New hardfork class
This keeps track of voting via block version, in order to decide
when to enable a particular fork's code.
2015-09-12 11:14:44 +01:00
moneromooo-monero 5990344cb0
dns: make ctor private
This ensures one can't instanciate a DNSResolver object by
mistake, but uses the singleton. A separate create static
function is added for cases where a new object is explicitely
needed.
2015-08-27 21:06:09 +01:00
Rostislav 16d71a3668 Fix block_reward unit tests 2015-07-26 20:15:23 +00:00
NoodleDoodleNoodleDoodleNoodleDoodleNoo e5d2680094 ** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY)
Bockchain:
1. Optim: Multi-thread long-hash computation when encountering groups of blocks.
2. Optim: Cache verified txs and return result from cache instead of re-checking whenever possible.
3. Optim: Preload output-keys when encoutering groups of blocks. Sort by amount and global-index before bulk querying database and multi-thread when possible.
4. Optim: Disable double spend check on block verification, double spend is already detected when trying to add blocks.
5. Optim: Multi-thread signature computation whenever possible.
6. Patch: Disable locking (recursive mutex) on called functions from check_tx_inputs which causes slowdowns (only seems to happen on ubuntu/VMs??? Reason: TBD)
7. Optim: Removed looped full-tx hash computation when retrieving transactions from pool (???).
8. Optim: Cache difficulty/timestamps (735 blocks) for next-difficulty calculations so that only 2 db reads per new block is needed when a new block arrives (instead of 1470 reads).

Berkeley-DB:
1. Fix: 32-bit data errors causing wrong output global indices and failure to send blocks to peers (etc).
2. Fix: Unable to pop blocks on reorganize due to transaction errors.
3. Patch: Large number of transaction aborts when running multi-threaded bulk queries.
4. Patch: Insufficient locks error when running full sync.
5. Patch: Incorrect db stats when returning from an immediate exit from "pop block" operation.
6. Optim: Add bulk queries to get output global indices.
7. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3)
8. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key
9. Optim: Added thread-safe buffers used when multi-threading bulk queries.
10. Optim: Added support for nosync/write_nosync options for improved performance (*see --db-sync-mode option for details)
11. Mod: Added checkpoint thread and auto-remove-logs option.
12. *Now usable on 32-bit systems like RPI2.

LMDB:
1. Optim: Added custom comparison for 256-bit key tables (minor speed-up, TBD: get actual effect)
2. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3)
3. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key
4. Optim: Added support for sync/writemap options for improved performance (*see --db-sync-mode option for details)
5. Mod: Auto resize to +1GB instead of multiplier x1.5

ETC:
1. Minor optimizations for slow-hash for ARM (RPI2). Incomplete.
2. Fix: 32-bit saturation bug when computing next difficulty on large blocks.

[PENDING ISSUES]
1. Berkely db has a very slow "pop-block" operation. This is very noticeable on the RPI2 as it sometimes takes > 10 MINUTES to pop a block during reorganization.
   This does not happen very often however, most reorgs seem to take a few seconds but it possibly depends on the number of outputs present. TBD.
2. Berkeley db, possible bug "unable to allocate memory". TBD.

[NEW OPTIONS] (*Currently all enabled for testing purposes)
1. --fast-block-sync arg=[0:1] (default: 1)
	a. 0 = Compute long hash per block (may take a while depending on CPU)
	b. 1 = Skip long-hash and verify blocks based on embedded known good block hashes (faster, minimal CPU dependence)
2. --db-sync-mode arg=[[safe|fast|fastest]:[sync|async]:[nblocks_per_sync]] (default: fastest:async:1000)
	a. safe = fdatasync/fsync (or equivalent) per stored block. Very slow, but safest option to protect against power-out/crash conditions.
	b. fast/fastest = Enables asynchronous fdatasync/fsync (or equivalent). Useful for battery operated devices or STABLE systems with UPS and/or systems with battery backed write cache/solid state cache.
	Fast    - Write meta-data but defer data flush.
	Fastest - Defer meta-data and data flush.
	Sync    - Flush data after nblocks_per_sync and wait.
	Async   - Flush data after nblocks_per_sync but do not wait for the operation to finish.
3. --prep-blocks-threads arg=[n] (default: 4 or system max threads, whichever is lower)
        Max number of threads to use when computing long-hash in groups.
4. --show-time-stats arg=[0:1] (default: 1)
	Show benchmark related time stats.
5. --db-auto-remove-logs arg=[0:1] (default: 1)
	For berkeley-db only. Auto remove logs if enabled.

**Note: lmdb and berkeley-db have changes to the tables and are not compatible with official git head version.
	At the moment, you need a full resync to use this optimized version.

[PERFORMANCE COMPARISON]
**Some figures are approximations only.
Using a baseline machine of an i7-2600K+SSD+(with full pow computation):
1. The optimized lmdb/blockhain core can process blocks up to 585K for ~1.25 hours + download time, so it usually takes 2.5 hours to sync the full chain.
2. The current head with memory can process blocks up to 585K for ~4.2 hours + download time, so it usually takes 5.5 hours to sync the full chain.
3. The current head with lmdb can process blocks up to 585K for ~32 hours + download time and usually takes 36 hours to sync the full chain.

Averate procesing times (with full pow computation):
lmdb-optimized:
1. tx_ave = 2.5 ms / tx
2. block_ave = 5.87 ms / block
memory-official-repo:
1. tx_ave = 8.85 ms / tx
2. block_ave = 19.68 ms / block
lmdb-official-repo (0f4a036437)
1. tx_ave = 47.8 ms / tx
2. block_ave = 64.2 ms / block

**Note: The following data denotes processing times only (does not include p2p download time)
lmdb-optimized processing times (with full pow computation):
1. Desktop,  Quad-core / 8-threads 2600k  (8Mb) - 1.25 hours processing time (--db-sync-mode=fastest:async:1000).
2. Laptop,   Dual-core / 4-threads U4200  (3Mb) - 4.90 hours processing time (--db-sync-mode=fastest:async:1000).
3. Embedded, Quad-core / 4-threads Z3735F (2x1Mb) - 12.0 hours processing time (--db-sync-mode=fastest:async:1000).

lmdb-optimized processing times (with per-block-checkpoint)
1. Desktop,  Quad-core / 8-threads 2600k  (8Mb) - 10 minutes processing time (--db-sync-mode=fastest:async:1000).

berkeley-db optimized processing times (with full pow computation)
1. Desktop, Quad-core / 8-threads 2600k  (8Mb) - 1.8 hours processing time (--db-sync-mode=fastest:async:1000).
2. RPI2. Improved from estimated 3 months(???) into 2.5 days (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).

berkeley-db optimized processing times (with per-block-checkpoint)
1. RPI2. 12-15 hours (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).
2015-07-15 23:20:16 -07:00
Rostislav 3ade396406 Set dnssec_valid value correctly in dns_utils; fix address_from_url test 2015-06-20 20:02:13 +00:00
Riccardo Spagni e01d32e52d
cleaning up, removing redundant files, renaming, fixing incorrect licenses 2015-05-31 13:40:18 +02:00
Riccardo Spagni 6f15194049
Merge pull request #290
fee8424 Allow name@domain.tld for OpenAlias lookups (warptangent)
a0fe18f Revert "Allow name@domain.tld for OpenAlias lookups" (warptangent)
2015-05-20 14:36:38 +02:00
warptangent fee8424938
Allow name@domain.tld for OpenAlias lookups
Based on tewinget's update.
Make OpenAlias address format independent of existing DNS functions.

Add tests.

Test:

make debug-test
cd build/debug/tests/unit_tests
# test that regular DNS functions work, including IPv4 lookups.
# also test function that converts OpenAlias address format
make && ./unit_tests --gtest_filter=DNSResolver*
# test that OpenAlias addresses like donate@getmonero.org work from
# wallet tools
make && ./unit_tests --gtest_filter=AddressFromURL.Success
2015-05-19 02:56:04 -07:00
moneromooo-monero f278fe3883
s/terget/target/ 2015-05-17 13:16:44 +01:00
rfree2monero 32c19c6c3d
[fix] log level change. compilation: dns, tests
old unbound #warning does not block compilation
unit tests build fine. Even though the RPC/P2P network type is required again
2015-04-10 16:54:21 +02:00
Thomas Winget a8bc7182ea
Merge BlockchainDB into upstream 2015-04-07 17:56:18 -04:00