No description
Find a file
Guilherme Lawless f9e6d8e818
Handle epoch_2 work thresholds in the wallet and most RPCs (#2671)
* Handle epoch_2 work thresholds in most RPCs

This PR is quite large with work generation and validation being a central piece of the node.

In lib/config, work thresholds have been added for the beta and test network. They are now placed under a `nano::work_thresholds`. Unlike the main network, the thresholds are 2x and 1/2x from the base threshold. For tests, the previous base threshold was lowered such that the new highest difficulty (2x) is the same as before. The reason for this is that work generation targets the highest difficulty.

`nano::work_validate` was renamed to `work_validate_entry`, further validation must be done by using `work_threshold_entry` and `work_threshold_full`.

Work generation was changed to always require `difficulty`, except for tests. The reason is that any caller should not assume a base difficulty anymore.

These RPCs now fully support the new thresholds and are ready for epoch_2 (will add some tests):
- `process` validates at the minimum, entry difficulty, and handles the new `insufficient_work` result from ledger processing (used in https://github.com/nanocurrency/nano-node/pull/2667)
- `send` and `account_representative_set` get the account epoch version and targets the correct difficulty
- `receive` aditionally checks if the `source` epoch is higher, allowing new epoch propagation
- `epoch_upgrader`

These RPCs have changes to be compatible but are not yet optimal:
- `block_create` now accepts an optional `difficulty`, and will generate at the highest difficulty otherwise (8x on mainnet).
- `work_generate` also generates at the highest difficulty if `difficulty` is not specified, and multipliers are now off the highest difficulty.
- `work_validate` validates at the highest difficulty unless `difficulty` is specified, meaning this is a breeaking change and it can return "not valid" for valid blocks. Multipliers are now off the highest difficulty.

Support is also limited for active difficulty. It is currently calculated off the `epoch_1` difficulty to avoid any changes.

All these cases will be handled in separate PRs, as this one is large enough as-is.

* Define in source file

* Fix websocket active_difficulty

* Extract system::work_generate_limited

* Fix debug_asserts in active_transactions::update_active_difficulty and add a test to ensure it

* Add disabled test for RPC process, to be enabled in https://github.com/nanocurrency/nano-node/pull/2667

* Add auxiliary system::upgrade_genesis_epoch_2

* Set sideband block details for legacy blocks, unused for now

* Higher amplitude between thresholds for the test network for easier testing

* Handle work thresholds in the node wallet

* Tests validating the node wallet handles thresholds

* Final tests and adjustments

* Fix ASSERT_NE

* Add test ensuring the reduced work is also used when opening accounts previously upgraded

* Ensure blocks from wallet meet the minimum difficulty

* No need to change sideband for legacy, since the wallet never uses them

* Enable test rpc.process_ledger_insufficient_work

* Fix a couple of RPC tests being slow due to testing unrelated functionality
2020-03-26 14:05:35 +00:00
.github clang 8 included in actions env (#2670) 2020-03-18 13:53:10 -04:00
api/flatbuffers IPC 2.0 (#2487) 2020-02-21 00:02:44 +01:00
ci typo on windows sha256 Out-File (#2660) 2020-03-13 10:20:31 -04:00
CL Fix typo in comment 2017-12-28 01:24:23 -06:00
cmake CMakeLists backwards compatibility (#2607) 2020-02-27 21:37:34 -05:00
cpptoml@5399650056 TOML config file support and migration (#2221) 2019-08-23 18:49:32 +02:00
crypto Update Argon2 to release 20190702 (#2357) 2019-10-22 15:47:16 +03:00
docker friendly backtraces in actions (#2591) 2020-02-24 15:21:28 +00:00
etc adding support for rpm building (#1175) 2019-02-15 11:23:58 -05:00
flatbuffers@3b458f7a17 IPC 2.0 (#2487) 2020-02-21 00:02:44 +01:00
gtest@dea0216d0c Migrate Gtest to submodule (#1661) 2019-03-14 07:26:43 -04:00
images Update README (#709) 2018-03-08 06:17:14 -05:00
lmdb@c6bb7edf9f Fix handling non-UTF8 code pages on windows (#1695) 2019-02-04 11:51:05 -05:00
miniupnp@582375b64f Update miniupnp submodule to version 2.1 @582375b (#1659) 2019-01-29 16:26:30 -05:00
nano Handle epoch_2 work thresholds in the wallet and most RPCs (#2671) 2020-03-26 14:05:35 +00:00
nano-pow-server@32e7826865 include nano_pow_server as a submodule and build into ci framework for tagged releases (#2333) 2019-10-24 09:49:21 -04:00
util update url for sourceforge (#2617) 2020-03-02 09:31:59 +00:00
valgrind Use the MDB_NOMEMINIT flag with the ledger db environment (#2077) 2019-06-25 12:11:21 +01:00
.clang-format.base Remove compiler warnings (incl from third party headers) (#2072) 2019-07-12 17:28:21 +01:00
.gitignore IPC 2.0 (#2487) 2020-02-21 00:02:44 +01:00
.gitlab-ci.yml adding support for rpm building (#1175) 2019-02-15 11:23:58 -05:00
.gitmodules IPC 2.0 (#2487) 2020-02-21 00:02:44 +01:00
asan_blacklist Fixing an asan issue. 2014-11-04 22:01:22 -06:00
CMakeLists.txt CMakeLists backwards compatibility (#2607) 2020-02-27 21:37:34 -05:00
doxygen.config Rename internal project bits from RaiBlocks to Nano (#1504) 2018-12-28 14:58:50 -06:00
Info.plist.in Add version info to Info.plist (#1631) 2019-01-28 21:29:46 +01:00
LICENSE Update license year 2019 (#1527) 2019-01-01 17:47:29 -06:00
logo.png Minimal wallet rebranding 2018-02-06 20:26:00 -06:00
Nano.icns Rename internal project bits from RaiBlocks to Nano (#1504) 2018-12-28 14:58:50 -06:00
Nano.ico Rename internal project bits from RaiBlocks to Nano (#1504) 2018-12-28 14:58:50 -06:00
Nano.rc Rename internal project bits from RaiBlocks to Nano (#1504) 2018-12-28 14:58:50 -06:00
nanocurrency-beta.spec.in nano_rpc included in packaging (#1961) 2019-05-06 13:47:24 -04:00
nanocurrency.spec.in nano_rpc included in packaging (#1961) 2019-05-06 13:47:24 -04:00
qt.conf Found the correct magic recipe to get packaging working. 2014-11-09 18:51:16 -06:00
README.md Update README badging to reflect changes to actions 2019-12-17 16:27:54 -05:00
rep_weights_beta.bin Update beta network bootstrap weights for v21, cutoff 7M (#2537) 2020-02-04 13:40:21 +00:00
rep_weights_live.bin Update live bootstrap_weights (#2404) 2019-11-12 11:22:29 -05:00
resources.qrc fixed the inclusion of the logo file into the binary using QT resources 2017-04-20 13:19:26 -05:00
tsan_clang_blacklist TSAN suppressions file (#1941) 2019-04-30 16:55:32 +01:00
tsan_suppressions Suppress RocksDB TSAN warnings (#2345) 2019-10-16 18:29:16 +01:00
valgrind.supp Valgrind fixes & suppressions (#1814) 2019-03-15 13:55:45 +03:00


Logo

Live Artifacts Beta Artifacts GitHub release (latest by date) GitHub tag (latest by date) Tests RelWithDebug Tests Discord


What is Nano?

Nano is a digital payment protocol designed to be accessible and lightweight, with a focus on removing inefficiencies present in other cryptocurrencies. With ultrafast transactions and zero fees on a secure, green and decentralized network, this makes Nano ideal for everyday transactions.


Guides & Documentation

Other documentation details can be found at https://docs.nano.org.



Want to Contribute?

Please see the contributors guide.


Contact us

We want to hear about any trouble, success, delight, or pain you experience when using Nano. Let us know by filing an issue, joining us on Reddit, or joining us on Discord.