├── .clang-format
├── .github
├── ISSUE_TEMPLATE.md
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── feature-request.yml
│ └── node-issue.yml
├── actions
│ └── restore-git-mtimes
│ │ └── action.yml
└── workflows
│ ├── analyzers.yml
│ ├── build_deploy.yml
│ ├── changelog.yml
│ ├── code_sanitizers.yml
│ ├── coverage.yml
│ ├── flamegraphs.yml
│ ├── prepare_release.yml
│ └── unit_tests.yml
├── .gitignore
├── .gitlab-ci.yml
├── .gitmodules
├── CL
├── cl.h
├── cl.hpp
├── cl2.hpp
├── cl_d3d10.h
├── cl_d3d11.h
├── cl_dx9_media_sharing.h
├── cl_egl.h
├── cl_ext.h
├── cl_gl.h
├── cl_gl_ext.h
├── cl_platform.h
└── opencl.h
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Info.plist.in
├── LICENSE
├── Nano.icns
├── Nano.ico
├── Nano.rc
├── README.md
├── SECURITY.md
├── api
└── flatbuffers
│ └── nanoapi.fbs
├── asan_blacklist
├── asan_suppressions
├── boost_checkout_lite.sh
├── ci
├── actions
│ ├── deploy.sh
│ ├── dev-build-tag-gen.sh
│ ├── generate_next_git_tag.sh
│ ├── linux
│ │ ├── docker-build.sh
│ │ ├── docker-deploy-env.sh
│ │ ├── docker-deploy.sh
│ │ ├── docker-impl
│ │ │ └── docker-common.sh
│ │ ├── ghcr-deploy-env.sh
│ │ ├── ghcr-deploy.sh
│ │ └── install_deps.sh
│ ├── osx
│ │ └── install_deps.sh
│ └── windows
│ │ ├── build.bat
│ │ ├── build.ps1
│ │ ├── configure.bat
│ │ ├── deploy.ps1
│ │ ├── disable_windows_defender.ps1
│ │ ├── install_deps.ps1
│ │ ├── run.bat
│ │ ├── run.ps1
│ │ └── signing.ps1
├── build-ci.sh
├── build-deploy.sh
├── build-docker-image.sh
├── build-gitlab.sh
├── build-node.sh
├── build-rhel.sh
├── build-tests.sh
├── build.sh
├── clang-format-check.sh
├── clang-format-do.sh
├── cmake-format-check.sh
├── cmake-format-do.sh
├── code-inspector-check.sh
├── custom-timeout.sh
├── impl
│ ├── clang-format.sh
│ ├── cmake-format.sh
│ ├── code-inspector.sh
│ └── common.sh
├── prepare
│ ├── linux
│ │ ├── prepare-clang.sh
│ │ ├── prepare-gcc.sh
│ │ └── prepare.sh
│ ├── macos
│ │ └── prepare.sh
│ └── windows
│ │ ├── disable-defender.ps1
│ │ ├── install-qt.ps1
│ │ └── prepare.ps1
├── test.sh
└── tests
│ ├── common.sh
│ ├── run-core-tests.sh
│ ├── run-flamegraph-tests.sh
│ ├── run-qt-tests.sh
│ ├── run-rpc-tests.sh
│ ├── run-system-tests.sh
│ ├── run-tests.sh
│ ├── show-core-dumps.sh
│ └── show-sanitizer-reports.sh
├── cmake
├── Modules
│ └── CoverageTest.cmake
└── legacyModules
│ └── FindBoost.cmake
├── coverage
└── CMakeLists.txt
├── crypto
├── blake2
│ ├── COPYING
│ ├── README.md
│ ├── blake2-config.h
│ ├── blake2-impl.h
│ ├── blake2.h
│ ├── blake2b-compress-avx2.h
│ ├── blake2b-load-avx2-simple.h
│ ├── blake2b-load-avx2.h
│ ├── blake2b-load-sse2.h
│ ├── blake2b-load-sse41.h
│ ├── blake2b-ref.c
│ ├── blake2b-round.h
│ └── blake2b.c
└── ed25519-donna
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── curve25519-donna-32bit.h
│ ├── curve25519-donna-64bit.h
│ ├── curve25519-donna-helpers.h
│ ├── curve25519-donna-sse2.h
│ ├── ed25519-donna-32bit-sse2.h
│ ├── ed25519-donna-32bit-tables.h
│ ├── ed25519-donna-64bit-sse2.h
│ ├── ed25519-donna-64bit-tables.h
│ ├── ed25519-donna-64bit-x86-32bit.h
│ ├── ed25519-donna-64bit-x86.h
│ ├── ed25519-donna-basepoint-table.h
│ ├── ed25519-donna-batchverify.h
│ ├── ed25519-donna-impl-base.h
│ ├── ed25519-donna-impl-sse2.h
│ ├── ed25519-donna-portable-identify.h
│ ├── ed25519-donna-portable.h
│ ├── ed25519-donna.h
│ ├── ed25519-hash-custom.h
│ ├── ed25519-hash.h
│ ├── ed25519-randombytes-custom.h
│ ├── ed25519-randombytes.h
│ ├── ed25519.c
│ ├── ed25519.h
│ ├── fuzz
│ ├── README.md
│ ├── build-nix.php
│ ├── curve25519-ref10.c
│ ├── curve25519-ref10.h
│ ├── ed25519-donna-sse2.c
│ ├── ed25519-donna.c
│ ├── ed25519-donna.h
│ ├── ed25519-ref10.c
│ ├── ed25519-ref10.h
│ ├── fuzz-curve25519.c
│ └── fuzz-ed25519.c
│ ├── modm-donna-32bit.h
│ ├── modm-donna-64bit.h
│ ├── regression.h
│ ├── test-internals.c
│ ├── test-ticks.h
│ └── test.c
├── debian-control
├── postinst.in
└── postrm.in
├── doc
└── diagram
│ └── .empty
├── docker
├── ci
│ ├── Dockerfile-base
│ ├── Dockerfile-clang
│ ├── Dockerfile-gcc
│ ├── Dockerfile-rhel
│ └── build.sh
├── node
│ ├── Dockerfile
│ ├── build.sh
│ ├── config
│ │ ├── config-node.toml
│ │ └── config-rpc.toml
│ └── entry.sh
└── sign
│ ├── Dockerfile-signer
│ ├── README.MD
│ └── entry.sh
├── doxygen.config
├── doxygen
└── MAIN_PAGE.md
├── etc
├── gpg
│ ├── argakiig.asc
│ ├── clemahieu.asc
│ ├── dsiganos.asc
│ ├── guilhermelawless.asc
│ ├── sergiysw.asc
│ ├── theohax.asc
│ ├── thsfs.asc
│ ├── wezrule.asc
│ └── zhyatt.asc
└── systemd
│ ├── nanocurrency-beta.service
│ ├── nanocurrency-test.service
│ └── nanocurrency.service
├── images
├── attack.png
├── confirmation - complex.gif
├── confirmation - easy.gif
├── confirmation - simple.gif
├── fan.png
├── fork.gif
├── logo.svg
└── transaction.gif
├── logo.png
├── nano
├── benchmarks
│ ├── CMakeLists.txt
│ ├── entry.cpp
│ ├── ledger.cpp
│ └── stats.cpp
├── boost
│ ├── asio
│ │ ├── basic_stream_socket.hpp
│ │ ├── bind_executor.hpp
│ │ ├── buffer.hpp
│ │ ├── connect.hpp
│ │ ├── deadline_timer.hpp
│ │ ├── dispatch.hpp
│ │ ├── executor_work_guard.hpp
│ │ ├── io_context.hpp
│ │ ├── ip
│ │ │ ├── address.hpp
│ │ │ ├── address_v6.hpp
│ │ │ ├── network_v6.hpp
│ │ │ └── tcp.hpp
│ │ ├── local
│ │ │ └── stream_protocol.hpp
│ │ ├── post.hpp
│ │ ├── read.hpp
│ │ ├── spawn.hpp
│ │ ├── steady_timer.hpp
│ │ ├── strand.hpp
│ │ ├── thread_pool.hpp
│ │ └── write.hpp
│ ├── beast
│ │ ├── core.hpp
│ │ ├── core
│ │ │ └── flat_buffer.hpp
│ │ ├── http.hpp
│ │ ├── http
│ │ │ ├── message.hpp
│ │ │ └── string_body.hpp
│ │ ├── version.hpp
│ │ └── websocket.hpp
│ ├── private
│ │ └── macro_warnings.hpp
│ ├── process
│ │ └── child.hpp
│ └── readme.txt
├── core_test
│ ├── CMakeLists.txt
│ ├── active_elections.cpp
│ ├── assert.cpp
│ ├── async.cpp
│ ├── backlog.cpp
│ ├── block.cpp
│ ├── block_processor.cpp
│ ├── block_store.cpp
│ ├── bootstrap.cpp
│ ├── bootstrap_frontier_scan.cpp
│ ├── bootstrap_server.cpp
│ ├── bucketing.cpp
│ ├── cementing_set.cpp
│ ├── cli.cpp
│ ├── confirmation_solicitor.cpp
│ ├── conflicts.cpp
│ ├── difficulty.cpp
│ ├── distributed_work.cpp
│ ├── election.cpp
│ ├── election_scheduler.cpp
│ ├── entry.cpp
│ ├── enums.cpp
│ ├── epochs.cpp
│ ├── fair_queue.cpp
│ ├── fakes
│ │ ├── websocket_client.hpp
│ │ └── work_peer.hpp
│ ├── fork_cache.cpp
│ ├── ipc.cpp
│ ├── ledger.cpp
│ ├── ledger_confirm.cpp
│ ├── ledger_priority.cpp
│ ├── locks.cpp
│ ├── logging.cpp
│ ├── memory_pool.cpp
│ ├── message.cpp
│ ├── message_deserializer.cpp
│ ├── network.cpp
│ ├── network_filter.cpp
│ ├── network_functions.cpp
│ ├── node.cpp
│ ├── numbers.cpp
│ ├── object_stream.cpp
│ ├── observer_set.cpp
│ ├── online_reps.cpp
│ ├── optimistic_scheduler.cpp
│ ├── peer_container.cpp
│ ├── peer_history.cpp
│ ├── processing_queue.cpp
│ ├── processor_service.cpp
│ ├── random.cpp
│ ├── random_pool.cpp
│ ├── rate_limiting.cpp
│ ├── receivable.cpp
│ ├── rep_crawler.cpp
│ ├── rep_weight_store.cpp
│ ├── request_aggregator.cpp
│ ├── scheduler_buckets.cpp
│ ├── signal_manager.cpp
│ ├── socket.cpp
│ ├── stacktrace.cpp
│ ├── stats.cpp
│ ├── system.cpp
│ ├── tcp_listener.cpp
│ ├── telemetry.cpp
│ ├── thread_pool.cpp
│ ├── throttle.cpp
│ ├── timer.cpp
│ ├── toml.cpp
│ ├── unchecked_map.cpp
│ ├── utility.cpp
│ ├── vote_cache.cpp
│ ├── vote_processor.cpp
│ ├── vote_rebroadcaster.cpp
│ ├── voting.cpp
│ ├── wallet.cpp
│ ├── wallets.cpp
│ ├── websocket.cpp
│ └── work_pool.cpp
├── crypto
│ ├── blake2
│ │ └── blake2.h
│ └── readme.txt
├── crypto_lib
│ ├── CMakeLists.txt
│ ├── interface.cpp
│ ├── random_pool.cpp
│ ├── random_pool.hpp
│ ├── random_pool_shuffle.hpp
│ ├── secure_memory.cpp
│ └── secure_memory.hpp
├── fuzzer_test
│ ├── CMakeLists.txt
│ ├── fuzz_bignum.cpp
│ ├── fuzz_buffer.cpp
│ └── fuzz_endpoint_parsing.cpp
├── ipc_flatbuffers_lib
│ ├── CMakeLists.txt
│ ├── flatbuffer_producer.cpp
│ └── flatbuffer_producer.hpp
├── ipc_flatbuffers_test
│ ├── CMakeLists.txt
│ └── entry.cpp
├── lib
│ ├── CMakeLists.txt
│ ├── asio.cpp
│ ├── asio.hpp
│ ├── assert.cpp
│ ├── assert.hpp
│ ├── async.hpp
│ ├── block_sideband.cpp
│ ├── block_sideband.hpp
│ ├── block_type.cpp
│ ├── block_type.hpp
│ ├── block_uniquer.hpp
│ ├── blockbuilders.cpp
│ ├── blockbuilders.hpp
│ ├── blocks.cpp
│ ├── blocks.hpp
│ ├── char_traits.hpp
│ ├── cli.cpp
│ ├── cli.hpp
│ ├── common.hpp
│ ├── config.cpp
│ ├── config.hpp
│ ├── configbase.hpp
│ ├── constants.cpp
│ ├── constants.hpp
│ ├── container_info.cpp
│ ├── container_info.hpp
│ ├── diagnosticsconfig.cpp
│ ├── diagnosticsconfig.hpp
│ ├── enum_util.hpp
│ ├── env.cpp
│ ├── env.hpp
│ ├── epoch.cpp
│ ├── epoch.hpp
│ ├── epochs.cpp
│ ├── epochs.hpp
│ ├── errors.cpp
│ ├── errors.hpp
│ ├── files.cpp
│ ├── files.hpp
│ ├── formatting.cpp
│ ├── formatting.hpp
│ ├── function.hpp
│ ├── fwd.hpp
│ ├── id_dispenser.hpp
│ ├── interval.hpp
│ ├── ipc.cpp
│ ├── ipc.hpp
│ ├── ipc_client.cpp
│ ├── ipc_client.hpp
│ ├── json_error_response.hpp
│ ├── jsonconfig.cpp
│ ├── jsonconfig.hpp
│ ├── lmdbconfig.cpp
│ ├── lmdbconfig.hpp
│ ├── locks.cpp
│ ├── locks.hpp
│ ├── logging.cpp
│ ├── logging.hpp
│ ├── logging_enums.cpp
│ ├── logging_enums.hpp
│ ├── memory.cpp
│ ├── memory.hpp
│ ├── network_filter.cpp
│ ├── network_filter.hpp
│ ├── numbers.cpp
│ ├── numbers.hpp
│ ├── numbers_templ.hpp
│ ├── object_stream.cpp
│ ├── object_stream.hpp
│ ├── object_stream_adapters.hpp
│ ├── observer_set.hpp
│ ├── optional_ptr.hpp
│ ├── plat
│ │ ├── darwin
│ │ │ └── thread_role.cpp
│ │ ├── default
│ │ │ ├── debugging.cpp
│ │ │ └── priority.cpp
│ │ ├── freebsd
│ │ │ └── thread_role.cpp
│ │ ├── linux
│ │ │ ├── debugging.cpp
│ │ │ ├── priority.cpp
│ │ │ └── thread_role.cpp
│ │ ├── posix
│ │ │ └── perms.cpp
│ │ └── windows
│ │ │ ├── perms.cpp
│ │ │ ├── priority.cpp
│ │ │ ├── registry.cpp
│ │ │ └── thread_role.cpp
│ ├── processing_queue.hpp
│ ├── random.hpp
│ ├── rate_limiting.cpp
│ ├── rate_limiting.hpp
│ ├── relaxed_atomic.hpp
│ ├── rocksdbconfig.cpp
│ ├── rocksdbconfig.hpp
│ ├── rpc_handler_interface.hpp
│ ├── rpcconfig.cpp
│ ├── rpcconfig.hpp
│ ├── signal_manager.cpp
│ ├── signal_manager.hpp
│ ├── stacktrace.cpp
│ ├── stacktrace.hpp
│ ├── stats.cpp
│ ├── stats.hpp
│ ├── stats_enums.cpp
│ ├── stats_enums.hpp
│ ├── stats_sinks.hpp
│ ├── stream.hpp
│ ├── thread_pool.hpp
│ ├── thread_roles.cpp
│ ├── thread_roles.hpp
│ ├── thread_runner.cpp
│ ├── thread_runner.hpp
│ ├── threading.cpp
│ ├── threading.hpp
│ ├── timer.cpp
│ ├── timer.hpp
│ ├── tomlconfig.cpp
│ ├── tomlconfig.hpp
│ ├── uniquer.hpp
│ ├── utility.cpp
│ ├── utility.hpp
│ ├── walletconfig.cpp
│ ├── walletconfig.hpp
│ ├── work.cpp
│ ├── work.hpp
│ └── work_version.hpp
├── load_test
│ ├── CMakeLists.txt
│ └── entry.cpp
├── nano_node
│ ├── CMakeLists.txt
│ ├── daemon.cpp
│ ├── daemon.hpp
│ └── entry.cpp
├── nano_rpc
│ ├── CMakeLists.txt
│ └── entry.cpp
├── nano_wallet
│ ├── .DS_Store
│ ├── entry.cpp
│ ├── entry_com.cpp
│ ├── icon.hpp
│ └── plat
│ │ ├── default
│ │ └── icon.cpp
│ │ └── windows
│ │ └── icon.cpp
├── node
│ ├── CMakeLists.txt
│ ├── active_elections.cpp
│ ├── active_elections.hpp
│ ├── backlog_scan.cpp
│ ├── backlog_scan.hpp
│ ├── bandwidth_limiter.cpp
│ ├── bandwidth_limiter.hpp
│ ├── block_context.hpp
│ ├── block_processor.cpp
│ ├── block_processor.hpp
│ ├── block_source.cpp
│ ├── block_source.hpp
│ ├── bootstrap
│ │ ├── account_sets.cpp
│ │ ├── account_sets.hpp
│ │ ├── bootstrap_config.cpp
│ │ ├── bootstrap_config.hpp
│ │ ├── bootstrap_server.cpp
│ │ ├── bootstrap_server.hpp
│ │ ├── bootstrap_service.cpp
│ │ ├── bootstrap_service.hpp
│ │ ├── common.hpp
│ │ ├── crawlers.hpp
│ │ ├── database_scan.cpp
│ │ ├── database_scan.hpp
│ │ ├── frontier_scan.cpp
│ │ ├── frontier_scan.hpp
│ │ ├── peer_scoring.cpp
│ │ ├── peer_scoring.hpp
│ │ ├── throttle.cpp
│ │ └── throttle.hpp
│ ├── bootstrap_weights_beta.hpp
│ ├── bootstrap_weights_live.hpp
│ ├── bounded_backlog.cpp
│ ├── bounded_backlog.hpp
│ ├── bucketing.cpp
│ ├── bucketing.hpp
│ ├── cementing_set.cpp
│ ├── cementing_set.hpp
│ ├── cli.cpp
│ ├── cli.hpp
│ ├── confirmation_solicitor.cpp
│ ├── confirmation_solicitor.hpp
│ ├── daemonconfig.cpp
│ ├── daemonconfig.hpp
│ ├── distributed_work.cpp
│ ├── distributed_work.hpp
│ ├── distributed_work_factory.cpp
│ ├── distributed_work_factory.hpp
│ ├── election.cpp
│ ├── election.hpp
│ ├── election_behavior.hpp
│ ├── election_insertion_result.hpp
│ ├── election_status.hpp
│ ├── endpoint.cpp
│ ├── endpoint.hpp
│ ├── endpoint_templ.hpp
│ ├── epoch_upgrader.cpp
│ ├── epoch_upgrader.hpp
│ ├── fair_queue.hpp
│ ├── fork_cache.cpp
│ ├── fork_cache.hpp
│ ├── fwd.hpp
│ ├── inactive_node.cpp
│ ├── inactive_node.hpp
│ ├── ipc
│ │ ├── action_handler.cpp
│ │ ├── action_handler.hpp
│ │ ├── flatbuffers_handler.cpp
│ │ ├── flatbuffers_handler.hpp
│ │ ├── flatbuffers_util.cpp
│ │ ├── flatbuffers_util.hpp
│ │ ├── ipc_access_config.cpp
│ │ ├── ipc_access_config.hpp
│ │ ├── ipc_broker.cpp
│ │ ├── ipc_broker.hpp
│ │ ├── ipc_config.cpp
│ │ ├── ipc_config.hpp
│ │ ├── ipc_server.cpp
│ │ └── ipc_server.hpp
│ ├── json_handler.cpp
│ ├── json_handler.hpp
│ ├── ledger_notifications.cpp
│ ├── ledger_notifications.hpp
│ ├── local_block_broadcaster.cpp
│ ├── local_block_broadcaster.hpp
│ ├── local_vote_history.cpp
│ ├── local_vote_history.hpp
│ ├── make_store.cpp
│ ├── make_store.hpp
│ ├── message_processor.cpp
│ ├── message_processor.hpp
│ ├── messages.cpp
│ ├── messages.hpp
│ ├── monitor.cpp
│ ├── monitor.hpp
│ ├── network.cpp
│ ├── network.hpp
│ ├── node.cpp
│ ├── node.hpp
│ ├── node_observers.cpp
│ ├── node_observers.hpp
│ ├── node_rpc_config.cpp
│ ├── node_rpc_config.hpp
│ ├── node_wrapper.cpp
│ ├── node_wrapper.hpp
│ ├── nodeconfig.cpp
│ ├── nodeconfig.hpp
│ ├── online_reps.cpp
│ ├── online_reps.hpp
│ ├── openclconfig.cpp
│ ├── openclconfig.hpp
│ ├── openclwork.cpp
│ ├── openclwork.hpp
│ ├── peer_exclusion.cpp
│ ├── peer_exclusion.hpp
│ ├── peer_history.cpp
│ ├── peer_history.hpp
│ ├── plat
│ │ ├── posix
│ │ │ └── openclapi.cpp
│ │ └── windows
│ │ │ └── openclapi.cpp
│ ├── portmapping.cpp
│ ├── portmapping.hpp
│ ├── pruning.cpp
│ ├── pruning.hpp
│ ├── recently_cemented_cache.cpp
│ ├── recently_cemented_cache.hpp
│ ├── recently_confirmed_cache.cpp
│ ├── recently_confirmed_cache.hpp
│ ├── rep_tiers.cpp
│ ├── rep_tiers.hpp
│ ├── repcrawler.cpp
│ ├── repcrawler.hpp
│ ├── request_aggregator.cpp
│ ├── request_aggregator.hpp
│ ├── rpc_callbacks.cpp
│ ├── rpc_callbacks.hpp
│ ├── scheduler
│ │ ├── bucket.cpp
│ │ ├── bucket.hpp
│ │ ├── component.cpp
│ │ ├── component.hpp
│ │ ├── hinted.cpp
│ │ ├── hinted.hpp
│ │ ├── manual.cpp
│ │ ├── manual.hpp
│ │ ├── optimistic.cpp
│ │ ├── optimistic.hpp
│ │ ├── priority.cpp
│ │ └── priority.hpp
│ ├── telemetry.cpp
│ ├── telemetry.hpp
│ ├── transport
│ │ ├── block_deserializer.cpp
│ │ ├── block_deserializer.hpp
│ │ ├── channel.cpp
│ │ ├── channel.hpp
│ │ ├── common.hpp
│ │ ├── fake.cpp
│ │ ├── fake.hpp
│ │ ├── fwd.hpp
│ │ ├── inproc.cpp
│ │ ├── inproc.hpp
│ │ ├── loopback.cpp
│ │ ├── loopback.hpp
│ │ ├── message_deserializer.cpp
│ │ ├── message_deserializer.hpp
│ │ ├── tcp_channel.cpp
│ │ ├── tcp_channel.hpp
│ │ ├── tcp_channels.cpp
│ │ ├── tcp_channels.hpp
│ │ ├── tcp_config.cpp
│ │ ├── tcp_config.hpp
│ │ ├── tcp_listener.cpp
│ │ ├── tcp_listener.hpp
│ │ ├── tcp_server.cpp
│ │ ├── tcp_server.hpp
│ │ ├── tcp_socket.cpp
│ │ ├── tcp_socket.hpp
│ │ ├── test_channel.cpp
│ │ ├── test_channel.hpp
│ │ ├── traffic_type.cpp
│ │ ├── traffic_type.hpp
│ │ ├── transport.cpp
│ │ └── transport.hpp
│ ├── unchecked_map.cpp
│ ├── unchecked_map.hpp
│ ├── vote_cache.cpp
│ ├── vote_cache.hpp
│ ├── vote_generator.cpp
│ ├── vote_generator.hpp
│ ├── vote_processor.cpp
│ ├── vote_processor.hpp
│ ├── vote_rebroadcaster.cpp
│ ├── vote_rebroadcaster.hpp
│ ├── vote_router.cpp
│ ├── vote_router.hpp
│ ├── vote_spacing.cpp
│ ├── vote_spacing.hpp
│ ├── vote_with_weight_info.hpp
│ ├── wallet.cpp
│ ├── wallet.hpp
│ ├── websocket.cpp
│ ├── websocket.hpp
│ ├── websocket_stream.cpp
│ ├── websocket_stream.hpp
│ ├── websocketconfig.cpp
│ ├── websocketconfig.hpp
│ └── xorshift.hpp
├── qt
│ ├── qt.cpp
│ └── qt.hpp
├── qt_test
│ ├── QTest
│ ├── entry.cpp
│ └── qt.cpp
├── rpc
│ ├── CMakeLists.txt
│ ├── rpc.cpp
│ ├── rpc.hpp
│ ├── rpc_connection.cpp
│ ├── rpc_connection.hpp
│ ├── rpc_handler.cpp
│ ├── rpc_handler.hpp
│ ├── rpc_request_processor.cpp
│ └── rpc_request_processor.hpp
├── rpc_test
│ ├── CMakeLists.txt
│ ├── common.cpp
│ ├── common.hpp
│ ├── entry.cpp
│ ├── receivable.cpp
│ ├── rpc.cpp
│ ├── rpc_context.cpp
│ ├── rpc_context.hpp
│ ├── test_response.cpp
│ └── test_response.hpp
├── secure
│ ├── CMakeLists.txt
│ ├── account_info.cpp
│ ├── account_info.hpp
│ ├── account_iterator.cpp
│ ├── account_iterator.hpp
│ ├── account_iterator_impl.hpp
│ ├── common.cpp
│ ├── common.hpp
│ ├── fwd.hpp
│ ├── generate_cache_flags.cpp
│ ├── generate_cache_flags.hpp
│ ├── ledger.cpp
│ ├── ledger.hpp
│ ├── ledger_cache.cpp
│ ├── ledger_cache.hpp
│ ├── ledger_set_any.cpp
│ ├── ledger_set_any.hpp
│ ├── ledger_set_confirmed.cpp
│ ├── ledger_set_confirmed.hpp
│ ├── parallel_traversal.hpp
│ ├── pending_info.cpp
│ ├── pending_info.hpp
│ ├── plat
│ │ ├── osx
│ │ │ └── working.mm
│ │ ├── posix
│ │ │ └── working.cpp
│ │ └── windows
│ │ │ └── working.cpp
│ ├── receivable_iterator.cpp
│ ├── receivable_iterator.hpp
│ ├── receivable_iterator_impl.hpp
│ ├── rep_weights.cpp
│ ├── rep_weights.hpp
│ ├── transaction.hpp
│ ├── utility.cpp
│ ├── utility.hpp
│ ├── vote.cpp
│ ├── vote.hpp
│ └── working.hpp
├── slow_test
│ ├── CMakeLists.txt
│ ├── bootstrap.cpp
│ ├── entry.cpp
│ ├── flamegraph.cpp
│ ├── ledger.cpp
│ ├── node.cpp
│ ├── vote_cache.cpp
│ └── vote_processor.cpp
├── store
│ ├── CMakeLists.txt
│ ├── account.cpp
│ ├── account.hpp
│ ├── block.cpp
│ ├── block.hpp
│ ├── block_w_sideband.hpp
│ ├── component.cpp
│ ├── component.hpp
│ ├── confirmation_height.cpp
│ ├── confirmation_height.hpp
│ ├── db_val.cpp
│ ├── db_val.hpp
│ ├── db_val_impl.hpp
│ ├── final_vote.cpp
│ ├── final_vote.hpp
│ ├── fwd.hpp
│ ├── iterator.cpp
│ ├── iterator.hpp
│ ├── lmdb
│ │ ├── account.cpp
│ │ ├── account.hpp
│ │ ├── block.cpp
│ │ ├── block.hpp
│ │ ├── confirmation_height.cpp
│ │ ├── confirmation_height.hpp
│ │ ├── db_val.cpp
│ │ ├── db_val.hpp
│ │ ├── final_vote.cpp
│ │ ├── final_vote.hpp
│ │ ├── iterator.cpp
│ │ ├── iterator.hpp
│ │ ├── lmdb.cpp
│ │ ├── lmdb.hpp
│ │ ├── lmdb_env.cpp
│ │ ├── lmdb_env.hpp
│ │ ├── online_weight.cpp
│ │ ├── online_weight.hpp
│ │ ├── peer.cpp
│ │ ├── peer.hpp
│ │ ├── pending.cpp
│ │ ├── pending.hpp
│ │ ├── pruned.cpp
│ │ ├── pruned.hpp
│ │ ├── rep_weight.cpp
│ │ ├── rep_weight.hpp
│ │ ├── transaction.cpp
│ │ ├── transaction_impl.hpp
│ │ ├── version.cpp
│ │ ├── version.hpp
│ │ ├── wallet_value.cpp
│ │ └── wallet_value.hpp
│ ├── online_weight.cpp
│ ├── online_weight.hpp
│ ├── peer.cpp
│ ├── peer.hpp
│ ├── pending.cpp
│ ├── pending.hpp
│ ├── pruned.cpp
│ ├── pruned.hpp
│ ├── rep_weight.cpp
│ ├── rep_weight.hpp
│ ├── reverse_iterator.hpp
│ ├── reverse_iterator_templ.hpp
│ ├── rocksdb
│ │ ├── account.cpp
│ │ ├── account.hpp
│ │ ├── block.cpp
│ │ ├── block.hpp
│ │ ├── confirmation_height.cpp
│ │ ├── confirmation_height.hpp
│ │ ├── db_val.cpp
│ │ ├── db_val.hpp
│ │ ├── final_vote.cpp
│ │ ├── final_vote.hpp
│ │ ├── iterator.cpp
│ │ ├── iterator.hpp
│ │ ├── online_weight.cpp
│ │ ├── online_weight.hpp
│ │ ├── peer.cpp
│ │ ├── peer.hpp
│ │ ├── pending.cpp
│ │ ├── pending.hpp
│ │ ├── pruned.cpp
│ │ ├── pruned.hpp
│ │ ├── rep_weight.cpp
│ │ ├── rep_weight.hpp
│ │ ├── rocksdb.cpp
│ │ ├── rocksdb.hpp
│ │ ├── transaction.cpp
│ │ ├── transaction_impl.hpp
│ │ ├── utility.cpp
│ │ ├── utility.hpp
│ │ ├── version.cpp
│ │ └── version.hpp
│ ├── tables.hpp
│ ├── transaction.cpp
│ ├── transaction.hpp
│ ├── typed_iterator.cpp
│ ├── typed_iterator.hpp
│ ├── typed_iterator_templ.hpp
│ ├── version.cpp
│ ├── version.hpp
│ ├── versioning.cpp
│ ├── versioning.hpp
│ ├── write_queue.cpp
│ └── write_queue.hpp
└── test_common
│ ├── CMakeLists.txt
│ ├── chains.cpp
│ ├── chains.hpp
│ ├── ledger_context.cpp
│ ├── ledger_context.hpp
│ ├── make_store.cpp
│ ├── make_store.hpp
│ ├── network.cpp
│ ├── network.hpp
│ ├── rate_observer.cpp
│ ├── rate_observer.hpp
│ ├── system.cpp
│ ├── system.hpp
│ ├── telemetry.cpp
│ ├── telemetry.hpp
│ ├── testutil.cpp
│ └── testutil.hpp
├── nanocurrency-beta.spec.in
├── nanocurrency.spec.in
├── qt.conf
├── record_rep_weights.py
├── resources.qrc
├── sanitize_ignorelist
├── sanitize_ignorelist_asan
├── sanitize_ignorelist_tsan
├── sanitize_ignorelist_ubsan
├── systest
├── RUNALL
├── cli_wallet_create.sh
├── daemon_interrupt.sh
├── node_initialize.sh
├── rpc_stop.sh
└── set_bandwidth_params.sh.disabled
├── tsan_clang_blacklist
├── tsan_suppressions
├── util
├── build_prep
│ ├── common.sh
│ ├── macosx
│ │ └── build_qt.sh
│ ├── rhel
│ │ └── prep.sh.in
│ └── update-common
├── changelog.py
├── changelog_generator
└── makesrc
├── valgrind.supp
└── valgrind
└── valgrind.h
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
20 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: Report a security vulnerability
4 | url: https://docs.nano.org/node-implementation/contributing/#security-vulnerability-disclosure
5 | about: DO NOT SUBMIT SECURITY VULNERABILITIES IN PUBLIC REPOSITORIES - find out how to privately submit in our documentation.
6 | - name: Nano Community Forum
7 | url: https://forum.nano.org
8 | about: Ask questions, get wallet or other support, and discuss Nano with the community.
9 |
10 |
--------------------------------------------------------------------------------
/.github/actions/restore-git-mtimes/action.yml:
--------------------------------------------------------------------------------
1 | name: "restore-git-mtimes"
2 | description: "Restore file modification timestamps from git commit timestamps"
3 | runs:
4 | using: "composite"
5 | steps:
6 | - uses: actions/checkout@v4
7 | with:
8 | repository: "MestreLion/git-tools"
9 | ref: a42a069bc755f0fa81316965335cb33dbf22a968 # pin latest commit
10 | path: "git-tools"
11 | - run: $GITHUB_WORKSPACE/git-tools/git-restore-mtime
12 | shell: bash
13 | - run: git submodule foreach --recursive '$GITHUB_WORKSPACE/git-tools/git-restore-mtime'
14 | shell: bash
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Compiled Dynamic libraries
8 | *.so
9 | *.dylib
10 | *.dll
11 |
12 | # Compiled Static libraries
13 | *.lai
14 | *.la
15 | *.a
16 | *.lib
17 |
18 | # Doxygen built HTML
19 | /doc-build
20 |
21 | # Executables
22 | *.exe
23 | *.out
24 | *.app
25 | *.dmg
26 | *.DS_Store
27 | core_test
28 | !core_test/
29 | rpc_test
30 | !rpc_test/
31 | qt_test
32 | !qt_test/
33 | nano_node
34 | !nano_node/
35 | nano_wallet
36 | !nano_wallet/
37 | slow_test
38 | !slow_test/
39 | nano_rpc
40 | !nano_rpc/
41 |
42 | # IDEs
43 | .idea
44 | .vscode
45 | *.plist
46 |
47 | # Visual Studio
48 | *.vcxproj
49 | *.vcxproj.filters
50 | *.vcxproj.user
51 | *.sln
52 | *.qrc.depends
53 | *.dir
54 | Debug
55 | Release
56 | .vs
57 | *.aps
58 | *.db
59 | *.opendb
60 |
61 | # Autogenerated Qt artifacts
62 | packaging
63 | qrc_resources.cpp
64 | resources.qrc.depends
65 |
66 | # Autogenerated Flatbuffers source files
67 | nano/ipc_flatbuffers_lib/generated/flatbuffers/nanoapi_generated.h
68 |
69 | # CMake artifacts
70 | _CPack_Packages
71 | CPack*
72 | cmake_install.cmake
73 | CMakeCache.txt
74 | CMakeFiles
75 | CMakeScripts
76 | compile_commands.json
77 | CTestTestfile.cmake
78 | install_manifest.txt
79 | Makefile
80 | Testing
81 |
82 | # Autogenerated Build Prep artifacts
83 | util/build_prep/*/prep.sh
84 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Thank you for contributing to the nano node and protocol core development. For details on contributing, please see https://docs.nano.org/core-development/overview/, which includes:
4 |
5 | - [Security vulnerability reporting details](https://docs.nano.org/core-development/overview/#security-vulnerability-reporting)
6 | - [Collaboration process information](https://docs.nano.org/core-development/collaboration-process/)
7 | - [Code standards](https://docs.nano.org/core-development/code-standards/)
8 | - Further information to help [understand the code](https://docs.nano.org/core-development/understanding-the-code/)
--------------------------------------------------------------------------------
/Info.plist.in:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrincipalClass
6 | NSApplication
7 | NSHighResolutionCapable
8 | True
9 | CFBundleExecutable
10 | nano_wallet
11 | CFBundleName
12 | @NANO_OSX_PACKAGE_NAME@
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleIconFile
16 | Nano.icns
17 | CFBundleIdentifier
18 | org.nano.nano_wallet
19 | CFBundleShortVersionString
20 | @CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@
21 | CFBundleVersion
22 | @CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@
23 | NSRequiresAquaSystemAppearance
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Nano.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/Nano.icns
--------------------------------------------------------------------------------
/Nano.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/Nano.ico
--------------------------------------------------------------------------------
/Nano.rc:
--------------------------------------------------------------------------------
1 | 1 ICON "Nano.ico"
--------------------------------------------------------------------------------
/asan_blacklist:
--------------------------------------------------------------------------------
1 | src:*ed25519*
--------------------------------------------------------------------------------
/asan_suppressions:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/asan_suppressions
--------------------------------------------------------------------------------
/ci/actions/linux/docker-build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh"
7 |
8 | docker_build
9 |
--------------------------------------------------------------------------------
/ci/actions/linux/docker-deploy-env.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh"
7 |
8 | docker_deploy_env
9 |
--------------------------------------------------------------------------------
/ci/actions/linux/docker-deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh"
7 |
8 | docker_deploy
9 |
--------------------------------------------------------------------------------
/ci/actions/linux/ghcr-deploy-env.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh"
7 |
8 | ghcr_deploy_env
--------------------------------------------------------------------------------
/ci/actions/linux/ghcr-deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | source "$(dirname "$BASH_SOURCE")/docker-impl/docker-common.sh"
7 |
8 | ghcr_deploy
--------------------------------------------------------------------------------
/ci/actions/linux/install_deps.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -x
4 |
5 | DOCKER_REGISTRY="${DOCKER_REGISTRY:-nanocurrency}"
6 |
7 | echo "Script ci/actions/linux/install_deps.sh starting COMPILER=\"$COMPILER\""
8 |
9 | # This enables IPv6 support in docker, needed to run node tests inside docker container
10 | sudo mkdir -p /etc/docker && echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json && sudo service docker restart
11 |
12 | ci/build-docker-image.sh docker/ci/Dockerfile-base ${DOCKER_REGISTRY}/nano-env:base
13 | if [[ "${COMPILER:-}" != "" ]]; then
14 | ci/build-docker-image.sh docker/ci/Dockerfile-${COMPILER} ${DOCKER_REGISTRY}/nano-env:${COMPILER}
15 | else
16 | ci/build-docker-image.sh docker/ci/Dockerfile-gcc ${DOCKER_REGISTRY}/nano-env:gcc
17 | ci/build-docker-image.sh docker/ci/Dockerfile-clang ${DOCKER_REGISTRY}/nano-env:clang
18 | ci/build-docker-image.sh docker/ci/Dockerfile-rhel ${DOCKER_REGISTRY}/nano-env:rhel
19 | fi
20 |
21 | echo "Script ci/actions/linux/install_deps.sh finished"
22 |
--------------------------------------------------------------------------------
/ci/actions/osx/install_deps.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | brew update
4 | brew install coreutils
5 | brew cask install xquartz
6 | util/build_prep/macosx/build_qt.sh
7 |
--------------------------------------------------------------------------------
/ci/actions/windows/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set exit_code=0
3 |
4 | goto %RUN%
5 |
6 | :test
7 | cmake --build . ^
8 | --target core_test ^
9 | --config %BUILD_TYPE% ^
10 | -- /m:2
11 | set exit_code=%errorlevel%
12 | if %exit_code% neq 0 goto exit
13 | cmake --build . ^
14 | --target rpc_test ^
15 | --config %BUILD_TYPE% ^
16 | -- /m:2
17 | set exit_code=%errorlevel%
18 | goto exit
19 |
20 | :artifact
21 | cmake --build . ^
22 | --target INSTALL ^
23 | --config %BUILD_TYPE% ^
24 | -- /m:2
25 | set exit_code=%errorlevel%
26 |
27 | echo "Packaging NSIS"
28 | call "%cmake_path%\cpack.exe" -C %BUILD_TYPE%
29 | echo "Packaging ZIP"
30 | call "%cmake_path%\cpack.exe" -G ZIP -C %BUILD_TYPE%
31 |
32 | goto exit
33 |
34 | :exit
35 | exit /B %exit_code%
36 |
--------------------------------------------------------------------------------
/ci/actions/windows/configure.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set exit_code=0
3 |
4 | echo "BUILD TYPE %BUILD_TYPE%"
5 | echo "RUN %RUN%"
6 |
7 | cmake .. ^
8 | -Ax64 ^
9 | %NANO_TEST% ^
10 | %CI% ^
11 | %ROCKS_LIB% ^
12 | -DPORTABLE=1 ^
13 | -DQt5_DIR="c:\qt\5.15.2\msvc2019_64\lib\cmake\Qt5" ^
14 | -DNANO_GUI=ON ^
15 | -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
16 | -DACTIVE_NETWORK=nano_%NETWORK_CFG%_network ^
17 | -DNANO_SIMD_OPTIMIZATIONS=TRUE ^
18 | -Dgtest_force_shared_crt=on
19 |
20 | set exit_code=%errorlevel%
21 | if %exit_code% neq 0 goto exit
22 |
23 | :exit
24 | exit /B %exit_code%
25 |
--------------------------------------------------------------------------------
/ci/actions/windows/disable_windows_defender.ps1:
--------------------------------------------------------------------------------
1 | $ErrorActionPreference = "Continue"
2 |
3 | Set-MpPreference -DisableArchiveScanning $true
4 | Set-MpPreference -DisableRealtimeMonitoring $true
5 | Set-MpPreference -DisableBehaviorMonitoring $true
--------------------------------------------------------------------------------
/ci/actions/windows/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal
3 | set exit_code=0
4 |
5 | call %BUILD_TYPE%\core_test.exe
6 | set core_code=%errorlevel%
7 |
8 | call %BUILD_TYPE%\rpc_test.exe
9 | set rpc_code=%errorlevel%
10 |
11 | echo Core Test return code: %core_code%
12 | echo RPC Test return code: %rpc_code%
13 |
14 | if not %core_code%==0 (
15 | echo Core Test fail
16 | set exit_code=1
17 | )
18 |
19 | if not %rpc_code%==0 (
20 | echo RPC Test fail
21 | set exit_code=1
22 | )
23 |
24 | if %exit_code%==0 (
25 | echo Success
26 | exit /b 0
27 | ) else (
28 | echo Failed
29 | exit /b 1
30 | )
--------------------------------------------------------------------------------
/ci/actions/windows/run.ps1:
--------------------------------------------------------------------------------
1 | $ErrorActionPreference = "Continue"
2 |
3 | $env:BUILD_TYPE = "Debug"
4 | $env:NETWORK_CFG = "dev"
5 |
6 | Push-Location build
7 |
8 | & ..\ci\actions\windows\run.bat
9 | if (${LastExitCode} -ne 0) {
10 | throw "Failed to Pass Tests"
11 | }
12 |
13 | Pop-Location
--------------------------------------------------------------------------------
/ci/actions/windows/signing.ps1:
--------------------------------------------------------------------------------
1 | $ErrorActionPreference = "Continue"
2 |
3 | if (Test-Path env:CSC_LINK) {
4 | $path = Join-Path -Path "$env:TMP" -ChildPath csc.p12
5 | [IO.File]::WriteAllBytes($path, [Convert]::FromBase64String($env:CSC_LINK))
6 | $arguments = -split 'sign /a /ph /tr http://timestamp.digicert.com /td sha256 /fd sha256'
7 | $arguments += @('/f', $path, '/p', $env:CSC_KEY_PASSWORD, "$env:BUILD_TYPE\*.exe")
8 | . "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe" $arguments
9 | }
--------------------------------------------------------------------------------
/ci/build-ci.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | qt_dir=${1}
5 | build_target=${2:-all}
6 |
7 | OS=$(uname)
8 |
9 | source "$(dirname "$BASH_SOURCE")/impl/code-inspector.sh"
10 | code_inspect "${ROOTPATH:-.}"
11 |
12 | mkdir -p build
13 | pushd build
14 |
15 | if [[ "${RELEASE:-false}" == "true" ]]; then
16 | BUILD_TYPE="RelWithDebInfo"
17 | fi
18 |
19 | if [[ ${ASAN_INT:-0} -eq 1 ]]; then
20 | SANITIZERS="-DNANO_ASAN_INT=ON"
21 | elif [[ ${ASAN:-0} -eq 1 ]]; then
22 | SANITIZERS="-DNANO_ASAN=ON"
23 | elif [[ ${TSAN:-0} -eq 1 ]]; then
24 | SANITIZERS="-DNANO_TSAN=ON"
25 | elif [[ ${LCOV:-0} -eq 1 ]]; then
26 | SANITIZERS="-DCOVERAGE=ON"
27 | fi
28 |
29 | ulimit -S -n 8192
30 |
31 | cmake \
32 | -G'Unix Makefiles' \
33 | -DACTIVE_NETWORK=nano_dev_network \
34 | -DNANO_TEST=ON \
35 | -DNANO_GUI=ON \
36 | -DPORTABLE=1 \
37 | -DNANO_WARN_TO_ERR=ON \
38 | -DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
39 | -DQt5_DIR=${qt_dir} \
40 | ${SANITIZERS:-} \
41 | ..
42 |
43 | if [[ "$OS" == 'Linux' ]]; then
44 | if [[ ${LCOV:-0} == 1 ]]; then
45 | cmake --build ${PWD} --target generate_coverage -- -j2
46 | else
47 | cmake --build ${PWD} --target ${build_target} -- -j2
48 | fi
49 | else
50 | sudo cmake --build ${PWD} --target ${build_target} -- -j2
51 | fi
52 |
53 | popd
54 |
--------------------------------------------------------------------------------
/ci/build-deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | qt_dir=${1}
4 | ci_version_pre_release="OFF"
5 | if [[ -n "${CI_VERSION_PRE_RELEASE}" ]]; then
6 | ci_version_pre_release="$CI_VERSION_PRE_RELEASE"
7 | fi
8 |
9 | set -o errexit
10 | set -o nounset
11 | set -o xtrace
12 | OS=$(uname)
13 |
14 | mkdir build
15 | pushd build
16 | CONFIGURATION="Release"
17 |
18 | case "${NETWORK}" in
19 | "BETA")
20 | NETWORK_CFG="beta"
21 | CONFIGURATION="RelWithDebInfo"
22 | ;;
23 | "TEST")
24 | NETWORK_CFG="test"
25 | ;;
26 | *)
27 | NETWORK_CFG="live"
28 | ;;
29 | esac
30 |
31 | cmake \
32 | -G'Unix Makefiles' \
33 | -DACTIVE_NETWORK=nano_${NETWORK_CFG}_network \
34 | -DNANO_GUI=ON \
35 | -DPORTABLE=1 \
36 | -DCMAKE_BUILD_TYPE=${CONFIGURATION} \
37 | -DCMAKE_VERBOSE_MAKEFILE=ON \
38 | -DQt5_DIR=${qt_dir} \
39 | -DCI_BUILD=true \
40 | -DCI_VERSION_PRE_RELEASE="${ci_version_pre_release}" \
41 | ..
42 |
43 | if [[ "$OS" == 'Linux' ]]; then
44 | cmake --build ${PWD} --target package --config ${CONFIGURATION} -- -j$(nproc)
45 | else
46 | sudo cmake --build ${PWD} --target package --config ${CONFIGURATION} -- -j2
47 | fi
48 |
49 | popd
50 |
--------------------------------------------------------------------------------
/ci/build-docker-image.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -u -x
3 |
4 | if [ "$#" -lt 2 ]; then
5 | echo 'Usage: build-docker-image.sh [...]' >&2
6 | exit 1
7 | fi
8 |
9 | dockerFile="$1"
10 | dockerTag="$2"
11 | githubTag="ghcr.io/${GITHUB_REPOSITORY}/${dockerTag#*/}"
12 | shift
13 | shift
14 |
15 | echo "ci/build-docker-image.sh dockerFile=\"$dockerFile\" dockerTag=\"$dockerTag\" githubTag=\"$githubTag\""
16 |
17 | scripts="$(dirname "$0")"
18 |
19 | echo "Pulling $githubTag"
20 | "$scripts"/custom-timeout.sh 20 docker pull "${githubTag}" || true
21 |
22 | echo "Building $githubTag"
23 | "$scripts"/custom-timeout.sh 60 docker build "$@" --build-arg REPOSITORY=${GITHUB_REPOSITORY} -f "${dockerFile}" -t "${githubTag}" --cache-from "${githubTag}" .
24 |
25 | echo "Tagging ${dockerTag} from ${githubTag}"
26 | docker tag $githubTag $dockerTag
27 |
--------------------------------------------------------------------------------
/ci/build-node.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euox pipefail
3 |
4 | $(dirname "$BASH_SOURCE")/build.sh executables
--------------------------------------------------------------------------------
/ci/build-rhel.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | TAG=$(echo $TAG)
3 | VERSION=$(echo "${TAG}" | sed 's/V//' | sed 's/-/_/g')
4 | RPM_RELEASE=$(echo $RPM_RELEASE)
5 | REPO_TO_BUILD=$(echo $REPO_TO_BUILD)
6 |
7 | run_source() {
8 | ./util/makesrc $TAG $REPO_TO_BUILD
9 | }
10 |
11 | run_build() {
12 | mkdir -p ~/rpmbuild/SOURCES/
13 | mv -f ~/nano-${VERSION}.tar.gz ~/rpmbuild/SOURCES/.
14 | case "${NETWORK}" in
15 | "LIVE")
16 | scl enable gcc-toolset-12 'rpmbuild --nodebuginfo -ba nanocurrency.spec'
17 | ;;
18 | "BETA")
19 | scl enable gcc-toolset-12 'rpmbuild -ba nanocurrency-beta.spec'
20 | ;;
21 | *)
22 | echo "Error: the node network was not defined."
23 | exit 1
24 | ;;
25 | esac
26 | }
27 |
28 | run_update() {
29 | for file in ./nanocurrency*.in; do
30 | outfile="${file//.in/}"
31 |
32 | echo "Updating \"${outfile}\"..."
33 |
34 | rm -f "${file}.new"
35 | awk -v srch="@VERSION@" -v repl="$VERSION" -v srch2="@RELEASE@" -v repl2="$RPM_RELEASE" '{ sub(srch,repl,$0); sub(srch2,repl2, $0); print $0}' <${file} >${file}.new
36 | rm -fr "${outfile}"
37 | cat "${file}.new" >"${outfile}"
38 | rm -f "${file}.new"
39 | chmod 755 "${outfile}"
40 | done
41 | }
42 |
43 | set -x
44 |
45 | run_update
46 | run_source
47 | run_build
48 |
--------------------------------------------------------------------------------
/ci/build-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euox pipefail
3 |
4 | NANO_TEST=ON \
5 | NANO_NETWORK=dev \
6 | NANO_GUI=ON \
7 | $(dirname "$BASH_SOURCE")/build.sh all_tests
--------------------------------------------------------------------------------
/ci/clang-format-check.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | source "$(dirname "$BASH_SOURCE")/impl/common.sh"
6 | source "$(dirname "$BASH_SOURCE")/impl/clang-format.sh"
7 |
8 | ###################################################################################################
9 |
10 | does_clang_format_exist
11 | if [[ $? == 0 ]]; then
12 | clang_format_check
13 | result=$?
14 |
15 | if [[ $result == 2 ]]; then
16 | exit $result
17 | fi
18 |
19 | if [[ $result == 1 ]]; then
20 | echo "Source code formatting differs from expected - please run ci/clang-format-do.sh"
21 | exit 1
22 | fi
23 |
24 | echo "clang-format check passed"
25 | fi
26 |
27 | ###################################################################################################
28 |
--------------------------------------------------------------------------------
/ci/clang-format-do.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | source "$(dirname "$BASH_SOURCE")/impl/common.sh"
6 | source "$(dirname "$BASH_SOURCE")/impl/clang-format.sh"
7 |
8 | ###################################################################################################
9 |
10 | does_clang_format_exist
11 | if [[ $? == 0 ]]; then
12 | clang_format_do
13 | fi
14 |
15 | ###################################################################################################
16 |
--------------------------------------------------------------------------------
/ci/cmake-format-check.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | source "$(dirname "$BASH_SOURCE")/impl/common.sh"
6 | source "$(dirname "$BASH_SOURCE")/impl/cmake-format.sh"
7 |
8 | ###################################################################################################
9 |
10 | does_cmake_format_exist
11 | if [[ $? == 0 ]]; then
12 | cmake_format_check
13 | result=$?
14 |
15 | if [[ $result == 2 ]]; then
16 | exit $result
17 | fi
18 |
19 | if [[ $result == 1 ]]; then
20 | echo "CMake formatting differs from expected - please run ci/cmake-format-do.sh"
21 | exit 1
22 | fi
23 |
24 | echo "cmake-format check passed"
25 | fi
26 |
27 | ###################################################################################################
28 |
--------------------------------------------------------------------------------
/ci/cmake-format-do.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | source "$(dirname "$BASH_SOURCE")/impl/common.sh"
6 | source "$(dirname "$BASH_SOURCE")/impl/cmake-format.sh"
7 |
8 | ###################################################################################################
9 |
10 | does_cmake_format_exist
11 | if [[ $? == 0 ]]; then
12 | cmake_format_do
13 | fi
14 |
15 | ###################################################################################################
16 |
--------------------------------------------------------------------------------
/ci/code-inspector-check.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | source "$(dirname "$BASH_SOURCE")/impl/common.sh"
6 | source "$(dirname "$BASH_SOURCE")/impl/code-inspector.sh"
7 |
8 | ###################################################################################################
9 |
10 | set -o errexit
11 | set -o nounset
12 |
13 | code_inspect "${ROOTPATH:-.}"
14 |
15 | echo "code-inspector check passed"
16 |
17 | ###################################################################################################
18 |
--------------------------------------------------------------------------------
/ci/custom-timeout.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | delay="$1"
3 | shift
4 | while true; do
5 | printf ".\b"
6 | sleep 120
7 | done &
8 | timeout -k 5 "$((delay * 60))" "$@"
9 | exit "$?"
10 |
--------------------------------------------------------------------------------
/ci/impl/code-inspector.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | code_inspect()
6 | {
7 | local SOURCE_ROOT_PATH=$1
8 | if [[ $SOURCE_ROOT_PATH == "" ]]; then
9 | echo "Missing the source code path" >&2
10 | return 1
11 | fi
12 |
13 | # This is to prevent out of scope access in async_write from asio which is not picked up by static analysers
14 | if [[ $(grep -rl --exclude="*asio.hpp" "asio::async_write" $SOURCE_ROOT_PATH/nano) ]]; then
15 | echo "Using boost::asio::async_write directly is not permitted (except in nano/lib/asio.hpp). Use nano::async_write instead" >&2
16 | return 1
17 | fi
18 |
19 | if [[ $(grep -rlP "^\s*assert \(" $SOURCE_ROOT_PATH/nano) ]]; then
20 | echo "Using assert is not permitted. Use debug_assert instead." >&2
21 | return 1
22 | fi
23 |
24 | return 0
25 | }
26 |
27 | ###################################################################################################
28 |
--------------------------------------------------------------------------------
/ci/impl/common.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ###################################################################################################
4 |
5 | ROOTPATH="$(git rev-parse --show-toplevel)"
6 |
7 | ###################################################################################################
8 |
--------------------------------------------------------------------------------
/ci/prepare/linux/prepare-clang.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euox pipefail
3 |
4 | # Clang installer dependencies
5 | DEBIAN_FRONTEND=noninteractive apt-get install -yqq lsb-release software-properties-common gnupg
6 |
7 | CLANG_VERSION=16
8 |
9 | # TODO: Verify integrity (at this time, the clang build is not used for any production artifacts)
10 | curl -O https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh $CLANG_VERSION
11 |
12 | update-alternatives --install /usr/bin/cc cc /usr/bin/clang-$CLANG_VERSION 100
13 | update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-$CLANG_VERSION 100
14 | update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-$CLANG_VERSION 100
15 |
16 | # Workaround to get a path that can be easily passed into cmake for BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE
17 | # See https://www.boost.org/doc/libs/1_70_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3
18 | backtrace_file=$(find /usr/lib/gcc/ -name 'backtrace.h' | head -n 1) && test -f $backtrace_file && ln -s $backtrace_file /usr/local/include/backtrace.h
--------------------------------------------------------------------------------
/ci/prepare/linux/prepare-gcc.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euox pipefail
--------------------------------------------------------------------------------
/ci/prepare/linux/prepare.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euox pipefail
3 |
4 | COMPILER=${COMPILER:-gcc}
5 |
6 | echo "Compiler: '${COMPILER}'"
7 |
8 | # Common dependencies needed for building & testing
9 | DEBIAN_FRONTEND=noninteractive apt-get update -qq
10 |
11 | DEBIAN_FRONTEND=noninteractive apt-get install -yqq \
12 | build-essential \
13 | g++ \
14 | curl \
15 | wget \
16 | python3 \
17 | zlib1g-dev \
18 | cmake \
19 | git \
20 | qtbase5-dev \
21 | qtchooser \
22 | qt5-qmake \
23 | qtbase5-dev-tools \
24 | valgrind \
25 | xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
26 |
27 | # Compiler specific setup
28 | $(dirname "$BASH_SOURCE")/prepare-${COMPILER}.sh
--------------------------------------------------------------------------------
/ci/prepare/macos/prepare.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euox pipefail
3 |
4 | # Homebrew randomly fails to update. Retry 5 times with 15s interval
5 | for i in {1..5}; do brew update && break || { echo "Update failed, retrying..."; sleep 15; }; done
6 |
7 | brew install coreutils
8 |
9 | brew install qt@5
10 | brew link qt@5
11 |
12 | # Workaround: https://github.com/Homebrew/homebrew-core/issues/8392
13 | echo "$(brew --prefix qt@5)/bin" >> $GITHUB_PATH
--------------------------------------------------------------------------------
/ci/prepare/windows/disable-defender.ps1:
--------------------------------------------------------------------------------
1 | $ErrorActionPreference = "Continue"
2 |
3 | Set-MpPreference -DisableArchiveScanning $true
4 | Set-MpPreference -DisableRealtimeMonitoring $true
5 | Set-MpPreference -DisableBehaviorMonitoring $true
--------------------------------------------------------------------------------
/ci/prepare/windows/prepare.ps1:
--------------------------------------------------------------------------------
1 | $ErrorActionPreference = "Stop"
2 |
3 | & "$PSScriptRoot\disable-defender.ps1"
4 | & "$PSScriptRoot\install-qt.ps1"
--------------------------------------------------------------------------------
/ci/tests/common.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | get_exec_extension() {
4 | case "$(uname -s)" in
5 | Linux*|Darwin*)
6 | echo ""
7 | ;;
8 | CYGWIN*|MINGW32*|MSYS*|MINGW*)
9 | echo ".exe"
10 | ;;
11 | *)
12 | echo "Unknown OS"
13 | exit 1
14 | ;;
15 | esac
16 | }
--------------------------------------------------------------------------------
/ci/tests/run-core-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | $(dirname "$BASH_SOURCE")/run-tests.sh core_test
--------------------------------------------------------------------------------
/ci/tests/run-flamegraph-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | # Ensure that an argument is provided
5 | if [ "$#" -ne 1 ]; then
6 | echo "Usage: $0 "
7 | exit 1
8 | fi
9 |
10 | # Capture the argument
11 | ARGUMENT="$1"
12 |
13 | # Run the command with the argument
14 | $(dirname "$BASH_SOURCE")/run-tests.sh slow_test --gtest_filter=flamegraph.${ARGUMENT}
15 |
--------------------------------------------------------------------------------
/ci/tests/run-qt-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | # Alpine doesn't offer an xvfb
5 | xvfb_run_()
6 | {
7 | INIT_DELAY_SEC=3
8 |
9 | Xvfb :2 -screen 0 1024x768x24 &
10 | xvfb_pid=$!
11 | sleep ${INIT_DELAY_SEC}
12 | DISPLAY=:2 $@
13 | res=${?}
14 | kill ${xvfb_pid}
15 |
16 | return ${res}
17 | }
18 |
19 | xvfb_run_ $(dirname "$BASH_SOURCE")/run-tests.sh qt_test
--------------------------------------------------------------------------------
/ci/tests/run-rpc-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | $(dirname "$BASH_SOURCE")/run-tests.sh rpc_test
--------------------------------------------------------------------------------
/ci/tests/show-sanitizer-reports.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -uo pipefail
3 |
4 | issue_reported=false
5 |
6 | # Check for sanitizer reports using glob
7 | shopt -s nullglob
8 | reports=(./sanitizer_report*)
9 |
10 | if [[ ${#reports[@]} -gt 0 ]]; then
11 | for report in "${reports[@]}"; do
12 | report_name=$(basename "${report}")
13 | echo "::group::Report: $report_name"
14 |
15 | cat "${report}"
16 |
17 | echo "::endgroup::"
18 |
19 | issue_reported=true
20 | done
21 | else
22 | echo "No report has been generated."
23 | fi
24 |
25 | echo "issue_reported=${issue_reported}" >> $GITHUB_OUTPUT
26 |
27 | if $issue_reported; then
28 | echo "::error::Issues were reported in the sanitizer report."
29 | exit 1
30 | else
31 | echo "No issues found in the sanitizer reports."
32 | exit 0
33 | fi
--------------------------------------------------------------------------------
/cmake/Modules/CoverageTest.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
2 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -lgcov")
3 | find_program(LCOV_PATH lcov)
4 | message("lcov found: ${LCOV_PATH}")
5 | find_program(GENHTML_PATH genhtml)
6 | message("genhtml found: ${GENHTML_PATH}")
7 | if(NOT CMAKE_COMPILER_IS_GNUCXX)
8 | # Clang version 3.0.0 and greater now supports gcov as well.
9 | message(
10 | WARNING
11 | "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't."
12 | )
13 | if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
14 | message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
15 | endif()
16 | endif()
17 | if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL
18 | "Coverage"))
19 | message(
20 | WARNING
21 | "Code coverage results with an optimized (non-Debug) build may be misleading"
22 | )
23 | endif()
--------------------------------------------------------------------------------
/crypto/blake2/README.md:
--------------------------------------------------------------------------------
1 | # BLAKE2
2 |
3 | This is the reference source code package of BLAKE2, which includes
4 |
5 | * `ref/`: C implementations of BLAKE2b, BLAKE2bp, BLAKE2s, BLAKE2sp,
6 | aimed at portability and simplicity.
7 |
8 | * `sse/`: C implementations of BLAKE2b, BLAKE2bp, BLAKE2s, BLAKE2sp,
9 | optimized for speed on CPUs supporting SSE2, SSSE3, SSE4.1, AVX, or
10 | XOP.
11 |
12 | * `csharp/`: C# implementation of BLAKE2b.
13 |
14 | * `b2sum/`: Command line utility to hash files, based on the `sse/`
15 | implementations.
16 |
17 | * `bench/`: Benchmark tool to measure cycles-per-byte speeds and produce
18 | graphs copyright.
19 |
20 | All code is triple-licensed under the [CC0](http://creativecommons.org/publicdomain/zero/1.0), the [OpenSSL Licence](https://www.openssl.org/source/license.html), or the [Apache Public License 2.0](http://www.apache.org/licenses/LICENSE-2.0),
21 | at your choosing.
22 |
23 | More: [https://blake2.net](https://blake2.net).
24 |
25 | Contact: contact@blake2.net
26 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library (ed25519
2 | ed25519-donna-portable.h
3 | ed25519-hash-custom.h
4 | ed25519-randombytes-custom.h
5 | ed25519.h
6 | ed25519.c)
7 |
8 | target_compile_definitions(ed25519 PUBLIC
9 | -DED25519_CUSTOMHASH
10 | -DED25519_CUSTOMRNG)
11 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/ed25519-hash-custom.h:
--------------------------------------------------------------------------------
1 | /*
2 | a custom hash must have a 512bit digest and implement:
3 |
4 | struct ed25519_hash_context;
5 |
6 | void ed25519_hash_init(ed25519_hash_context *ctx);
7 | void ed25519_hash_update(ed25519_hash_context *ctx, const uint8_t *in, size_t inlen);
8 | void ed25519_hash_final(ed25519_hash_context *ctx, uint8_t *hash);
9 | void ed25519_hash(uint8_t *hash, const uint8_t *in, size_t inlen);
10 | */
11 |
12 | #include
13 |
14 | typedef blake2b_state ed25519_hash_context;
15 |
16 | void ed25519_hash_init (ed25519_hash_context * ctx);
17 |
18 | void ed25519_hash_update (ed25519_hash_context * ctx, uint8_t const * in, size_t inlen);
19 |
20 | void ed25519_hash_final (ed25519_hash_context * ctx, uint8_t * out);
21 |
22 | void ed25519_hash (uint8_t * out, uint8_t const * in, size_t inlen);
23 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/ed25519-randombytes-custom.h:
--------------------------------------------------------------------------------
1 | /*
2 | a custom randombytes must implement:
3 |
4 | void ED25519_FN(ed25519_randombytes_unsafe) (void *p, size_t len);
5 |
6 | ed25519_randombytes_unsafe is used by the batch verification function
7 | to create random scalars
8 | */
9 |
10 | void ed25519_randombytes_unsafe (void * out, size_t outlen);
--------------------------------------------------------------------------------
/crypto/ed25519-donna/ed25519.h:
--------------------------------------------------------------------------------
1 | #ifndef ED25519_H
2 | #define ED25519_H
3 |
4 | #include
5 |
6 | #if defined(__cplusplus)
7 | extern "C" {
8 | #endif
9 |
10 | typedef unsigned char ed25519_signature[64];
11 | typedef unsigned char ed25519_public_key[32];
12 | typedef unsigned char ed25519_secret_key[32];
13 |
14 | typedef unsigned char curved25519_key[32];
15 |
16 | void ed25519_publickey(const ed25519_secret_key sk, ed25519_public_key pk);
17 | int ed25519_sign_open(const unsigned char *m, size_t mlen, const ed25519_public_key pk, const ed25519_signature RS);
18 | void ed25519_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, const ed25519_public_key pk, ed25519_signature RS);
19 |
20 | int ed25519_sign_open_batch(const unsigned char **m, size_t *mlen, const unsigned char **pk, const unsigned char **RS, size_t num, int *valid);
21 |
22 | void ed25519_randombytes_unsafe(void *out, size_t count);
23 |
24 | void curved25519_scalarmult_basepoint(curved25519_key pk, const curved25519_key e);
25 |
26 | #if defined(__cplusplus)
27 | }
28 | #endif
29 |
30 | #endif // ED25519_H
31 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/fuzz/curve25519-ref10.h:
--------------------------------------------------------------------------------
1 | #ifndef CURVE25519_REF10_H
2 | #define CURVE25519_REF10_H
3 |
4 | int crypto_scalarmult_base_ref10(unsigned char *q,const unsigned char *n);
5 | int crypto_scalarmult_ref10(unsigned char *q, const unsigned char *n, const unsigned char *p);
6 |
7 | #endif /* CURVE25519_REF10_H */
8 |
9 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/fuzz/ed25519-donna-sse2.c:
--------------------------------------------------------------------------------
1 | #define ED25519_SUFFIX _sse2
2 | #define ED25519_SSE2
3 | #include "../ed25519.c"
4 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/fuzz/ed25519-donna.c:
--------------------------------------------------------------------------------
1 | #include "../ed25519.c"
2 |
--------------------------------------------------------------------------------
/crypto/ed25519-donna/fuzz/ed25519-ref10.h:
--------------------------------------------------------------------------------
1 | #ifndef ED25519_REF10_H
2 | #define ED25519_REF10_H
3 |
4 | int crypto_sign_pk_ref10(unsigned char *pk,unsigned char *sk);
5 | int crypto_sign_ref10(unsigned char *sm,unsigned long long *smlen,const unsigned char *m,unsigned long long mlen,const unsigned char *sk);
6 | int crypto_sign_open_ref10(unsigned char *m,unsigned long long *mlen,const unsigned char *sm,unsigned long long smlen,const unsigned char *pk);
7 |
8 | #endif /* ED25519_REF10_H */
9 |
10 |
--------------------------------------------------------------------------------
/debian-control/postinst.in:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set +e
4 |
5 | useradd -r nanocurrency
6 | groupadd -r nanocurrency
7 |
8 | mkdir -p /var/nanocurrency/Nano
9 | mkdir -p /var/nanocurrency/NanoBeta
10 | mkdir -p /var/nanocurrency/NanoTest
11 | chown -R nanocurrency: /var/nanocurrency
12 |
13 | systemctl stop ${NANO_SERVICE} 2>/dev/null
14 | systemctl disable ${NANO_SERVICE} 2>/dev/null
15 | cp ${CMAKE_INSTALL_PREFIX}/extras/systemd/${NANO_SERVICE} /etc/systemd/system/${NANO_SERVICE}
16 | systemctl daemon-reload
17 | systemctl enable ${NANO_SERVICE}
18 | systemctl start ${NANO_SERVICE}
19 | sleep 1
20 | systemctl --no-pager status ${NANO_SERVICE}
21 |
22 | set -e
23 |
--------------------------------------------------------------------------------
/debian-control/postrm.in:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set +e
4 |
5 | systemctl stop ${NANO_SERVICE} 2>/dev/null
6 | systemctl disable ${NANO_SERVICE} 2>/dev/null
7 | rm -rf /etc/systemd/system/${NANO_SERVICE}
8 | systemctl daemon-reload
9 |
10 | set -e
11 |
--------------------------------------------------------------------------------
/doc/diagram/.empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/doc/diagram/.empty
--------------------------------------------------------------------------------
/docker/ci/Dockerfile-base:
--------------------------------------------------------------------------------
1 | FROM ubuntu:22.04
2 |
3 | ENV DEBIAN_FRONTEND=noninteractive
4 |
5 | RUN apt-get update -qq && apt-get install -yqq \
6 | build-essential \
7 | g++ \
8 | wget \
9 | python3 \
10 | zlib1g-dev \
11 | cmake \
12 | git
13 |
14 | RUN apt-get update -qq && apt-get install -yqq \
15 | qtbase5-dev \
16 | qtchooser \
17 | qt5-qmake \
18 | qtbase5-dev-tools \
19 | valgrind \
20 | xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
21 |
22 | ARG REPOSITORY=nanocurrency/nano-node
23 | LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
24 |
--------------------------------------------------------------------------------
/docker/ci/Dockerfile-clang:
--------------------------------------------------------------------------------
1 | ARG ENV_REPOSITORY=nanocurrency/nano-env
2 | FROM ${ENV_REPOSITORY}:base
3 |
4 | RUN apt-get update -qq && apt-get install -yqq \
5 | clang \
6 | lldb
7 |
8 | ENV CXX=/usr/bin/clang++
9 | ENV CC=/usr/bin/clang
10 | RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
11 | RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
12 |
13 | # workaround to get a path that can be easily passed into cmake for
14 | # BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE
15 | # see https://www.boost.org/doc/libs/1_70_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3
16 |
17 | RUN backtrace_file=$(find /usr/lib/gcc/ -name 'backtrace.h' | head -n 1) && test -f $backtrace_file && ln -s $backtrace_file /tmp/backtrace.h
18 |
19 | ARG REPOSITORY=nanocurrency/nano-node
20 | LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
21 |
--------------------------------------------------------------------------------
/docker/ci/Dockerfile-gcc:
--------------------------------------------------------------------------------
1 | ARG ENV_REPOSITORY=nanocurrency/nano-env
2 | FROM ${ENV_REPOSITORY}:base
3 |
4 | ARG REPOSITORY=nanocurrency/nano-node
5 | LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
6 |
--------------------------------------------------------------------------------
/docker/ci/Dockerfile-rhel:
--------------------------------------------------------------------------------
1 | FROM rockylinux:8
2 |
3 | WORKDIR /workspace
4 |
5 | RUN yum update -y
6 | RUN yum install -y git wget openssl bzip2
7 | RUN yum install -y rpm-build
8 | RUN yum install -y glibc-devel glibc-headers make which
9 | RUN yum install -y cmake gcc-toolset-12
10 | RUN yum install -y python38
11 |
--------------------------------------------------------------------------------
/docker/ci/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | REPO_ROOT=`git rev-parse --show-toplevel`
3 | pushd $REPO_ROOT
4 | docker build -f docker/ci/Dockerfile -t nano-ci:latest .
5 | popd
6 |
--------------------------------------------------------------------------------
/docker/node/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | network='live'
4 |
5 | print_usage() {
6 | echo 'build.sh [-h] [-n {live|beta|dev}]'
7 | }
8 |
9 | while getopts 'hn:' OPT; do
10 | case "${OPT}" in
11 | h)
12 | print_usage
13 | exit 0
14 | ;;
15 | n)
16 | network="${OPTARG}"
17 | ;;
18 | *)
19 | print_usage >&2
20 | exit 1
21 | ;;
22 | esac
23 | done
24 |
25 | case "${network}" in
26 | live)
27 | network_tag=''
28 | ;;
29 | dev | beta)
30 | network_tag="-${network}"
31 | ;;
32 | *)
33 | echo "Invalid network: ${network}" >&2
34 | exit 1
35 | ;;
36 | esac
37 |
38 | REPO_ROOT=$(git rev-parse --show-toplevel)
39 | COMMIT_SHA=$(git rev-parse --short HEAD)
40 | pushd $REPO_ROOT
41 | docker build --build-arg NETWORK="${network}" -f docker/node/Dockerfile -t nano-node${network_tag}:latest .
42 | popd
43 |
--------------------------------------------------------------------------------
/docker/node/config/config-node.toml:
--------------------------------------------------------------------------------
1 |
2 | [node.websocket]
3 |
4 | # WebSocket server bind address.
5 | # type:string,ip
6 | address = "::ffff:0.0.0.0"
7 | # Enable or disable WebSocket server.
8 | # type:bool
9 | enable = true
10 |
11 | [rpc]
12 |
13 | # Enable or disable RPC.
14 | # type:bool
15 | enable = true
16 |
--------------------------------------------------------------------------------
/docker/node/config/config-rpc.toml:
--------------------------------------------------------------------------------
1 |
2 | # Bind address for the RPC server
3 | # type:string,ip
4 | address = "::ffff:0.0.0.0"
5 |
6 | # Enable or disable control-level requests
7 | # type:bool
8 | enable_control = false
9 |
--------------------------------------------------------------------------------
/docker/sign/Dockerfile-signer:
--------------------------------------------------------------------------------
1 | FROM python:3.9-buster
2 |
3 |
4 | ENV DEBIAN_FRONTEND="noninteractive"
5 | ENV TZ="America/Los_Angeles"
6 | ENV GPG_TTY=/dev/console
7 |
8 | ARG GPG_PRIVATE_KEY
9 | ARG GPG_SIGNER
10 |
11 | ## Install required for rpm signing
12 | RUN apt-get update -yqq && \
13 | apt-get install -y librpmsign8 gnupg2 wget rpm
14 |
15 | ## Additional for mkrepo support
16 | RUN python3 -m pip install mkrepo boto3
17 |
18 | #WORKDIR /signing
19 | #RUN python3 -m venv && .venv/bin/pip install mkrepo
20 |
21 | ## Control Entrypoint
22 | ADD docker/sign/entry.sh /usr/local/bin/entry.sh
23 |
24 | ENTRYPOINT [ "entry.sh" ]
25 |
--------------------------------------------------------------------------------
/docker/sign/README.MD:
--------------------------------------------------------------------------------
1 | ## Usage
2 |
3 | ### Build
4 |
5 | `docker build . -f docker/sign/Dockerfile-signer -t `
6 |
7 | ### Required Variables
8 | * GPG_PRIVATE_KEY -> base64 encoded GPG private signing key
9 | * GPG_SIGNER -> key id to sign with, must match GPG_PRIVATE_KEY
10 | * S3_ACCESS_KEY_ID -> S3 Key with access to rpm/repo
11 | * S3_SECRET_ACCES_KEY -> S3 Secret for S3_ACCESS_KEY_ID
12 |
13 | ### Sign RPM artifacts
14 | `docker run --rm -it -e GPG_PRIVATE_KEY -e GPG_SIGNER -v :/tmp rpm-sign /tmp`
15 |
16 | ### Upload RPM artifacts
17 | Upload artifacts to appropriate location
18 |
19 | ### Update Repo Metadata Files
20 |
21 | `docker run --rm -it -e GPG_PRIVATE_KEY -e GPG_SIGNER -e S3_ACCESS_KEY_ID -e S3_SECRET_ACCESS_KEY repo-update `
--------------------------------------------------------------------------------
/doxygen/MAIN_PAGE.md:
--------------------------------------------------------------------------------
1 | This provides a basic source-code generated documentation for the core classes of the nano-node.
2 | Doxygen docs may look a bit overwhelming as it tries to document all the smaller pieces of code. For
3 | this reason only the files from `nano` directory were added to this. Some other
4 | files were also excluded as the `EXCLUDE_PATTERN` configuration stated below.
5 |
6 | EXCLUDE_PATTERNS = */nano/*_test/* \
7 | */nano/test_common/* \
8 | */nano/boost/* \
9 | */nano/qt/* \
10 | */nano/nano_wallet/*
11 |
12 |
--------------------------------------------------------------------------------
/etc/gpg/clemahieu.asc:
--------------------------------------------------------------------------------
1 | -----BEGIN PGP PUBLIC KEY BLOCK-----
2 |
3 | mDMEXZTdLxYJKwYBBAHaRw8BAQdAPXgGtAVcgz+RNJRvSgk1YrV5bzEYxG1QY8g6
4 | g1J/Hbu0JENvbGluIExlTWFoaWV1IDxjbGVtYWhpZXVAZ21haWwuY29tPoiQBBMW
5 | CAA4FiEEOp9RXuwHACGmDlkdQ3CFIMjfuTgFAl2U3S8CGwMFCwkIBwIGFQoJCAsC
6 | BBYCAwECHgECF4AACgkQQ3CFIMjfuTjO1wD/fD8d8f1Vv7HUiBc/rFDUZWDS4eYq
7 | VvYxoTVows4otP4A/1DDpZs7xfM1uZjhgIZhUP1pMmLpDj5qmnK1w+9GGj4EuDgE
8 | XZTdLxIKKwYBBAGXVQEFAQEHQM+vDx1fYPjMlF8aMTdJF7iTe+17VQWsQeEwDOG5
9 | qCISAwEIB4h4BBgWCAAgFiEEOp9RXuwHACGmDlkdQ3CFIMjfuTgFAl2U3S8CGwwA
10 | CgkQQ3CFIMjfuTgi+QEA/Nnz32RFBCzErI7WwvsEVL6NJCihqEiRiKG7FvaDd20A
11 | /R87rAQzAkyuCekif5eCQ7V6HD1uBTSTDCIOKM/QDcoA
12 | =A+a5
13 | -----END PGP PUBLIC KEY BLOCK-----
14 |
--------------------------------------------------------------------------------
/etc/systemd/nanocurrency-beta.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Nano Beta Network Daemon
3 | After=network.target
4 |
5 | [Service]
6 | Type=simple
7 | User=nanocurrency
8 | WorkingDirectory=/var/nanocurrency/NanoBeta
9 | ExecStart=/usr/bin/nano_node --daemon --network=beta --data_path=/var/nanocurrency/NanoBeta
10 | Restart=on-failure
11 |
12 | [Install]
13 | WantedBy=multi-user.target
14 |
--------------------------------------------------------------------------------
/etc/systemd/nanocurrency-test.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Nano Test Network Daemon
3 | After=network.target
4 |
5 | [Service]
6 | Type=simple
7 | User=nanocurrency
8 | WorkingDirectory=/var/nanocurrency/NanoTest
9 | ExecStart=/usr/bin/nano_node --daemon --network=test --data_path=/var/nanocurrency/NanoTest
10 | Restart=on-failure
11 |
12 | [Install]
13 | WantedBy=multi-user.target
14 |
--------------------------------------------------------------------------------
/etc/systemd/nanocurrency.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Nano Live Network Daemon
3 | After=network.target
4 |
5 | [Service]
6 | Type=simple
7 | User=nanocurrency
8 | WorkingDirectory=/var/nanocurrency/Nano
9 | ExecStart=/usr/bin/nano_node --daemon --data_path=/var/nanocurrency/Nano
10 | Restart=on-failure
11 |
12 | [Install]
13 | WantedBy=multi-user.target
14 |
--------------------------------------------------------------------------------
/images/attack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/attack.png
--------------------------------------------------------------------------------
/images/confirmation - complex.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/confirmation - complex.gif
--------------------------------------------------------------------------------
/images/confirmation - easy.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/confirmation - easy.gif
--------------------------------------------------------------------------------
/images/confirmation - simple.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/confirmation - simple.gif
--------------------------------------------------------------------------------
/images/fan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/fan.png
--------------------------------------------------------------------------------
/images/fork.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/fork.gif
--------------------------------------------------------------------------------
/images/transaction.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/images/transaction.gif
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/logo.png
--------------------------------------------------------------------------------
/nano/benchmarks/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(benchmarks entry.cpp ledger.cpp stats.cpp)
2 |
3 | target_link_libraries(benchmarks test_common benchmark::benchmark)
4 |
5 | include_directories(${CMAKE_SOURCE_DIR}/submodules)
6 |
--------------------------------------------------------------------------------
/nano/benchmarks/entry.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | // Customized main, based on BENCHMARK_MAIN macro
6 | int main (int argc, char ** argv)
7 | {
8 | nano::logger::initialize_dummy ();
9 |
10 | benchmark::MaybeReenterWithoutASLR (argc, argv);
11 | char arg0_default[] = "benchmark";
12 | char * args_default = reinterpret_cast (arg0_default);
13 | if (!argv)
14 | {
15 | argc = 1;
16 | argv = &args_default;
17 | }
18 | ::benchmark::Initialize (&argc, argv);
19 | if (::benchmark::ReportUnrecognizedArguments (argc, argv))
20 | return 1;
21 | ::benchmark::RunSpecifiedBenchmarks ();
22 | ::benchmark::Shutdown ();
23 | return 0;
24 | }
25 |
26 | static void BM_StringCreation (benchmark::State & state)
27 | {
28 | for (auto _ : state)
29 | std::string empty_string;
30 | }
31 | // Register the function as a benchmark
32 | BENCHMARK (BM_StringCreation);
33 |
34 | // Define another benchmark
35 | static void BM_StringCopy (benchmark::State & state)
36 | {
37 | std::string x = "hello";
38 | for (auto _ : state)
39 | std::string copy (x);
40 | }
41 | BENCHMARK (BM_StringCopy);
--------------------------------------------------------------------------------
/nano/boost/asio/basic_stream_socket.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/bind_executor.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/buffer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/connect.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/deadline_timer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/dispatch.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/executor_work_guard.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/io_context.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/ip/address.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/ip/address_v6.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/ip/network_v6.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/ip/tcp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/local/stream_protocol.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/post.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/read.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/spawn.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/steady_timer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/strand.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/thread_pool.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/asio/write.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_ASIO_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/core.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/core/flat_buffer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/http.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/http/message.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/http/string_body.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/version.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/beast/websocket.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/private/macro_warnings.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef _WIN32
4 | #define DISABLE_ASIO_WARNINGS \
5 | __pragma (warning (push)) \
6 | __pragma (warning (disable : 4191)) \
7 | __pragma (warning (disable : 4242))
8 |
9 | #else
10 | #define DISABLE_ASIO_WARNINGS
11 | #endif
12 |
13 | #ifdef _WIN32
14 | #define REENABLE_WARNINGS \
15 | __pragma (warning (pop))
16 | #else
17 | #define REENABLE_WARNINGS
18 | #endif
19 |
20 | #define DISABLE_BEAST_WARNINGS DISABLE_ASIO_WARNINGS
21 |
22 | #ifdef _WIN32
23 | #define DISABLE_PROCESS_WARNINGS \
24 | __pragma (warning (push)) \
25 | __pragma (warning (disable : 4191)) \
26 | __pragma (warning (disable : 4242)) \
27 | __pragma (warning (disable : 4244))
28 | #else
29 | #define DISABLE_PROCESS_WARNINGS
30 | #endif
31 |
--------------------------------------------------------------------------------
/nano/boost/process/child.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | DISABLE_BEAST_WARNINGS
6 | #include
7 | REENABLE_WARNINGS
8 |
--------------------------------------------------------------------------------
/nano/boost/readme.txt:
--------------------------------------------------------------------------------
1 | These are files which wrap other boost files and suppress compiler warnings associated with them.
--------------------------------------------------------------------------------
/nano/core_test/assert.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | TEST (assert_DeathTest, debug_assert)
6 | {
7 | debug_assert (true);
8 | ASSERT_DEATH (debug_assert (false, "test"), ".*Assertion `false` failed: test.*");
9 | }
10 |
11 | TEST (assert_DeathTest, release_assert)
12 | {
13 | release_assert (true);
14 | ASSERT_DEATH (release_assert (false, "test"), ".*Assertion `false` failed: test.*");
15 | }
--------------------------------------------------------------------------------
/nano/core_test/entry.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | namespace nano
11 | {
12 | namespace test
13 | {
14 | void cleanup_dev_directories_on_exit ();
15 | }
16 | void force_nano_dev_network ();
17 | }
18 |
19 | GTEST_API_ int main (int argc, char ** argv)
20 | {
21 | nano::initialize_file_descriptor_limit ();
22 | nano::logger::initialize_for_tests (nano::log_config::tests_default ());
23 | nano::force_nano_dev_network ();
24 | nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard;
25 | testing::InitGoogleTest (&argc, argv);
26 | auto res = RUN_ALL_TESTS ();
27 | nano::test::cleanup_dev_directories_on_exit ();
28 | return res;
29 | }
30 |
--------------------------------------------------------------------------------
/nano/core_test/random.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
--------------------------------------------------------------------------------
/nano/core_test/random_pool.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | #include
7 |
8 | TEST (random_pool, multithreading)
9 | {
10 | std::vector threads;
11 | for (auto i = 0; i < 100; ++i)
12 | {
13 | threads.emplace_back ([] () {
14 | nano::uint256_union number;
15 | nano::random_pool::generate_block (number.bytes.data (), number.bytes.size ());
16 | });
17 | }
18 | for (auto & i : threads)
19 | {
20 | i.join ();
21 | }
22 | }
23 |
24 | // Test that random 64bit numbers are within the given range
25 | TEST (random_pool, generate_word64)
26 | {
27 | int occurrences[10] = { 0 };
28 | for (auto i = 0; i < 1000; ++i)
29 | {
30 | auto random = nano::random_pool::generate_word64 (1, 9);
31 | ASSERT_TRUE (random >= 1 && random <= 9);
32 | occurrences[random] += 1;
33 | }
34 |
35 | for (auto i = 1; i < 10; ++i)
36 | {
37 | ASSERT_GT (occurrences[i], 0);
38 | }
39 | }
40 |
41 | // Test random numbers > uint32 max
42 | TEST (random_pool, generate_word64_big_number)
43 | {
44 | uint64_t min = static_cast (std::numeric_limits::max ()) + 1;
45 | uint64_t max = std::numeric_limits::max ();
46 | auto big_random = nano::random_pool::generate_word64 (min, max);
47 | ASSERT_GE (big_random, min);
48 | }
49 |
--------------------------------------------------------------------------------
/nano/core_test/stacktrace.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | // Check that the stacktrace contains the current function name
6 | // This depends on the way testcase names are compiled by gtest
7 | // Current name: "stacktrace_human_readable_Test::TestBody()"
8 | TEST (stacktrace, human_readable)
9 | {
10 | auto stacktrace = nano::generate_stacktrace ();
11 | std::cout << stacktrace << std::endl;
12 | ASSERT_FALSE (stacktrace.empty ());
13 | ASSERT_TRUE (stacktrace.find ("stacktrace_human_readable_Test") != std::string::npos);
14 | }
--------------------------------------------------------------------------------
/nano/core_test/throttle.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | TEST (throttle, construction)
6 | {
7 | nano::bootstrap::throttle throttle{ 2 };
8 | ASSERT_FALSE (throttle.throttled ());
9 | }
10 |
11 | TEST (throttle, throttled)
12 | {
13 | nano::bootstrap::throttle throttle{ 2 };
14 | throttle.add (false);
15 | ASSERT_FALSE (throttle.throttled ());
16 | throttle.add (false);
17 | ASSERT_TRUE (throttle.throttled ());
18 | }
19 |
20 | TEST (throttle, resize_up)
21 | {
22 | nano::bootstrap::throttle throttle{ 2 };
23 | throttle.add (false);
24 | throttle.resize (4);
25 | ASSERT_FALSE (throttle.throttled ());
26 | throttle.add (false);
27 | ASSERT_TRUE (throttle.throttled ());
28 | }
29 |
30 | TEST (throttle, resize_down)
31 | {
32 | nano::bootstrap::throttle throttle{ 4 };
33 | throttle.add (false);
34 | ASSERT_FALSE (throttle.throttled ());
35 | throttle.resize (2);
36 | ASSERT_FALSE (throttle.throttled ());
37 | throttle.add (false);
38 | ASSERT_TRUE (throttle.throttled ());
39 | }
40 |
--------------------------------------------------------------------------------
/nano/crypto/blake2/blake2.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef _WIN32
4 | #pragma warning(push)
5 | #pragma warning(disable : 4804)
6 | #endif
7 |
8 | #include
9 |
10 | #ifdef _WIN32
11 | #pragma warning(pop)
12 | #endif
13 |
--------------------------------------------------------------------------------
/nano/crypto/readme.txt:
--------------------------------------------------------------------------------
1 | These are files which wrap other crypto/ third party files and suppress compiler warnings associated with them.
--------------------------------------------------------------------------------
/nano/crypto_lib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(nano_ed25519 interface.cpp)
2 |
3 | target_link_libraries(ed25519 nano_ed25519)
4 |
5 | add_library(crypto_lib random_pool.hpp random_pool.cpp random_pool_shuffle.hpp
6 | secure_memory.hpp secure_memory.cpp)
7 |
8 | target_link_libraries(crypto_lib blake2 ed25519 ${CRYPTOPP_LIBRARY})
9 |
--------------------------------------------------------------------------------
/nano/crypto_lib/interface.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | extern "C" {
5 | #include
6 | void ed25519_randombytes_unsafe (void * out, size_t outlen)
7 | {
8 | nano::random_pool::generate_block (reinterpret_cast (out), outlen);
9 | }
10 | void ed25519_hash_init (ed25519_hash_context * ctx)
11 | {
12 | blake2b_init (ctx, 64);
13 | }
14 |
15 | void ed25519_hash_update (ed25519_hash_context * ctx, uint8_t const * in, size_t inlen)
16 | {
17 | blake2b_update (ctx, in, inlen);
18 | }
19 |
20 | void ed25519_hash_final (ed25519_hash_context * ctx, uint8_t * out)
21 | {
22 | blake2b_final (ctx, out, 64);
23 | }
24 |
25 | void ed25519_hash (uint8_t * out, uint8_t const * in, size_t inlen)
26 | {
27 | ed25519_hash_context ctx;
28 | ed25519_hash_init (&ctx);
29 | ed25519_hash_update (&ctx, in, inlen);
30 | ed25519_hash_final (&ctx, out);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/nano/crypto_lib/random_pool.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | void nano::random_pool::generate_block (unsigned char * output, size_t size)
7 | {
8 | auto & pool = get_pool ();
9 | pool.GenerateBlock (output, size);
10 | }
11 |
12 | unsigned nano::random_pool::generate_word32 (unsigned min, unsigned max)
13 | {
14 | auto & pool = get_pool ();
15 | return pool.GenerateWord32 (min, max);
16 | }
17 |
18 | uint64_t nano::random_pool::generate_word64 (uint64_t min, uint64_t max)
19 | {
20 | auto & pool = get_pool ();
21 |
22 | const auto range = max - min;
23 | const auto max_bits = CryptoPP::BitPrecision (range);
24 |
25 | uint64_t value;
26 |
27 | do
28 | {
29 | pool.GenerateBlock ((unsigned char *)&value, sizeof (value));
30 | value = CryptoPP::Crop (value, max_bits);
31 | } while (value > range);
32 |
33 | return value + min;
34 | }
35 |
36 | unsigned char nano::random_pool::generate_byte ()
37 | {
38 | auto & pool = get_pool ();
39 | return pool.GenerateByte ();
40 | }
41 |
42 | CryptoPP::AutoSeededRandomPool & nano::random_pool::get_pool ()
43 | {
44 | static thread_local CryptoPP::AutoSeededRandomPool pool;
45 | return pool;
46 | }
47 |
--------------------------------------------------------------------------------
/nano/crypto_lib/random_pool_shuffle.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace nano
8 | {
9 | template
10 | void random_pool_shuffle (Iter begin, Iter end)
11 | {
12 | random_pool::get_pool ().Shuffle (begin, end);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/nano/crypto_lib/secure_memory.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #ifdef _MSC_VER
4 | #include
5 | #endif
6 | #if defined __STDC_LIB_EXT1__
7 | #define __STDC_WANT_LIB_EXT1__ 1
8 | #endif
9 |
10 | /* for explicit_bzero() on glibc */
11 | #ifndef _DEFAULT_SOURCE
12 | #define _DEFAULT_SOURCE
13 | #endif
14 |
15 | #include
16 |
17 | #if defined(__clang__)
18 | #if __has_attribute(optnone)
19 | #define NOT_OPTIMIZED __attribute__ ((optnone))
20 | #endif
21 | #elif defined(__GNUC__)
22 | #define NOT_OPTIMIZED __attribute__ ((optimize ("O0")))
23 | #endif
24 | #ifndef NOT_OPTIMIZED
25 | #define NOT_OPTIMIZED
26 | #endif
27 |
28 | #if defined(__OpenBSD__)
29 | #define HAVE_EXPLICIT_BZERO 1
30 | #elif defined(__GLIBC__) && defined(__GLIBC_PREREQ)
31 | #if __GLIBC_PREREQ(2, 25)
32 | #define HAVE_EXPLICIT_BZERO 1
33 | #endif
34 | #endif
35 |
36 | void NOT_OPTIMIZED nano::secure_wipe_memory (void * v, size_t n)
37 | {
38 | #if defined(_MSC_VER)
39 | SecureZeroMemory (v, n);
40 | #elif defined memset_s
41 | memset_s (v, n, 0, n);
42 | #elif defined(HAVE_EXPLICIT_BZERO)
43 | explicit_bzero (v, n);
44 | #else
45 | memset (v, 0, n);
46 | #endif
47 | }
48 |
--------------------------------------------------------------------------------
/nano/crypto_lib/secure_memory.hpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #if defined(__clang__)
4 | #if __has_attribute(optnone)
5 | #define NOT_OPTIMIZED __attribute__ ((optnone))
6 | #endif
7 | #elif defined(__GNUC__)
8 | #define NOT_OPTIMIZED __attribute__ ((optimize ("O0")))
9 | #endif
10 | #ifndef NOT_OPTIMIZED
11 | #define NOT_OPTIMIZED
12 | #endif
13 |
14 | namespace nano
15 | {
16 | void NOT_OPTIMIZED secure_wipe_memory (void * v, size_t n);
17 | }
--------------------------------------------------------------------------------
/nano/fuzzer_test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(fuzz_buffer fuzz_buffer.cpp)
2 | target_compile_options(fuzz_buffer PUBLIC -fsanitize=fuzzer)
3 | target_link_libraries(fuzz_buffer PRIVATE -fsanitize=fuzzer node gtest)
4 |
5 | add_executable(fuzz_bignum fuzz_bignum.cpp)
6 | target_compile_options(fuzz_bignum PUBLIC -fsanitize=fuzzer)
7 | target_link_libraries(fuzz_bignum PRIVATE -fsanitize=fuzzer node gtest)
8 |
9 | add_executable(fuzz_endpoint_parsing fuzz_endpoint_parsing.cpp)
10 | target_compile_options(fuzz_endpoint_parsing PUBLIC -fsanitize=fuzzer)
11 | target_link_libraries(fuzz_endpoint_parsing PRIVATE -fsanitize=fuzzer node
12 | gtest)
13 |
--------------------------------------------------------------------------------
/nano/fuzzer_test/fuzz_bignum.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | /** Fuzz decimal, hex and account parsing */
4 | void fuzz_bignum_parsers (uint8_t const * Data, size_t Size)
5 | {
6 | try
7 | {
8 | auto data (std::string (reinterpret_cast (const_cast (Data)), Size));
9 | nano::uint128_union u128;
10 | u128.decode_dec (data);
11 | u128.decode_hex (data);
12 |
13 | nano::uint256_union u256;
14 | u256.decode_dec (data);
15 | u256.decode_hex (data);
16 |
17 | nano::uint512_union u512;
18 | u512.decode_hex (data);
19 |
20 | nano::public_key pkey;
21 | pkey.decode_account (data);
22 |
23 | uint64_t out;
24 | nano::from_string_hex (data, out);
25 | }
26 | catch (std::out_of_range const &)
27 | {
28 | }
29 | }
30 |
31 | /** Fuzzer entry point */
32 | extern "C" int LLVMFuzzerTestOneInput (uint8_t const * Data, size_t Size)
33 | {
34 | fuzz_bignum_parsers (Data, Size);
35 | return 0;
36 | }
37 |
--------------------------------------------------------------------------------
/nano/fuzzer_test/fuzz_endpoint_parsing.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | /** Fuzz endpoint parsing */
4 | void fuzz_endpoint_parsing (uint8_t const * Data, size_t Size)
5 | {
6 | auto data (std::string (reinterpret_cast (const_cast (Data)), Size));
7 | nano::endpoint endpoint;
8 | nano::parse_endpoint (data, endpoint);
9 | nano::tcp_endpoint tcp_endpoint;
10 | nano::parse_tcp_endpoint (data, tcp_endpoint);
11 | }
12 |
13 | /** Fuzzer entry point */
14 | extern "C" int LLVMFuzzerTestOneInput (uint8_t const * Data, size_t Size)
15 | {
16 | fuzz_endpoint_parsing (Data, Size);
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/nano/ipc_flatbuffers_lib/flatbuffer_producer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | nano::ipc::flatbuffer_producer::flatbuffer_producer ()
4 | {
5 | fbb = std::make_shared ();
6 | }
7 |
8 | nano::ipc::flatbuffer_producer::flatbuffer_producer (std::shared_ptr const & builder_a) :
9 | fbb (builder_a)
10 | {
11 | }
12 |
13 | void nano::ipc::flatbuffer_producer::make_error (int code, std::string const & message)
14 | {
15 | auto msg = fbb->CreateString (message);
16 | nanoapi::ErrorBuilder builder (*fbb);
17 | builder.add_code (code);
18 | builder.add_message (msg);
19 | create_builder_response (builder);
20 | }
21 |
22 | void nano::ipc::flatbuffer_producer::set_correlation_id (std::string const & correlation_id_a)
23 | {
24 | correlation_id = correlation_id_a;
25 | }
26 |
27 | void nano::ipc::flatbuffer_producer::set_credentials (std::string const & credentials_a)
28 | {
29 | credentials = credentials_a;
30 | }
31 |
32 | std::shared_ptr nano::ipc::flatbuffer_producer::get_shared_flatbuffer () const
33 | {
34 | return fbb;
35 | }
36 |
--------------------------------------------------------------------------------
/nano/ipc_flatbuffers_test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(ipc_flatbuffers_test_client entry.cpp)
2 |
3 | target_link_libraries(ipc_flatbuffers_test_client node)
4 |
--------------------------------------------------------------------------------
/nano/lib/block_type.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | std::string_view nano::to_string (nano::block_type type)
5 | {
6 | return nano::enum_util::name (type);
7 | }
8 |
--------------------------------------------------------------------------------
/nano/lib/block_type.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace nano
7 | {
8 | enum class block_type : uint8_t
9 | {
10 | invalid = 0,
11 | not_a_block = 1,
12 | send = 2,
13 | receive = 3,
14 | open = 4,
15 | change = 5,
16 | state = 6
17 | };
18 |
19 | std::string_view to_string (block_type);
20 | } // namespace nano
21 |
--------------------------------------------------------------------------------
/nano/lib/block_uniquer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace nano
8 | {
9 | class block;
10 | using block_uniquer = nano::uniquer;
11 | }
12 |
--------------------------------------------------------------------------------
/nano/lib/cli.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace nano
8 | {
9 | class config_key_value_pair
10 | {
11 | public:
12 | std::string key;
13 | std::string value;
14 | };
15 |
16 | std::vector config_overrides (std::vector const & key_value_pairs_a);
17 |
18 | std::istream & operator>> (std::istream & is, nano::config_key_value_pair & into);
19 | }
20 |
--------------------------------------------------------------------------------
/nano/lib/common.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace boost::asio::ip
4 | {
5 | class address;
6 | class tcp;
7 | template
8 | class basic_endpoint;
9 | }
10 |
11 | namespace nano
12 | {
13 | using ip_address = boost::asio::ip::address;
14 | using endpoint = boost::asio::ip::basic_endpoint;
15 | using tcp_endpoint = endpoint;
16 | }
17 |
--------------------------------------------------------------------------------
/nano/lib/container_info.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | nano::container_info_composite::container_info_composite (std::string name) :
4 | name (std::move (name))
5 | {
6 | }
7 |
8 | bool nano::container_info_composite::is_composite () const
9 | {
10 | return true;
11 | }
12 |
13 | void nano::container_info_composite::add_component (std::unique_ptr child)
14 | {
15 | children.push_back (std::move (child));
16 | }
17 |
18 | std::vector> const & nano::container_info_composite::get_children () const
19 | {
20 | return children;
21 | }
22 |
23 | std::string const & nano::container_info_composite::get_name () const
24 | {
25 | return name;
26 | }
27 |
28 | nano::container_info_leaf::container_info_leaf (container_info_entry info) :
29 | info (std::move (info))
30 | {
31 | }
32 |
33 | bool nano::container_info_leaf::is_composite () const
34 | {
35 | return false;
36 | }
37 |
38 | nano::container_info_entry const & nano::container_info_leaf::get_info () const
39 | {
40 | return info;
41 | }
--------------------------------------------------------------------------------
/nano/lib/diagnosticsconfig.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace nano
8 | {
9 | class jsonconfig;
10 | class tomlconfig;
11 | class txn_tracking_config final
12 | {
13 | public:
14 | /** If true, enable tracking for transaction read/writes held open longer than the min time variables */
15 | bool enable{ false };
16 | std::chrono::milliseconds min_read_txn_time{ 5000 };
17 | std::chrono::milliseconds min_write_txn_time{ 500 };
18 | bool ignore_writes_below_block_processor_max_time{ true };
19 | };
20 |
21 | /** Configuration options for diagnostics information */
22 | class diagnostics_config final
23 | {
24 | public:
25 | nano::error serialize_toml (nano::tomlconfig &) const;
26 | nano::error deserialize_toml (nano::tomlconfig &);
27 |
28 | txn_tracking_config txn_tracking;
29 | };
30 | }
31 |
--------------------------------------------------------------------------------
/nano/lib/env.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include
6 |
7 | std::optional nano::env::get (std::string_view name)
8 | {
9 | std::string name_str{ name };
10 | if (auto value = std::getenv (name_str.c_str ()))
11 | {
12 | return std::string{ value };
13 | }
14 | return std::nullopt;
15 | }
16 |
17 | template <>
18 | std::optional nano::env::get (std::string_view name)
19 | {
20 | std::vector const on_values{ "1", "true", "on" };
21 | std::vector const off_values{ "0", "false", "off" };
22 |
23 | if (auto value = get (name))
24 | {
25 | // Using case-insensitive comparison
26 | if (std::any_of (on_values.begin (), on_values.end (), [&value] (auto const & on) { return boost::iequals (*value, on); }))
27 | {
28 | return true;
29 | }
30 | if (std::any_of (off_values.begin (), off_values.end (), [&value] (auto const & off) { return boost::iequals (*value, off); }))
31 | {
32 | return false;
33 | }
34 |
35 | throw std::invalid_argument ("Invalid environment boolean value: " + *value);
36 | }
37 | return std::nullopt;
38 | }
--------------------------------------------------------------------------------
/nano/lib/env.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | namespace nano::env
9 | {
10 | /**
11 | * Get environment variable as a specific type or none if variable is not present.
12 | */
13 | std::optional get (std::string_view name);
14 |
15 | /**
16 | * Get environment variable as a specific type or none if variable is not present.
17 | * @throws std::invalid_argument if the value cannot be converted
18 | */
19 | template
20 | std::optional get (std::string_view name)
21 | {
22 | if (auto value = get (name))
23 | {
24 | try
25 | {
26 | return boost::lexical_cast (*value);
27 | }
28 | catch (boost::bad_lexical_cast const &)
29 | {
30 | throw std::invalid_argument ("Invalid environment value: " + *value);
31 | }
32 | }
33 | return std::nullopt;
34 | }
35 |
36 | /**
37 | * Specialization for boolean values.
38 | * @throws std::invalid_argument if the value is not a valid boolean
39 | */
40 | template <>
41 | std::optional get (std::string_view name);
42 | }
--------------------------------------------------------------------------------
/nano/lib/epoch.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | std::underlying_type_t nano::normalized_epoch (nano::epoch epoch_a)
5 | {
6 | // Currently assumes that the epoch versions in the enum are sequential.
7 | auto start = std::underlying_type_t (nano::epoch::epoch_0);
8 | auto end = std::underlying_type_t (epoch_a);
9 | debug_assert (end >= start);
10 | return end - start;
11 | }
12 |
--------------------------------------------------------------------------------
/nano/lib/epoch.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace nano
8 | {
9 | /**
10 | * Tag for which epoch an entry belongs to
11 | */
12 | enum class epoch : uint8_t
13 | {
14 | invalid = 0,
15 | unspecified = 1,
16 | epoch_begin = 2,
17 | epoch_0 = 2,
18 | epoch_1 = 3,
19 | epoch_2 = 4,
20 | max = epoch_2
21 | };
22 |
23 | /* This turns epoch_0 into 0 for instance */
24 | std::underlying_type_t normalized_epoch (nano::epoch epoch_a);
25 | }
26 | namespace std
27 | {
28 | template <>
29 | struct hash<::nano::epoch>
30 | {
31 | std::size_t operator() (::nano::epoch const & epoch_a) const
32 | {
33 | return std::underlying_type_t<::nano::epoch> (epoch_a);
34 | }
35 | };
36 | }
37 |
--------------------------------------------------------------------------------
/nano/lib/formatting.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
--------------------------------------------------------------------------------
/nano/lib/function.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace nano
8 | {
9 | // TODO: Replace with std::move_only_function in C++23
10 | template
11 | auto wrap_move_only (F && f)
12 | {
13 | using fn_type = decltype (std::function{ std::declval () });
14 | auto ptr = std::make_shared> (std::forward (f));
15 | return fn_type ([ptr] (auto &&... args) {
16 | return (*ptr) (std::forward (args)...);
17 | });
18 | }
19 | }
--------------------------------------------------------------------------------
/nano/lib/fwd.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | struct uint8_char_traits;
7 |
8 | namespace nano
9 | {
10 | class block;
11 | class block_details;
12 | class block_visitor;
13 | class container_info;
14 | class jsonconfig;
15 | class logger;
16 | class mutable_block_visitor;
17 | class network_constants;
18 | class object_stream;
19 | class root;
20 | class stats;
21 | class thread_pool;
22 | class thread_runner;
23 | class tomlconfig;
24 | template
25 | class uniquer;
26 |
27 | enum class block_type : uint8_t;
28 | enum class epoch : uint8_t;
29 | enum class work_version;
30 |
31 | using stream = std::basic_streambuf;
32 | }
33 |
34 | namespace nano::stat
35 | {
36 | enum class type;
37 | enum class detail;
38 | enum class dir;
39 | }
40 |
--------------------------------------------------------------------------------
/nano/lib/interval.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace nano
7 | {
8 | class interval
9 | {
10 | public:
11 | bool elapse (auto target)
12 | {
13 | auto const now = std::chrono::steady_clock::now ();
14 | if (now - last >= target)
15 | {
16 | last = now;
17 | return true;
18 | }
19 | return false;
20 | }
21 |
22 | private:
23 | std::chrono::steady_clock::time_point last{};
24 | };
25 |
26 | class interval_mt
27 | {
28 | public:
29 | bool elapse (auto target)
30 | {
31 | std::lock_guard guard{ mutex };
32 | auto const now = std::chrono::steady_clock::now ();
33 | if (now - last >= target)
34 | {
35 | last = now;
36 | return true;
37 | }
38 | return false;
39 | }
40 |
41 | private:
42 | std::mutex mutex;
43 | std::chrono::steady_clock::time_point last{};
44 | };
45 | }
--------------------------------------------------------------------------------
/nano/lib/ipc.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | nano::ipc::socket_base::socket_base (boost::asio::io_context & io_ctx_a) :
5 | io_timer (io_ctx_a)
6 | {
7 | }
8 |
9 | void nano::ipc::socket_base::timer_start (std::chrono::seconds timeout_a)
10 | {
11 | if (timeout_a < std::chrono::seconds::max ())
12 | {
13 | io_timer.expires_from_now (boost::posix_time::seconds (static_cast (timeout_a.count ())));
14 | io_timer.async_wait ([this] (boost::system::error_code const & ec) {
15 | if (!ec)
16 | {
17 | this->timer_expired ();
18 | }
19 | });
20 | }
21 | }
22 |
23 | void nano::ipc::socket_base::timer_expired ()
24 | {
25 | close ();
26 | }
27 |
28 | void nano::ipc::socket_base::timer_cancel ()
29 | {
30 | boost::system::error_code ec;
31 | io_timer.cancel (ec);
32 | debug_assert (!ec);
33 | }
34 |
35 | nano::ipc::dsock_file_remover::dsock_file_remover (std::string const & file_a) :
36 | filename (file_a)
37 | {
38 | std::remove (filename.c_str ());
39 | }
40 |
41 | nano::ipc::dsock_file_remover::~dsock_file_remover ()
42 | {
43 | std::remove (filename.c_str ());
44 | }
45 |
--------------------------------------------------------------------------------
/nano/lib/json_error_response.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace nano
7 | {
8 | inline void json_error_response (std::function response_a, std::string const & message_a)
9 | {
10 | boost::property_tree::ptree response_l;
11 | response_l.put ("error", message_a);
12 | std::stringstream ostream;
13 | boost::property_tree::write_json (ostream, response_l);
14 | response_a (ostream.str ());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/nano/lib/memory.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace
4 | {
5 | #ifdef MEMORY_POOL_DISABLED
6 | /** TSAN on mac is generating some warnings. They need further investigating before memory pools can be used, so disable them for now */
7 | bool use_memory_pools{ false };
8 | #else
9 | bool use_memory_pools{ true };
10 | #endif
11 | }
12 |
13 | bool nano::get_use_memory_pools ()
14 | {
15 | return use_memory_pools;
16 | }
17 |
18 | /** This has no effect on Mac */
19 | void nano::set_use_memory_pools (bool use_memory_pools_a)
20 | {
21 | #ifndef MEMORY_POOL_DISABLED
22 | use_memory_pools = use_memory_pools_a;
23 | #endif
24 | }
25 |
26 | nano::cleanup_guard::cleanup_guard (std::vector> const & cleanup_funcs_a) :
27 | cleanup_funcs (cleanup_funcs_a)
28 | {
29 | }
30 |
31 | nano::cleanup_guard::~cleanup_guard ()
32 | {
33 | for (auto & func : cleanup_funcs)
34 | {
35 | func ();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/nano/lib/object_stream.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | nano::object_stream_config const & nano::object_stream_config::default_config ()
4 | {
5 | static object_stream_config const config{};
6 | return config;
7 | }
8 |
9 | nano::object_stream_config const & nano::object_stream_config::json_config ()
10 | {
11 | static object_stream_config const config{
12 | .field_name_begin = "\"",
13 | .field_name_end = "\"",
14 | .field_assignment = ":",
15 | .field_separator = ",",
16 | .object_begin = "{",
17 | .object_end = "}",
18 | .array_begin = "[",
19 | .array_end = "]",
20 | .array_element_begin = "",
21 | .array_element_end = "",
22 | .array_element_separator = ",",
23 | .indent = "",
24 | .newline = "",
25 | .precision = 4,
26 | };
27 | return config;
28 | }
--------------------------------------------------------------------------------
/nano/lib/plat/darwin/thread_role.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | void nano::thread_role::set_os_name (std::string const & thread_name)
6 | {
7 | pthread_setname_np (thread_name.c_str ());
8 | }
9 |
--------------------------------------------------------------------------------
/nano/lib/plat/default/debugging.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void nano::create_load_memory_address_files ()
5 | {
6 | }
7 |
--------------------------------------------------------------------------------
/nano/lib/plat/default/priority.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void nano::work_thread_reprioritize ()
4 | {
5 | }
6 |
--------------------------------------------------------------------------------
/nano/lib/plat/freebsd/thread_role.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | void nano::thread_role::set_os_name (std::string const & thread_name)
7 | {
8 | pthread_set_name_np (pthread_self (), thread_name.c_str ());
9 | }
10 |
--------------------------------------------------------------------------------
/nano/lib/plat/linux/priority.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | void nano::work_thread_reprioritize ()
6 | {
7 | auto handle (pthread_self ());
8 | int policy;
9 | struct sched_param sched;
10 | if (pthread_getschedparam (handle, &policy, &sched) == 0)
11 | {
12 | policy = SCHED_BATCH;
13 | auto result (pthread_setschedparam (handle, policy, &sched));
14 | (void)result;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/nano/lib/plat/linux/thread_role.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | void nano::thread_role::set_os_name (std::string const & thread_name)
6 | {
7 | pthread_setname_np (pthread_self (), thread_name.c_str ());
8 | }
9 |
--------------------------------------------------------------------------------
/nano/lib/plat/posix/perms.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 |
7 | void nano::set_umask ()
8 | {
9 | umask (077);
10 | }
11 |
12 | void nano::set_secure_perm_directory (std::filesystem::path const & path)
13 | {
14 | std::filesystem::permissions (path, std::filesystem::perms::owner_all);
15 | }
16 |
17 | void nano::set_secure_perm_directory (std::filesystem::path const & path, std::error_code & ec)
18 | {
19 | std::filesystem::permissions (path, std::filesystem::perms::owner_all, ec);
20 | }
21 |
22 | void nano::set_secure_perm_file (std::filesystem::path const & path)
23 | {
24 | std::filesystem::permissions (path, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write);
25 | }
26 |
27 | void nano::set_secure_perm_file (std::filesystem::path const & path, std::error_code & ec)
28 | {
29 | std::filesystem::permissions (path, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write, ec);
30 | }
31 |
--------------------------------------------------------------------------------
/nano/lib/plat/windows/priority.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace nano
4 | {
5 | void work_thread_reprioritize ()
6 | {
7 | SetThreadPriority (GetCurrentThread (), THREAD_MODE_BACKGROUND_BEGIN);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/nano/lib/plat/windows/registry.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace nano
4 | {
5 | bool event_log_reg_entry_exists ()
6 | {
7 | HKEY h_key;
8 | auto res = RegOpenKeyExW (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Nano\\Nano", 0, KEY_READ, &h_key);
9 | auto found_key = (res == ERROR_SUCCESS);
10 | if (found_key)
11 | {
12 | RegCloseKey (h_key);
13 | }
14 | return found_key;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/nano/lib/plat/windows/thread_role.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | void nano::thread_role::set_os_name (std::string const & thread_name)
6 | {
7 | using SetThreadDescription_t = HRESULT (*) (HANDLE, PCWSTR);
8 | SetThreadDescription_t SetThreadDescription_local = (SetThreadDescription_t)GetProcAddress (GetModuleHandle (TEXT ("kernel32.dll")), "SetThreadDescription");
9 | if (SetThreadDescription_local)
10 | {
11 | std::wstring thread_name_wide (thread_name.begin (), thread_name.end ());
12 | SetThreadDescription_local (GetCurrentThread (), thread_name_wide.c_str ());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/nano/lib/rocksdbconfig.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | namespace nano
9 | {
10 | class tomlconfig;
11 |
12 | /** Configuration options for RocksDB */
13 | class rocksdb_config final
14 | {
15 | public:
16 | rocksdb_config () :
17 | enable{ using_rocksdb_in_tests () }
18 | {
19 | }
20 |
21 | nano::error serialize_toml (nano::tomlconfig &) const;
22 | nano::error deserialize_toml (nano::tomlconfig &);
23 |
24 | /** To use RocksDB in tests make sure the environment variable TEST_USE_ROCKSDB=1 is set */
25 | static bool using_rocksdb_in_tests ();
26 |
27 | bool enable{ false };
28 | unsigned io_threads{ std::max (nano::hardware_concurrency () / 2, 1u) };
29 | long read_cache{ 32 };
30 | long write_cache{ 64 };
31 | };
32 | }
33 |
--------------------------------------------------------------------------------
/nano/lib/stacktrace.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include
6 |
7 | void nano::dump_crash_stacktrace ()
8 | {
9 | boost::stacktrace::safe_dump_to ("nano_node_backtrace.dump");
10 | }
11 |
12 | std::string nano::generate_stacktrace ()
13 | {
14 | auto stacktrace = boost::stacktrace::stacktrace ();
15 | std::stringstream ss;
16 | ss << stacktrace;
17 | return ss.str ();
18 | }
19 |
--------------------------------------------------------------------------------
/nano/lib/stacktrace.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace nano
6 | {
7 | /**
8 | * Dumps a stacktrace file which can be read using the --debug_output_last_backtrace_dump CLI command
9 | */
10 | void dump_crash_stacktrace ();
11 |
12 | /**
13 | * Generates the current stacktrace
14 | */
15 | std::string generate_stacktrace ();
16 | }
--------------------------------------------------------------------------------
/nano/lib/stats_enums.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | std::string_view nano::to_string (nano::stat::type type)
5 | {
6 | return nano::enum_util::name (type);
7 | }
8 |
9 | std::string_view nano::to_string (nano::stat::detail detail)
10 | {
11 | return nano::enum_util::name (detail);
12 | }
13 |
14 | std::string_view nano::to_string (nano::stat::dir dir)
15 | {
16 | return nano::enum_util::name (dir);
17 | }
18 |
19 | std::string_view nano::to_string (nano::stat::sample sample)
20 | {
21 | return nano::enum_util::name (sample);
22 | }
--------------------------------------------------------------------------------
/nano/lib/threading.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | /*
9 | * thread_attributes
10 | */
11 |
12 | boost::thread::attributes nano::thread_attributes::get_default ()
13 | {
14 | boost::thread::attributes attrs;
15 | attrs.set_stack_size (8000000); // 8MB
16 | return attrs;
17 | }
18 |
19 | unsigned nano::hardware_concurrency ()
20 | {
21 | static auto const concurrency = [] () {
22 | if (auto value = nano::env::get ("NANO_HARDWARE_CONCURRENCY"))
23 | {
24 | std::cerr << "Hardware concurrency overridden by NANO_HARDWARE_CONCURRENCY environment variable: " << *value << std::endl;
25 | return *value;
26 | }
27 | return std::thread::hardware_concurrency ();
28 | }();
29 | release_assert (concurrency > 0, "configured hardware concurrency must be non zero");
30 | return concurrency;
31 | }
32 |
33 | bool nano::join_or_pass (std::thread & thread)
34 | {
35 | if (thread.joinable ())
36 | {
37 | thread.join ();
38 | return true;
39 | }
40 | else
41 | {
42 | return false;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/nano/lib/threading.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | #include
8 |
9 | namespace nano
10 | {
11 | namespace thread_attributes
12 | {
13 | boost::thread::attributes get_default ();
14 | } // namespace thread_attributes
15 |
16 | /**
17 | * Number of available logical processor cores. Might be overridden by setting `NANO_HARDWARE_CONCURRENCY` environment variable
18 | */
19 | unsigned hardware_concurrency ();
20 |
21 | /**
22 | * If thread is joinable joins it, otherwise does nothing
23 | * Returns thread.joinable()
24 | */
25 | bool join_or_pass (std::thread &);
26 | } // namespace nano
27 |
--------------------------------------------------------------------------------
/nano/lib/utility.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | // Issue #3748
6 | void nano::sort_options_description (const boost::program_options::options_description & source, boost::program_options::options_description & target)
7 | {
8 | // Grab all of the options, get the option display name, stick it in a map using the display name as
9 | // the key (the map will sort) and the value as the option itself.
10 | const auto & options = source.options ();
11 | std::map> sorted_options;
12 | for (const auto & option : options)
13 | {
14 | auto pair = std::make_pair (option->canonical_display_name (2), option);
15 | sorted_options.insert (pair);
16 | }
17 |
18 | // Rebuild for display purposes only.
19 | for (const auto & option_pair : sorted_options)
20 | {
21 | target.add (option_pair.second);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/nano/lib/walletconfig.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | namespace nano
9 | {
10 | class tomlconfig;
11 |
12 | /** Configuration options for the Qt wallet */
13 | class wallet_config final
14 | {
15 | public:
16 | wallet_config ();
17 | /** Update this instance by parsing the given wallet and account */
18 | nano::error parse (std::string const & wallet_a, std::string const & account_a);
19 | nano::error serialize_toml (nano::tomlconfig & toml_a) const;
20 | nano::error deserialize_toml (nano::tomlconfig & toml_a);
21 | nano::wallet_id wallet;
22 | nano::account account{};
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/nano/lib/work_version.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace nano
4 | {
5 | enum class work_version
6 | {
7 | unspecified,
8 | work_1
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/nano/load_test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(load_test entry.cpp)
2 |
3 | target_link_libraries(load_test test_common Boost::process)
4 |
5 | include_directories(${CMAKE_SOURCE_DIR}/submodules)
6 | include_directories(${CMAKE_SOURCE_DIR}/submodules/gtest/googletest/include)
7 |
--------------------------------------------------------------------------------
/nano/nano_node/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(nano_node daemon.cpp daemon.hpp entry.cpp)
2 |
3 | target_link_libraries(nano_node node Boost::process ${PLATFORM_LIBS})
4 |
5 | include_directories(${CMAKE_SOURCE_DIR}/submodules)
6 |
7 | target_compile_definitions(
8 | nano_node PRIVATE -DTAG_VERSION_STRING=${TAG_VERSION_STRING}
9 | -DGIT_COMMIT_HASH=${GIT_COMMIT_HASH})
10 |
11 | set_target_properties(
12 | nano_node PROPERTIES COMPILE_FLAGS
13 | "-DQT_NO_KEYWORDS -DBOOST_ASIO_HAS_STD_ARRAY=1")
14 |
15 | add_custom_command(
16 | TARGET nano_node
17 | POST_BUILD
18 | COMMAND nano_node --generate_config node >
19 | ${PROJECT_BINARY_DIR}/config-node.toml.sample
20 | COMMAND nano_node --generate_config rpc >
21 | ${PROJECT_BINARY_DIR}/config-rpc.toml.sample
22 | COMMAND nano_node --generate_config log >
23 | ${PROJECT_BINARY_DIR}/config-log.toml.sample)
24 |
25 | if((NANO_GUI OR RAIBLOCKS_GUI) AND NOT APPLE)
26 | if(WIN32)
27 | install(TARGETS nano_node RUNTIME DESTINATION .)
28 | else()
29 | install(TARGETS nano_node RUNTIME DESTINATION ./bin)
30 | endif()
31 | endif()
32 |
--------------------------------------------------------------------------------
/nano/nano_node/daemon.hpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace nano
4 | {
5 | class node_flags;
6 |
7 | class daemon
8 | {
9 | nano::logger logger{ "daemon" };
10 |
11 | public:
12 | void run (std::filesystem::path const &, nano::node_flags const & flags);
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/nano/nano_rpc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(nano_rpc entry.cpp)
2 |
3 | target_link_libraries(nano_rpc node)
4 |
5 | target_compile_definitions(
6 | nano_rpc
7 | PUBLIC -DACTIVE_NETWORK=${ACTIVE_NETWORK}
8 | PRIVATE -DTAG_VERSION_STRING=${TAG_VERSION_STRING}
9 | -DGIT_COMMIT_HASH=${GIT_COMMIT_HASH})
10 |
11 | if((NANO_GUI OR RAIBLOCKS_GUI) AND NOT APPLE)
12 | if(WIN32)
13 | install(TARGETS nano_rpc RUNTIME DESTINATION .)
14 | else()
15 | install(TARGETS nano_rpc RUNTIME DESTINATION ./bin)
16 | endif()
17 | endif()
18 |
--------------------------------------------------------------------------------
/nano/nano_wallet/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nanocurrency/nano-node/bbed2c1c4d6d1b7d55626b73bbfc157163ff179e/nano/nano_wallet/.DS_Store
--------------------------------------------------------------------------------
/nano/nano_wallet/icon.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class QApplication;
4 | namespace nano
5 | {
6 | void set_application_icon (QApplication &);
7 | }
8 |
--------------------------------------------------------------------------------
/nano/nano_wallet/plat/default/icon.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void nano::set_application_icon (QApplication &)
4 | {
5 | }
6 |
--------------------------------------------------------------------------------
/nano/nano_wallet/plat/windows/icon.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | void nano::set_application_icon (QApplication & application_a)
8 | {
9 | HICON hIcon = static_cast (LoadImage (GetModuleHandle (nullptr), MAKEINTRESOURCE (1), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADTRANSPARENT));
10 | application_a.setWindowIcon (QIcon (QtWin::fromHICON (hIcon)));
11 | DestroyIcon (hIcon);
12 | }
13 |
--------------------------------------------------------------------------------
/nano/node/block_context.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | namespace nano
9 | {
10 | class block_context
11 | {
12 | public:
13 | using result_t = nano::block_status;
14 | using callback_t = std::function;
15 |
16 | public: // Keep fields public for simplicity
17 | std::shared_ptr block;
18 | nano::block_source source;
19 | callback_t callback;
20 | std::chrono::steady_clock::time_point arrival{ std::chrono::steady_clock::now () };
21 |
22 | public:
23 | block_context (std::shared_ptr block, nano::block_source source, callback_t callback = nullptr) :
24 | block{ std::move (block) },
25 | source{ source },
26 | callback{ std::move (callback) }
27 | {
28 | debug_assert (source != nano::block_source::unknown);
29 | }
30 |
31 | std::future get_future ()
32 | {
33 | return promise.get_future ();
34 | }
35 |
36 | void set_result (result_t result)
37 | {
38 | promise.set_value (result);
39 | }
40 |
41 | private:
42 | std::promise promise;
43 | };
44 | }
--------------------------------------------------------------------------------
/nano/node/block_source.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | std::string_view nano::to_string (nano::block_source source)
6 | {
7 | return nano::enum_util::name (source);
8 | }
9 |
10 | nano::stat::detail nano::to_stat_detail (nano::block_source type)
11 | {
12 | return nano::enum_util::cast (type);
13 | }
--------------------------------------------------------------------------------
/nano/node/block_source.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace nano
8 | {
9 | enum class block_source
10 | {
11 | unknown = 0,
12 | live,
13 | live_originator,
14 | bootstrap,
15 | bootstrap_legacy,
16 | unchecked,
17 | local,
18 | forced,
19 | election,
20 | };
21 |
22 | std::string_view to_string (block_source);
23 | nano::stat::detail to_stat_detail (block_source);
24 | }
--------------------------------------------------------------------------------
/nano/node/bootstrap/common.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace nano::bootstrap
6 | {
7 | using id_t = uint64_t;
8 | static nano::bootstrap::id_t generate_id ()
9 | {
10 | nano::bootstrap::id_t id;
11 | nano::random_pool::generate_block (reinterpret_cast (&id), sizeof (id));
12 | return id;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/nano/node/bootstrap/throttle.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | nano::bootstrap::throttle::throttle (std::size_t size) :
5 | successes_m{ size }
6 | {
7 | samples.insert (samples.end (), size, true);
8 | debug_assert (size > 0);
9 | }
10 |
11 | void nano::bootstrap::throttle::reset ()
12 | {
13 | successes_m = samples.size ();
14 | std::fill (samples.begin (), samples.end (), true);
15 | }
16 |
17 | bool nano::bootstrap::throttle::throttled () const
18 | {
19 | return successes_m == 0;
20 | }
21 |
22 | void nano::bootstrap::throttle::add (bool sample)
23 | {
24 | debug_assert (!samples.empty ());
25 | pop ();
26 | samples.push_back (sample);
27 | if (sample)
28 | {
29 | ++successes_m;
30 | }
31 | }
32 |
33 | void nano::bootstrap::throttle::resize (std::size_t size)
34 | {
35 | debug_assert (size > 0);
36 | while (size < samples.size ())
37 | {
38 | pop ();
39 | }
40 | while (size > samples.size ())
41 | {
42 | samples.push_back (false);
43 | }
44 | }
45 |
46 | std::size_t nano::bootstrap::throttle::size () const
47 | {
48 | return samples.size ();
49 | }
50 |
51 | std::size_t nano::bootstrap::throttle::successes () const
52 | {
53 | return successes_m;
54 | }
55 |
56 | void nano::bootstrap::throttle::pop ()
57 | {
58 | if (samples.front ())
59 | {
60 | --successes_m;
61 | }
62 | samples.pop_front ();
63 | }
64 |
--------------------------------------------------------------------------------
/nano/node/bootstrap/throttle.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace nano::bootstrap
6 | {
7 | // Class used to throttle the ascending bootstrapper once it reaches a steady state
8 | // Tracks verify_result samples and signals throttling if no tracked samples have gotten results
9 | class throttle
10 | {
11 | public:
12 | // Initialized with all true samples
13 | explicit throttle (std::size_t size);
14 |
15 | [[nodiscard]] bool throttled () const;
16 | void add (bool success);
17 |
18 | // Resizes the number of samples tracked
19 | // Drops the oldest samples if the size decreases
20 | // Adds false samples if the size increases
21 | void resize (std::size_t size);
22 |
23 | [[nodiscard]] std::size_t size () const;
24 | [[nodiscard]] std::size_t successes () const;
25 |
26 | void reset ();
27 |
28 | private:
29 | void pop ();
30 |
31 | // Bit set that tracks sample results. True when something was retrieved, false otherwise
32 | std::deque