Skip to content

Commit

Permalink
Merge pull request #238 from ConcealNetwork/development
Browse files Browse the repository at this point in the history
v6.5.2
  • Loading branch information
krypt0x authored Dec 5, 2021
2 parents 83596bf + 17e7cdf commit e050750
Show file tree
Hide file tree
Showing 34 changed files with 295 additions and 184 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,41 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-ubuntu20-clang:
name: Ubuntu 20.04 clang
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master

- name: Build
id: build
run: |
sudo apt-get update
sudo apt-get install -y libboost-all-dev clang
build_folder="build/debug"
ccx_version=${GITHUB_SHA::7}
ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g')
release_name=ccx-cli-ubuntu-2004-clang-dev"$ccx_version"
mkdir -p "$build_folder"
cd "$build_folder"
cmake ../.. -DCMAKE_BUILD_TYPE=Debug
make -j2
mkdir -p "$release_name"
exeFiles=()
for f in src/*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
cp "${exeFiles[@]}" "$release_name/"
echo "::set-output name=release_name::${release_name}.zip"
echo "::set-output name=artifact_path::$build_folder/$release_name"
- name: Upload To GH Artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: ${{ steps.build.outputs.release_name }}
path: ${{ steps.build.outputs.artifact_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-macos:
name: macOS
runs-on: macos-latest
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0)

include(CheckCXXCompilerFlag)
set(VERSION "6.5.1")
set(VERSION "6.5.2")
set(VERSION_BUILD_NO "Endovelicus")
# Packaged from main commits
set(COMMIT 72946d9)
Expand Down Expand Up @@ -271,6 +271,7 @@ endif()

if(BUILD_TESTS)
add_subdirectory(tests)
add_subdirectory(external/gtest)
enable_testing()
endif()

Expand Down Expand Up @@ -308,4 +309,4 @@ else()
endif()

add_subdirectory(external)
add_subdirectory(src)
add_subdirectory(src)
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml)
[![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml)

Latest Release: v6.5.1
Latest Release: v6.5.2

Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community.

Expand Down Expand Up @@ -40,44 +40,44 @@ In some build scenarios it may be necessary to increase the size of the SWAP to
For example if you have 8GB of RAM, then your SWAP size should be 5GB

- Ubuntu / Linux
```bash
```bash
sudo fallocate -l 5G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```
```

- Rasberry Pi OS
```bash
```bash
sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=5120
sudo nano /sbin/dphys-swapfile
#CONF_MAXSWAP=2048
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
```
```

### Linux / Ubuntu / Debian

#### Prerequisites

- You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make:
```bash
```bash
sudo apt update
sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev
```
```

#### Building

- On Ubuntu:
```bash
```bash
git clone https://github.com/ConcealNetwork/conceal-core
cd conceal-core
mkdir build && cd $_
cmake ..
make
```
```

If the build is successful the binaries will be in the `src` folder.

Expand All @@ -101,13 +101,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES.
#### Building

- From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt.
```ps
```ps
git clone https://github.com/ConcealNetwork/conceal-core
cd conceal-core
mkdir build
cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2"
msbuild concealX.sln /p:Configuration=Release /m
```
```

If the build is successful the binaries will be in the `src/Release` folder.

Expand All @@ -117,28 +117,28 @@ If the build is successful the binaries will be in the `src/Release` folder.

- In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed.
Once both are ready, open Terminal app and run the following command to install additional tools:
```bash
```bash
xcode-select --install
```
```

- On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences.

- After that, proceed with installing dependencies:
```bash
```bash
brew install git python cmake gcc boost
```
```


#### Building

- When all dependencies are installed, build Conceal Core binaries:
```bash
```bash
git clone https://github.com/ConcealNetwork/conceal-core
cd conceal-core
mkdir build && cd $_
cmake ..
make
```
```

If the build is successful the binaries will be located in `src` directory.

Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 6.4.8 | :white_check_mark: |
| 6.4.4 | :white_check_mark: |
| 6.5.1 | :white_check_mark: |
| 6.4.9 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
6 changes: 3 additions & 3 deletions src/BlockchainExplorer/BlockchainExplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ class ScopeExitHandler {
};

BlockchainExplorer::BlockchainExplorer(INode& node, Logging::ILogger& logger) :
synchronized(false),
observersCounter(0),
node(node),
logger(logger, "BlockchainExplorer"),
state(NOT_INITIALIZED),
synchronized(false),
observersCounter(0) {
state(NOT_INITIALIZED) {
}

BlockchainExplorer::~BlockchainExplorer() {}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/FileMappedVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ void FileMappedVector<T>::rename(const std::string& newPath) {
template<class T>
template<class F>
void FileMappedVector<T>::atomicUpdate(F&& func) {
atomicUpdate0(capacity(), prefixSize(), suffixSize(), std::move(func));
atomicUpdate0(capacity(), prefixSize(), suffixSize(), std::forward(func));
}

template<class T>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Varint.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ namespace Tools {

template<typename InputIt, typename T>
int read_varint(InputIt &&first, InputIt &&last, T &i) {
return read_varint<std::numeric_limits<T>::digits, InputIt, T>(std::move(first), std::move(last), i);
return read_varint<std::numeric_limits<T>::digits, InputIt, T>(std::forward<InputIt>(first), std::forward<InputIt>(last), i);
}
}
18 changes: 11 additions & 7 deletions src/CryptoNoteCore/BlockIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,23 @@ namespace CryptoNote {
return false;
}

std::vector<Crypto::Hash> BlockIndex::buildSparseChain(const Crypto::Hash& startBlockId) const {
std::vector<Crypto::Hash> BlockIndex::buildSparseChain(const Crypto::Hash &startBlockId) const
{
assert(m_index.count(startBlockId) > 0);

uint32_t startBlockHeight;
getBlockHeight(startBlockId, startBlockHeight);

std::vector<Crypto::Hash> result;
size_t sparseChainEnd = static_cast<size_t>(startBlockHeight + 1);
for (size_t i = 1; i <= sparseChainEnd; i *= 2) {
result.emplace_back(m_container[sparseChainEnd - i]);
if (getBlockHeight(startBlockId, startBlockHeight))
{
size_t sparseChainEnd = static_cast<size_t>(startBlockHeight + 1);
for (size_t i = 1; i <= sparseChainEnd; i *= 2)
{
result.emplace_back(m_container[sparseChainEnd - i]);
}
}

if (result.back() != m_container[0]) {
if (result.back() != m_container[0])
{
result.emplace_back(m_container[0]);
}

Expand Down
14 changes: 7 additions & 7 deletions src/CryptoNoteCore/Blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,11 @@ namespace CryptoNote
Crypto::Hash blockHash = get_block_hash(block.bl);
m_blockIndex.push(blockHash);
uint64_t interest = 0;
for (uint16_t t = 0; t < block.transactions.size(); ++t)
for (uint32_t t = 0; t < block.transactions.size(); ++t)
{
const TransactionEntry &transaction = block.transactions[t];
Crypto::Hash transactionHash = getObjectHash(transaction.tx);
TransactionIndex transactionIndex = {b, t};
TransactionIndex transactionIndex = {b, static_cast<uint16_t>(t)};
m_transactionMap.insert(std::make_pair(transactionHash, transactionIndex));

// process inputs
Expand All @@ -686,7 +686,7 @@ namespace CryptoNote
}

// process outputs
for (uint16_t o = 0; o < transaction.tx.outputs.size(); ++o)
for (uint32_t o = 0; o < transaction.tx.outputs.size(); ++o)
{
const auto &out = transaction.tx.outputs[o];
if (out.target.type() == typeid(KeyOutput))
Expand All @@ -695,7 +695,7 @@ namespace CryptoNote
}
else if (out.target.type() == typeid(MultisignatureOutput))
{
MultisignatureOutputUsage usage = {transactionIndex, o, false};
MultisignatureOutputUsage usage = {transactionIndex, static_cast<uint16_t>(o), false};
m_multisignatureOutputs[out.amount].push_back(usage);
}
}
Expand Down Expand Up @@ -2740,7 +2740,7 @@ namespace CryptoNote
}

transaction.m_global_output_indexes.resize(transaction.tx.outputs.size());
for (uint16_t output = 0; output < transaction.tx.outputs.size(); ++output)
for (uint32_t output = 0; output < transaction.tx.outputs.size(); ++output)
{
if (transaction.tx.outputs[output].target.type() == typeid(KeyOutput))
{
Expand All @@ -2752,7 +2752,7 @@ namespace CryptoNote
{
auto &amountOutputs = m_multisignatureOutputs[transaction.tx.outputs[output].amount];
transaction.m_global_output_indexes[output] = static_cast<uint32_t>(amountOutputs.size());
MultisignatureOutputUsage outputUsage = {transactionIndex, output, false};
MultisignatureOutputUsage outputUsage = {transactionIndex, static_cast<uint16_t>(output), false};
amountOutputs.push_back(outputUsage);
}
}
Expand Down Expand Up @@ -3156,7 +3156,7 @@ namespace CryptoNote
const BlockEntry &block = m_blocks[b];
m_timestampIndex.add(block.bl.timestamp, get_block_hash(block.bl));
m_generatedTransactionsIndex.add(block.bl);
for (uint16_t t = 0; t < block.transactions.size(); ++t)
for (size_t t = 0; t < block.transactions.size(); ++t)
{
const TransactionEntry &transaction = block.transactions[t];
m_paymentIdIndex.add(transaction.tx);
Expand Down
2 changes: 1 addition & 1 deletion src/CryptoNoteCore/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace CryptoNote {

class core : public ICore, public IMinerHandler, public IBlockchainStorageObserver, public ITxPoolObserver {
public:
core(const Currency &currency, i_cryptonote_protocol *pprotocol, Logging::ILogger &logger, bool blockchainIndexesEnabled, bool blockchainAutosaveEnabled);
core(const Currency &currency, i_cryptonote_protocol *pprotocol, Logging::ILogger &logger, bool blockchainIndexesEnabled = false, bool blockchainAutosaveEnabled = false);
~core();

bool on_idle() override;
Expand Down
11 changes: 8 additions & 3 deletions src/CryptoNoteCore/Currency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,17 +1092,22 @@ namespace CryptoNote

uint64_t T = 120; // target solvetime seconds
uint64_t N = 60; // N=45, 60, and 90 for T=600, 120, 60.
uint64_t L(0), ST, sum_3_ST(0), next_D, prev_D, this_timestamp, previous_timestamp;
uint64_t L = 0;
uint64_t sum_3_ST = 0;
uint64_t next_D = 0;
uint64_t prev_D;
uint64_t this_timestamp;
uint64_t previous_timestamp;

// Make sure timestamps & CD vectors are not bigger than they are supposed to be.
// assert(timestamps.size() == cumulative_difficulties.size() &&
// timestamps.size() <= N + 1); // fails at block 104200

// If it's a new coin, do startup code.
// Increase difficulty_guess if it needs to be much higher, but guess lower than lowest guess.
uint64_t difficulty_guess = 100;
if (timestamps.size() <= 10)
{
uint64_t difficulty_guess = 100;
return difficulty_guess;
}
// Use "if" instead of "else if" in case vectors are incorrectly N all the time instead of N+1.
Expand Down Expand Up @@ -1130,7 +1135,7 @@ namespace CryptoNote
this_timestamp = previous_timestamp + 1;
}
// Limit solvetime ST to 6*T to prevent large drop in difficulty that could cause oscillations.
ST = std::min(6 * T, this_timestamp - previous_timestamp);
uint64_t ST = std::min(6 * T, this_timestamp - previous_timestamp);
previous_timestamp = this_timestamp;
L += ST * i; // give linearly higher weight to more recent solvetimes
// delete the following line if you do not want the "jump rule"
Expand Down
14 changes: 7 additions & 7 deletions src/CryptoNoteCore/Miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ namespace CryptoNote
m_stop(true),
m_template(boost::value_initialized<Block>()),
m_template_no(0),
m_diffic(0),
m_handler(handler),
m_pausers_count(0),
m_threads_total(0),
m_starter_nonce(0),
m_last_hr_merge_time(0),
m_hashes(0),
m_threads_total(0),
m_pausers_count(0),
m_diffic(0),
m_do_print_hashrate(false),
m_do_mining(false),
m_current_hash_rate(0),
m_update_block_template_interval(5),
m_update_merge_hr_interval(2)
m_update_merge_hr_interval(2),
m_current_hash_rate(0),
m_last_hr_merge_time(0),
m_hashes(0)
{
}
//-----------------------------------------------------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions src/CryptoNoteCore/OnceInInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ namespace CryptoNote
class OnceInInterval {
public:

OnceInInterval(unsigned interval, bool startNow = true)
: m_interval(interval), m_lastCalled(startNow ? 0 : time(nullptr)) {}
OnceInInterval(unsigned interval, bool startNow = true) :
m_lastCalled(startNow ? 0 : time(nullptr)),
m_interval(interval)
{
}

template<class F>
bool call(F func) {
Expand Down
Loading

0 comments on commit e050750

Please sign in to comment.