Skip to content

Commit

Permalink
Merge pull request #1200 from sumoprojects/dev
Browse files Browse the repository at this point in the history
Request to merge dev to master (set HF 10 height at 502257 (15/01/2021))
  • Loading branch information
quangvu3 authored Dec 21, 2020
2 parents 7cb7fac + 6f5df8d commit fb18fa4
Show file tree
Hide file tree
Showing 23 changed files with 252 additions and 123 deletions.
55 changes: 48 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ on: [push, pull_request]
jobs:
build-macos-native:
runs-on: macOS-latest
env:
CCACHE_COMPRESS: 1
CCACHE_TEMPDIR: /tmp/.ccache-temp
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-macos-build-${{ github.sha }}
restore-keys: ccache-macos-build-
- name: install dependencies
run: brew install boost hidapi zmq libpgm ldns expat libunwind-headers protobuf
run: brew install boost hidapi zmq libpgm ldns expat libunwind-headers protobuf ccache
- name: build
run: make -j3
run: |
ccache --max-size=150M
make -j3
macOS-cross-on-bionic:
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -87,8 +97,16 @@ jobs:

build-ubuntu-bionic-native:
runs-on: ubuntu-18.04
env:
CCACHE_COMPRESS: 1
CCACHE_TEMPDIR: /tmp/.ccache-temp
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-ubuntu-bionic-build-${{ github.sha }}
restore-keys: ccache-ubuntu-bionic-build-
- name: remove bundled boost
run: sudo rm -rf /usr/local/share/boost
- name: set apt conf
Expand All @@ -101,12 +119,19 @@ jobs:
- name: install sumokoin dependencies
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev libevent-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev ccache
- name: build sumokoin
run: make -j 3
run: |
ccache --max-size=150M
make -j3
build-bionic-debug-native:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-ubuntu-debug-build-${{ github.sha }}
restore-keys: ccache-ubuntu-debug-build-
- name: remove bundled boost
run: sudo rm -rf /usr/local/share/boost
- name: set apt conf
Expand All @@ -119,12 +144,19 @@ jobs:
- name: install sumokoin dependencies
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev ccache
- name: build sumokoin
run: make debug -j 3
run: |
ccache --max-size=150M
make -j3
build-ubuntu-focal-fossa-native:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-ubuntu-focal-build-${{ github.sha }}
restore-keys: ccache-ubuntu-focal-build-
- name: remove bundled boost
run: sudo rm -rf /usr/local/share/boost
- name: set apt conf
Expand All @@ -137,12 +169,19 @@ jobs:
- name: install sumokoin dependencies
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev ccache
- name: build sumokoin
run: make -j 3
run: |
ccache --max-size=150M
make -j3
build-ubuntu-bionic-static-native:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-ubuntu-bionic-static-build-${{ github.sha }}
restore-keys: ccache-ubuntu-bionic-static-build-
- name: remove bundled boost
run: sudo rm -rf /usr/local/share/boost
- name: set apt conf
Expand All @@ -153,7 +192,7 @@ jobs:
- name: update apt
run: sudo apt update
- name: install sumokoin dependencies
run: sudo apt -y install build-essential cmake miniupnpc libunbound-dev libevent-dev graphviz doxygen pkg-config libssl-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libudev-dev ccache libtool autoconf automake python libtinfo5
run: sudo apt -y install build-essential cmake miniupnpc libunbound-dev libevent-dev graphviz doxygen pkg-config libssl-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libudev-dev ccache libtool autoconf automake python libtinfo5 ccache
- name: build boost 1_74
run: |
wget https://dl.bintray.com/boostorg/release/1.74.0/source/boost_1_74_0.tar.bz2
Expand Down Expand Up @@ -183,7 +222,9 @@ jobs:
sudo make install
cd ..
- name: build sumokoin
run: make release-static -j 3
run: |
ccache --max-size=150M
make release-static -j 3
FreeBSD-cross-on-bionic:
runs-on: ubuntu-18.04
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers

cmake_minimum_required(VERSION 2.8.7)
cmake_minimum_required(VERSION 2.8.12)
message(STATUS "CMake version ${CMAKE_VERSION}")

cmake_host_system_information(RESULT freememsys QUERY AVAILABLE_PHYSICAL_MEMORY)
Expand Down
1 change: 0 additions & 1 deletion contrib/depends/packages/ncurses.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ endef
define $(package)_stage_cmds
$(MAKE) install.libs DESTDIR=$($(package)_staging_dir)
endef

31 changes: 12 additions & 19 deletions contrib/depends/packages/openssl.mk
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
package=openssl
$(package)_version=1.0.2r
$(package)_download_path=https://ftp.openssl.org/source/old/1.0.2
$(package)_version=1.1.1i
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=ae51d08bba8a83958e894946f15303ff894d75c2b8bbd44a852b64e3fe11d0d6
$(package)_patches=fix_arflags.patch
$(package)_sha256_hash=e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242

define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
$(package)_config_env_arm_android=ANDROID_NDK_HOME="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib
$(package)_config_env_aarch64_android=ANDROID_NDK_HOME="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib
$(package)_build_env_arm_android=ANDROID_NDK_HOME="$(host_prefix)/native"
$(package)_build_env_aarch64_android=ANDROID_NDK_HOME="$(host_prefix)/native"
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl
$(package)_config_opts+=no-capieng
$(package)_config_opts+=no-dso
$(package)_config_opts+=no-dtls1
$(package)_config_opts+=no-ec_nistp_64_gcc_128
$(package)_config_opts+=no-gost
$(package)_config_opts+=no-gmp
$(package)_config_opts+=no-heartbeats
$(package)_config_opts+=no-jpake
$(package)_config_opts+=no-krb5
$(package)_config_opts+=no-libunbound
$(package)_config_opts+=no-md2
$(package)_config_opts+=no-rc5
$(package)_config_opts+=no-rdrand
$(package)_config_opts+=no-rfc3779
$(package)_config_opts+=no-rsax
$(package)_config_opts+=no-sctp
$(package)_config_opts+=no-sha0
$(package)_config_opts+=no-shared
$(package)_config_opts+=no-ssl-trace
$(package)_config_opts+=no-ssl2
$(package)_config_opts+=no-ssl3
$(package)_config_opts+=no-static_engine
$(package)_config_opts+=no-store
$(package)_config_opts+=no-unit-test
$(package)_config_opts+=no-weak-ssl-ciphers
$(package)_config_opts+=no-zlib
Expand All @@ -42,8 +37,8 @@ $(package)_config_opts_x86_64_linux=linux-x86_64
$(package)_config_opts_i686_linux=linux-generic32
$(package)_config_opts_arm_linux=linux-generic32
$(package)_config_opts_aarch64_linux=linux-generic64
$(package)_config_opts_arm_android=--static android-armv7 no-asm
$(package)_config_opts_aarch64_android=--static android no-asm
$(package)_config_opts_arm_android=--static android-arm
$(package)_config_opts_aarch64_android=--static android-arm64
$(package)_config_opts_riscv64_linux=linux-generic64
$(package)_config_opts_mipsel_linux=linux-generic32
$(package)_config_opts_mips_linux=linux-generic32
Expand All @@ -55,10 +50,8 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64
endef

define $(package)_preprocess_cmds
sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
sed -i.old "s|engines apps test|engines|" Makefile.org && \
sed -i -e "s/-mandroid //" Configure && \
patch < $($(package)_patch_dir)/fix_arflags.patch
sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure && \
sed -i -e 's|cflags --sysroot.*",|cflags",|' Configurations/15-android.conf
endef

define $(package)_config_cmds
Expand All @@ -70,7 +63,7 @@ define $(package)_build_cmds
endef

define $(package)_stage_cmds
$(MAKE) INSTALL_PREFIX=$($(package)_staging_dir) -j1 install_sw
$(MAKE) DESTDIR=$($(package)_staging_dir) -j1 install_sw
endef

define $(package)_postprocess_cmds
Expand Down
24 changes: 0 additions & 24 deletions contrib/depends/patches/openssl/fix_arflags.patch

This file was deleted.

4 changes: 2 additions & 2 deletions contrib/epee/include/byte_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace epee
}

//! Reset write position, but do not release internal memory. \post `size() == 0`.
void clear() noexcept { next_write_ = buffer_.get(); }
void clear() noexcept { next_write_ = buffer_.get(); }

/*! Copy `length` bytes starting at `ptr` to end of stream.
\throw std::range_error If exceeding max size_t value.
Expand Down Expand Up @@ -188,7 +188,7 @@ namespace epee
void put_n(const std::uint8_t ch, const std::size_t count)
{
check(count);
std::memset(tellp(), count, ch);
std::memset(tellp(), ch, count);
next_write_ += count;
}

Expand Down
1 change: 1 addition & 0 deletions src/cryptonote_basic/connection_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ namespace cryptonote
bool m_anchor;
int32_t m_score;
int m_expect_response;
uint64_t m_expect_height;
};

inline std::string get_protocol_state_string(cryptonote_connection_context::state s)
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_protocol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# 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 2.6)
cmake_minimum_required (VERSION 2.8.12)
project (monero CXX)

file(GLOB CRYPTONOTE_PROTOCOL *)
Expand Down
29 changes: 15 additions & 14 deletions src/cryptonote_protocol/block_queue.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Copyright (c) 2017-2020, 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
Expand All @@ -25,7 +25,7 @@
// 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

#include <vector>
Expand All @@ -52,12 +52,12 @@ namespace std {
namespace cryptonote
{

void block_queue::add_blocks(uint64_t height, std::vector<cryptonote::block_complete_entry> bcel, const boost::uuids::uuid &connection_id, float rate, size_t size)
void block_queue::add_blocks(uint64_t height, std::vector<cryptonote::block_complete_entry> bcel, const boost::uuids::uuid &connection_id, const epee::net_utils::network_address &addr, float rate, size_t size)
{
boost::unique_lock<boost::recursive_mutex> lock(mutex);
std::vector<crypto::hash> hashes;
bool has_hashes = remove_span(height, &hashes);
blocks.insert(span(height, std::move(bcel), connection_id, rate, size));
blocks.insert(span(height, std::move(bcel), connection_id, addr, rate, size));
if (has_hashes)
{
for (const crypto::hash &h: hashes)
Expand All @@ -69,11 +69,11 @@ void block_queue::add_blocks(uint64_t height, std::vector<cryptonote::block_comp
}
}

void block_queue::add_blocks(uint64_t height, uint64_t nblocks, const boost::uuids::uuid &connection_id, boost::posix_time::ptime time)
void block_queue::add_blocks(uint64_t height, uint64_t nblocks, const boost::uuids::uuid &connection_id, const epee::net_utils::network_address &addr, boost::posix_time::ptime time)
{
CHECK_AND_ASSERT_THROW_MES(nblocks > 0, "Empty span");
boost::unique_lock<boost::recursive_mutex> lock(mutex);
blocks.insert(span(height, nblocks, connection_id, time));
blocks.insert(span(height, nblocks, connection_id, addr, time));
}

void block_queue::flush_spans(const boost::uuids::uuid &connection_id, bool all)
Expand Down Expand Up @@ -228,7 +228,7 @@ bool block_queue::have(const crypto::hash &hash) const
return have_blocks.find(hash) != have_blocks.end();
}

std::pair<uint64_t, uint64_t> block_queue::reserve_span(uint64_t first_block_height, uint64_t last_block_height, uint64_t max_blocks, const boost::uuids::uuid &connection_id, bool sync_pruned_blocks, uint32_t local_pruning_seed, uint32_t pruning_seed, uint64_t blockchain_height, const std::vector<std::pair<crypto::hash, uint64_t>> &block_hashes, boost::posix_time::ptime time)
std::pair<uint64_t, uint64_t> block_queue::reserve_span(uint64_t first_block_height, uint64_t last_block_height, uint64_t max_blocks, const boost::uuids::uuid &connection_id, const epee::net_utils::network_address &addr, bool sync_pruned_blocks, uint32_t local_pruning_seed, uint32_t pruning_seed, uint64_t blockchain_height, const std::vector<std::pair<crypto::hash, uint64_t>> &block_hashes, boost::posix_time::ptime time)
{
boost::unique_lock<boost::recursive_mutex> lock(mutex);

Expand Down Expand Up @@ -305,7 +305,7 @@ std::pair<uint64_t, uint64_t> block_queue::reserve_span(uint64_t first_block_hei
return std::make_pair(0, 0);
}
MDEBUG("Reserving span " << span_start_height << " - " << (span_start_height + span_length - 1) << " for " << connection_id);
add_blocks(span_start_height, span_length, connection_id, time);
add_blocks(span_start_height, span_length, connection_id, addr, time);
set_span_hashes(span_start_height, connection_id, hashes);
return std::make_pair(span_start_height, span_length);
}
Expand Down Expand Up @@ -354,7 +354,7 @@ void block_queue::set_span_hashes(uint64_t start_height, const boost::uuids::uui
}
}

bool block_queue::get_next_span(uint64_t &height, std::vector<cryptonote::block_complete_entry> &bcel, boost::uuids::uuid &connection_id, bool filled) const
bool block_queue::get_next_span(uint64_t &height, std::vector<cryptonote::block_complete_entry> &bcel, boost::uuids::uuid &connection_id, epee::net_utils::network_address &addr, bool filled) const
{
boost::unique_lock<boost::recursive_mutex> lock(mutex);
if (blocks.empty())
Expand All @@ -367,6 +367,7 @@ bool block_queue::get_next_span(uint64_t &height, std::vector<cryptonote::block_
height = i->start_block_height;
bcel = i->blocks;
connection_id = i->connection_id;
addr = i->origin;
return true;
}
}
Expand Down
Loading

0 comments on commit fb18fa4

Please sign in to comment.