Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
af08c83
utils: delete outdated windows build script
selsta May 7, 2022
bae4a1a
Don't send peerlist larger than max allowed
j-berman May 12, 2022
b9d2c78
fix backoff delay logic when re-relaying txs
j-berman May 12, 2022
62914e7
Ignore gitian build files
May 12, 2022
fde7c96
wallet2: fix spurious reorg detection with untrusted nodes
moneromooo-monero May 15, 2022
1164874
src, epee: fix a couple compiler warnings
selsta May 16, 2022
5858f05
GCC: Fix -Wstringop-overflow= warnings
May 17, 2022
2979474
disable multisig by default
moneromooo-monero May 14, 2022
a66a52d
common: update sha256sum to use OpenSSL 3.0 API
May 17, 2022
08080df
unit_tests: add more sha256sum test cases
May 17, 2022
2dab31f
Don't exclusively drop tor/i2p outgoing cxns in idle loop
j-berman May 15, 2022
97271b7
Merge pull request #8349
luigi1111 May 23, 2022
de2f0d0
wallet_api: add scanTransactions function
selsta May 26, 2022
bc05d2d
README.md: Add v15/v16 network upgrade
May 26, 2022
6d0df2f
Merge pull request #8318
luigi1111 May 27, 2022
7f2f7ce
Merge pull request #8324
luigi1111 May 27, 2022
7b0b06a
Merge pull request #8325
luigi1111 May 27, 2022
d52b7d0
Merge pull request #8326
luigi1111 May 27, 2022
f96cf86
Merge pull request #8328
luigi1111 May 27, 2022
f9d789d
Merge pull request #8330
luigi1111 May 27, 2022
1ff2b02
Merge pull request #8331
luigi1111 May 27, 2022
e8252ef
Merge pull request #8337
luigi1111 May 27, 2022
72cba50
Merge pull request #8338
luigi1111 May 27, 2022
9750e1f
Merge pull request #8340
luigi1111 May 27, 2022
fb3f7ce
clang warning fix for #8338
May 28, 2022
da0715e
Improve consistency between on_money_received and on_money_received_u…
kayabaNerve Jun 1, 2022
16f8e04
Remove erraneous commas
kayabaNerve Jun 1, 2022
747f5d3
Preliminary raw partition support
hyc Feb 21, 2016
4e7586c
More RAWPART support
hyc Jun 11, 2018
b46a60e
Fix rawpart flag collision
hyc Oct 11, 2020
493577a
Silence spurious fallthru warning
hyc Jul 7, 2021
b096e16
Revert "db_lmdb: test for mmap support at init time"
hyc Jul 7, 2021
033a32a
Remove check is_directory check on lmdb path
hyc Jul 7, 2021
ade464a
ITS#9385 fix using MDB_NOSUBDIR with nonexistent file
kriszyp Nov 2, 2020
61d0712
Gitian: refresh the stale Monero dir via --setup switch
mj-xmr Apr 27, 2022
8460fcc
Revert "Merge pull request #7937"
j-berman Jun 13, 2022
41b1a6b
simplewallet: print usage when given no args
hinto-janai Jun 18, 2022
4278a3a
cryptonote_basic: catch crypto api errors
moneromooo-monero Jun 20, 2022
6f3abbe
Depends: Unbound disable getentropy()/reallocarray() (glibc < 2.26)
sedited Jun 22, 2022
50ccc7e
wallet2: remove obsolete rpc version check
tobtoht Jun 24, 2022
04c0da2
Chunk /gettransactions to avoid hitting restricted RPC limit
tobtoht Jun 27, 2022
09a597b
wallet2: don't use DNS to obtain segregation heights
tobtoht Jun 28, 2022
83aa817
(fix): Confusingly named CI-Job
Jun 29, 2022
8e9c60a
README: depends has only been tested on ubuntu 18.04 and 20.04
selsta Jun 29, 2022
d486c03
utils: add fish shell completions
LeoNero Jun 17, 2022
30a9183
Merge pull request #7774
luigi1111 Jul 3, 2022
622f251
Merge pull request #8296
luigi1111 Jul 3, 2022
82cde93
Merge pull request #8356
luigi1111 Jul 3, 2022
e2e5fbf
Merge pull request #8357
luigi1111 Jul 3, 2022
aa0b4fc
Merge pull request #8358
luigi1111 Jul 3, 2022
b54d5ae
Merge pull request #8384
luigi1111 Jul 3, 2022
9693166
Merge pull request #8371
luigi1111 Jul 6, 2022
45a44aa
Merge pull request #8388
luigi1111 Jul 6, 2022
6e89d35
Merge pull request #8390
luigi1111 Jul 6, 2022
5a3c77b
Merge pull request #8391
luigi1111 Jul 6, 2022
7a118f0
Merge pull request #8394
luigi1111 Jul 6, 2022
0f91416
Merge pull request #8400
luigi1111 Jul 6, 2022
cea2498
Merge pull request #8404
luigi1111 Jul 6, 2022
4476c35
Merge pull request #8408
luigi1111 Jul 6, 2022
e32b7a5
Merge pull request #8412
luigi1111 Jul 6, 2022
8f48f46
Merge pull request #8413
luigi1111 Jul 6, 2022
0093bc2
Focus Doxygen documentation
May 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
ccache --set-config=compression=true

jobs:
build-macos:
build-cross:
runs-on: ubuntu-18.04
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ external/miniupnpc/Makefile
miniupnpcstrings.h
version/
ClangBuildAnalyzerSession.txt

# gitian
contrib/gitian/builder/
contrib/gitian/docker/
contrib/gitian/sigs/

# Created by https://www.gitignore.io

### C++ ###
Expand Down
4 changes: 2 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ WARN_LOGFILE =
# spaces.
# Note: If this tag is empty the current directory is searched.

INPUT = .
INPUT = contrib/epee external/easylogging++ src

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -805,7 +805,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS = */build/* */contrib/depends/*
EXCLUDE_PATTERNS = */src/crypto/crypto_ops_builder/ref10*

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ Dates are provided in the format YYYY-MM-DD.
| 1978433 | 2019-11-30 | v12 | v0.15.0.0 | v0.16.0.0 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs
| 2210000 | 2020-10-17 | v13 | v0.17.0.0 | v0.17.3.2 | New CLSAG transaction format
| 2210720 | 2020-10-18 | v14 | v0.17.1.1 | v0.17.3.2 | forbid old MLSAG transaction format
| 2668888 | 2022-07-16 | v15 | v0.18.0.0 | v0.18.0.0 | ringsize = 16, bulletproofs+, view tags, adjusted dynamic block weight algorithm
| 2669608 | 2022-07-17 | v16 | v0.18.0.0 | v0.18.0.0 | forbid old v14 transaction format
| XXXXXXX | XXX-XX-XX | XXX | vX.XX.X.X | vX.XX.X.X | XXX |

X's indicate that these details have not been determined as of commit date.
Expand Down Expand Up @@ -579,7 +581,7 @@ You can also cross-compile static binaries on Linux for Windows and macOS with t
* ```make depends target=aarch64-linux-android``` for 64bit android binaries


The required packages are the names for each toolchain on apt. Depending on your distro, they may have different names.
The required packages are the names for each toolchain on apt. Depending on your distro, they may have different names. The `depends` system has been tested on Ubuntu 18.04 and 20.04.

Using `depends` might also be easier to compile Monero on Windows than using MSYS. Activate Windows Subsystem for Linux (WSL) with a distro (for example Ubuntu), install the apt build-essentials and follow the `depends` steps as depicted above.

Expand Down
9 changes: 8 additions & 1 deletion contrib/depends/packages/unbound.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ $(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f
$(package)_dependencies=openssl expat ldns
$(package)_patches=disable-glibc-reallocarray.patch


define $(package)_set_vars
$(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
Expand All @@ -12,8 +14,13 @@ define $(package)_set_vars
$(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread"
endef

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/disable-glibc-reallocarray.patch &&\
autoconf
endef

define $(package)_config_cmds
$($(package)_autoconf)
$($(package)_autoconf) ac_cv_func_getentropy=no
endef

define $(package)_build_cmds
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/configure.ac b/configure.ac
index 5c7da197..e2b25288 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1702,6 +1702,9 @@ AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
#ifndef _OPENBSD_SOURCE
#define _OPENBSD_SOURCE 1
#endif
+#ifdef __linux__
+# error reallocarray() is currently disabled on Linux to support glibc < 2.26
+#endif
#include <stdlib.h>
int main(void) {
void* p = reallocarray(NULL, 10, 100);
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace epee
{
CHECK_AND_ASSERT_THROW_MES(recursion < EPEE_JSON_RECURSION_LIMIT_INTERNAL, "Wrong JSON data: recursion limitation (" << EPEE_JSON_RECURSION_LIMIT_INTERNAL << ") exceeded");

std::string::const_iterator sub_element_start;
std::string name;
typename t_storage::harray h_array = nullptr;
enum match_state
Expand Down
3 changes: 2 additions & 1 deletion contrib/gitian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ Common setup part:
su - gitianuser

GH_USER=YOUR_GITHUB_USER_NAME
VERSION=v0.17.2.0
VERSION=v0.17.3.2
```

Where `GH_USER` is your GitHub user name and `VERSION` is the version tag you want to build.
The `gitian-build.py`'s `--setup` switch will also refresh the environment of any stale files and submodules.

Setup for LXC:

Expand Down
6 changes: 4 additions & 2 deletions contrib/gitian/gitian-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ def setup():
subprocess.check_call(['git', 'checkout', 'c0f77ca018cb5332bfd595e0aff0468f77542c23'])
os.makedirs('inputs', exist_ok=True)
os.chdir('inputs')
if not os.path.isdir('monero'):
subprocess.check_call(['git', 'clone', args.url, 'monero'])
if os.path.isdir('monero'):
# Remove the potentially stale monero dir. Otherwise you might face submodule mismatches.
subprocess.check_call(['rm', 'monero', '-fR'])
subprocess.check_call(['git', 'clone', args.url, 'monero'])
os.chdir('..')
make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64']
if args.docker:
Expand Down
7 changes: 7 additions & 0 deletions external/boost/archive/portable_binary_archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ reverse_bytes(signed char size, char *address){
char * first = address;
char * last = first + size - 1;
for(;first < last;++first, --last){
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow="
#endif
char x = *last;
*last = *first;
*first = x;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}
}

Expand Down
58 changes: 56 additions & 2 deletions external/db_drivers/liblmdb/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,8 @@ struct MDB_env {
#endif
/** Failed to update the meta page. Probably an I/O error. */
#define MDB_FATAL_ERROR 0x80000000U
/** using a raw block device */
#define MDB_RAWPART 0x40000000U
/** Some fields are initialized. */
#define MDB_ENV_ACTIVE 0x20000000U
/** me_txkey is set */
Expand Down Expand Up @@ -4038,6 +4040,8 @@ mdb_txn_commit(MDB_txn *txn)
return rc;
}

static int ESECT mdb_env_map(MDB_env *env, void *addr);

/** Read the environment parameters of a DB environment before
* mapping it into memory.
* @param[in] env the environment handle
Expand All @@ -4054,6 +4058,31 @@ mdb_env_read_header(MDB_env *env, int prev, MDB_meta *meta)
int i, rc, off;
enum { Size = sizeof(pbuf) };

if (env->me_flags & MDB_RAWPART) {
#define VM_ALIGN 0x200000
env->me_mapsize += VM_ALIGN-1;
env->me_mapsize &= ~(VM_ALIGN-1);
env->me_psize = env->me_os_psize;
rc = mdb_env_map(env, NULL);
if (rc) {
DPRINTF(("mdb_env_map: %s", mdb_strerror(rc)));
return rc;
}
p = (MDB_page *)env->me_map;
for (i=0; i<NUM_METAS; i++) {
if (!F_ISSET(p->mp_flags, P_META))
return ENOENT;
if (env->me_metas[i]->mm_magic != MDB_MAGIC)
return MDB_INVALID;
if (env->me_metas[i]->mm_version != MDB_DATA_VERSION)
return MDB_VERSION_MISMATCH;
if (i == 0 || env->me_metas[i]->mm_txnid > meta->mm_txnid)
*meta = *env->me_metas[i];
p = (MDB_page *)((char *)p + env->me_psize);
}
return 0;
}

/* We don't know the page size yet, so use a minimum value.
* Read both meta pages so we can use the latest one.
*/
Expand Down Expand Up @@ -4081,6 +4110,8 @@ mdb_env_read_header(MDB_env *env, int prev, MDB_meta *meta)
p = (MDB_page *)&pbuf;

if (!F_ISSET(p->mp_flags, P_META)) {
if (env->me_flags & MDB_RAWPART)
return ENOENT;
DPRINTF(("page %"Yu" not a meta page", p->mp_pgno));
return MDB_INVALID;
}
Expand Down Expand Up @@ -4148,6 +4179,18 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta)

psize = env->me_psize;

if ((env->me_flags & (MDB_RAWPART|MDB_WRITEMAP)) == (MDB_RAWPART|MDB_WRITEMAP)) {
p = (MDB_page *)env->me_map;
p->mp_pgno = 0;
p->mp_flags = P_META;
*(MDB_meta *)METADATA(p) = *meta;
q = (MDB_page *)((char *)p + psize);
q->mp_pgno = 1;
q->mp_flags = P_META;
*(MDB_meta *)METADATA(q) = *meta;
return 0;
}

p = calloc(NUM_METAS, psize);
if (!p)
return ENOMEM;
Expand Down Expand Up @@ -4410,7 +4453,7 @@ mdb_env_map(MDB_env *env, void *addr)
int prot = PROT_READ;
if (flags & MDB_WRITEMAP) {
prot |= PROT_WRITE;
if (ftruncate(env->me_fd, env->me_mapsize) < 0)
if (!(flags & MDB_RAWPART) && ftruncate(env->me_fd, env->me_mapsize) < 0)
return ErrCode();
}
env->me_map = mmap(addr, env->me_mapsize, prot, MAP_SHARED,
Expand Down Expand Up @@ -5448,6 +5491,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
if (rc)
goto leave;
#endif
#endif
#ifndef _WIN32
{
struct stat st;
flags &= ~MDB_RAWPART;
if (!stat(path, &st) && (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))) {
flags |= MDB_RAWPART | MDB_NOSUBDIR;
if (!env->me_mapsize)
env->me_mapsize = DEFAULT_MAPSIZE;
}
}
#endif
flags |= MDB_ENV_ACTIVE; /* tell mdb_env_close0() to clean up */

Expand Down Expand Up @@ -7668,7 +7722,7 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data,
offset *= 4; /* space for 4 more */
break;
}
/* FALLTHRU: Big enough MDB_DUPFIXED sub-page */
/* FALLTHRU *//* Big enough MDB_DUPFIXED sub-page */
case MDB_CURRENT:
fp->mp_flags |= P_DIRTY;
COPY_PGNO(fp->mp_pgno, mp->mp_pgno);
Expand Down
40 changes: 2 additions & 38 deletions src/blockchain_db/lmdb/db_lmdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@
// 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.

#ifndef _WIN32
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#endif

#include "db_lmdb.h"

#include <boost/filesystem.hpp>
Expand Down Expand Up @@ -1303,26 +1296,6 @@ BlockchainLMDB::BlockchainLMDB(bool batch_transactions): BlockchainDB()
m_hardfork = nullptr;
}

void BlockchainLMDB::check_mmap_support()
{
#ifndef _WIN32
const boost::filesystem::path mmap_test_file = m_folder / boost::filesystem::unique_path();
int mmap_test_fd = ::open(mmap_test_file.string().c_str(), O_RDWR | O_CREAT, 0600);
if (mmap_test_fd < 0)
throw0(DB_ERROR((std::string("Failed to check for mmap support: open failed: ") + strerror(errno)).c_str()));
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([mmap_test_fd, &mmap_test_file]() {
::close(mmap_test_fd);
boost::filesystem::remove(mmap_test_file.string());
});
if (write(mmap_test_fd, "mmaptest", 8) != 8)
throw0(DB_ERROR((std::string("Failed to check for mmap support: write failed: ") + strerror(errno)).c_str()));
void *mmap_res = mmap(NULL, 8, PROT_READ, MAP_SHARED, mmap_test_fd, 0);
if (mmap_res == MAP_FAILED)
throw0(DB_ERROR("This filesystem does not support mmap: use --data-dir to place the blockchain on a filesystem which does"));
munmap(mmap_res, 8);
#endif
}

void BlockchainLMDB::open(const std::string& filename, const int db_flags)
{
int result;
Expand All @@ -1334,14 +1307,8 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
throw0(DB_OPEN_FAILURE("Attempted to open db, but it's already open"));

boost::filesystem::path direc(filename);
if (boost::filesystem::exists(direc))
{
if (!boost::filesystem::is_directory(direc))
throw0(DB_OPEN_FAILURE("LMDB needs a directory path, but a file was passed"));
}
else
{
if (!boost::filesystem::create_directories(direc))
if (!boost::filesystem::exists(direc) &&
!boost::filesystem::create_directories(direc)) {
throw0(DB_OPEN_FAILURE(std::string("Failed to create directory ").append(filename).c_str()));
}

Expand All @@ -1364,9 +1331,6 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)

m_folder = filename;

try { check_mmap_support(); }
catch(...) { MERROR("Failed to check for mmap support, proceeding"); }

#ifdef __OpenBSD__
if ((mdb_flags & MDB_WRITEMAP) == 0) {
MCLOG_RED(el::Level::Info, "global", "Running on OpenBSD: forcing WRITEMAP");
Expand Down
1 change: 0 additions & 1 deletion src/blockchain_db/lmdb/db_lmdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ class BlockchainLMDB : public BlockchainDB
static int compare_string(const MDB_val *a, const MDB_val *b);

private:
void check_mmap_support();
void do_resize(uint64_t size_increase=0);

bool need_resize(uint64_t threshold_size=0) const;
Expand Down
19 changes: 6 additions & 13 deletions src/common/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ using namespace epee;
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <boost/format.hpp>
#include <openssl/sha.h>
#include <openssl/evp.h>

#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "util"
Expand Down Expand Up @@ -941,14 +941,7 @@ std::string get_nix_version_display_string()

bool sha256sum(const uint8_t *data, size_t len, crypto::hash &hash)
{
SHA256_CTX ctx;
if (!SHA256_Init(&ctx))
return false;
if (!SHA256_Update(&ctx, data, len))
return false;
if (!SHA256_Final((unsigned char*)hash.data, &ctx))
return false;
return true;
return EVP_Digest(data, len, (unsigned char*) hash.data, NULL, EVP_sha256(), NULL) != 0;
}

bool sha256sum(const std::string &filename, crypto::hash &hash)
Expand All @@ -961,8 +954,8 @@ std::string get_nix_version_display_string()
if (!f)
return false;
std::ifstream::pos_type file_size = f.tellg();
SHA256_CTX ctx;
if (!SHA256_Init(&ctx))
std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)> ctx(EVP_MD_CTX_new(), &EVP_MD_CTX_free);
if (!EVP_DigestInit_ex(ctx.get(), EVP_sha256(), nullptr))
return false;
size_t size_left = file_size;
f.seekg(0, std::ios::beg);
Expand All @@ -973,12 +966,12 @@ std::string get_nix_version_display_string()
f.read(buf, read_size);
if (!f || !f.good())
return false;
if (!SHA256_Update(&ctx, buf, read_size))
if (!EVP_DigestUpdate(ctx.get(), buf, read_size))
return false;
size_left -= read_size;
}
f.close();
if (!SHA256_Final((unsigned char*)hash.data, &ctx))
if (!EVP_DigestFinal_ex(ctx.get(), (unsigned char*)hash.data, nullptr))
return false;
return true;
}
Expand Down
Loading