Compare commits

..

100 Commits

Author SHA1 Message Date
dsc c2d1ac9f25 wat
2 months ago
dsc e3d8ab8281 cmake-rewrite
2 months ago
dsc 66c2b5d8ad enable refresh thread
4 months ago
dsc b2c9c6b2ae Add CoinsInfo->description and 'preferred_inputs' to create_transaction
4 months ago
dsc dd1c07a58b add hex() and txKey() to PendingTransaction
4 months ago
dsc b1d3a27af9 compile fix
5 months ago
wowario 276fd65f2a
Update RandomWOW to 1.2.1-wow
7 months ago
j-berman 1e38c3c508
wallet2: ensure transfers and sweeps use same fee calc logic
7 months ago
jeffro256 1cb536ff45
http_client: reduce number of packets sent for small bodies
7 months ago
tobtoht 7737171b6c
depends: openssl: update to 3.0.11
7 months ago
selsta 1b8475003c
wallet2: fix refresh function parameters
7 months ago
Boog900 c1093aa33d
Fix: long term block weight cache
7 months ago
Boog900 650cef2279
add a test for the long term weight cache
7 months ago
wowario 3c329005f5
add more seeds
7 months ago
wowario 56b5d10b41
disable mismatched daemon check
7 months ago
wowario bae8df3f21
remove nudge in daemon_is_outdated
7 months ago
wowario 8f6e5fb500
[README] bump version
7 months ago
wowario b322839951
update checkpoints
7 months ago
wowario 1e5184a63a
remove nudge in num_mainnet_hard_forks
7 months ago
_XxFedexX_ 87be033224
Add _xxfedexx_'s PGP key
7 months ago
wowario c1488d7896
remove rx_set code
7 months ago
wowario 140a5e430a
use rx_set_miner_thread after RX_BLOCK_VERSION
7 months ago
thotbot 378e241ff6
Import transaction
7 months ago
wowario b403a4e6d4
show wallet info
7 months ago
hinto-janaiyo 35a6b6c825
simplewallet/wallet2: set option - show-detailed-prompt
7 months ago
moneromooo-monero bfc28a3bfe
blockchain_prune: faster
7 months ago
moneromooo-monero 27a9a417dc
simplewallet: print fully qualified filename for new wallets
7 months ago
thotbot e3d5e895cd
Misc. network related
7 months ago
thotbot 5b9e342966
Skip unneeded blocks in fast refresh
7 months ago
thotbot dc44ccad2d
subaddressIndex()
7 months ago
thotbot fad6c11b6f
Print wallet cache
7 months ago
thotbot 493608203f
Misc. wallet API and wallet2 changes
7 months ago
thotbot ce32e59844
Coins
7 months ago
thotbot c7c1558c1d
Offline transaction signing
7 months ago
wowario 176ed83a39
update checkpoints
7 months ago
wowario 51e192d2cc
connect to updated seeds
7 months ago
wowario 2ebf9fcfe9
add wowario PGP key
7 months ago
wowario 938420b2e6
Revoke old pgp key
7 months ago
wowario 4679496727
support old ass BPs
7 months ago
wowario 8780f9fb30
revert sanity check
7 months ago
wowario 7cd57d6479
wallet seed message spacing
7 months ago
wowario 6e22bcadd9
remove warning reusing keys
7 months ago
wowario 02c36da7e5
remove warning about background mining
7 months ago
wowario d3e753deb5
add clear screen command
7 months ago
wowario 487418b952
wownero chan
7 months ago
wowario 748d6a3184
update README.md
7 months ago
wowario 7ab0cbb19e
update checkpoints
7 months ago
wowario 31c5ba00d5
set fork height
7 months ago
wowario c80566ca00
from v20, limit tx extra size
7 months ago
wowario dcafb09415
Debug level No incoming connections
7 months ago
wowario ae54f2e737
update checkpoints
7 months ago
wowario e1f25be028
uri remainder
7 months ago
wowario 3b15bb4696
update README.md
7 months ago
wowario e00a7d1638
remove testnet/stagenet fork heights/blocks
7 months ago
wowario c69dc334fb
don't request pre-bulletprooof pruned blocks
7 months ago
wowario 89c0a9de4c
change to debug level
7 months ago
wowario 7174ff9bcb
rename ringdb-dir
7 months ago
wowario 0fc75eb44e
mod variant4_random_math
7 months ago
wowario fe05821c19
support old BP
7 months ago
wowario daddd7d231
vote by block
7 months ago
wowario 0871203167
tidy up miner msgs
7 months ago
wowario de2a8c65cf
miner block header signing
7 months ago
wowario 2e18be9977
difficulty is fun
7 months ago
wowario 67f16d765c
shorten timestamp check window
7 months ago
wowario d81ef76d7c
limit future blk time to 10 min
7 months ago
wowario 39809d46c6
bump unlock time to 288 blks
7 months ago
wowario 8243f192ab
broadcast donation sub-address
7 months ago
wowario bb391f0d00
revert Preserve commitment format inside transactions #8277
7 months ago
wowario 052e775d24
add systemd file
7 months ago
wowario 2adf97e0d3
update gitian
7 months ago
wowario b3ce01e702
update Dockerfile
7 months ago
wowario 6a6f6c1424
adjust approx_blockchain_height
7 months ago
wowario 9b2d897043
add wowario gpg key
7 months ago
wowario 37169ebb39
config wallet2 settings
7 months ago
wowario c92464e27f
set dev fund address
7 months ago
wowario ae7c139056
add seed nodes
7 months ago
wowario add841d552
set name of daemon stdout
7 months ago
wowario 31f59338d3
set last v1 block
7 months ago
wowario c9b8d94e83
set pow variants
7 months ago
wowario 8498370447
set quick height for syncing
7 months ago
wowario c1ef123bad
send dump log to wowario
7 months ago
wowario 065e89580f
set genesis block timestamp
7 months ago
wowario 5d369a5bf3
set decimal point
7 months ago
wowario 07e3c1a9b8
add forks and checkpoints
7 months ago
wowario ad27e5892b
wownero skin pack
7 months ago
wowario 10f22a4267
bump RX block version
7 months ago
wowario 3709b2684b
correct length of addresses
7 months ago
wowario 0901cd95c9
move utilities to debug build
7 months ago
wowario 67e03a315a
automatic submodule update
7 months ago
wowario 36edf137e4
Doxygen off
7 months ago
wowario f36d2f79b8
trezor support off
7 months ago
wowario d890edf7db
turn off tests
7 months ago
wowario 6e1158eaa4
gitian: copy config file
7 months ago
wowario d1387cbadc
add RandomWOW
7 months ago
wowario 82a019cd12
show full version
7 months ago
wowario b83ff851d2
remove moneropulse urls
7 months ago
wowario 95e7407aa1
remove monero tx bug fixes
7 months ago
wowario 5f6703f2c2
bump ring size to 22
7 months ago
wowario 4c6e685174
initialize genesis block
7 months ago
wowario 92ebb323e1
config cryptonote
7 months ago

15
.gitmodules vendored

@ -1,19 +1,12 @@
[submodule "external/miniupnp"]
path = external/miniupnp
url = https://github.com/miniupnp/miniupnp
[submodule "external/rapidjson"]
path = external/rapidjson
url = https://github.com/Tencent/rapidjson
[submodule "external/trezor-common"]
active = false
path = external/trezor-common
url = https://github.com/trezor/trezor-common.git
[submodule "external/supercop"]
path = external/supercop
url = https://github.com/monero-project/supercop
branch = monero
url = https://git.wownero.com/dsc/supercop.git
branch = cmake-rewrite
[submodule "external/randomwow"]
path = external/randomwow
url = https://git.wownero.com/wownero/RandomWOW
branch = 1.2.1-wow
url = https://git.wownero.com/dsc/randomwow.git
branch = cmake-rewrite

File diff suppressed because it is too large Load Diff

@ -104,7 +104,7 @@ release-all:
release-static:
mkdir -p $(builddir)/release
cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D USE_DEVICE_TREZOR=OFF -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D USE_DEVICE_TREZOR=OFF -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
coverage:
mkdir -p $(builddir)/debug

@ -1,12 +1,7 @@
# ~~Mo~~Wownero - Such privacy! Many coins! Wow!
# ~~Mo~~Wownero - Such privacy! Many coins! Wow! 🐕
[<img src="https://suchwow.xyz/data/suchwow/image/to23moqn.jpeg">](https://suchwow.xyz/s/oh-really-9eda16b2/item)
## Introduction
Wownero is a Doge-inspired, CPU-mineable, solo-mining only, privacy-respecting memecoin. It was fairly launched on April Fools' Day in 2018. It is a software fork of Monero, but with a lite version of RandomX, larger ring size, and a fixed supply of 184 million coins emitted over 50 years. Wownero has no trusted setup, premine, or dev tax. Besides betting on online snail racing, the main use case of Wownero is micro-tipping meme creators with sound magic internet money. As a 100% community-driven, free and open source software, Wownero does not depend on billionaire shills or lame ass "influencers."
Unlike Opposing Projects.
Copyright (c) 2014-2023 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Resources
@ -16,35 +11,32 @@ Unlike Opposing Projects.
- Reddit: [/r/wownero](https://www.reddit.com/r/wownero)
- Mail: [wownero@wownero.org](mailto:wownero@wownero.org)
- Git: [git.wownero.com/wownero/wownero](https://git.wownero.com/wownero/wownero)
- Wownero Funding System: [funding.wownero.com](https://funding.wownero.com)
- Wownero Forum: [forum.wownero.com](https://forum.wownero.com)
- Discord: [discord.gg/ykZyAzJhDK](https://discord.com/invite/ykZyAzJhDK)
- Telegram: [t.me/wownero](https://t.me/wownero)
- Public Node Status: [monero.fail](https://monero.fail/?chain=wownero&network=mainnet)
- Wowlet Desktop Wallet: [git.wownero.com/wowlet/wowlet](https://git.wownero.com/wowlet/wowlet/releases)
- Stack Wallet iOS & Android Mobile Wallet: [stackwallet.com](https://stackwallet.com)
- Wonerujo Android Mobile Wallet: [google store](https://play.google.com/store/apps/details?id=com.m2049r.wowwallet)
- Elite Wallet Android Mobile Wallet: [github](https://github.com/Elite-Labs/EliteWallet)
- Public Node Status: [monero.fail](https://monero.fail/?crypto=wownero)
- Wownero Memes: [suchwow.xyz](https://suchwow.xyz/posts/top)
- Market Info: [coinmarketcap.com](https://coinmarketcap.com/currencies/wownero), [coingecko.com](https://www.coingecko.com/en/coins/wownero/usd)
## Exchanges
- [NonKYC](https://nonkyc.io/market/WOW_BTC)
- [neroswap](https://neroswap.com)
- [AltQuick](https://altquick.com/market/Wownero)
- [Majestic Bank](https://majesticbank.sc)
- [TradeOgre](https://tradeogre.com/exchange/BTC-WOW)
## Wallets
- Wonero CLI Wallet: [git.wownero.com/wownero/wownero](https://git.wownero.com/wownero/wownero/releases)
- Wowlet Desktop Wallet: [git.wownero.com/wowlet/wowlet](https://git.wownero.com/wowlet/wowlet/releases)
- Stack Wallet iOS & Android Mobile Wallet: [stackwallet.com](https://stackwallet.com)
- Wonerujo Android Mobile Wallet: [google store](https://play.google.com/store/apps/details?id=com.m2049r.wowwallet)
- Elite Wallet Android Mobile Wallet: [github](https://github.com/Elite-Labs/EliteWallet)
## Blockchain Explorers
### Blockchain Explorers
- https://explore.wownero.com
- https://explorer.suchwow.xyz
- https://kryfi.com/explorer/wownero
- https://muchwow.lol
## Introduction
Wownero is a privacy-centric memecoin that was fairly launched on April 1, 2018 with no pre-mine, stealth-mine or ICO. Wownero has a maximum supply of around 184 million WOW with a slow and steady emission over 50 years. It is a fork of Monero, but with its own genesis block, so there is no degradation of privacy due to ring signatures using different participants for the same tx outputs on opposing forks.
## Supporting the project
@ -57,7 +49,7 @@ height="100">](https://www.macstadium.com)
alt="JetBrains"
height="100">](https://www.jetbrains.com)
Developers are volunteers doing this mostly for shits and giggles. If you would like to support our shenanigans and stimulant addictions, please consider donating to the dev slush fund.
Developers are volunteers doing this mostly for shits and giggles. If you would like to support our shenanigans and stimulant addictions, please consider donating to [WFS proposals](https://funding.wownero.com/proposals) or the dev slush fund.
### Donation Addresses
@ -71,6 +63,12 @@ XMR: `44SQVPGLufPasUcuUQSZiF5c9BFzjcP8ucDxzzFDgLf1VkCEFaidJ3u2AhSKMhPLKA3jc2iS8w
BTC: `bc1qcw9zglp3fxyl25zswemw7jczlqryms2lsmu464`
### Open Collective
Open Collective is an online funding platform for open source software and collaborative communities. The platform brings together legal entities that act as a “Fiscal Host”, “Collectives” (unincorporated, community-based projects), and individuals interested in supporting projects with donations. Fiscal hosts hold donations for collectives in trust and handle all the taxes and legal stuff.
Wownero is hosted by Open Collective Europe, a Brussels-based non-profit that hosts many other collectives, such as Manjaro, EndeavourOS, Xfce, and peertube.social. If you would like donate to the Wownero Project using this method, you can check out our [Wownero - Open Collective](https://opencollective.com/wownero) page.
## Release staging and Contributing
**Anyone is welcome to contribute to Wownero's codebase!**
@ -98,7 +96,7 @@ Dates are provided in the format YYYY-MM-DD.
| - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.3.3 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
| 331,170 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.2.0 | Bulletproofs+, Miner Block Header Signing, Vote by Block, Change coinbase unlock time to 1 day, Reset difficulty and switch back to Monero's difficulty algorithm
| 514,000 | 2023-04-01 | Kunty Karen | v0.11.0.0 | v0.11.2.0 | View tags, fee changes, adjusted dynamic block weight algorithm, multisig security fixes, RPC broadcast node donation sub-address, Limit tx_extra max size to ~1kb, 12-hour difficulty adjustment window
| 514,000 | 2023-04-01 | Kunty Karen | v0.11.0.0 | v0.11.1.0 | View tags, fee changes, adjusted dynamic block weight algorithm, multisig security fixes, RPC broadcast node donation sub-address, Limit tx_extra max size to ~1kb, 12-hour difficulty adjustment window
X's indicate that these details have not been determined as of commit date.
@ -217,6 +215,3 @@ More information on running Tor and i2p nodes is available [here](https://forum.
```
./wownero-wallet-cli --proxy 127.0.0.1:9050 --daemon-address iy6ry6uudpzvbd72zsipepukp6nsazjdu72n52vg3isfnxqn342flzad.onion:34568
```
Copyright (c) 2014-2024 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.

@ -1,14 +0,0 @@
#ifdef __CLASSIC_C__
int main()
{
int ac;
char* av[];
#else
int main(int ac, char* av[])
{
#endif
if (ac > 1000) {
return *av[0];
}
return 0;
}

@ -1,48 +0,0 @@
include(CheckCCompilerFlag)
macro(CHECK_LINKER_FLAG flag VARIABLE)
if(NOT DEFINED "${VARIABLE}")
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag")
endif()
set(_cle_source ${CMAKE_SOURCE_DIR}/cmake/CheckLinkerFlag.c)
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${flag}")
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${_cle_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${flag}
CMAKE_FLAGS
"-DCMAKE_EXE_LINKER_FLAGS=${flag}"
OUTPUT_VARIABLE OUTPUT)
unset(_cle_source)
set(CMAKE_C_FLAGS ${saved_CMAKE_C_FLAGS})
unset(saved_CMAKE_C_FLAGS)
if ("${OUTPUT}" MATCHES "warning.*ignored")
set(${VARIABLE} 0)
endif()
if(${VARIABLE})
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have linker flag ${flag}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${flag} linker flag is supported "
"passed with the following output:\n"
"${OUTPUT}\n\n")
else()
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have linker flag ${flag}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${flag} linker flag is supported "
"failed with the following output:\n"
"${OUTPUT}\n\n")
endif()
endif()
endmacro()

@ -1,181 +0,0 @@
OPTION(USE_DEVICE_TREZOR "Trezor support compilation" ON)
OPTION(USE_DEVICE_TREZOR_LIBUSB "Trezor LibUSB compilation" ON)
OPTION(USE_DEVICE_TREZOR_UDP_RELEASE "Trezor UdpTransport in release mode" OFF)
OPTION(USE_DEVICE_TREZOR_DEBUG "Trezor Debugging enabled" OFF)
OPTION(TREZOR_DEBUG "Main trezor debugging switch" OFF)
# Helper function to fix cmake < 3.6.0 FindProtobuf variables
function(_trezor_protobuf_fix_vars)
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
foreach(UPPER
PROTOBUF_SRC_ROOT_FOLDER
PROTOBUF_IMPORT_DIRS
PROTOBUF_DEBUG
PROTOBUF_LIBRARY
PROTOBUF_PROTOC_LIBRARY
PROTOBUF_INCLUDE_DIR
PROTOBUF_PROTOC_EXECUTABLE
PROTOBUF_LIBRARY_DEBUG
PROTOBUF_PROTOC_LIBRARY_DEBUG
PROTOBUF_LITE_LIBRARY
PROTOBUF_LITE_LIBRARY_DEBUG
)
if (DEFINED ${UPPER})
string(REPLACE "PROTOBUF_" "Protobuf_" Camel ${UPPER})
if (NOT DEFINED ${Camel})
set(${Camel} ${${UPPER}} PARENT_SCOPE)
endif()
endif()
endforeach()
endif()
endfunction()
# Use Trezor master switch
if (USE_DEVICE_TREZOR)
# Protobuf is required to build protobuf messages for Trezor
include(FindProtobuf OPTIONAL)
find_package(Protobuf)
_trezor_protobuf_fix_vars()
# Protobuf handling the cache variables set in docker.
if(NOT Protobuf_FOUND AND NOT Protobuf_LIBRARY AND NOT Protobuf_PROTOC_EXECUTABLE AND NOT Protobuf_INCLUDE_DIR)
message(STATUS "Could not find Protobuf")
elseif(NOT Protobuf_LIBRARY OR NOT EXISTS "${Protobuf_LIBRARY}")
message(STATUS "Protobuf library not found: ${Protobuf_LIBRARY}")
unset(Protobuf_FOUND)
elseif(NOT Protobuf_PROTOC_EXECUTABLE OR NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
message(STATUS "Protobuf executable not found: ${Protobuf_PROTOC_EXECUTABLE}")
unset(Protobuf_FOUND)
elseif(NOT Protobuf_INCLUDE_DIR OR NOT EXISTS "${Protobuf_INCLUDE_DIR}")
message(STATUS "Protobuf include dir not found: ${Protobuf_INCLUDE_DIR}")
unset(Protobuf_FOUND)
else()
message(STATUS "Protobuf lib: ${Protobuf_LIBRARY}, inc: ${Protobuf_INCLUDE_DIR}, protoc: ${Protobuf_PROTOC_EXECUTABLE}")
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIR})
set(Protobuf_FOUND 1) # override found if all rquired info was provided by variables
endif()
if(TREZOR_DEBUG)
set(USE_DEVICE_TREZOR_DEBUG 1)
endif()
# Compile debugging support (for tests)
if (USE_DEVICE_TREZOR_DEBUG)
add_definitions(-DWITH_TREZOR_DEBUGGING=1)
endif()
else()
message(STATUS "Trezor support disabled by USE_DEVICE_TREZOR")
endif()
if(Protobuf_FOUND AND USE_DEVICE_TREZOR)
if (NOT "$ENV{TREZOR_PYTHON}" STREQUAL "")
set(TREZOR_PYTHON "$ENV{TREZOR_PYTHON}" CACHE INTERNAL "Copied from environment variable TREZOR_PYTHON")
else()
find_package(Python QUIET COMPONENTS Interpreter) # cmake 3.12+
if(Python_Interpreter_FOUND)
set(TREZOR_PYTHON "${Python_EXECUTABLE}")
endif()
endif()
if(NOT TREZOR_PYTHON)
find_package(PythonInterp)
if(PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE)
set(TREZOR_PYTHON "${PYTHON_EXECUTABLE}")
endif()
endif()
if(NOT TREZOR_PYTHON)
message(STATUS "Trezor: Python not found")
endif()
endif()
# Protobuf compilation test
if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON)
execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} -I "${CMAKE_CURRENT_LIST_DIR}" -I "${Protobuf_INCLUDE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/test-protobuf.proto" --cpp_out ${CMAKE_BINARY_DIR} RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
if(RET)
message(STATUS "Protobuf test generation failed: ${OUT} ${ERR}")
endif()
try_compile(Protobuf_COMPILE_TEST_PASSED
"${CMAKE_BINARY_DIR}"
SOURCES
"${CMAKE_BINARY_DIR}/test-protobuf.pb.cc"
"${CMAKE_CURRENT_LIST_DIR}/test-protobuf.cpp"
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${Protobuf_INCLUDE_DIR};${CMAKE_BINARY_DIR}"
"-DCMAKE_CXX_STANDARD=11"
LINK_LIBRARIES ${Protobuf_LIBRARY}
OUTPUT_VARIABLE OUTPUT
)
if(NOT Protobuf_COMPILE_TEST_PASSED)
message(STATUS "Protobuf Compilation test failed: ${OUTPUT}.")
endif()
endif()
# Try to build protobuf messages
if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON AND Protobuf_COMPILE_TEST_PASSED)
set(ENV{PROTOBUF_INCLUDE_DIRS} "${Protobuf_INCLUDE_DIR}")
set(ENV{PROTOBUF_PROTOC_EXECUTABLE} "${Protobuf_PROTOC_EXECUTABLE}")
set(TREZOR_PROTOBUF_PARAMS "")
if (USE_DEVICE_TREZOR_DEBUG)
set(TREZOR_PROTOBUF_PARAMS "--debug")
endif()
execute_process(COMMAND ${TREZOR_PYTHON} tools/build_protob.py ${TREZOR_PROTOBUF_PARAMS} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../src/device_trezor/trezor RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
if(RET)
message(WARNING "Trezor protobuf messages could not be regenerated (err=${RET}, python ${PYTHON})."
"OUT: ${OUT}, ERR: ${ERR}."
"Please read src/device_trezor/trezor/tools/README.md")
else()
message(STATUS "Trezor protobuf messages regenerated out: \"${OUT}.\"")
set(DEVICE_TREZOR_READY 1)
add_definitions(-DDEVICE_TREZOR_READY=1)
add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DTREZOR_DEBUG=1)
endif()
if(USE_DEVICE_TREZOR_UDP_RELEASE)
add_definitions(-DUSE_DEVICE_TREZOR_UDP_RELEASE=1)
endif()
if (Protobuf_INCLUDE_DIR)
include_directories(${Protobuf_INCLUDE_DIR})
endif()
# LibUSB support, check for particular version
# Include support only if compilation test passes
if (USE_DEVICE_TREZOR_LIBUSB)
find_package(LibUSB)
endif()
if (LibUSB_COMPILE_TEST_PASSED)
add_definitions(-DHAVE_TREZOR_LIBUSB=1)
if(LibUSB_INCLUDE_DIRS)
include_directories(${LibUSB_INCLUDE_DIRS})
endif()
endif()
set(TREZOR_LIBUSB_LIBRARIES "")
if(LibUSB_COMPILE_TEST_PASSED)
list(APPEND TREZOR_LIBUSB_LIBRARIES ${LibUSB_LIBRARIES} ${LIBUSB_DEP_LINKER})
message(STATUS "Trezor compatible LibUSB found at: ${LibUSB_INCLUDE_DIRS}")
endif()
if (BUILD_GUI_DEPS)
set(TREZOR_DEP_LIBS "")
set(TREZOR_DEP_LINKER "")
if (Protobuf_LIBRARY)
list(APPEND TREZOR_DEP_LIBS ${Protobuf_LIBRARY})
string(APPEND TREZOR_DEP_LINKER " -lprotobuf")
endif()
if (TREZOR_LIBUSB_LIBRARIES)
list(APPEND TREZOR_DEP_LIBS ${TREZOR_LIBUSB_LIBRARIES})
string(APPEND TREZOR_DEP_LINKER " -lusb-1.0 ${LIBUSB_DEP_LINKER}")
endif()
endif()
endif()
endif()

File diff suppressed because it is too large Load Diff

@ -1,14 +0,0 @@
/* increase vertical space */
#titlearea, #nav-path {
display: none;
height: 0px;
}
/* uncomment these lines for some extra vertical space */
/*
.tablist li {
line-height: 26px;
}
*/

@ -0,0 +1,104 @@
#[=======================================================================[.rst:
FindLibunbound
--------------
Find the Libunbound library
Imported targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``Libunbound::Libunbound``
The Libunbound library, if found.
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``Libunbound_FOUND``
If false, do not try to use Libunbound.
``LIBUNBOUND_INCLUDE_DIR``
where to find libunbound headers.
``LIBUNBOUND_LIBRARIES``
the libraries needed to use Libunbound.
``LIBUNBOUND_VERSION``
the version of the Libunbound library found
#]=======================================================================]
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PkgLibunbound IMPORTED_TARGET GLOBAL QUIET libunbound)
endif ()
if (PkgLibunbound_FOUND)
set(LIBUNBOUND_INCLUDE_DIR ${PkgLibunbound_INCLUDE_DIRS} CACHE FILEPATH "libunbound include path")
set(LIBUNBOUND_LIBRARIES ${PkgLibunbound_LIBRARIES} CACHE STRING "libunbound libraries")
set(LIBUNBOUND_VERSION ${PkgLibunbound_VERSION})
add_library(Libunbound::Libunbound ALIAS PkgConfig::PkgLibunbound)
set(Libunbound_FOUND ON)
else ()
find_path(LIBUNBOUND_INCLUDE_DIR unbound.h
HINTS
"${LIBUNBOUND_DIR}"
"${LIBUNBOUND_DIR}/include"
)
find_library(LIBUNBOUND_LIBRARY NAMES unbound
HINTS
"${LIBUNBOUND_DIR}"
"${LIBUNBOUND_DIR}/lib"
)
set(_LIBUNBOUND_LIBRARIES "")
if (UNIX)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
list(APPEND _LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
list(APPEND _LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}")
endif()
if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY)
if (NOT TARGET Libunbound::Libunbound)
add_library(Libunbound::Libunbound UNKNOWN IMPORTED)
set_target_properties(Libunbound::Libunbound PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}"
)
if(UNIX AND TARGET Threads::Threads)
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Threads::Threads)
endif ()
if(UNIX AND TARGET OpenSSL::SSL)
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenSSL::SSL)
endif ()
if(UNIX AND TARGET OpenSSL::Crypto)
set_property(TARGET Libunbound::Libunbound APPEND PROPERTY
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
endif ()
endif ()
if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h")
file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+")
string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}")
endif ()
endif ()
list(APPEND _LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}")
set(LIBUNBOUND_LIBRARIES ${_LIBUNBOUND_LIBRARIES} CACHE STRING "libunbound libraries")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libunbound
REQUIRED_VARS LIBUNBOUND_LIBRARIES LIBUNBOUND_INCLUDE_DIR
VERSION_VAR LIBUNBOUND_VERSION
)
endif ()
mark_as_advanced(LIBUNBOUND_INCLUDE_DIR LIBUNBOUND_LIBRARIES LIBUNBOUND_LIBRARY)

@ -1,40 +0,0 @@
# Copyright (c) 2014-2022, The Monero Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MESSAGE(STATUS "Looking for libunbound")
FIND_PATH(UNBOUND_INCLUDE_DIR
NAMES unbound.h
PATH_SUFFIXES include/ include/unbound/
PATHS "${PROJECT_SOURCE_DIR}"
${UNBOUND_ROOT}
$ENV{UNBOUND_ROOT}
/usr/local/
/usr/
)
find_library(UNBOUND_LIBRARIES unbound)

@ -0,0 +1,17 @@
# - Try to find ZMQ
# Once done this will define
# ZMQ_FOUND - System has ZMQ
# ZMQ_INCLUDE_DIRS - The ZMQ include directories
# ZMQ_LIBRARIES - The libraries needed to use ZMQ
# ZMQ_DEFINITIONS - Compiler switches required for using ZMQ
find_path ( ZMQ_INCLUDE_DIR zmq.h )
find_library ( ZMQ_LIBRARY NAMES zmq )
set ( ZMQ_LIBRARIES ${ZMQ_LIBRARY} )
set ( ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR} )
include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args ( ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR )

@ -0,0 +1,291 @@
# Written in 2016 by Henrik Steffen Gaßmann <henrik@gassmann.onl>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along with
# this software. If not, see
#
# http://creativecommons.org/publicdomain/zero/1.0/
#
# ##############################################################################
# Tries to find the local libsodium installation.
#
# On Windows the sodium_DIR environment variable is used as a default hint which
# can be overridden by setting the corresponding cmake variable.
#
# Once done the following variables will be defined:
#
# sodium_FOUND sodium_INCLUDE_DIR sodium_LIBRARY_DEBUG sodium_LIBRARY_RELEASE
# sodium_VERSION_STRING
#
# Furthermore an imported "sodium" target is created.
#
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(_GCC_COMPATIBLE 1)
endif()
# static library option
if(NOT DEFINED sodium_USE_STATIC_LIBS)
option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF)
endif()
if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST))
unset(sodium_LIBRARY CACHE)
unset(sodium_LIBRARY_DEBUG CACHE)
unset(sodium_LIBRARY_RELEASE CACHE)
unset(sodium_DLL_DEBUG CACHE)
unset(sodium_DLL_RELEASE CACHE)
set(sodium_USE_STATIC_LIBS_LAST
${sodium_USE_STATIC_LIBS}
CACHE INTERNAL "internal change tracking variable")
endif()
# ##############################################################################
# UNIX
if(UNIX)
# import pkg-config
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(sodium_PKG QUIET libsodium)
endif()
if(sodium_USE_STATIC_LIBS)
if(sodium_PKG_STATIC_LIBRARIES)
foreach(_libname ${sodium_PKG_STATIC_LIBRARIES})
if(NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending
# with .a
list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a")
endif()
endforeach()
list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES)
else()
# if pkgconfig for libsodium doesn't provide static lib info, then
# override PKG_STATIC here..
set(sodium_PKG_STATIC_LIBRARIES libsodium.a)
endif()
set(XPREFIX sodium_PKG_STATIC)
else()
if(sodium_PKG_LIBRARIES STREQUAL "")
set(sodium_PKG_LIBRARIES sodium)
endif()
set(XPREFIX sodium_PKG)
endif()
find_path(sodium_INCLUDE_DIR sodium.h HINTS ${${XPREFIX}_INCLUDE_DIRS})
find_library(sodium_LIBRARY_DEBUG
NAMES ${${XPREFIX}_LIBRARIES}
HINTS ${${XPREFIX}_LIBRARY_DIRS})
find_library(sodium_LIBRARY_RELEASE
NAMES ${${XPREFIX}_LIBRARIES}
HINTS ${${XPREFIX}_LIBRARY_DIRS})
# ############################################################################
# Windows
elseif(WIN32)
set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory")
mark_as_advanced(sodium_DIR)
find_path(sodium_INCLUDE_DIR sodium.h
HINTS ${sodium_DIR}
PATH_SUFFIXES include)
if(MSVC)
# detect target architecture
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.c" [=[
#if defined _M_IX86
#error ARCH_VALUE x86_32
#elif defined _M_X64
#error ARCH_VALUE x86_64
#endif
#error ARCH_VALUE unknown
]=])
try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/arch.c"
OUTPUT_VARIABLE _COMPILATION_LOG)
string(REGEX
REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*"
"\\1"
_TARGET_ARCH
"${_COMPILATION_LOG}")
# construct library path
if(_TARGET_ARCH STREQUAL "x86_32")
string(APPEND _PLATFORM_PATH "Win32")
elseif(_TARGET_ARCH STREQUAL "x86_64")
string(APPEND _PLATFORM_PATH "x64")
else()
message(
FATAL_ERROR
"the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake."
)
endif()
string(APPEND _PLATFORM_PATH "/$$CONFIG$$")
if(MSVC_VERSION LESS 1900)
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60")
else()
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50")
endif()
string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}")
if(sodium_USE_STATIC_LIBS)
string(APPEND _PLATFORM_PATH "/static")
else()
string(APPEND _PLATFORM_PATH "/dynamic")
endif()
string(REPLACE "$$CONFIG$$"
"Debug"
_DEBUG_PATH_SUFFIX
"${_PLATFORM_PATH}")
string(REPLACE "$$CONFIG$$"
"Release"
_RELEASE_PATH_SUFFIX
"${_PLATFORM_PATH}")
find_library(sodium_LIBRARY_DEBUG libsodium.lib
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX})
find_library(sodium_LIBRARY_RELEASE libsodium.lib
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX})
if(NOT sodium_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(sodium_DLL_DEBUG libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX})
find_library(sodium_DLL_RELEASE libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK})
endif()
elseif(_GCC_COMPATIBLE)
if(sodium_USE_STATIC_LIBS)
find_library(sodium_LIBRARY_DEBUG libsodium.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib)
find_library(sodium_LIBRARY_RELEASE libsodium.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib)
else()
find_library(sodium_LIBRARY_DEBUG libsodium.dll.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib)
find_library(sodium_LIBRARY_RELEASE libsodium.dll.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib)
file(GLOB _DLL
LIST_DIRECTORIES false
RELATIVE "${sodium_DIR}/bin"
"${sodium_DIR}/bin/libsodium*.dll")
find_library(sodium_DLL_DEBUG ${_DLL} libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES bin)
find_library(sodium_DLL_RELEASE ${_DLL} libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES bin)
endif()
else()
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
endif()
# ############################################################################
# unsupported
else()
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
endif()
# ##############################################################################
# common stuff
# extract sodium version
if(sodium_INCLUDE_DIR)
set(_VERSION_HEADER "${sodium_INCLUDE_DIR}/sodium/version.h")
if(EXISTS "${_VERSION_HEADER}")
file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT)
string(REGEX
REPLACE ".*define[ \t]+SODIUM_VERSION_STRING[^\"]+\"([^\"]+)\".*"
"\\1"
sodium_VERSION_STRING
"${_VERSION_HEADER_CONTENT}")
set(sodium_VERSION_STRING "${sodium_VERSION_STRING}")
endif()
endif()
# communicate results
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(sodium
REQUIRED_VARS
sodium_LIBRARY_RELEASE
sodium_LIBRARY_DEBUG
sodium_INCLUDE_DIR
VERSION_VAR
sodium_VERSION_STRING)
# mark file paths as advanced
mark_as_advanced(sodium_INCLUDE_DIR)
mark_as_advanced(sodium_LIBRARY_DEBUG)
mark_as_advanced(sodium_LIBRARY_RELEASE)
if(WIN32)
mark_as_advanced(sodium_DLL_DEBUG)
mark_as_advanced(sodium_DLL_RELEASE)
endif()
# create imported target
if(sodium_USE_STATIC_LIBS)
set(_LIB_TYPE STATIC)
else()
set(_LIB_TYPE SHARED)
endif()
add_library(sodium ${_LIB_TYPE} IMPORTED)
set_target_properties(sodium
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${sodium_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES
"C")
if(sodium_USE_STATIC_LIBS)
set_target_properties(sodium
PROPERTIES INTERFACE_COMPILE_DEFINITIONS
"SODIUM_STATIC"
IMPORTED_LOCATION
"${sodium_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG
"${sodium_LIBRARY_DEBUG}")
else()
if(UNIX)
set_target_properties(sodium
PROPERTIES IMPORTED_LOCATION
"${sodium_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG
"${sodium_LIBRARY_DEBUG}")
elseif(WIN32)
set_target_properties(sodium
PROPERTIES IMPORTED_IMPLIB
"${sodium_LIBRARY_RELEASE}"
IMPORTED_IMPLIB_DEBUG
"${sodium_LIBRARY_DEBUG}")
if(NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND"))
set_target_properties(sodium
PROPERTIES IMPORTED_LOCATION_DEBUG
"${sodium_DLL_DEBUG}")
endif()
if(NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND"))
set_target_properties(sodium
PROPERTIES IMPORTED_LOCATION_RELWITHDEBINFO
"${sodium_DLL_RELEASE}"
IMPORTED_LOCATION_MINSIZEREL
"${sodium_DLL_RELEASE}"
IMPORTED_LOCATION_RELEASE
"${sodium_DLL_RELEASE}")
endif()
endif()
endif()

@ -0,0 +1,51 @@
@PACKAGE_INIT@
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules/")
include("${CMAKE_CURRENT_LIST_DIR}/MoneroTargets.cmake")
find_package(Threads)
find_package(Backtrace)
find_package(PythonInterp)
find_package(miniupnpc REQUIRED)
find_package(ZMQ REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Boost 1.58 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
find_package(Libunbound 1.16 REQUIRED)
find_package(sodium REQUIRED)
check_required_components(epee)
check_required_components(easylogging)
check_required_components(qrcodegen)
check_required_components(lmdb)
check_required_components(cncrypto)
check_required_components(version)
check_required_components(common)
check_required_components(lmdb_lib)
check_required_components(randomx)
check_required_components(cryptonote_format_utils_basic)
check_required_components(monero-crypto-amd64-64-24k)
check_required_components(wallet-crypto)
check_required_components(ringct)
check_required_components(cryptonote_basic)
check_required_components(ringct_basic)
check_required_components(checkpoints)
check_required_components(blockchain_db)
check_required_components(cryptonote_core)
check_required_components(cryptonote_protocol)
check_required_components(mnemonics)
check_required_components(device)
check_required_components(blocks)
check_required_components(wallet)
check_required_components(wallet_api)
check_required_components(rpc_base)
check_required_components(rpc)
check_required_components(rpc_pub)
check_required_components(daemon_messages)
check_required_components(daemon_rpc_server)
check_required_components(net)
check_required_components(p2p)
check_required_components(multisig)
check_required_components(hardforks)
check_required_components(daemonizer)
check_required_components(serialization)

@ -1,72 +0,0 @@
# Copyright (c) 2014-2022, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html
# This module sets the following variables:
# CMAKE_C_CLANG_TIDY
# CMAKE_CXX_CLANG_TIDY
# when clang-tidy is found in PATH. Afterwards, the code is being linted by the tool.
# The checks to be enabled can be manipulated with the variable MONERO_CLANG_TIDY_CHECKS
macro (monero_clang_tidy LANGUAGE)
set(TOOL_NAME "clang-tidy")
set(MONERO_CLANG_TIDY_MIN_VERSION "3.6")
if(${CMAKE_VERSION} VERSION_LESS "${MONERO_CLANG_TIDY_MIN_VERSION}")
message(FATAL_ERROR "Sorry, ${TOOL_NAME} is available for CMake from version ${MONERO_CLANG_TIDY_MIN_VERSION}")
else()
message(STATUS "Trying to enable ${TOOL_NAME}")
find_program(MONERO_CLANG_BIN ${TOOL_NAME})
if(NOT MONERO_CLANG_BIN)
message(FATAL_ERROR "${TOOL_NAME} not found! Try running: sudo apt install ${TOOL_NAME}")
else()
message(STATUS "Found ${MONERO_CLANG_BIN}")
set(MONERO_CLANG_TIDY_CHECKS
-header-filter=.; # By default the headers are excluded. This line enables them.
-checks=*; # Currently enabling all checks
# An example of selectively enabling checks:
#-checks=bugprone-*,cppcoreguidelines-avoid-goto # Have to be in one line :(
)
# Current list of checks is avaibale under:
# https://clang.llvm.org/extra/clang-tidy/
if (${LANGUAGE} STREQUAL "C")
set(CMAKE_C_CLANG_TIDY
${MONERO_CLANG_BIN}; # Mind the semicolon
${MONERO_CLANG_TIDY_CHECKS}
)
elseif (${LANGUAGE} STREQUAL "CXX")
set(CMAKE_CXX_CLANG_TIDY
${MONERO_CLANG_BIN}; # Mind the semicolon
${MONERO_CLANG_TIDY_CHECKS}
)
else()
message(FATAL_ERROR "${TOOL_NAME}: Unsupported language: ${LANGUAGE}")
endif()
endif()
endif()
endmacro()

@ -0,0 +1,95 @@
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
function(monero_install_library targetName)
set(flags)
set(args)
set(listArgs INCLUDE_DIR HEADERS)
cmake_parse_arguments(arg "${flags}" "${args}" "${listArgs}" ${ARGN})
set(include_dir "${arg_INCLUDE_DIR}")
set(headers "${arg_HEADERS}")
if(NOT include_dir)
set(include_dir "${CMAKE_INSTALL_INCLUDEDIR}/monero/")
endif()
if(${targetName} STREQUAL "device")
message(STATUS "lol")
endif()
if(headers AND include_dir)
install_with_directory(DESTINATION ${include_dir} FILES ${headers})
endif()
install(TARGETS ${targetName} EXPORT MoneroTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/monero/
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/monero/
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/monero/
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monero/)
endfunction()
function(print_cmake_summary)
message(STATUS "\n====================================== SUMMARY")
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
if(GIT_FOUND)
execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wownero OUTPUT_VARIABLE _WOWNERO_HEAD OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _WOWNERO_HEAD STREQUAL WOWNERO_HEAD)
message(STATUS "[+] WOWNERO HEAD: ${_WOWNERO_HEAD} ... while CMake requested ${WOWNERO_HEAD}")
else()
message(STATUS "[+] WOWNERO HEAD: ${WOWNERO_HEAD}")
endif()
endif()
message(STATUS "[+] VERSION: ${VERSION}")
message(STATUS "[+] STATIC: ${STATIC}")
message(STATUS "[+] ARM: ${ARM}")
message(STATUS "[+] Android: ${ANDROID}")
message(STATUS "[+] iOS: ${IOS}")
message(STATUS "[+] OpenSSL")
message(STATUS " - version: ${OPENSSL_VERSION}")
message(STATUS " - dirs: ${OPENSSL_INCLUDE_DIR}")
message(STATUS " - libs: ${OPENSSL_LIBRARIES}")
if(CAIRO_FOUND)
message(STATUS "[+] Cairo")
message(STATUS " - version: ${CAIRO_VERSION}")
message(STATUS " - dirs: ${CAIRO_INCLUDE_DIRS}")
message(STATUS " - libs: ${CAIRO_LIBRARIES}")
endif()
if(XFIXES_FOUND)
message(STATUS "[+] Xfixes")
message(STATUS " - dirs: ${XFIXES_INCLUDE_DIR}")
message(STATUS " - libs: ${XFIXES_LIBRARY}")
endif()
message(STATUS "[+] Boost")
message(STATUS " - version: ${Boost_VERSION}")
message(STATUS " - dirs: ${Boost_INCLUDE_DIRS}")
message(STATUS " - libs: ${Boost_LIBRARIES}")
if(Iconv_FOUND)
message(STATUS "[+] Iconv")
message(STATUS " - version: ${Iconv_VERSION}")
message(STATUS " - libs: ${Iconv_LIBRARIES}")
message(STATUS " - dirs: ${Iconv_INCLUDE_DIRS}")
endif()
endfunction()
macro(install_with_directory)
set(optionsArgs "")
set(oneValueArgs "DESTINATION")
set(multiValueArgs "FILES")
cmake_parse_arguments(CAS "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
foreach(FILE ${CAS_FILES})
get_filename_component(DIR ${FILE} DIRECTORY)
INSTALL(FILES ${FILE} DESTINATION ${CAS_DESTINATION}/${DIR})
endforeach()
endmacro(install_with_directory)

@ -1,52 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <libusb.h>
#define UNUSED(expr) (void)(expr)
int main(int argc, char *argv[]) {
libusb_device **devs;
libusb_context *ctx = NULL;
int r = libusb_init(&ctx); UNUSED(r);
ssize_t cnt = libusb_get_device_list(ctx, &devs); UNUSED(cnt);
struct libusb_device_descriptor desc;
r = libusb_get_device_descriptor(devs[0], &desc); UNUSED(r);
uint8_t bus_id = libusb_get_bus_number(devs[0]); UNUSED(bus_id);
uint8_t addr = libusb_get_device_address(devs[0]); UNUSED(addr);
uint8_t tmp_path[16];
r = libusb_get_port_numbers(devs[0], tmp_path, sizeof(tmp_path));
UNUSED(r);
UNUSED(tmp_path);
libusb_free_device_list(devs, 1);
libusb_exit(ctx);
}

@ -1,43 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <iostream>
#include <google/protobuf/message.h>
#include <google/protobuf/unknown_field_set.h>
#include "test-protobuf.pb.h"
int main(int argc, char *argv[]) {
google::protobuf::UnknownFieldSet ufs;
ufs.ClearAndFreeMemory();
Success sc;
sc.set_message("test");
sc.SerializeToOstream(&std::cerr);
return 0;
}

@ -1,7 +0,0 @@
syntax = "proto2";
import "google/protobuf/descriptor.proto";
message Success {
optional string message = 1;
}

@ -1,34 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
static_assert(1, "FAIL");
int main(int argc, char *argv[]) {
return 0;
}

@ -1,34 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
static_assert(1, "FAIL");
int main(int argc, char *argv[]) {
return 0;
}

@ -26,6 +26,5 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
monero_enable_coverage()
add_subdirectory(epee)

@ -145,7 +145,7 @@ $(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)"
$(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)"
$(1)_autoconf=./configure --host=$($($(1)_type)_host) --prefix=$($($(1)_type)_prefix) $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)"
ifeq ($(filter $(1),libusb unbound),)
ifneq ($(1),libusb)
$(1)_autoconf += --disable-dependency-tracking
endif
ifneq ($($(1)_nm),)

@ -1,12 +1,12 @@
package=expat
$(package)_version=2.6.0
$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$($(package)_version))/
$(package)_version=2.4.1
$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_4_1
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
$(package)_sha256_hash=ff60e6a6b6ce570ae012dc7b73169c7fdf4b6bf08c12ed0ec6f55736b78d85ba
$(package)_sha256_hash=2f9b6a580b94577b150a7d5617ad4643a4301a6616ff459307df3e225bcfbf40
define $(package)_set_vars
$(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples
$(package)_config_opts+=--enable-option-checking --without-xmlwf --with-pic
$(package)_config_opts=--enable-static
$(package)_config_opts=--disable-shared
$(package)_config_opts+=--prefix=$(host_prefix)
endef
@ -23,6 +23,6 @@ define $(package)_stage_cmds
endef
define $(package)_postprocess_cmds
rm -rf share lib/cmake lib/*.la
rm lib/*.la
endef

@ -1,8 +1,8 @@
package=openssl
$(package)_version=3.0.13
$(package)_version=3.0.11
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313
$(package)_sha256_hash=b3425d3bb4a2218d0697eb41f7fc0cdede016ed19ca49d168b78e8d947887f55
define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"

@ -1,21 +1,18 @@
package=unbound
$(package)_version=1.19.1
$(package)_version=1.15.0
$(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=bc1d576f3dd846a0739adc41ffaa702404c6767d2b6082deb9f2f97cbb24a3a9
$(package)_sha256_hash=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f
$(package)_dependencies=openssl expat
$(package)_patches=disable-glibc-reallocarray.patch
define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix)
$(package)_config_opts+=--with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no
$(package)_config_opts+=--without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only
$(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix) --with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix)
$(package)_config_opts_x86_64_darwin=ac_cv_func_SHA384_Init=yes
$(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread"
$(package)_cflags_mingw32+="-D_WIN32_WINNT=0x600"
endef
define $(package)_preprocess_cmds
@ -34,3 +31,6 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
define $(package)_postprocess_cmds
endef

@ -144,11 +144,8 @@ elseif(ARCHITECTURE STREQUAL "aarch64")
endif()
if(ARCHITECTURE STREQUAL "riscv64")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BUILD_TAG "linux-riscv64")
endif()
set(ARCH_ID "riscv64")
set(ARCH "rv64gc")
set(ARCH_ID "riscv64")
set(ARCH "rv64gc")
endif()
if(ARCHITECTURE STREQUAL "i686")

@ -245,8 +245,18 @@ namespace net_utils
}
}
// This magic var determines the maximum length for when copying the body message in
// memory is faster/more preferable than the round-trip time for one packet
constexpr size_t BODY_NO_COPY_CUTOFF = 128 * 1024; // ~262 KB or ~175 packets
// Maximum expected total headers bytes
constexpr size_t HEADER_RESERVE_SIZE = 2048;
const bool do_copy_body = body.size() <= BODY_NO_COPY_CUTOFF;
const size_t req_buff_cap = HEADER_RESERVE_SIZE + (do_copy_body ? body.size() : 0);
std::string req_buff{};
req_buff.reserve(2048);
req_buff.reserve(req_buff_cap);
req_buff.append(method.data(), method.size()).append(" ").append(uri.data(), uri.size()).append(" HTTP/1.1\r\n");
add_field(req_buff, "Host", m_host_buff);
add_field(req_buff, "Content-Length", std::to_string(body.size()));
@ -255,9 +265,7 @@ namespace net_utils
for(const auto& field : additional_params)
add_field(req_buff, field);
for (unsigned sends = 0; sends < 2; ++sends)
{
const std::size_t initial_size = req_buff.size();
const auto auth = m_auth.get_auth_field(method, uri);
if (auth)
add_field(req_buff, *auth);
@ -265,11 +273,21 @@ namespace net_utils
req_buff += "\r\n";
//--
bool res = m_net_client.send(req_buff, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
if(body.size())
if (do_copy_body) // small body
{
// Copy headers + body together and potentially send one fewer packet
req_buff.append(body.data(), body.size());
const bool res = m_net_client.send(req_buff, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
}
else // large body
{
// Send headers and body seperately to avoid copying heavy body message
bool res = m_net_client.send(req_buff, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
res = m_net_client.send(body, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
}
m_response_info.clear();
m_state = reciev_machine_state_header;
@ -282,19 +300,11 @@ namespace net_utils
return true;
}
switch (m_auth.handle_401(m_response_info))
if (m_auth.handle_401(m_response_info) == http_client_auth::kParseFailure)
{
case http_client_auth::kSuccess:
break;
case http_client_auth::kBadPassword:
sends = 2;
break;
default:
case http_client_auth::kParseFailure:
LOG_ERROR("Bad server response for authentication");
return false;
}
req_buff.resize(initial_size); // rollback for new auth generation
}
LOG_ERROR("Client has incorrect username/password for server requiring authentication");
return false;

@ -27,64 +27,37 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(EPEE_INCLUDE_DIR_BASE "${CMAKE_CURRENT_SOURCE_DIR}/../include")
file(GLOB EPEE_HEADERS_PUBLIC "${EPEE_INCLUDE_DIR_BASE}/*.h")
# Add headers to the file list, to be able to search for them and autosave in IDEs.
monero_find_all_headers(EPEE_HEADERS_PUBLIC "${EPEE_INCLUDE_DIR_BASE}")
monero_add_library(epee byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp parserse_base_utils.cpp
wipeable_string.cpp levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp
int-util.cpp portable_storage.cpp
misc_language.cpp
file_io_utils.cpp
net_parse_helpers.cpp
http_base.cpp
${EPEE_HEADERS_PUBLIC}
file(GLOB EPEE_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
monero_add_library(epee_readline readline_buffer.cpp)
endif()
add_library(epee)
target_sources(epee
PRIVATE
${EPEE_SOURCES}
)
set_property(SOURCE memwipe.c PROPERTY C_STANDARD 11)
# Build and install libepee if we're building for GUI
if (BUILD_GUI_DEPS)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS epee
ARCHIVE DESTINATION ${lib_folder})
if (USE_READLINE AND GNU_READLINE_FOUND)
install(TARGETS epee_readline
ARCHIVE DESTINATION ${lib_folder})
endif()
endif()
target_link_libraries(epee
PUBLIC
easylogging
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${OPENSSL_LIBRARIES}
PRIVATE
${EXTRA_LIBRARIES})
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
target_link_libraries(epee_readline
PUBLIC
easylogging
${Boost_SYSTEM_LIBRARY}
PRIVATE
${GNU_READLINE_LIBRARY})
endif()
Boost::chrono
Boost::filesystem
Boost::thread
Boost::regex
Boost::system
OpenSSL::SSL)
target_include_directories(epee
PUBLIC
"${EPEE_INCLUDE_DIR_BASE}"
"${OPENSSL_INCLUDE_DIR}")
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/epee/>)
install(DIRECTORY ${EPEE_INCLUDE_DIR_BASE}/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/monero/epee/")
monero_install_library(epee)

@ -338,21 +338,11 @@ bool is_stdout_a_tty()
return is_a_tty.load(std::memory_order_relaxed);
}
static bool is_nocolor()
{
static const char *no_color_var = getenv("NO_COLOR");
static const bool no_color = no_color_var && *no_color_var; // apparently, NO_COLOR=0 means no color too (as per no-color.org)
return no_color;
}
void set_console_color(int color, bool bright)
{
if (!is_stdout_a_tty())
return;
if (is_nocolor())
return;
switch(color)
{
case console_color_default:
@ -471,9 +461,6 @@ void reset_console_color() {
if (!is_stdout_a_tty())
return;
if (is_nocolor())
return;
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);

@ -238,10 +238,6 @@ static char** attempted_completion(const char* text, int start, int end)
static void install_line_handler()
{
#if RL_READLINE_VERSION >= 0x0801
rl_variable_bind("enable-bracketed-paste", "off");
#endif
rl_attempted_completion_function = attempted_completion;
rl_callback_handler_install("", handle_line);
stifle_history(500);

@ -57,7 +57,7 @@ The dockrun.sh script will do everything to build the binaries. Just specify the
version to build as its only argument, e.g.
```bash
VERSION=v0.18.3.2
VERSION=v0.18.3.0
./dockrun.sh $VERSION
```

@ -133,7 +133,7 @@ Common setup part:
su - gitianuser
GH_USER=YOUR_GITHUB_USER_NAME
VERSION=v0.18.3.2
VERSION=v0.18.3.0
```
Where `GH_USER` is your GitHub user name and `VERSION` is the version tag you want to build.

@ -21,7 +21,6 @@ packages:
- "g++-7-arm-linux-gnueabihf"
- "gcc-arm-linux-gnueabihf"
- "g++-arm-linux-gnueabihf"
- "g++-riscv64-linux-gnu"
- "g++-7-multilib"
- "gcc-7-multilib"
- "binutils-arm-linux-gnueabihf"
@ -44,7 +43,7 @@ files: []
script: |
WRAP_DIR=$HOME/wrapped
HOSTS="x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu i686-linux-gnu riscv64-linux-gnu"
HOSTS="x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu i686-linux-gnu"
FAKETIME_HOST_PROGS=""
FAKETIME_PROGS="date"
HOST_CFLAGS="-O2 -g"
@ -160,13 +159,7 @@ script: |
fi
export C_INCLUDE_PATH="$EXTRA_INCLUDES"
export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES"
# glibc only added riscv support in 2.27, disable backwards compatibility
if [ "$i" == "riscv64-linux-gnu" ]; then
BACKCOMPAT_OPTION=OFF
else
BACKCOMPAT_OPTION=ON
fi
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=${BACKCOMPAT_OPTION} -DCMAKE_SKIP_RPATH=ON
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON -DCMAKE_SKIP_RPATH=ON
make ${MAKEOPTS}
chmod 755 bin/*
cp ../utils/conf/wow.conf bin

@ -71,13 +71,13 @@ type, and max connections:
```
--anonymous-inbound rveahdfho7wo4b2m.onion:28083,127.0.0.1:28083,25
--anonymous-inbound cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p,127.0.0.1:30000
--anonymous-inbound cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p:5000,127.0.0.1:30000
```
which tells `monerod` that a max of 25 inbound Tor connections are being
received at address "rveahdfho7wo4b2m.onion:28083" and forwarded to `monerod`
localhost port 28083, and a default max I2P connections are being received at
address "cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p" and
address "cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p:5000" and
forwarded to `monerod` localhost port 30000.
These addresses will be shared with outgoing peers, over the same network type,
otherwise the peer will not be notified of the peer address by the proxy.

@ -28,45 +28,11 @@
#
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
# This is broken up into two parts: first we check for miniupnp, compile it if we can't
# find it, and thereafter we check for libunbound, and compile it if we can't find it.
# We always compile if we are building statically to reduce static dependency issues...
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
# others.
find_package(Miniupnpc REQUIRED)
message(STATUS "Using in-tree miniupnpc")
set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
add_subdirectory(miniupnp/miniupnpc)
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
if(MSVC)
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
elseif(NOT MSVC)
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
endif()
set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
find_package(Unbound)
if(NOT UNBOUND_INCLUDE_DIR)
die("Could not find libunbound")
else()
message(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}")
if(UNBOUND_LIBRARIES)
message(STATUS "Found libunbound library")
else()
die("Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent")
endif()
endif()
add_subdirectory(db_drivers)
add_subdirectory(easylogging++)
add_subdirectory(qrcodegen)
add_subdirectory(randomwow EXCLUDE_FROM_ALL)
add_subdirectory(randomwow)
add_subdirectory(supercop)
install(DIRECTORY boost
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/monero/")

@ -26,40 +26,40 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(lmdb_sources
mdb.c
midl.c)
add_library(lmdb)
target_sources(lmdb PRIVATE ${lmdb_sources})
target_include_directories(lmdb
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
target_link_libraries(lmdb PRIVATE Threads::Threads)
if(FREEBSD)
add_definitions(-DMDB_DSYNC=O_SYNC)
target_compile_definitions(lmdb PUBLIC MDB_DSYNC=O_SYNC)
endif()
if(ANDROID)
add_definitions("-DANDROID=1")
target_compile_definitions(lmdb PUBLIC ANDROID=1)
endif()
set (lmdb_sources
mdb.c
midl.c)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_library(lmdb
${lmdb_sources})
target_link_libraries(lmdb
PRIVATE
${CMAKE_THREAD_LIBS_INIT})
if(${ARCH_WIDTH} EQUAL 32)
target_compile_definitions(lmdb
PUBLIC -DMDB_VL32)
target_compile_definitions(lmdb PUBLIC MDB_VL32=1)
endif()
# GUI/libwallet install target
if (BUILD_GUI_DEPS)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS lmdb
ARCHIVE DESTINATION ${lib_folder}
LIBRARY DESTINATION ${lib_folder})
endif()
set_property(TARGET lmdb APPEND PROPERTY COMPILE_FLAGS "-fPIC")
set_target_properties(lmdb PROPERTIES
POSITION_INDEPENDENT_CODE ON
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
monero_install_library(lmdb
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/lmdb/"
HEADERS "midl.h;lmdb.h")

@ -26,43 +26,31 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.5)
set(EL_HEADERS
easylogging++.h
ea_config.h)
add_library(easylogging)
target_sources(easylogging
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/easylogging++.cc
)
target_compile_definitions(easylogging PUBLIC
AUTO_INITIALIZE_EASYLOGGINGPP
)
target_include_directories(easylogging
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/easylogging++/>
)
project(easylogging CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
monero_enable_coverage()
find_package(Threads)
find_package(Backtrace)
monero_find_all_headers(EASYLOGGING_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}")
add_library(easylogging
easylogging++.cc
${EASYLOGGING_HEADERS}
)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
target_link_libraries(easylogging
PRIVATE
${CMAKE_THREAD_LIBS_INIT}
${Backtrace_LIBRARIES})
# GUI/libwallet install target
if (BUILD_GUI_DEPS)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS easylogging
ARCHIVE DESTINATION ${lib_folder}
LIBRARY DESTINATION ${lib_folder})
endif()
set_property(TARGET easylogging APPEND PROPERTY COMPILE_FLAGS "-fPIC")
PRIVATE
Threads::Threads
${Backtrace_LIBRARIES})
monero_install_library(easylogging
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/easylogging++/"
HEADERS ${EL_HEADERS})

@ -149,11 +149,6 @@ static el::Color colorFromLevel(el::Level level)
static void setConsoleColor(el::Color color, bool bright)
{
static const char *no_color_var = getenv("NO_COLOR");
static const bool no_color = no_color_var && *no_color_var; // apparently, NO_COLOR=0 means no color too (as per no-color.org)
if (no_color)
return;
#if ELPP_OS_WINDOWS
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
switch (color)

1
external/miniupnp vendored

@ -1 +0,0 @@
Subproject commit 544e6fcc73c5ad9af48a8985c94f0f1d742ef2e0

@ -1,8 +1,16 @@
project(libqrcodegen)
add_library(qrcodegen)
add_library(qrcodegen STATIC QrCode.cpp)
set_target_properties(qrcodegen PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(qrcodegen PROPERTIES CXX_STANDARD 11)
target_sources(qrcodegen
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/QrCode.cpp
)
target_include_directories(qrcodegen PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(qrcodegen
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(qrcodegen
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/qrcodegen/"
HEADERS QrCode.hpp)

@ -1 +1 @@
Subproject commit 27b099b6dd6fef6e17f58c6dfe00009e9c5df587
Subproject commit bb4ed329c76493cc07a5c5bfae041b28434d9caf

@ -1 +0,0 @@
Subproject commit 129d19ba7f496df5e33658527a7158c79b99c21c

2
external/supercop vendored

@ -1 +1 @@
Subproject commit 633500ad8c8759995049ccd022107d1fa8a1bbc9
Subproject commit 036511a8bdc0883059d107aeb2910b54ee0a061b

@ -28,60 +28,23 @@
#
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
if (WIN32 OR STATIC)
add_definitions(-DSTATICLIB)
# miniupnp changed their static define
add_definitions(-DMINIUPNP_STATICLIB)
endif ()
function (monero_private_headers group)
source_group("${group}\\Private"
FILES
${ARGN})
endfunction ()
function (monero_install_headers subdir)
install(
FILES ${ARGN}
DESTINATION "include/${subdir}"
COMPONENT development)
endfunction ()
function (enable_stack_trace target)
if(STACK_TRACE)
set_property(TARGET ${target}
APPEND PROPERTY COMPILE_DEFINITIONS "STACK_TRACE")
if (STATIC)
set_property(TARGET "${target}"
APPEND PROPERTY LINK_FLAGS "-Wl,--wrap=__cxa_throw")
endif()
endif()
endfunction()
function (monero_add_executable name)
source_group("${name}"
FILES
${ARGN})
add_executable("${name}"
${ARGN})
target_link_libraries("${name}"
include(Version)
add_library(version)
target_sources(version
PRIVATE
${EXTRA_LIBRARIES})
set_property(TARGET "${name}"
PROPERTY
FOLDER "prog")
set_property(TARGET "${name}"
PROPERTY
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
enable_stack_trace("${name}")
monero_set_target_no_relink("${name}")
monero_set_target_strip ("${name}")
endfunction ()
${CMAKE_BINARY_DIR}/version.cpp
)
include(Version)
monero_add_library(version SOURCES ${CMAKE_BINARY_DIR}/version.cpp DEPENDS genversion)
target_include_directories(version
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/external>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(version
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/"
HEADERS version.h)
add_subdirectory(common)
add_subdirectory(crypto)
@ -96,6 +59,7 @@ add_subdirectory(hardforks)
add_subdirectory(blockchain_db)
add_subdirectory(mnemonics)
add_subdirectory(rpc)
#add_subdirectory(test)
if(NOT IOS)
add_subdirectory(serialization)
endif()
@ -110,16 +74,11 @@ if(NOT IOS)
add_subdirectory(daemon)
endif()
if(BUILD_DEBUG_UTILITIES)
add_subdirectory(debug_utilities)
add_subdirectory(blockchain_utilities)
add_subdirectory(gen_multisig)
add_subdirectory(gen_ssl_cert)
endif()
if(PER_BLOCK_CHECKPOINT)
add_subdirectory(blocks)
endif()
add_subdirectory(device)
add_subdirectory(device_trezor)
install(FILES cryptonote_config.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/monero/")

@ -26,28 +26,38 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(blockchain_db_sources
blockchain_db.cpp
lmdb/db_lmdb.cpp
)
file(GLOB BCDB_SOURCES *.cpp *.c *.cc)
list(APPEND BCDB_SOURCES lmdb/db_lmdb.cpp)
set(blockchain_db_headers)
set(BCDB_HEADERS
blockchain_db.h
locked_txn.h
testdb.h
lmdb/db_lmdb.h)
monero_find_all_headers(blockchain_db_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "${BCDB_HEADERS}")
monero_private_headers(blockchain_db
${crypto_private_headers})
monero_add_library(blockchain_db
${blockchain_db_sources}
${blockchain_db_headers}
${blockchain_db_private_headers})
add_library(blockchain_db)
target_sources(blockchain_db
PRIVATE
${BCDB_SOURCES}
)
target_link_libraries(blockchain_db
PUBLIC
common
cncrypto
ringct
${LMDB_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
lmdb
Boost::filesystem
Boost::thread)
target_include_directories(blockchain_db
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/external>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(blockchain_db
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/blockchain_db/"
HEADERS ${BCDB_HEADERS})

@ -158,7 +158,7 @@ endif()
set_property(TARGET blockchain_import
PROPERTY
OUTPUT_NAME "wownero-blockchain-import")
install(TARGETS blockchain_import DESTINATION bin)
install(TARGETS blockchain_import DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_export
${blockchain_export_sources}
@ -179,7 +179,7 @@ target_link_libraries(blockchain_export
set_property(TARGET blockchain_export
PROPERTY
OUTPUT_NAME "wownero-blockchain-export")
install(TARGETS blockchain_export DESTINATION bin)
install(TARGETS blockchain_export DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_blackball
${blockchain_blackball_sources}
@ -201,7 +201,7 @@ target_link_libraries(blockchain_blackball
set_property(TARGET blockchain_blackball
PROPERTY
OUTPUT_NAME "wownero-blockchain-mark-spent-outputs")
install(TARGETS blockchain_blackball DESTINATION bin)
install(TARGETS blockchain_blackball DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_usage
@ -223,7 +223,7 @@ target_link_libraries(blockchain_usage
set_property(TARGET blockchain_usage
PROPERTY
OUTPUT_NAME "wownero-blockchain-usage")
install(TARGETS blockchain_usage DESTINATION bin)
install(TARGETS blockchain_usage DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_ancestry
${blockchain_ancestry_sources}
@ -244,7 +244,7 @@ target_link_libraries(blockchain_ancestry
set_property(TARGET blockchain_ancestry
PROPERTY
OUTPUT_NAME "wownero-blockchain-ancestry")
install(TARGETS blockchain_ancestry DESTINATION bin)
install(TARGETS blockchain_ancestry DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_depth
${blockchain_depth_sources}
@ -265,7 +265,7 @@ target_link_libraries(blockchain_depth
set_property(TARGET blockchain_depth
PROPERTY
OUTPUT_NAME "wownero-blockchain-depth")
install(TARGETS blockchain_depth DESTINATION bin)
install(TARGETS blockchain_depth DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_stats
${blockchain_stats_sources}
@ -286,7 +286,7 @@ target_link_libraries(blockchain_stats
set_property(TARGET blockchain_stats
PROPERTY
OUTPUT_NAME "wownero-blockchain-stats")
install(TARGETS blockchain_stats DESTINATION bin)
install(TARGETS blockchain_stats DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_prune_known_spent_data
${blockchain_prune_known_spent_data_sources}
@ -308,7 +308,7 @@ target_link_libraries(blockchain_prune_known_spent_data
set_property(TARGET blockchain_prune_known_spent_data
PROPERTY
OUTPUT_NAME "wownero-blockchain-prune-known-spent-data")
install(TARGETS blockchain_prune_known_spent_data DESTINATION bin)
install(TARGETS blockchain_prune_known_spent_data DESTINATION ${CMAKE_INSTALL_BINDIR})
monero_add_executable(blockchain_prune
${blockchain_prune_sources}
@ -317,7 +317,7 @@ monero_add_executable(blockchain_prune
set_property(TARGET blockchain_prune
PROPERTY
OUTPUT_NAME "wownero-blockchain-prune")
install(TARGETS blockchain_prune DESTINATION bin)
install(TARGETS blockchain_prune DESTINATION ${CMAKE_INSTALL_BINDIR})
target_link_libraries(blockchain_prune
PRIVATE

@ -52,9 +52,11 @@ using namespace cryptonote;
static std::string db_path;
// default to fast:1
static uint64_t records_per_sync = 128;
static uint64_t records_per_sync = 16 * 65536;
static const size_t slack = 512 * 1024 * 1024;
static std::vector<bool> is_v1;
static std::error_code replace_file(const boost::filesystem::path& replacement_name, const boost::filesystem::path& replaced_name)
{
std::error_code ec = tools::replace_file(replacement_name.string(), replaced_name.string());
@ -89,6 +91,14 @@ static void close(MDB_env *env)
mdb_env_close(env);
}
static void mark_v1_tx(const MDB_val &k, const MDB_val &v)
{
const uint64_t tx_id = *(const uint64_t*)k.mv_data;
if (tx_id >= is_v1.size())
is_v1.resize(tx_id + 1, false);
is_v1[tx_id] = cryptonote::is_v1_tx(cryptonote::blobdata_ref{(const char*)v.mv_data, v.mv_size});
}
static void add_size(MDB_env *env, uint64_t bytes)
{
try
@ -136,7 +146,7 @@ static void check_resize(MDB_env *env, size_t bytes)
add_size(env, size_used + bytes + 2 * slack - mei.me_mapsize);
}
static bool resize_point(size_t nrecords, MDB_env *env, MDB_txn **txn, size_t &bytes)
static bool resize_point(size_t &nrecords, MDB_env *env, MDB_txn **txn, size_t &bytes)
{
if (nrecords % records_per_sync && bytes <= slack / 2)
return false;
@ -146,10 +156,11 @@ static bool resize_point(size_t nrecords, MDB_env *env, MDB_txn **txn, size_t &b
dbr = mdb_txn_begin(env, NULL, 0, txn);
if (dbr) throw std::runtime_error("Failed to create LMDB transaction: " + std::string(mdb_strerror(dbr)));
bytes = 0;
nrecords = 0;
return true;
}
static void copy_table(MDB_env *env0, MDB_env *env1, const char *table, unsigned int flags, unsigned int putflags, int (*cmp)(const MDB_val*, const MDB_val*)=0)
static void copy_table(MDB_env *env0, MDB_env *env1, const char *table, unsigned int flags, unsigned int putflags, int (*cmp)(const MDB_val*, const MDB_val*)=0, void (*f)(const MDB_val&, const MDB_val&) = 0)
{
MDB_dbi dbi0, dbi1;
MDB_txn *txn0, *txn1;
@ -200,6 +211,11 @@ static void copy_table(MDB_env *env0, MDB_env *env1, const char *table, unsigned
dbr = mdb_cursor_open(txn1, dbi1, &cur1);
if (dbr) throw std::runtime_error("Failed to create LMDB cursor: " + std::string(mdb_strerror(dbr)));
if (flags & MDB_DUPSORT)
putflags |= MDB_APPENDDUP;
else
putflags |= MDB_APPEND;
MDB_val k;
MDB_val v;
MDB_cursor_op op = MDB_FIRST;
@ -214,7 +230,8 @@ static void copy_table(MDB_env *env0, MDB_env *env1, const char *table, unsigned
throw std::runtime_error("Failed to enumerate " + std::string(table) + " records: " + std::string(mdb_strerror(ret)));
bytes += k.mv_size + v.mv_size;
if (resize_point(++nrecords, env1, &txn1, bytes))
++nrecords;
if (resize_point(nrecords, env1, &txn1, bytes))
{
dbr = mdb_cursor_open(txn1, dbi1, &cur1);
if (dbr) throw std::runtime_error("Failed to create LMDB cursor: " + std::string(mdb_strerror(dbr)));
@ -223,6 +240,9 @@ static void copy_table(MDB_env *env0, MDB_env *env1, const char *table, unsigned
ret = mdb_cursor_put(cur1, &k, &v, putflags);
if (ret)
throw std::runtime_error("Failed to write " + std::string(table) + " record: " + std::string(mdb_strerror(ret)));
if (f)
(*f)(k, v);
}
mdb_cursor_close(cur1);
@ -235,17 +255,6 @@ static void copy_table(MDB_env *env0, MDB_env *env1, const char *table, unsigned
mdb_dbi_close(env0, dbi0);
}
static bool is_v1_tx(MDB_cursor *c_txs_pruned, MDB_val *tx_id)
{
MDB_val v;
int ret = mdb_cursor_get(c_txs_pruned, tx_id, &v, MDB_SET);
if (ret)
throw std::runtime_error("Failed to find transaction pruned data: " + std::string(mdb_strerror(ret)));
if (v.mv_size == 0)
throw std::runtime_error("Invalid transaction pruned data");
return cryptonote::is_v1_tx(cryptonote::blobdata_ref{(const char*)v.mv_data, v.mv_size});
}
static void prune(MDB_env *env0, MDB_env *env1)
{
MDB_dbi dbi0_blocks, dbi0_txs_pruned, dbi0_txs_prunable, dbi0_tx_indices, dbi1_txs_prunable, dbi1_txs_prunable_tip, dbi1_properties;
@ -324,7 +333,10 @@ static void prune(MDB_env *env0, MDB_env *env1)
mdb_dbi_close(env0, dbi0_blocks);
const uint64_t blockchain_height = stats.ms_entries;
size_t nrecords = 0, bytes = 0;
std::vector<bool> prunable_needed;
// go through all txes tx indices, recording which ones should have their prunable part retained
MINFO("Marking prunable txes");
MDB_cursor_op op = MDB_FIRST;
while (1)
{
@ -336,7 +348,8 @@ static void prune(MDB_env *env0, MDB_env *env1)
const txindex *ti = (const txindex*)v.mv_data;
const uint64_t block_height = ti->data.block_id;
MDB_val_set(kk, ti->data.tx_id);
const uint64_t tx_id = ti->data.tx_id;
MDB_val_set(kk, tx_id);
if (block_height + CRYPTONOTE_PRUNING_TIP_BLOCKS >= blockchain_height)
{
MDEBUG(block_height << "/" << blockchain_height << " is in tip");
@ -344,22 +357,23 @@ static void prune(MDB_env *env0, MDB_env *env1)
dbr = mdb_cursor_put(cur1_txs_prunable_tip, &kk, &vv, 0);
if (dbr) throw std::runtime_error("Failed to write prunable tx tip data: " + std::string(mdb_strerror(dbr)));
bytes += kk.mv_size + vv.mv_size;
}
if (tools::has_unpruned_block(block_height, blockchain_height, pruning_seed) || is_v1_tx(cur0_txs_pruned, &kk))
{
MDB_val vv;
dbr = mdb_cursor_get(cur0_txs_prunable, &kk, &vv, MDB_SET);
if (dbr) throw std::runtime_error("Failed to read prunable tx data: " + std::string(mdb_strerror(dbr)));
bytes += kk.mv_size + vv.mv_size;
if (resize_point(++nrecords, env1, &txn1, bytes))
++nrecords;
if (resize_point(nrecords, env1, &txn1, bytes))
{
dbr = mdb_cursor_open(txn1, dbi1_txs_prunable, &cur1_txs_prunable);
if (dbr) throw std::runtime_error("Failed to create LMDB cursor: " + std::string(mdb_strerror(dbr)));
dbr = mdb_cursor_open(txn1, dbi1_txs_prunable_tip, &cur1_txs_prunable_tip);
if (dbr) throw std::runtime_error("Failed to create LMDB cursor: " + std::string(mdb_strerror(dbr)));
}
dbr = mdb_cursor_put(cur1_txs_prunable, &kk, &vv, 0);
if (dbr) throw std::runtime_error("Failed to write prunable tx data: " + std::string(mdb_strerror(dbr)));
}
if (tx_id >= is_v1.size())
throw std::runtime_error("tx_id out of range of is_v1 vector");
if (tools::has_unpruned_block(block_height, blockchain_height, pruning_seed) || is_v1[tx_id])
{
if (tx_id >= prunable_needed.size())
prunable_needed.resize(tx_id + 1, false);
prunable_needed[tx_id] = true;
}
else
{
@ -367,6 +381,37 @@ static void prune(MDB_env *env0, MDB_env *env1)
}
}
// go through prunable parts, carrying over those we need
MINFO("Copying retained prunable data");
op = MDB_FIRST;
while (1)
{
int ret = mdb_cursor_get(cur0_txs_prunable, &k, &v, op);
op = MDB_NEXT;
if (ret == MDB_NOTFOUND)
break;
if (ret) throw std::runtime_error("Failed to enumerate records: " + std::string(mdb_strerror(ret)));
const uint64_t tx_id = *(const uint64_t*)k.mv_data;
if (tx_id >= prunable_needed.size())
throw std::runtime_error("tx_id out of range of prunable_needed vector");
if (prunable_needed[tx_id])
{
dbr = mdb_cursor_put(cur1_txs_prunable, &k, &v, MDB_APPEND);
if (dbr) throw std::runtime_error("Failed to write prunable tx data: " + std::string(mdb_strerror(dbr)));
bytes += k.mv_size + v.mv_size;
++nrecords;
if (resize_point(nrecords, env1, &txn1, bytes))
{
dbr = mdb_cursor_open(txn1, dbi1_txs_prunable, &cur1_txs_prunable);
if (dbr) throw std::runtime_error("Failed to create LMDB cursor: " + std::string(mdb_strerror(dbr)));
dbr = mdb_cursor_open(txn1, dbi1_txs_prunable_tip, &cur1_txs_prunable_tip);
if (dbr) throw std::runtime_error("Failed to create LMDB cursor: " + std::string(mdb_strerror(dbr)));
}
}
}
mdb_cursor_close(cur1_txs_prunable_tip);
mdb_cursor_close(cur1_txs_prunable);
mdb_cursor_close(cur0_txs_prunable);
@ -419,7 +464,7 @@ static bool parse_db_sync_mode(std::string db_sync_mode, uint64_t &db_flags)
else if(options[0] == "fastest")
{
db_flags = DBF_FASTEST;
records_per_sync = 1000; // default to fastest:async:1000
// default to fastest:async:N
}
else
return false;
@ -455,7 +500,7 @@ int main(int argc, char* argv[])
const command_line::arg_descriptor<std::string> arg_db_sync_mode = {
"db-sync-mode"
, "Specify sync option, using format [safe|fast|fastest]:[nrecords_per_sync]."
, "fast:1000"
, "fast:" + std::to_string(records_per_sync)
};
const command_line::arg_descriptor<bool> arg_copy_pruned_database = {"copy-pruned-database", "Copy database anyway if already pruned"};
@ -601,26 +646,27 @@ int main(int argc, char* argv[])
MDB_env *env0 = NULL, *env1 = NULL;
open(env0, paths[0], db_flags, true);
open(env1, paths[1], db_flags, false);
copy_table(env0, env1, "blocks", MDB_INTEGERKEY, MDB_APPEND);
copy_table(env0, env1, "block_info", MDB_INTEGERKEY | MDB_DUPSORT| MDB_DUPFIXED, MDB_APPENDDUP, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "blocks", MDB_INTEGERKEY, 0);
copy_table(env0, env1, "block_info", MDB_INTEGERKEY | MDB_DUPSORT| MDB_DUPFIXED, 0, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "block_heights", MDB_INTEGERKEY | MDB_DUPSORT| MDB_DUPFIXED, 0, BlockchainLMDB::compare_hash32);
//copy_table(env0, env1, "txs", MDB_INTEGERKEY);
copy_table(env0, env1, "txs_pruned", MDB_INTEGERKEY, MDB_APPEND);
copy_table(env0, env1, "txs_prunable_hash", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, MDB_APPEND);
copy_table(env0, env1, "txs_pruned", MDB_INTEGERKEY, 0, NULL, &mark_v1_tx);
copy_table(env0, env1, "txs_prunable_hash", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, 0);
// not copied: prunable, prunable_tip
copy_table(env0, env1, "tx_indices", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, 0, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "tx_outputs", MDB_INTEGERKEY, MDB_APPEND);
copy_table(env0, env1, "output_txs", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, MDB_APPENDDUP, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "output_amounts", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, MDB_APPENDDUP, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "spent_keys", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, MDB_NODUPDATA, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "txpool_meta", 0, MDB_NODUPDATA, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "txpool_blob", 0, MDB_NODUPDATA, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "hf_versions", MDB_INTEGERKEY, MDB_APPEND);
copy_table(env0, env1, "tx_outputs", MDB_INTEGERKEY, 0);
copy_table(env0, env1, "output_txs", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, 0, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "output_amounts", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, 0, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "spent_keys", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, 0, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "txpool_meta", 0, 0, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "txpool_blob", 0, 0, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "alt_blocks", 0, 0, BlockchainLMDB::compare_hash32);
copy_table(env0, env1, "hf_versions", MDB_INTEGERKEY, 0);
copy_table(env0, env1, "properties", 0, 0, BlockchainLMDB::compare_string);
if (already_pruned)
{
copy_table(env0, env1, "txs_prunable", MDB_INTEGERKEY, MDB_APPEND, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "txs_prunable_tip", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, MDB_NODUPDATA, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "txs_prunable", MDB_INTEGERKEY, 0, BlockchainLMDB::compare_uint64);
copy_table(env0, env1, "txs_prunable_tip", MDB_INTEGERKEY | MDB_DUPSORT | MDB_DUPFIXED, 0, BlockchainLMDB::compare_uint64);
}
else
{

@ -57,4 +57,20 @@ foreach(BLOB_NAME checkpoints)
)
endforeach()
monero_add_library(blocks blocks.cpp ${GENERATED_SOURCES})
add_library(blocks)
target_sources(blocks
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/blocks.cpp
${GENERATED_SOURCES}
)
target_include_directories(blocks
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/contrib/epee/include>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(blocks
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/blocks/"
HEADERS blocks.h)

Binary file not shown.

@ -26,38 +26,28 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(APPLE)
if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
else()
find_library(IOKIT_LIBRARY IOKit)
mark_as_advanced(IOKIT_LIBRARY)
list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
endif()
endif()
add_library(checkpoints)
target_sources(checkpoints
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/checkpoints.cpp
)
set(checkpoints_sources
checkpoints.cpp)
set(checkpoints_headers)
monero_find_all_headers(checkpoints_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(checkpoints
${checkpoints_private_headers})
monero_add_library(checkpoints
${checkpoints_sources}
${checkpoints_headers}
${checkpoints_private_headers})
target_link_libraries(checkpoints
PUBLIC
target_link_libraries(checkpoints PUBLIC
common
cncrypto
${Boost_DATE_TIME_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::date_time
Boost::program_options
Boost::serialization
Boost::filesystem
Boost::system
Boost::thread)
target_include_directories(checkpoints
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(checkpoints
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/checkpoints/"
HEADERS checkpoints.h)

@ -240,7 +240,6 @@ namespace cryptonote
ADD_CHECKPOINT2(516700, "0443c47c5a4e344c3f68a491a3b2f6b78a769cdf9076249c93f187ececf9cc7c", "0x12128a532a59a6");
ADD_CHECKPOINT2(522000, "8c15ae514063bf05e7662ab33b86a4131aa89df0784ce3da7876c5339bc1de3d", "0x123d9c604a7be6");
ADD_CHECKPOINT2(566000, "136e37f5f130dd2dc2d8d30e46e16d74377cb834b7c5be32cd09ee6ad402556c", "0x1318d703b1bff7");
ADD_CHECKPOINT2(611300, "34fd2ff914ad34edc2dabb0fe38f15b2ac6a301dc501bdfec15d2108b304a455", "0x13b61f061add9d");
return true;
}

@ -26,61 +26,77 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
file(GLOB COMMON_SOURCES "*.cpp" "*.c")
set(COMMON_HEADERS
aligned.h
apply_permutation.h
base58.h
boost_serialization_helper.h
combinator.h
command_line.h
common_fwd.h
data_cache.h
dns_utils.h
download.h
error.h
expect.h
http_connection.h
i18n.h
json_util.h
notify.h
password.h
perf_timer.h
pod-class.h
powerof.h
pruning.h
rpc_client.h
scoped_message_writer.h
sfinae_helpers.h
spawn.h
stack_trace.h
threadpool.h
timings.h
unordered_containers_boost_serialization.h
updates.h
utf8.h
util.h
varint.h)
set(common_sources
base58.cpp
command_line.cpp
dns_utils.cpp
download.cpp
error.cpp
expect.cpp
util.cpp
i18n.cpp
notify.cpp
password.cpp
perf_timer.cpp
pruning.cpp
spawn.cpp
threadpool.cpp
updates.cpp
aligned.c
timings.cc
combinator.cpp)
add_library(common)
target_sources(common
PRIVATE
${COMMON_SOURCES}
)
if (STACK_TRACE)
list(APPEND common_sources stack_trace.cpp)
endif()
if (BACKCOMPAT)
list(APPEND common_sources compat/glibc_compat.cpp)
endif()
set(common_headers)
monero_find_all_headers(common_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(common
${common_private_headers})
monero_add_library(common
${common_sources}
${common_headers}
${common_private_headers}
DEPENDS generate_translations_header)
target_link_libraries(common
PUBLIC
cncrypto
${UNBOUND_LIBRARIES}
${LIBUNWIND_LIBRARIES}
${Boost_DATE_TIME_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_CHRONO_LIBRARY}
easylogging
Libunbound::Libunbound
Boost::chrono
Boost::date_time
Boost::filesystem
Boost::thread
Boost::regex
Boost::system
PRIVATE
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES})
OpenSSL::SSL
OpenSSL::Crypto)
target_include_directories(common
PRIVATE ${LIBUNBOUND_INCLUDE_DIR}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/translations>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
if(STATIC)
target_compile_definitions(common PUBLIC STATICLIB=1)
endif()
add_dependencies(common generate_translations_header)
#monero_install_headers(common
# ${common_headers})
monero_install_library(common
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/common/"
HEADERS ${COMMON_HEADERS})

@ -1,98 +0,0 @@
#include <cstddef>
#include <cstdint>
#include <strings.h>
#include <string.h>
#include <glob.h>
#include <unistd.h>
#include <fnmatch.h>
#if defined(HAVE_SYS_SELECT_H)
#include <sys/select.h>
#endif
// Prior to GLIBC_2.14, memcpy was aliased to memmove.
extern "C" void* memmove(void* a, const void* b, size_t c);
//extern "C" void* memset(void* a, int b, long unsigned int c);
extern "C" void* memcpy(void* a, const void* b, size_t c)
{
return memmove(a, b, c);
}
extern "C" void __chk_fail(void) __attribute__((__noreturn__));
#if defined(__i386__) || defined(__arm__)
extern "C" int64_t __udivmoddi4(uint64_t u, uint64_t v, uint64_t* rp);
extern "C" int64_t __wrap___divmoddi4(int64_t u, int64_t v, int64_t* rp)
{
int32_t c1 = 0, c2 = 0;
int64_t uu = u, vv = v;
int64_t w;
int64_t r;
if (uu < 0) {
c1 = ~c1, c2 = ~c2, uu = -uu;
}
if (vv < 0) {
c1 = ~c1, vv = -vv;
}
w = __udivmoddi4(uu, vv, (uint64_t*)&r);
if (c1)
w = -w;
if (c2)
r = -r;
*rp = r;
return w;
}
#endif
/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
redirects to that. */
#undef explicit_bzero
/* Set LEN bytes of S to 0. The compiler will not delete a call to
this function, even if S is dead after the call. */
void
explicit_bzero (void *s, size_t len)
{
memset (s, '\0', len);
/* Compiler barrier. */
asm volatile ("" ::: "memory");
}
// Redefine explicit_bzero_chk
void
__explicit_bzero_chk (void *dst, size_t len, size_t dstlen)
{
/* Inline __memset_chk to avoid a PLT reference to __memset_chk. */
if (__glibc_unlikely (dstlen < len))
__chk_fail ();
memset (dst, '\0', len);
/* Compiler barrier. */
asm volatile ("" ::: "memory");
}
/* libc-internal references use the hidden
__explicit_bzero_chk_internal symbol. This is necessary if
__explicit_bzero_chk is implemented as an IFUNC because some
targets do not support hidden references to IFUNC symbols. */
#define strong_alias (__explicit_bzero_chk, __explicit_bzero_chk_internal)
#undef glob
extern "C" int glob_old(const char * pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob);
#ifdef __i386__
__asm__(".symver glob_old,glob@GLIBC_2.0");
#elif defined(__amd64__)
__asm__(".symver glob_old,glob@GLIBC_2.2.5");
#elif defined(__arm__)
__asm(".symver glob_old,glob@GLIBC_2.4");
#elif defined(__aarch64__)
__asm__(".symver glob_old,glob@GLIBC_2.17");
#endif
extern "C" int __wrap_glob(const char * pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob)
{
return glob_old(pattern, flags, errfunc, pglob);
}

@ -31,7 +31,7 @@
#else
#define ELPP_FEATURE_CRASH_LOG 1
#endif
#include "easylogging++/easylogging++.h"
#include "easylogging++.h"
#include <stdexcept>
#ifdef USE_UNWIND

@ -27,76 +27,104 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(crypto_sources
aesb.c
blake256.c
chacha.c
crypto-ops-data.c
crypto-ops.c
crypto.cpp
groestl.c
hash-extra-blake.c
hash-extra-groestl.c
hash-extra-jh.c
hash-extra-skein.c
hash.c
hmac-keccak.c
jh.c
keccak.c
oaes_lib.c
random.c
skein.c
slow-hash.c
rx-slow-hash.c
CryptonightR_JIT.c
tree-hash.c)
aesb.c
blake256.c
chacha.c
crypto-ops-data.c
crypto-ops.c
crypto.cpp
groestl.c
hash-extra-blake.c
hash-extra-groestl.c
hash-extra-jh.c
hash-extra-skein.c
hash.c
hmac-keccak.c
jh.c
keccak.c
oaes_lib.c
random.c
skein.c
slow-hash.c
rx-slow-hash.c
CryptonightR_JIT.c
tree-hash.c)
if(ARCH_ID STREQUAL "i386" OR ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64")
list(APPEND crypto_sources CryptonightR_template.S)
endif()
set(crypto_headers
CryptonightR_JIT.h
CryptonightR_template.h
blake256.h
c_threads.h
chacha.h
crypto-ops.h
crypto.h
duration.h
generic-ops.h
groestl.h
groestl_tables.h
hash-ops.h
hash.h
hmac-keccak.h
initializer.h
jh.h
keccak.h
oaes_config.h
oaes_lib.h
random.h
skein.h
skein_port.h
variant2_int_sqrt.h
variant4_random_math.h)
include_directories(${RANDOMX_INCLUDE})
message(STATUS "${crypto_headers}")
set(crypto_headers)
if(NOT ARM)
list(APPEND crypto_sources CryptonightR_template.S)
endif()
monero_find_all_headers(crypto_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
add_library(cncrypto)
target_sources(cncrypto
PRIVATE
${crypto_sources}
)
monero_private_headers(cncrypto
${crypto_private_headers})
monero_add_library(cncrypto
${crypto_sources}
${crypto_headers}
${crypto_private_headers})
target_link_libraries(cncrypto
PUBLIC
epee
randomx
${Boost_SYSTEM_LIBRARY}
${SODIUM_LIBRARY}
Boost::system
${sodium_LIBRARY_RELEASE}
PRIVATE
${EXTRA_LIBRARIES})
OpenSSL::SSL
OpenSSL::Crypto)
if (ARM)
option(NO_OPTIMIZED_MULTIPLY_ON_ARM
"Compute multiply using generic C implementation instead of ARM ASM" OFF)
if(NO_OPTIMIZED_MULTIPLY_ON_ARM)
message(STATUS "Using generic C implementation for multiply")
set_property(SOURCE slow-hash.c
PROPERTY COMPILE_DEFINITIONS "NO_OPTIMIZED_MULTIPLY_ON_ARM")
endif()
target_include_directories(cncrypto
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PUBLIC ${sodium_INCLUDE_DIR}
)
if (ARM AND NO_OPTIMIZED_MULTIPLY_ON_ARM)
message(STATUS "Using generic C implementation for multiply")
set_property(SOURCE slow-hash.c
PROPERTY COMPILE_DEFINITIONS "NO_OPTIMIZED_MULTIPLY_ON_ARM")
endif()
# Because of the way Qt works on android with JNI, the code does not live in the main android thread
# So this code runs with a 1 MB default stack size.
# This will force the use of the heap for the allocation of the scratchpad
if (ANDROID OR IOS)
if( BUILD_GUI_DEPS )
add_definitions(-DFORCE_USE_HEAP=1)
endif()
endif()
# cheat because cmake and ccache hate each other
set_property(SOURCE CryptonightR_template.S PROPERTY LANGUAGE C)
set_property(SOURCE CryptonightR_template.S PROPERTY LANGUAGE ASM)
set_property(SOURCE CryptonightR_template.S PROPERTY XCODE_EXPLICIT_FILE_TYPE sourcecode.asm)
# Must be done last, because it references libraries in this directory
add_subdirectory(wallet)
monero_install_library(cncrypto
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/crypto/"
HEADERS ${crypto_headers})

@ -34,7 +34,7 @@ typedef struct {
unsigned long long databitlen; /*the message size in bits*/
unsigned long long datasize_in_buffer; /*the size of the message remained in buffer; assumed to be multiple of 8bits except for the last partial block at the end of the message*/
DATA_ALIGN16(uint64 x[8][2]); /*the 1024-bit state, ( x[i][0] || x[i][1] ) is the ith row of the state in the pseudocode*/
DATA_ALIGN16(unsigned char buffer[64]); /*the 512-bit message block to be hashed;*/
unsigned char buffer[64]; /*the 512-bit message block to be hashed;*/
} hashState;
@ -213,24 +213,16 @@ static void E8(hashState *state)
/*The compression function F8 */
static void F8(hashState *state)
{
uint64_t* x = (uint64_t*)state->x;
uint64 i;
/*xor the 512-bit message with the fist half of the 1024-bit hash state*/
for (int i = 0; i < 8; ++i) {
uint64 b;
memcpy(&b, &state->buffer[i << 3], sizeof(b));
x[i] ^= b;
}
for (i = 0; i < 8; i++) state->x[i >> 1][i & 1] ^= ((uint64*)state->buffer)[i];
/*the bijective function E8 */
E8(state);
/*xor the 512-bit message with the second half of the 1024-bit hash state*/
for (int i = 0; i < 8; ++i) {
uint64 b;
memcpy(&b, &state->buffer[i << 3], sizeof(b));
x[i + 8] ^= b;
}
for (i = 0; i < 8; i++) state->x[(8+i) >> 1][(8+i) & 1] ^= ((uint64*)state->buffer)[i];
}
/*before hashing a message, initialize the hash state as H0 */
@ -248,7 +240,6 @@ static HashReturn Init(hashState *state, int hashbitlen)
case 224: memcpy(state->x,JH224_H0,128); break;
case 256: memcpy(state->x,JH256_H0,128); break;
case 384: memcpy(state->x,JH384_H0,128); break;
default:
case 512: memcpy(state->x,JH512_H0,128); break;
}

@ -61,11 +61,11 @@ static void generate_system_random_bytes(size_t n, void *result) {
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
static void generate_system_random_bytes(size_t n, void *result) {
int fd;

@ -27,37 +27,19 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Possibly user defined values.
#
set(MONERO_WALLET_CRYPTO_LIBRARY "auto" CACHE STRING "Select a wallet crypto library")
include(CheckLanguage)
check_language(ASM-ATT)
#
# If the user specified "auto", detect best library defaulting to internal.
#
if (${MONERO_WALLET_CRYPTO_LIBRARY} STREQUAL "auto")
monero_crypto_autodetect(AVAILABLE BEST)
if (DEFINED BEST)
message("Wallet crypto is using ${BEST} backend")
set(MONERO_WALLET_CRYPTO_LIBRARY ${BEST})
else ()
message("Defaulting to internal crypto library for wallet")
set(MONERO_WALLET_CRYPTO_LIBRARY "cn")
endif ()
endif ()
add_library(wallet-crypto crypto.h)
#
# Configure library target "wallet-crypto" - clients will use this as a
# library dependency which in turn will depend on the crypto library selected.
#
if (${MONERO_WALLET_CRYPTO_LIBRARY} STREQUAL "cn")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/empty.h.in ${MONERO_GENERATED_HEADERS_DIR}/crypto/wallet/ops.h)
add_library(wallet-crypto ALIAS cncrypto)
else ()
monero_crypto_generate_header(${MONERO_WALLET_CRYPTO_LIBRARY} "${MONERO_GENERATED_HEADERS_DIR}/crypto/wallet/ops.h")
monero_crypto_get_target(${MONERO_WALLET_CRYPTO_LIBRARY} CRYPTO_TARGET)
add_library(wallet-crypto $<TARGET_OBJECTS:${CRYPTO_TARGET}>)
target_link_libraries(wallet-crypto cncrypto)
endif ()
target_include_directories(wallet-crypto
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated_include>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
target_link_libraries(wallet-crypto PUBLIC cncrypto)
monero_install_library(wallet-crypto
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/wallet-crypto/"
HEADERS crypto.h)

@ -26,56 +26,68 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(APPLE)
if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit")
else()
find_library(IOKIT_LIBRARY IOKit)
mark_as_advanced(IOKIT_LIBRARY)
list(APPEND EXTRA_LIBRARIES ${IOKIT_LIBRARY})
endif()
endif()
file(GLOB CN_BASIC_SOURCES *.cpp *.c *.cc)
set(CN_BASIC_HEADERS
account.h
account_boost_serialization.h
blobdatatype.h
connection_context.h
cryptonote_basic.h
cryptonote_basic_impl.h
cryptonote_boost_serialization.h
cryptonote_format_utils.h
difficulty.h
events.h
fwd.h
hardfork.h
merge_mining.h
miner.h
subaddress_index.h
tx_extra.h
verification_context.h)
monero_add_library(cryptonote_format_utils_basic
cryptonote_format_utils_basic.cpp
)
target_link_libraries(cryptonote_format_utils_basic
PUBLIC
cncrypto
)
set(cryptonote_basic_sources
account.cpp
connection_context.cpp
cryptonote_basic_impl.cpp
cryptonote_format_utils.cpp
difficulty.cpp
hardfork.cpp
merge_mining.cpp
miner.cpp)
# cryptonote_format_utils_basic
add_library(cryptonote_format_utils_basic)
target_sources(cryptonote_format_utils_basic
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/cryptonote_format_utils_basic.cpp
)
set(cryptonote_basic_headers)
target_link_libraries(cryptonote_format_utils_basic PUBLIC cncrypto)
target_include_directories(cryptonote_format_utils_basic
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_find_all_headers(cryptonote_basic_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
# cryptonote_basic
add_library(cryptonote_basic)
target_sources(cryptonote_basic
PRIVATE
${CN_BASIC_SOURCES}
)
monero_private_headers(cryptonote_basic
${cryptonote_basic_private_headers})
monero_add_library(cryptonote_basic
${cryptonote_basic_sources}
${cryptonote_basic_headers}
${cryptonote_basic_private_headers})
target_link_libraries(cryptonote_basic
PUBLIC
common
cncrypto
checkpoints
cryptonote_format_utils_basic
device
${Boost_DATE_TIME_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::date_time
Boost::program_options
Boost::serialization
Boost::filesystem
Boost::system
Boost::thread)
target_include_directories(cryptonote_basic
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/cryptonote_basic>
)
monero_install_library(cryptonote_format_utils_basic)
monero_install_library(cryptonote_basic
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/cryptonote_basic/"
HEADERS ${CN_BASIC_HEADERS})

@ -52,7 +52,7 @@ namespace cryptonote
// load
template <template <bool> class Archive>
bool member_do_serialize(Archive<false>& ar)
bool do_serialize(Archive<false>& ar)
{
// size - 1 - because of variant tag
for (size = 1; size <= TX_EXTRA_PADDING_MAX_COUNT; ++size)
@ -73,7 +73,7 @@ namespace cryptonote
// store
template <template <bool> class Archive>
bool member_do_serialize(Archive<true>& ar)
bool do_serialize(Archive<true>& ar)
{
if(TX_EXTRA_PADDING_MAX_COUNT < size)
return false;
@ -129,7 +129,7 @@ namespace cryptonote
// load
template <template <bool> class Archive>
bool member_do_serialize(Archive<false>& ar)
bool do_serialize(Archive<false>& ar)
{
std::string field;
if(!::do_serialize(ar, field))
@ -142,7 +142,7 @@ namespace cryptonote
// store
template <template <bool> class Archive>
bool member_do_serialize(Archive<true>& ar)
bool do_serialize(Archive<true>& ar)
{
std::ostringstream oss;
binary_archive<true> oar(oss);

@ -30,7 +30,6 @@
#pragma once
#include <cstdint>
#include <stdexcept>
#include <string>
#include <boost/uuid/uuid.hpp>

@ -26,25 +26,18 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(cryptonote_core_sources
blockchain.cpp
cryptonote_core.cpp
tx_pool.cpp
tx_sanity_check.cpp
cryptonote_tx_utils.cpp
tx_verification_utils.cpp
)
file(GLOB CN_CORE_SOURCES *.cpp *.c *.cc)
set(CN_CORE_HEADERS
blockchain.h
blockchain_storage_boost_serialization.h
cryptonote_core.h
cryptonote_tx_utils.h
i_core_events.h
tx_pool.h
tx_sanity_check.h
tx_verification_utils.h)
set(cryptonote_core_headers)
monero_find_all_headers(cryptonote_core_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(cryptonote_core
${cryptonote_core_private_headers})
monero_add_library(cryptonote_core
${cryptonote_core_sources}
${cryptonote_core_headers}
${cryptonote_core_private_headers})
add_library(cryptonote_core)
target_link_libraries(cryptonote_core
PUBLIC
version
@ -54,11 +47,34 @@ target_link_libraries(cryptonote_core
ringct
device
hardforks
${Boost_DATE_TIME_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::date_time
Boost::program_options
Boost::serialization
Boost::filesystem
Boost::system
Boost::thread)
target_include_directories(cryptonote_core PRIVATE
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/external>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
if(PER_BLOCK_CHECKPOINT)
target_compile_definitions(cryptonote_core PUBLIC PER_BLOCK_CHECKPOINT=1)
endif()
target_sources(cryptonote_core
PRIVATE
${CN_CORE_SOURCES}
)
target_include_directories(cryptonote_core
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(cryptonote_core
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/cryptonote_core/"
HEADERS ${CN_CORE_HEADERS})

@ -3945,8 +3945,6 @@ void Blockchain::get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_block
const uint8_t version = get_current_hard_fork_version();
const uint64_t db_height = m_db->height();
CHECK_AND_ASSERT_THROW_MES(grace_blocks <= CRYPTONOTE_REWARD_BLOCKS_WINDOW, "Grace blocks invalid In 2021 fee scaling estimate.");
// we want Mlw = median of max((min(Mbw, 1.7 * Ml), Zm), Ml / 1.7)
// Mbw: block weight for the last 99990 blocks, 0 for the next 10
// Ml: penalty free zone (dynamic), aka long_term_median, aka median of max((min(Mb, 1.7 * Ml), Zm), Ml / 1.7)
@ -3960,6 +3958,7 @@ void Blockchain::get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_block
const uint64_t Mlw_penalty_free_zone_for_wallet = std::max<uint64_t>(rm.median(), CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5);
// Msw: median over [100 - grace blocks] past + [grace blocks] future blocks
CHECK_AND_ASSERT_THROW_MES(grace_blocks <= 100, "Grace blocks invalid In 2021 fee scaling estimate.");
std::vector<uint64_t> weights;
get_last_n_blocks_weights(weights, 100 - grace_blocks);
weights.reserve(100);
@ -5672,7 +5671,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
static const char expected_block_hashes_hash[] = "3c0d098139491ab668f9f063747e31a3f3b09fa519ab68f90026da8641dfc913";
static const char expected_block_hashes_hash[] = "9ce2e9f40ff58954d6176e300af1d8da1804b829e1be8565805fea497df40f4b";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)

@ -247,7 +247,6 @@ namespace cryptonote
LOG_PRINT_L1("Transaction with id= "<< id << " used already spent key images");
tvc.m_verifivation_failed = true;
tvc.m_double_spend = true;
tvc.m_no_drop_offense = true;
return false;
}
}
@ -436,14 +435,8 @@ namespace cryptonote
void tx_memory_pool::prune(size_t bytes)
{
CRITICAL_REGION_LOCAL(m_transactions_lock);
// Nothing to do if already empty
if (m_txs_by_fee_and_receive_time.empty())
return;
if (bytes == 0)
bytes = m_txpool_max_weight;
CRITICAL_REGION_LOCAL1(m_blockchain);
LockedTXN lock(m_blockchain.get_db());
bool changed = false;
@ -488,13 +481,8 @@ namespace cryptonote
reduce_txpool_weight(meta.weight);
remove_transaction_keyimages(tx, txid);
MINFO("Pruned tx " << txid << " from txpool: weight: " << meta.weight << ", fee/byte: " << it->first.first);
auto it_prev = it;
--it_prev;
remove_tx_from_transient_lists(it, txid, !meta.matches(relay_category::broadcasted));
it = it_prev;
it--;
changed = true;
}
catch (const std::exception &e)
@ -1086,7 +1074,7 @@ namespace cryptonote
// If the total weight is too high, choose the best paying transactions
if (total_weight > max_backlog_weight)
std::stable_sort(tmp.begin(), tmp.end(), [](const auto& a, const auto& b){ return a.fee * b.weight > b.fee * a.weight; });
std::sort(tmp.begin(), tmp.end(), [](const auto& a, const auto& b){ return a.fee * b.weight > b.fee * a.weight; });
backlog.clear();
uint64_t w = 0;
@ -1839,7 +1827,7 @@ namespace cryptonote
auto sorted_it = find_tx_in_sorted_container(txid);
if (sorted_it == m_txs_by_fee_and_receive_time.end())
{
MDEBUG("Re-adding tx " << txid << " to tx pool, but it was not found in the sorted txs container");
MERROR("Re-adding tx " << txid << " to tx pool, but it was not found in the sorted txs container");
}
else
{

@ -69,12 +69,11 @@ namespace cryptonote
{
// sort by greatest first, not least
if (a.first.first > b.first.first) return true;
if (a.first.first < b.first.first) return false;
if (a.first.second < b.first.second) return true;
if (a.first.second > b.first.second) return false;
return memcmp(a.second.data, b.second.data, sizeof(crypto::hash)) < 0;
else if (a.first.first < b.first.first) return false;
else if (a.first.second < b.first.second) return true;
else if (a.first.second > b.first.second) return false;
else if (a.second != b.second) return true;
else return false;
}
};

@ -26,16 +26,31 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required (VERSION 3.5)
project (monero CXX)
file(GLOB CN_PROT_SOURCES *.cpp *.c *.cc)
set(CN_PROT_HEADERS
block_queue.h
cryptonote_protocol_defs.h
cryptonote_protocol_handler.h
cryptonote_protocol_handler_common.h
enums.h
fwd.h
levin_notify.h)
file(GLOB CRYPTONOTE_PROTOCOL *)
source_group(cryptonote_protocol FILES ${CRYPTONOTE_PROTOCOL})
add_library(cryptonote_protocol)
target_sources(cryptonote_protocol
PRIVATE
${CN_PROT_SOURCES}
)
#monero_private_headers(cryptonote_protocol ${CRYPTONOTE_PROTOCOL})
monero_add_library(cryptonote_protocol ${CRYPTONOTE_PROTOCOL})
target_link_libraries(cryptonote_protocol
PUBLIC
p2p
PRIVATE
${EXTRA_LIBRARIES})
target_link_libraries(cryptonote_protocol PUBLIC p2p)
target_include_directories(cryptonote_protocol
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(cryptonote_protocol
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/cryptonote_protocol/"
HEADERS ${CN_PROT_HEADERS})

@ -26,25 +26,14 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(daemon_sources
command_parser_executor.cpp
command_server.cpp
daemon.cpp
executor.cpp
main.cpp
rpc_command_executor.cpp
)
file(GLOB DAEMON_SOURCES
*.cpp
*.c
*.cc
*.h)
set(daemon_headers)
add_executable(daemon ${DAEMON_SOURCES})
monero_find_all_headers(daemon_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(daemon
${daemon_private_headers})
monero_add_executable(daemon
${daemon_sources}
${daemon_headers}
${daemon_private_headers})
target_link_libraries(daemon
PRIVATE
rpc
@ -57,19 +46,27 @@ target_link_libraries(daemon
daemonizer
serialization
daemon_rpc_server
${EPEE_READLINE}
version
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${ZMQ_LIB}
${GNU_READLINE_LIBRARY}
${EXTRA_LIBRARIES}
${Blocks})
Boost::chrono
Boost::program_options
Boost::filesystem
Boost::system
Boost::thread
Boost::regex
Threads::Threads
${ZMQ_LIBRARIES}
blocks)
target_include_directories(daemon
PRIVATE ${ZMQ_INCLUDE_DIRS}
PRIVATE ${OPENSSL_INCLUDE_DIR})
if(PER_BLOCK_CHECKPOINT)
target_compile_definitions(daemon PUBLIC PER_BLOCK_CHECKPOINT=1)
endif()
set_property(TARGET daemon
PROPERTY
OUTPUT_NAME "wownerod")
install(TARGETS daemon DESTINATION bin)
install(TARGETS daemon DESTINATION ${CMAKE_INSTALL_BINDIR})

@ -58,17 +58,16 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG_TMPDIR_LOG=1)
endif()
monero_private_headers(daemonizer
${daemonizer_private_headers})
monero_add_library(daemonizer
add_library(daemonizer
${daemonizer_sources}
${daemonizer_headers}
${daemonizer_private_headers})
target_link_libraries(daemonizer
PUBLIC
common
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::chrono
Boost::filesystem
Boost::program_options)
target_include_directories(daemonizer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)

@ -26,57 +26,41 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(device_sources
device.cpp
device_default.cpp
log.cpp
)
set(HEADERS
device.hpp
device_io.hpp
device_default.hpp
device_cold.hpp
log.hpp)
if(HIDAPI_FOUND)
set(device_sources
${device_sources}
device_ledger.cpp
device_io_hid.cpp
add_library(device)
target_sources(device
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_default.cpp
${CMAKE_CURRENT_SOURCE_DIR}/log.cpp
)
endif()
set(device_headers
device.hpp
device_io.hpp
device_default.hpp
device_cold.hpp
log.hpp
)
if(HIDAPI_FOUND)
set(device_headers
${device_headers}
device_ledger.hpp
device_io_hid.hpp
)
endif()
set(device_private_headers)
monero_private_headers(device
${device_private_headers})
monero_add_library(device
${device_sources}
${device_headers}
${device_private_headers})
target_link_libraries(device
PUBLIC
${HIDAPI_LIBRARIES}
cncrypto
cryptonote_format_utils_basic
ringct_basic
wallet-crypto
${OPENSSL_CRYPTO_LIBRARIES}
${Boost_SERIALIZATION_LIBRARY}
monero-crypto-amd64-64-24k
OpenSSL::Crypto
Boost::serialization
PRIVATE
version
${Blocks}
${EXTRA_LIBRARIES})
blocks)
target_include_directories(device
PUBLIC $<TARGET_PROPERTY:monero-crypto-amd64-64-24k,INTERFACE_INCLUDE_DIRECTORIES>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(device
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/device/"
HEADERS "${HEADERS}")

@ -51,4 +51,4 @@ add_dependencies(gen_multisig
set_property(TARGET gen_multisig
PROPERTY
OUTPUT_NAME "wownero-gen-trusted-multisig")
install(TARGETS gen_multisig DESTINATION bin)
install(TARGETS gen_multisig DESTINATION ${CMAKE_INSTALL_BINDIR})

@ -46,4 +46,4 @@ add_dependencies(gen_ssl_cert
set_property(TARGET gen_ssl_cert
PROPERTY
OUTPUT_NAME "wownero-gen-ssl-cert")
install(TARGETS gen_ssl_cert DESTINATION bin)
install(TARGETS gen_ssl_cert DESTINATION ${CMAKE_INSTALL_BINDIR})

@ -26,21 +26,14 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(hardforks_sources
hardforks.cpp)
add_library(hardforks)
target_sources(hardforks
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/hardforks.cpp
)
monero_find_all_headers(hardforks_headers "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(hardforks PUBLIC version)
set(hardforks_private_headers)
monero_private_headers(hardforks
${hardforks_private_headers})
monero_add_library(hardforks
${hardforks_sources}
${hardforks_headers}
${hardforks_private_headers})
target_link_libraries(hardforks
PUBLIC
version
PRIVATE
${EXTRA_LIBRARIES})
monero_install_library(hardforks
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/hardforks/"
HEADERS hardforks.h)

@ -26,8 +26,26 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(lmdb_sources database.cpp error.cpp table.cpp value_stream.cpp)
monero_find_all_headers(lmdb_headers "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB LMDB_SOURCES *.cpp *.c *.cc)
set(LMDB_HEADERS
database.h
error.h
key_stream.h
table.h
transaction.h
util.h
value_stream.h)
monero_add_library(lmdb_lib ${lmdb_sources} ${lmdb_headers})
target_link_libraries(lmdb_lib common ${LMDB_LIBRARY})
add_library(lmdb_lib)
target_sources(lmdb_lib
PRIVATE
${LMDB_SOURCES}
)
target_link_libraries(lmdb_lib PRIVATE
common
lmdb)
monero_install_library(lmdb_lib
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/lmdb_lib/"
HEADERS ${LMDB_HEADERS})

@ -26,23 +26,43 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(mnemonics_sources
electrum-words.cpp)
file(GLOB MN_SOURCES *.cpp *.c *.cc)
set(MN_HEADERS
chinese_simplified.h
dutch.h
electrum-words.h
english.h
english_old.h
esperanto.h
french.h
german.h
italian.h
japanese.h
language_base.h
lojban.h
portuguese.h
russian.h
singleton.h
spanish.h)
set(mnemonics_headers)
add_library(mnemonics)
target_sources(mnemonics
PRIVATE
${MN_SOURCES}
)
monero_find_all_headers(mnemonics_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(mnemonics
${mnemonics_private_headers})
monero_add_library(mnemonics
${mnemonics_sources}
${mnemonics_headers}
${mnemonics_private_headers})
target_link_libraries(mnemonics
PUBLIC
epee
easylogging
${Boost_SYSTEM_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::system)
target_include_directories(mnemonics
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(mnemonics
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/mnemonics/"
HEADERS ${MN_HEADERS})

@ -25,26 +25,20 @@
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
file(GLOB MULTISIG_SOURCES *.cpp *.c *.cc)
set(MULTISIG_HEADERS
multisig_account.h
multisig_clsag_context.h
multisig.h
multisig_kex_msg.h
multisig_kex_msg_serialization.h
multisig_tx_builder_ringct.h)
set(multisig_sources
multisig.cpp
multisig_account.cpp
multisig_account_kex_impl.cpp
multisig_clsag_context.cpp
multisig_kex_msg.cpp
multisig_tx_builder_ringct.cpp)
set(multisig_headers)
monero_find_all_headers(multisig_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(multisig
${multisig_private_headers})
monero_add_library(multisig
${multisig_sources}
${multisig_headers}
${multisig_private_headers})
add_library(multisig)
target_sources(multisig
PRIVATE
${MULTISIG_SOURCES}
)
target_link_libraries(multisig
PUBLIC
@ -52,6 +46,14 @@ target_link_libraries(multisig
cryptonote_basic
cryptonote_core
common
cncrypto
PRIVATE
${EXTRA_LIBRARIES})
cncrypto)
target_include_directories(multisig
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(multisig
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/multisig/"
HEADERS ${MULTISIG_HEADERS})

@ -206,13 +206,8 @@ namespace multisig
//----------------------------------------------------------------------------------------------------------------------
void multisig_kex_msg::parse_and_validate_msg()
{
CHECK_AND_ASSERT_THROW_MES(MULTISIG_KEX_MSG_V2_MAGIC_1.size() == MULTISIG_KEX_MSG_V2_MAGIC_N.size(),
"Multisig kex msg magic inconsistency.");
CHECK_AND_ASSERT_THROW_MES(MULTISIG_KEX_MSG_V2_MAGIC_1.size() >= MULTISIG_KEX_V1_MAGIC.size(),
"Multisig kex msg magic inconsistency.");
// check message type
CHECK_AND_ASSERT_THROW_MES(m_msg.size() >= MULTISIG_KEX_MSG_V2_MAGIC_1.size(), "Kex message unexpectedly small.");
CHECK_AND_ASSERT_THROW_MES(m_msg.size() > 0, "Kex message unexpectedly empty.");
CHECK_AND_ASSERT_THROW_MES(m_msg.substr(0, MULTISIG_KEX_V1_MAGIC.size()) != MULTISIG_KEX_V1_MAGIC,
"V1 multisig kex messages are deprecated (unsafe).");
CHECK_AND_ASSERT_THROW_MES(m_msg.substr(0, MULTISIG_KEX_MSG_V1_MAGIC.size()) != MULTISIG_KEX_MSG_V1_MAGIC,
@ -220,6 +215,8 @@ namespace multisig
// deserialize the message
std::string msg_no_magic;
CHECK_AND_ASSERT_THROW_MES(MULTISIG_KEX_MSG_V2_MAGIC_1.size() == MULTISIG_KEX_MSG_V2_MAGIC_N.size(),
"Multisig kex msg magic inconsistency.");
CHECK_AND_ASSERT_THROW_MES(tools::base58::decode(m_msg.substr(MULTISIG_KEX_MSG_V2_MAGIC_1.size()), msg_no_magic),
"Multisig kex msg decoding error.");
binary_archive<false> b_archive{epee::strspan<std::uint8_t>(msg_no_magic)};

@ -27,10 +27,40 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(net_sources dandelionpp.cpp error.cpp http.cpp i2p_address.cpp parse.cpp resolve.cpp
socks.cpp socks_connect.cpp tor_address.cpp zmq.cpp)
monero_find_all_headers(net_headers "${CMAKE_CURRENT_SOURCE_DIR}")
SET(NET_HEADERS
dandelionpp.h
error.h
fwd.h
http.h
i2p_address.h
parse.h
resolve.h
socks_connect.h
socks.h
tor_address.h
zmq.h)
file(GLOB NET_SOURCES *.cpp *.c *.cc)
monero_add_library(net ${net_sources} ${net_headers})
target_link_libraries(net common epee ${ZMQ_LIB} ${Boost_ASIO_LIBRARY})
add_library(net)
target_sources(net
PRIVATE
${NET_SOURCES}
)
target_link_libraries(net PUBLIC
common
epee
${ZMQ_LIBRARIES}
Boost::system)
target_include_directories(net
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${ZMQ_INCLUDE_DIRS}
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(net
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/net/"
HEADERS ${NET_HEADERS})

@ -71,7 +71,7 @@ namespace net
struct i2p_serialized
{
std::string host;
std::uint16_t port; //! Leave for compatability with older clients
std::uint16_t port;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(host)
@ -80,7 +80,8 @@ namespace net
};
}
i2p_address::i2p_address(const boost::string_ref host) noexcept
i2p_address::i2p_address(const boost::string_ref host, const std::uint16_t port) noexcept
: port_(port)
{
// this is a private constructor, throw if moved to public
assert(host.size() < sizeof(host_));
@ -96,19 +97,27 @@ namespace net
}
i2p_address::i2p_address() noexcept
: port_(0)
{
static_assert(sizeof(unknown_host) <= sizeof(host_), "bad buffer size");
std::memcpy(host_, unknown_host, sizeof(unknown_host));
std::memset(host_ + sizeof(unknown_host), 0, sizeof(host_) - sizeof(unknown_host));
}
expect<i2p_address> i2p_address::make(const boost::string_ref address)
expect<i2p_address> i2p_address::make(const boost::string_ref address, const std::uint16_t default_port)
{
boost::string_ref host = address.substr(0, address.rfind(':'));
const boost::string_ref port =
address.substr(host.size() + (host.size() == address.size() ? 0 : 1));
MONERO_CHECK(host_check(host));
std::uint16_t porti = default_port;
if (!port.empty() && !epee::string_tools::get_xtype_from_string(porti, std::string{port}))
return {net::error::invalid_port};
static_assert(b32_length + sizeof(tld) == sizeof(i2p_address::host_), "bad internal host size");
return i2p_address{host};
return i2p_address{host, porti};
}
bool i2p_address::_load(epee::serialization::portable_storage& src, epee::serialization::section* hparent)
@ -118,21 +127,23 @@ namespace net
{
std::memcpy(host_, in.host.data(), in.host.size());
std::memset(host_ + in.host.size(), 0, sizeof(host_) - in.host.size());
port_ = in.port;
return true;
}
static_assert(sizeof(unknown_host) <= sizeof(host_), "bad buffer size");
std::memcpy(host_, unknown_host, sizeof(unknown_host)); // include null terminator
port_ = 0;
return false;
}
bool i2p_address::store(epee::serialization::portable_storage& dest, epee::serialization::section* hparent) const
{
// Set port to 1 for backwards compatability; zero is invalid port
const i2p_serialized out{std::string{host_}, 1};
const i2p_serialized out{std::string{host_}, port_};
return out.store(dest, hparent);
}
i2p_address::i2p_address(const i2p_address& rhs) noexcept
: port_(rhs.port_)
{
std::memcpy(host_, rhs.host_, sizeof(host_));
}
@ -141,6 +152,7 @@ namespace net
{
if (this != std::addressof(rhs))
{
port_ = rhs.port_;
std::memcpy(host_, rhs.host_, sizeof(host_));
}
return *this;
@ -154,12 +166,13 @@ namespace net
bool i2p_address::equal(const i2p_address& rhs) const noexcept
{
return is_same_host(rhs);
return port_ == rhs.port_ && is_same_host(rhs);
}
bool i2p_address::less(const i2p_address& rhs) const noexcept
{
return std::strcmp(host_str(), rhs.host_str()) < 0;
int res = std::strcmp(host_str(), rhs.host_str());
return res < 0 || (res == 0 && port() < rhs.port());
}
bool i2p_address::is_same_host(const i2p_address& rhs) const noexcept
@ -169,6 +182,20 @@ namespace net
std::string i2p_address::str() const
{
return host_str();
const std::size_t host_length = std::strlen(host_str());
const std::size_t port_length =
port_ == 0 ? 0 : std::numeric_limits<std::uint16_t>::digits10 + 2;
std::string out{};
out.reserve(host_length + port_length);
out.assign(host_str(), host_length);
if (port_ != 0)
{
out.push_back(':');
namespace karma = boost::spirit::karma;
karma::generate(std::back_inserter(out), karma::ushort_, port());
}
return out;
}
}

@ -50,10 +50,11 @@ namespace net
//! b32 i2p address; internal format not condensed/decoded.
class i2p_address
{
std::uint16_t port_;
char host_[61]; // null-terminated
//! Keep in private, `host.size()` has no runtime check
i2p_address(boost::string_ref host) noexcept;
i2p_address(boost::string_ref host, std::uint16_t port) noexcept;
public:
//! \return Size of internal buffer for host.
@ -73,7 +74,7 @@ namespace net
with `default_port` being used if port is not specified in
`address`.
*/
static expect<i2p_address> make(boost::string_ref address);
static expect<i2p_address> make(boost::string_ref address, std::uint16_t default_port = 0);
//! Load from epee p2p format, and \return false if not valid tor address
bool _load(epee::serialization::portable_storage& src, epee::serialization::section* hparent);
@ -102,8 +103,8 @@ namespace net
//! \return Null-terminated `x.b32.i2p` value or `unknown_str()`.
const char* host_str() const noexcept { return host_; }
//! \return `1` to work with I2P socks which considers `0` error.
std::uint16_t port() const noexcept { return 1; }
//! \return Port value or `0` if unspecified.
std::uint16_t port() const noexcept { return port_; }
static constexpr bool is_loopback() noexcept { return false; }
static constexpr bool is_local() noexcept { return false; }

@ -81,7 +81,7 @@ namespace net
if (host_str_ref.ends_with(".onion"))
return tor_address::make(address, default_port);
if (host_str_ref.ends_with(".i2p"))
return i2p_address::make(address);
return i2p_address::make(address, default_port);
boost::system::error_code ec;
boost::asio::ip::address_v6 v6 = boost::asio::ip::address_v6::from_string(host_str, ec);

@ -26,27 +26,41 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required (VERSION 3.5)
project (monero CXX)
file(GLOB P2P_SOURCES *.cpp *.c *.cc)
set(P2P_HEADERS
net_node_common.h
net_node.h
net_peerlist_boost_serialization.h
net_peerlist.h
p2p_protocol_defs.h)
file(GLOB P2P *)
source_group(p2p FILES ${P2P})
add_library(p2p)
target_sources(p2p
PRIVATE
${P2P_SOURCES}
)
#add_library(p2p ${P2P})
#monero_private_headers(p2p ${P2P})
monero_add_library(p2p ${P2P})
target_link_libraries(p2p
PUBLIC
version
cryptonote_core
net
${UPNP_LIBRARIES}
${Boost_CHRONO_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
miniupnpc::miniupnpc
Boost::chrono
Boost::program_options
Boost::filesystem
Boost::system
Boost::thread
Boost::serialization)
target_include_directories(p2p
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/external>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(p2p
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/p2p/"
HEADERS ${P2P_HEADERS})

@ -60,9 +60,9 @@
#include "cryptonote_core/cryptonote_core.h"
#include "net/parse.h"
#include <miniupnp/miniupnpc/miniupnpc.h>
#include <miniupnp/miniupnpc/upnpcommands.h>
#include <miniupnp/miniupnpc/upnperrors.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"

@ -196,7 +196,7 @@ namespace boost
if (std::strcmp(host, net::i2p_address::unknown_str()) == 0)
na = net::i2p_address::unknown();
else
na = MONERO_UNWRAP(net::i2p_address::make(host));
na = MONERO_UNWRAP(net::i2p_address::make(host, port));
}
template <class Archive, class ver_type>

@ -1,33 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#include <malloc.h>

@ -1,33 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#define alloca(size) _alloca(size)

@ -1,35 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#ifndef __cplusplus
#define inline __inline
#endif

@ -1,39 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#if !defined(__cplusplus)
typedef int bool;
#define true 1
#define false 0
#endif

@ -1,36 +0,0 @@
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#define PDP_ENDIAN 3412
#define BYTE_ORDER LITTLE_ENDIAN

@ -27,45 +27,50 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(ringct_basic_sources
rctOps.cpp
rctTypes.cpp
rctCryptoOps.c
multiexp.cc
bulletproofs.cc
bulletproofs2.cc
bulletproofs_plus.cc)
rctOps.cpp
rctTypes.cpp
rctCryptoOps.c
multiexp.cc
bulletproofs.cc
bulletproofs2.cc
bulletproofs_plus.cc)
monero_find_all_headers(ringct_basic_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
set(ringct_basic_headers
rctOps.h
rctTypes.h
rctCryptoOps.h
multiexp.h
bulletproofs.h
bulletproofs_plus.h)
add_library(ringct_basic)
target_sources(ringct_basic
PRIVATE
${ringct_basic_sources}
)
monero_private_headers(ringct_basic
${crypto_private_headers})
monero_add_library(ringct_basic
${ringct_basic_sources}
${ringct_basic_private_headers})
target_link_libraries(ringct_basic
PUBLIC
common
cncrypto
PRIVATE
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES})
set(ringct_sources
rctSigs.cpp
)
OpenSSL::SSL
OpenSSL::Crypto)
set(ringct_headers)
target_include_directories(ringct_basic
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
set(ringct_private_headers
rctSigs.h
)
add_library(ringct)
target_sources(ringct
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/rctSigs.cpp
)
monero_private_headers(ringct
${crypto_private_headers})
monero_add_library(ringct
${ringct_sources}
${ringct_headers}
${ringct_private_headers})
target_link_libraries(ringct
PUBLIC
common
@ -73,5 +78,19 @@ target_link_libraries(ringct
cryptonote_basic
device
PRIVATE
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES})
OpenSSL::SSL)
target_include_directories(ringct
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(ringct_basic
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/ringct/"
HEADERS ${ringct_basic_headers})
monero_install_library(ringct
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/ringct/"
HEADERS rctSigs.h)

@ -329,10 +329,6 @@ namespace rct {
ctkeyV outPk;
xmr_amount txnFee; // contains b
rctSigBase() :
type(RCTTypeNull), message{}, mixRing{}, pseudoOuts{}, ecdhInfo{}, outPk{}, txnFee(0)
{}
template<bool W, template <bool> class Archive>
bool serialize_rctsig_base(Archive<W> &ar, size_t inputs, size_t outputs)
{
@ -370,17 +366,11 @@ namespace rct {
{
if (type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus)
{
// Since RCTTypeBulletproof2 enote types, we don't serialize the blinding factor, and only serialize the
// first 8 bytes of ecdhInfo[i].amount
ar.begin_object();
crypto::hash8 trunc_amount; // placeholder variable needed to maintain "strict aliasing"
if (!typename Archive<W>::is_saving()) // loading
if (!typename Archive<W>::is_saving())
memset(ecdhInfo[i].amount.bytes, 0, sizeof(ecdhInfo[i].amount.bytes));
else // saving
memcpy(trunc_amount.data, ecdhInfo[i].amount.bytes, sizeof(trunc_amount));
FIELD_N("amount", trunc_amount);
if (!typename Archive<W>::is_saving()) // loading
memcpy(ecdhInfo[i].amount.bytes, trunc_amount.data, sizeof(trunc_amount));
crypto::hash8 &amount = (crypto::hash8&)ecdhInfo[i].amount;
FIELD(amount);
ar.end_object();
}
else

@ -26,108 +26,59 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include_directories(SYSTEM ${ZMQ_INCLUDE_PATH})
set(rpc_base_sources
rpc_args.cpp
rpc_payment_signature.cpp
rpc_handler.cpp)
set(rpc_sources
bootstrap_daemon.cpp
bootstrap_node_selector.cpp
core_rpc_server.cpp
rpc_payment.cpp
rpc_version_str.cpp
instanciations.cpp)
set(daemon_messages_sources
message.cpp
daemon_messages.cpp)
set(rpc_pub_sources zmq_pub.cpp)
set(daemon_rpc_server_sources
daemon_handler.cpp
zmq_pub.cpp
zmq_server.cpp)
set(rpc_base_headers
rpc_args.h
rpc_payment_signature.h
rpc_handler.h)
set(rpc_headers
rpc_version_str.h
rpc_handler.h)
set(rpc_pub_headers zmq_pub.h)
set(daemon_rpc_server_headers)
set(rpc_private_headers
bootstrap_daemon.h
core_rpc_server.h
rpc_payment.h
core_rpc_server_commands_defs.h
core_rpc_server_error_codes.h)
set(daemon_messages_private_headers
message.h
daemon_messages.h)
set(daemon_rpc_server_private_headers
message.h
daemon_messages.h
daemon_handler.h
zmq_server.h)
monero_private_headers(rpc
${rpc_private_headers})
set(rpc_pub_private_headers)
monero_private_headers(daemon_rpc_server
${daemon_rpc_server_private_headers})
monero_add_library(rpc_base
${rpc_base_sources}
${rpc_base_headers}
${rpc_base_private_headers})
monero_add_library(rpc
${rpc_sources}
${rpc_headers}
${rpc_private_headers})
monero_add_library(rpc_pub
${rpc_pub_sources}
${rpc_pub_headers}
${rpc_pub_private_headers})
monero_add_library(daemon_messages
${daemon_messages_sources}
${daemon_messages_headers}
${daemon_messages_private_headers})
monero_add_library(daemon_rpc_server
${daemon_rpc_server_sources}
${daemon_rpc_server_headers}
${daemon_rpc_server_private_headers})
# rpc base
set(RPC_BASE_HEADERS
rpc_args.h
rpc_payment_signature.h
rpc_handler.h)
add_library(rpc_base)
target_sources(rpc_base
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/rpc_args.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rpc_payment_signature.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rpc_handler.cpp
)
target_link_libraries(rpc_base
PUBLIC
common
epee
${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::regex
Boost::thread
Boost::program_options)
target_include_directories(rpc_base
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero>
PRIVATE ${ZMQ_INCLUDE_DIRS}
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(rpc_base
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/rpc_base/"
HEADERS "${RPC_BASE_HEADERS}")
# rpc
set(RPC_HEADERS
rpc_version_str.h
rpc_handler.h
bootstrap_daemon.h
core_rpc_server.h
rpc_payment.h
core_rpc_server_commands_defs.h
core_rpc_server_error_codes.h)
add_library(rpc)
target_sources(rpc
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/bootstrap_daemon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/bootstrap_node_selector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/core_rpc_server.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rpc_payment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rpc_version_str.cpp
${CMAKE_CURRENT_SOURCE_DIR}/instanciations.cpp
)
target_link_libraries(rpc
PUBLIC
@ -137,10 +88,30 @@ target_link_libraries(rpc
cryptonote_protocol
net
version
${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
Boost::regex
Boost::thread)
target_include_directories(rpc
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${ZMQ_INCLUDE_DIRS}
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(rpc
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/rpc/"
HEADERS "${RPC_HEADERS}")
# rpc pub
set(RPC_PUB_HEADERS
zmq_pub.h)
add_library(rpc_pub)
target_sources(rpc_pub
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/zmq_pub.cpp
)
target_link_libraries(rpc_pub
PUBLIC
@ -148,15 +119,46 @@ target_link_libraries(rpc_pub
net
cryptonote_basic
serialization
${Boost_THREAD_LIBRARY})
Boost::thread)
target_include_directories(rpc_pub
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
PRIVATE ${ZMQ_INCLUDE_DIRS}
PRIVATE ${OPENSSL_INCLUDE_DIR}
)
monero_install_library(rpc_pub
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/rpc_pub/"
HEADERS "${RPC_PUB_HEADERS}")
# daemon messages
set(DAEMON_MESSAGES_HEADERS
message.h
daemon_messages.h)
add_library(daemon_messages
message.cpp
daemon_messages.cpp)
target_link_libraries(daemon_messages
LINK_PRIVATE
cryptonote_core
cryptonote_protocol
version
serialization
${EXTRA_LIBRARIES})
serialization)
# daemon rpc server
add_library(daemon_rpc_server
daemon_handler.cpp
zmq_pub.cpp
zmq_server.cpp
message.h
daemon_messages.h
daemon_handler.h
zmq_server.h)
target_link_libraries(daemon_rpc_server
LINK_PRIVATE
@ -167,11 +169,13 @@ target_link_libraries(daemon_rpc_server
version
daemon_messages
serialization
${Boost_CHRONO_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${ZMQ_LIB}
${EXTRA_LIBRARIES})
target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
target_include_directories(obj_daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
Boost::chrono
Boost::regex
Boost::system
Boost::thread
${ZMQ_LIBRARIES})
target_include_directories(daemon_rpc_server
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../
PRIVATE ${ZMQ_INCLUDE_DIRS}
PRIVATE ${OPENSSL_INCLUDE_DIR})

@ -48,11 +48,6 @@ void GetHeight::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest) c
void GetHeight::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, height, height);
}
@ -66,11 +61,6 @@ void GetBlocksFast::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest
void GetBlocksFast::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, block_ids, block_ids);
GET_FROM_JSON_OBJECT(val, start_height, start_height);
GET_FROM_JSON_OBJECT(val, prune, prune);
@ -86,11 +76,6 @@ void GetBlocksFast::Response::doToJson(rapidjson::Writer<epee::byte_stream>& des
void GetBlocksFast::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, blocks, blocks);
GET_FROM_JSON_OBJECT(val, start_height, start_height);
GET_FROM_JSON_OBJECT(val, current_height, current_height);
@ -106,11 +91,6 @@ void GetHashesFast::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest
void GetHashesFast::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, known_hashes, known_hashes);
GET_FROM_JSON_OBJECT(val, start_height, start_height);
}
@ -120,16 +100,10 @@ void GetHashesFast::Response::doToJson(rapidjson::Writer<epee::byte_stream>& des
INSERT_INTO_JSON_OBJECT(dest, hashes, hashes);
INSERT_INTO_JSON_OBJECT(dest, start_height, start_height);
INSERT_INTO_JSON_OBJECT(dest, current_height, current_height);
}
void GetHashesFast::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, hashes, hashes);
GET_FROM_JSON_OBJECT(val, start_height, start_height);
GET_FROM_JSON_OBJECT(val, current_height, current_height);
@ -143,11 +117,6 @@ void GetTransactions::Request::doToJson(rapidjson::Writer<epee::byte_stream>& de
void GetTransactions::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, tx_hashes, tx_hashes);
}
@ -159,11 +128,6 @@ void GetTransactions::Response::doToJson(rapidjson::Writer<epee::byte_stream>& d
void GetTransactions::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, txs, txs);
GET_FROM_JSON_OBJECT(val, missed_hashes, missed_hashes);
}
@ -176,11 +140,6 @@ void KeyImagesSpent::Request::doToJson(rapidjson::Writer<epee::byte_stream>& des
void KeyImagesSpent::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, key_images, key_images);
}
@ -191,11 +150,6 @@ void KeyImagesSpent::Response::doToJson(rapidjson::Writer<epee::byte_stream>& de
void KeyImagesSpent::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, spent_status, spent_status);
}
@ -207,11 +161,6 @@ void GetTxGlobalOutputIndices::Request::doToJson(rapidjson::Writer<epee::byte_st
void GetTxGlobalOutputIndices::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, tx_hash, tx_hash);
}
@ -222,11 +171,6 @@ void GetTxGlobalOutputIndices::Response::doToJson(rapidjson::Writer<epee::byte_s
void GetTxGlobalOutputIndices::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, output_indices, output_indices);
}
@ -238,11 +182,6 @@ void SendRawTx::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest) co
void SendRawTx::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, tx, tx);
GET_FROM_JSON_OBJECT(val, relay, relay);
}
@ -255,11 +194,6 @@ void SendRawTx::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest) c
void SendRawTx::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, relayed, relayed);
}
@ -271,11 +205,6 @@ void SendRawTxHex::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest)
void SendRawTxHex::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, tx_as_hex, tx_as_hex);
GET_FROM_JSON_OBJECT(val, relay, relay);
}
@ -290,11 +219,6 @@ void StartMining::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest)
void StartMining::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, miner_address, miner_address);
GET_FROM_JSON_OBJECT(val, threads_count, threads_count);
GET_FROM_JSON_OBJECT(val, do_background_mining, do_background_mining);
@ -342,11 +266,6 @@ void MiningStatus::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest
void MiningStatus::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, active, active);
GET_FROM_JSON_OBJECT(val, speed, speed);
GET_FROM_JSON_OBJECT(val, threads_count, threads_count);
@ -369,11 +288,6 @@ void GetInfo::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest) con
void GetInfo::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, info, info);
}
@ -400,11 +314,6 @@ void GetBlockHash::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest)
void GetBlockHash::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, height, height);
}
@ -415,11 +324,6 @@ void GetBlockHash::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest
void GetBlockHash::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, hash, hash);
}
@ -438,11 +342,6 @@ void GetLastBlockHeader::Response::doToJson(rapidjson::Writer<epee::byte_stream>
void GetLastBlockHeader::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, header, header);
}
@ -454,11 +353,6 @@ void GetBlockHeaderByHash::Request::doToJson(rapidjson::Writer<epee::byte_stream
void GetBlockHeaderByHash::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, hash, hash);
}
@ -469,11 +363,6 @@ void GetBlockHeaderByHash::Response::doToJson(rapidjson::Writer<epee::byte_strea
void GetBlockHeaderByHash::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, header, header);
}
@ -485,11 +374,6 @@ void GetBlockHeaderByHeight::Request::doToJson(rapidjson::Writer<epee::byte_stre
void GetBlockHeaderByHeight::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, height, height);
}
@ -500,11 +384,6 @@ void GetBlockHeaderByHeight::Response::doToJson(rapidjson::Writer<epee::byte_str
void GetBlockHeaderByHeight::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, header, header);
}
@ -516,11 +395,6 @@ void GetBlockHeadersByHeight::Request::doToJson(rapidjson::Writer<epee::byte_str
void GetBlockHeadersByHeight::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, heights, heights);
}
@ -531,11 +405,6 @@ void GetBlockHeadersByHeight::Response::doToJson(rapidjson::Writer<epee::byte_st
void GetBlockHeadersByHeight::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, headers, headers);
}
@ -555,11 +424,6 @@ void GetPeerList::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest)
void GetPeerList::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, white_list, white_list);
GET_FROM_JSON_OBJECT(val, gray_list, gray_list);
}
@ -572,11 +436,6 @@ void SetLogLevel::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest)
void SetLogLevel::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, level, level);
}
@ -603,11 +462,6 @@ void GetTransactionPool::Response::doToJson(rapidjson::Writer<epee::byte_stream>
void GetTransactionPool::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, transactions, transactions);
GET_FROM_JSON_OBJECT(val, key_images, key_images);
}
@ -620,11 +474,6 @@ void HardForkInfo::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest)
void HardForkInfo::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, version, version);
}
@ -635,11 +484,6 @@ void HardForkInfo::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest
void HardForkInfo::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, info, info);
}
@ -655,11 +499,6 @@ void GetOutputHistogram::Request::doToJson(rapidjson::Writer<epee::byte_stream>&
void GetOutputHistogram::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, amounts, amounts);
GET_FROM_JSON_OBJECT(val, min_count, min_count);
GET_FROM_JSON_OBJECT(val, max_count, max_count);
@ -674,11 +513,6 @@ void GetOutputHistogram::Response::doToJson(rapidjson::Writer<epee::byte_stream>
void GetOutputHistogram::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, histogram, histogram);
}
@ -690,11 +524,6 @@ void GetOutputKeys::Request::doToJson(rapidjson::Writer<epee::byte_stream>& dest
void GetOutputKeys::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, outputs, outputs);
}
@ -705,11 +534,6 @@ void GetOutputKeys::Response::doToJson(rapidjson::Writer<epee::byte_stream>& des
void GetOutputKeys::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, keys, keys);
}
@ -728,11 +552,6 @@ void GetRPCVersion::Response::doToJson(rapidjson::Writer<epee::byte_stream>& des
void GetRPCVersion::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, version, version);
}
@ -743,11 +562,6 @@ void GetFeeEstimate::Request::doToJson(rapidjson::Writer<epee::byte_stream>& des
void GetFeeEstimate::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, num_grace_blocks, num_grace_blocks);
}
@ -761,11 +575,6 @@ void GetFeeEstimate::Response::doToJson(rapidjson::Writer<epee::byte_stream>& de
void GetFeeEstimate::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, estimated_base_fee, estimated_base_fee);
GET_FROM_JSON_OBJECT(val, fee_mask, fee_mask);
GET_FROM_JSON_OBJECT(val, size_scale, size_scale);
@ -782,11 +591,6 @@ void GetOutputDistribution::Request::doToJson(rapidjson::Writer<epee::byte_strea
void GetOutputDistribution::Request::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, amounts, amounts);
GET_FROM_JSON_OBJECT(val, from_height, from_height);
GET_FROM_JSON_OBJECT(val, to_height, to_height);
@ -801,11 +605,6 @@ void GetOutputDistribution::Response::doToJson(rapidjson::Writer<epee::byte_stre
void GetOutputDistribution::Response::fromJson(const rapidjson::Value& val)
{
if (!val.IsObject())
{
throw json::WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, status, status);
GET_FROM_JSON_OBJECT(val, distributions, distributions);
}

@ -158,22 +158,13 @@ void ZmqServer::serve()
if (!pub || sockets[2].revents)
{
expect<std::string> message = net::zmq::receive(rep.get(), read_flags);
if (!message)
{
// EAGAIN can occur when using `zmq_poll`, which doesn't inspect for message validity
if (message != net::zmq::make_error_code(EAGAIN))
MONERO_THROW(message.error(), "Read failure on ZMQ-RPC");
}
else // no errors
{
MDEBUG("Received RPC request: \"" << *message << "\"");
epee::byte_slice response = handler.handle(std::move(*message));
const boost::string_ref response_view{reinterpret_cast<const char*>(response.data()), response.size()};
MDEBUG("Sending RPC reply: \"" << response_view << "\"");
MONERO_UNWRAP(net::zmq::send(std::move(response), rep.get()));
}
std::string message = MONERO_UNWRAP(net::zmq::receive(rep.get(), read_flags));
MDEBUG("Received RPC request: \"" << message << "\"");
epee::byte_slice response = handler.handle(std::move(message));
const boost::string_ref response_view{reinterpret_cast<const char*>(response.data()), response.size()};
MDEBUG("Sending RPC reply: \"" << response_view << "\"");
MONERO_UNWRAP(net::zmq::send(std::move(response), rep.get()));
}
}
}

@ -26,30 +26,49 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(serialization_sources
json_object.cpp)
file(GLOB SER_SOURCES *.cpp *.c *.cc)
set(SER_HEADERS
binary_archive.h
binary_utils.h
container.h
containers.h
crypto.h
debug_archive.h
difficulty_type.h
json_archive.h
json_object.h
json_utils.h
pair.h
serialization.h
string.h
tuple.h
variant.h)
set(serialization_headers)
add_library(serialization)
target_sources(serialization
PRIVATE
${SER_SOURCES}
)
monero_find_all_headers(serialization_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
monero_private_headers(serialization
${serialization_private_headers})
monero_add_library(serialization
${serialization_sources}
${serialization_headers}
${serialization_private_headers})
target_link_libraries(serialization
LINK_PRIVATE
cryptonote_basic
cryptonote_core
cryptonote_protocol
epee
${Boost_CHRONO_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${EXTRA_LIBRARIES})
add_dependencies(serialization
version)
Boost::chrono
Boost::regex
Boost::system
Boost::thread)
add_dependencies(serialization version)
target_include_directories(serialization
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monero/>
)
monero_install_library(serialization
INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/monero/serialization/"
HEADERS "${SER_HEADERS}")

@ -42,7 +42,7 @@ namespace serialization
typename std::enable_if<!use_container_varint<T>(), bool>::type
serialize_container_element(Archive& ar, T& e)
{
return do_serialize(ar, e);
return ::do_serialize(ar, e);
}
template<typename Archive, typename T>
@ -52,7 +52,7 @@ namespace serialization
static constexpr const bool previously_varint = std::is_same<uint64_t, T>() || std::is_same<uint32_t, T>();
if (!previously_varint && ar.varint_bug_backward_compatibility_enabled() && !typename Archive::is_saving())
return do_serialize(ar, e);
return ::do_serialize(ar, e);
ar.serialize_varint(e);
return true;
}

@ -42,12 +42,14 @@ struct debug_archive : public json_archive<W> {
};
template <class T>
static inline bool do_serialize(debug_archive<true> &ar, T &v)
struct serializer<debug_archive<true>, T>
{
static void serialize(debug_archive<true> &ar, T &v)
{
ar.begin_object();
ar.tag(variant_serialization_traits<debug_archive<true>, T>::get_tag());
do_serialize(static_cast<json_archive<true>&>(ar), v);
serializer<json_archive<true>, T>::serialize(ar, v);
ar.end_object();
ar.stream() << std::endl;
return true;
}
}
};

@ -31,6 +31,8 @@
#include "cryptonote_basic/difficulty.h"
#include "serialization.h"
template<> struct is_basic_type<cryptonote::difficulty_type> { typedef boost::true_type type; };
template <template <bool> class Archive>
inline bool do_serialize(Archive<false>& ar, cryptonote::difficulty_type &diff)
{

@ -47,7 +47,7 @@ namespace serialization
typename std::enable_if<!use_pair_varint<T>(), bool>::type
serialize_pair_element(Archive& ar, T& e)
{
return do_serialize(ar, e);
return ::do_serialize(ar, e);
}
template<typename Archive, typename T>
@ -57,7 +57,7 @@ namespace serialization
static constexpr const bool previously_varint = std::is_same<uint64_t, T>();
if (!previously_varint && ar.varint_bug_backward_compatibility_enabled() && !typename Archive::is_saving())
return do_serialize(ar, e);
return ::do_serialize(ar, e);
ar.serialize_varint(e);
return true;
}

@ -57,30 +57,73 @@
template <class T>
struct is_blob_type { typedef boost::false_type type; };
/*! \fn do_serialize(Archive &ar, T &v)
/*! \struct has_free_serializer
*
* \brief a descriptor for dispatching serialize
*/
template <class T>
struct has_free_serializer { typedef boost::true_type type; };
/*! \struct is_basic_type
*
* \brief a descriptor for dispatching serialize
*/
template <class T>
struct is_basic_type { typedef boost::false_type type; };
template<typename F, typename S>
struct is_basic_type<std::pair<F,S>> { typedef boost::true_type type; };
template<>
struct is_basic_type<std::string> { typedef boost::true_type type; };
/*! \struct serializer
*
* \brief main function for dispatching serialization for a given pair of archive and value types
* \brief ... wouldn't a class be better?
*
* Types marked true with is_blob_type<T> will be serialized as a blob, integral types will be
* serialized as integers, and types who have a `member_do_serialize` method will be serialized
* using that method. Booleans are serialized like blobs.
* \detailed The logic behind serializing data. Places the archive
* data into the supplied parameter. This dispatches based on the
* supplied \a T template parameter's traits of is_blob_type or it is
* an integral (as defined by the is_integral trait). Depends on the
* \a Archive parameter to have overloaded the serialize_blob(T v,
* size_t size) and serialize_int(T v) base on which trait it
* applied. When the class has neither types, it falls to the
* overloaded method do_serialize(Archive ar) in T to do the work.
*/
template <class Archive, class T>
inline std::enable_if_t<is_blob_type<T>::type::value, bool> do_serialize(Archive &ar, T &v)
{
ar.serialize_blob(&v, sizeof(v));
return true;
}
template <class Archive, class T>
inline std::enable_if_t<boost::is_integral<T>::value, bool> do_serialize(Archive &ar, T &v)
{
ar.serialize_int(v);
return true;
}
struct serializer{
static bool serialize(Archive &ar, T &v) {
return serialize(ar, v, typename boost::is_integral<T>::type(), typename is_blob_type<T>::type(), typename is_basic_type<T>::type());
}
template<typename A>
static bool serialize(Archive &ar, T &v, boost::false_type, boost::true_type, A a) {
ar.serialize_blob(&v, sizeof(v));
return true;
}
template<typename A>
static bool serialize(Archive &ar, T &v, boost::true_type, boost::false_type, A a) {
ar.serialize_int(v);
return true;
}
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::false_type) {
//serialize_custom(ar, v, typename has_free_serializer<T>::type());
return v.do_serialize(ar);
}
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::true_type) {
//serialize_custom(ar, v, typename has_free_serializer<T>::type());
return do_serialize(ar, v);
}
static void serialize_custom(Archive &ar, T &v, boost::true_type) {
}
};
/*! \fn do_serialize(Archive &ar, T &v)
*
* \brief just calls the serialize function defined for ar and v...
*/
template <class Archive, class T>
inline auto do_serialize(Archive &ar, T &v) -> decltype(v.member_do_serialize(ar), true)
inline bool do_serialize(Archive &ar, T &v)
{
return v.member_do_serialize(ar);
return ::serializer<Archive, T>::serialize(ar, v);
}
template <class Archive>
inline bool do_serialize(Archive &ar, bool &v)
@ -101,6 +144,16 @@ inline bool do_serialize(Archive &ar, bool &v)
typedef boost::true_type type; \
}
/*! \macro FREE_SERIALIZER
*
* \brief adds the has_free_serializer to the type
*/
#define FREE_SERIALIZER(T) \
template<> \
struct has_free_serializer<T> { \
typedef boost::true_type type; \
}
/*! \macro VARIANT_TAG
*
* \brief Adds the tag \tag to the \a Archive of \a Type
@ -121,7 +174,7 @@ inline bool do_serialize(Archive &ar, bool &v)
*/
#define BEGIN_SERIALIZE() \
template <bool W, template <bool> class Archive> \
bool member_do_serialize(Archive<W> &ar) {
bool do_serialize(Archive<W> &ar) {
/*! \macro BEGIN_SERIALIZE_OBJECT
*
@ -130,7 +183,7 @@ inline bool do_serialize(Archive &ar, bool &v)
*/
#define BEGIN_SERIALIZE_OBJECT() \
template <bool W, template <bool> class Archive> \
bool member_do_serialize(Archive<W> &ar) { \
bool do_serialize(Archive<W> &ar) { \
ar.begin_object(); \
bool r = do_serialize_object(ar); \
ar.end_object(); \
@ -144,6 +197,11 @@ inline bool do_serialize(Archive &ar, bool &v)
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec) \
::serialization::detail::prepare_custom_vector_serialization(size, vec, typename Archive<W>::is_saving())
/*! \macro PREPARE_CUSTOM_DEQUE_SERIALIZATION
*/
#define PREPARE_CUSTOM_DEQUE_SERIALIZATION(size, vec) \
::serialization::detail::prepare_custom_deque_serialization(size, vec, typename Archive<W>::is_saving())
/*! \macro END_SERIALIZE
* \brief self-explanatory
*/
@ -151,6 +209,16 @@ inline bool do_serialize(Archive &ar, bool &v)
return ar.good(); \
}
/*! \macro VALUE(f)
* \brief the same as FIELD(f)
*/
#define VALUE(f) \
do { \
ar.tag(#f); \
bool r = ::do_serialize(ar, f); \
if (!r || !ar.good()) return false; \
} while(0);
/*! \macro FIELD_N(t,f)
*
* \brief serializes a field \a f tagged \a t
@ -158,7 +226,7 @@ inline bool do_serialize(Archive &ar, bool &v)
#define FIELD_N(t, f) \
do { \
ar.tag(t); \
bool r = do_serialize(ar, f); \
bool r = ::do_serialize(ar, f); \
if (!r || !ar.good()) return false; \
} while(0);
@ -169,7 +237,7 @@ inline bool do_serialize(Archive &ar, bool &v)
#define FIELD(f) \
do { \
ar.tag(#f); \
bool r = do_serialize(ar, f); \
bool r = ::do_serialize(ar, f); \
if (!r || !ar.good()) return false; \
} while(0);
@ -179,7 +247,7 @@ inline bool do_serialize(Archive &ar, bool &v)
*/
#define FIELDS(f) \
do { \
bool r = do_serialize(ar, f); \
bool r = ::do_serialize(ar, f); \
if (!r || !ar.good()) return false; \
} while(0);
@ -249,6 +317,17 @@ namespace serialization {
vec.resize(size);
}
template <typename T>
void prepare_custom_deque_serialization(size_t size, std::deque<T>& vec, const boost::mpl::bool_<true>& /*is_saving*/)
{
}
template <typename T>
void prepare_custom_deque_serialization(size_t size, std::deque<T>& vec, const boost::mpl::bool_<false>& /*is_saving*/)
{
vec.resize(size);
}
/*! \fn do_check_stream_state
*
* \brief self explanatory

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save