forked from lthn/blockchain
Merge remote-tracking branch 'origin/master' into frontend
This commit is contained in:
commit
a811ee6367
10 changed files with 57 additions and 226 deletions
49
Makefile
49
Makefile
|
|
@ -13,7 +13,14 @@ cmake = cmake $(cmake_gen)
|
|||
|
||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug
|
||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release
|
||||
cmake_tests = $(cmake) -D BUILD_TESTS=ON
|
||||
|
||||
cmake_gui = -D BUILD_GUI=ON
|
||||
cmake_static = -D STATIC=ON
|
||||
cmake_tests = -D BUILD_TESTS=ON
|
||||
|
||||
gui:
|
||||
$(eval command += $(cmake_release) $(cmake_gui))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
# Helper macro
|
||||
define CMAKE
|
||||
|
|
@ -30,16 +37,42 @@ release:
|
|||
$(eval command += $(cmake_release))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
test-release:
|
||||
$(eval command += $(cmake_release) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
test: test-release
|
||||
|
||||
debug:
|
||||
$(eval command += $(cmake_debug))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
||||
|
||||
static: static-release
|
||||
static-release:
|
||||
$(eval command += $(cmake_release) $(cmake_static))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
#
|
||||
# GUI
|
||||
#
|
||||
|
||||
gui: gui-release
|
||||
gui-release:
|
||||
$(eval command += $(cmake_release) $(cmake_gui))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
gui-debug:
|
||||
$(eval command += $(cmake_debug) $(cmake_gui))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
||||
|
||||
gui-static: gui-release-static
|
||||
gui-release-static:
|
||||
$(eval command += $(cmake_release) $(cmake_gui) $(cmake_static))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
#
|
||||
# Tests
|
||||
#
|
||||
|
||||
test: test-release
|
||||
test-release:
|
||||
$(eval command += $(cmake_release) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
test-debug:
|
||||
$(eval command += $(cmake_debug) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
|
@ -50,4 +83,4 @@ clean:
|
|||
tags:
|
||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||
|
||||
.PHONY: all release test-release test all-debug debug test-debug clean tags
|
||||
.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -13,12 +13,12 @@ Building
|
|||
| [Qt](https://download.qt.io/archive/qt/) (only for GUI) | 5.8.0 | 5.9.1 | 5.10.1 |
|
||||
|
||||
### Linux
|
||||
|
||||
Recommended OS version: Ubuntu 17.04 LTS.
|
||||
1. Install dependencies: `sudo apt-get install build-essential git cmake unzip libicu-dev ocl-icd-opencl-dev mesa-common-dev libglu1-mesa-dev`
|
||||
2. Install Qt and Boost
|
||||
3. Set `BOOST_ROOT` and `QT_PREFIX_PATH` environment variables
|
||||
4. `mkdir build` <br> `cd build` <br> `cmake -DBUILD_GUI=FALSE -DSTATIC=TRUE ..` <br> `make`
|
||||
5. In order to build GUI, revise and run script at `/utils/build_script_linux.sh`
|
||||
|
||||
1. `$ sudo apt install git g++ cmake unzip libicu-dev mesa-common-dev libglu1-mesa-dev qt5-default qtwebengine5-dev`
|
||||
2. `$ cd zano/ && make -j$(nproc) gui`
|
||||
3. Look for the binaries, including the `Zano` GUI, in the build directory
|
||||
|
||||
### Windows
|
||||
Recommended OS version: Windows 7 x64.
|
||||
|
|
|
|||
|
|
@ -98,9 +98,6 @@ endif()
|
|||
|
||||
add_library(crypto ${CRYPTO})
|
||||
|
||||
MESSAGE( STATUS "INCLUDING OpenCL_INCLUDE_DIRS: " ${OpenCL_INCLUDE_DIRS} )
|
||||
include_directories( ${OpenCL_INCLUDE_DIRS} )
|
||||
|
||||
add_library(currency_core ${CURRENCY_CORE})
|
||||
add_dependencies(currency_core version rpc ${PCH_LIB_NAME})
|
||||
ENABLE_SHARED_PCH(CURRENCY_CORE)
|
||||
|
|
@ -165,6 +162,8 @@ if(BUILD_GUI)
|
|||
set_property(TARGET Zano PROPERTY FOLDER "prog")
|
||||
set_target_properties(Zano PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/Info.plist.in)
|
||||
|
||||
set_target_properties(Zano PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "--html-path=${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/html")
|
||||
|
||||
set(CMAKE_AUTOMOC OFF)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
// Memory-hard extension of keccak for PoW
|
||||
// Copyright (c) 2014 The Boolberry developers
|
||||
// Copyright (c) 2019 The Hyle Team
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
|
@ -77,46 +78,6 @@ namespace crypto
|
|||
}
|
||||
}
|
||||
|
||||
void mul_f::keccakf(uint64_t st[25], int rounds)
|
||||
{
|
||||
int i, j, round;
|
||||
uint64_t t, bc[5];
|
||||
|
||||
for (round = 0; round < rounds; round++) {
|
||||
|
||||
// Theta
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] * st[i + 15] * st[i + 20];//surprise
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1);
|
||||
for (j = 0; j < 25; j += 5)
|
||||
st[j + i] ^= t;
|
||||
}
|
||||
|
||||
// Rho Pi
|
||||
t = st[1];
|
||||
for (i = 0; i < 24; i++) {
|
||||
j = keccakf_piln[i];
|
||||
bc[0] = st[j];
|
||||
st[j] = ROTL64(t, keccakf_rotc[i]);
|
||||
t = bc[0];
|
||||
}
|
||||
|
||||
// Chi
|
||||
for (j = 0; j < 25; j += 5) {
|
||||
for (i = 0; i < 5; i++)
|
||||
bc[i] = st[j + i];
|
||||
for (i = 0; i < 5; i++)
|
||||
st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5];
|
||||
}
|
||||
|
||||
// Iota
|
||||
st[0] ^= keccakf_rndc[round];
|
||||
}
|
||||
}
|
||||
bool generate_scratchpad(const crypto::hash& seed_data, std::vector<crypto::hash>& result_data, uint64_t target_size)
|
||||
{
|
||||
result_data.resize(target_size);
|
||||
|
|
@ -128,20 +89,6 @@ namespace crypto
|
|||
return true;
|
||||
}
|
||||
|
||||
#define WK2_COUNT 0
|
||||
|
||||
bool generate_scratchpad2(const crypto::hash& seed_data, std::vector<crypto::hash>& result_data, uint64_t target_size)
|
||||
{
|
||||
CHECK_AND_ASSERT_THROW_MES(target_size % 10 == 0, "wrong target_size = " << target_size);
|
||||
result_data.resize(target_size);
|
||||
result_data[0] = crypto::cn_fast_hash(&seed_data, sizeof(seed_data));
|
||||
for (size_t i = 1; i < target_size; i++)
|
||||
{
|
||||
result_data[i] = crypto::cn_fast_hash(&result_data[i - 1], sizeof(result_data[i - 1]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool generate_scratchpad_light(const crypto::hash& seed_data, std::vector<crypto::hash>& result_data, uint64_t target_size)
|
||||
{
|
||||
CHECK_AND_ASSERT_THROW_MES(target_size % 10 == 0, "wrong target_size = " << target_size);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// 19-Nov-11 Markku-Juhani O. Saarinen <mjos@iki.fi>
|
||||
|
||||
// Copyright (c) 2014 The Boolberry developers
|
||||
// Copyright (c) 2019 The Hyle Team
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
|
@ -29,124 +30,9 @@ extern "C" {
|
|||
|
||||
namespace crypto
|
||||
{
|
||||
#define CONCAT_IMPL(x, y) x##y
|
||||
#define CONCAT(x, y) CONCAT_IMPL(x, y)
|
||||
#define UNIQUE(x) CONCAT(x, __LINE__)
|
||||
|
||||
#define OPT_XOR_4_RES(A_, B_, C_, D_, Res) \
|
||||
crypto::hash UNIQUE(A) = A_;crypto::hash UNIQUE(B) = B_;crypto::hash UNIQUE(C) = C_; crypto::hash UNIQUE(D) = D_; \
|
||||
((uint64_t*)&Res)[0] = ((const uint64_t*)&UNIQUE(A))[0] ^ ((const uint64_t*)&UNIQUE(B))[0] ^ ((const uint64_t*)&UNIQUE(C))[0] ^ ((const uint64_t*)&UNIQUE(D))[0]; \
|
||||
((uint64_t*)&Res)[1] = ((const uint64_t*)&UNIQUE(A))[1] ^ ((const uint64_t*)&UNIQUE(B))[1] ^ ((const uint64_t*)&UNIQUE(C))[1] ^ ((const uint64_t*)&UNIQUE(D))[1]; \
|
||||
((uint64_t*)&Res)[2] = ((const uint64_t*)&UNIQUE(A))[2] ^ ((const uint64_t*)&UNIQUE(B))[2] ^ ((const uint64_t*)&UNIQUE(C))[2] ^ ((const uint64_t*)&UNIQUE(D))[2]; \
|
||||
((uint64_t*)&Res)[3] = ((const uint64_t*)&UNIQUE(A))[3] ^ ((const uint64_t*)&UNIQUE(B))[3] ^ ((const uint64_t*)&UNIQUE(C))[3] ^ ((const uint64_t*)&UNIQUE(D))[3];
|
||||
|
||||
typedef uint64_t state_t_m[25];
|
||||
typedef uint64_t mixin_t[KK_MIXIN_SIZE];
|
||||
|
||||
//with multiplication, for tests
|
||||
template<class f_traits>
|
||||
int keccak_generic(const uint8_t *in, size_t inlen, uint8_t *md, size_t mdlen)
|
||||
{
|
||||
state_t_m st;
|
||||
uint8_t temp[144];
|
||||
size_t i, rsiz, rsizw;
|
||||
|
||||
rsiz = sizeof(state_t_m) == mdlen ? HASH_DATA_AREA : 200 - 2 * mdlen;
|
||||
rsizw = rsiz / 8;
|
||||
|
||||
memset(st, 0, sizeof(st));
|
||||
|
||||
for ( ; inlen >= rsiz; inlen -= rsiz, in += rsiz) {
|
||||
for (i = 0; i < rsizw; i++)
|
||||
st[i] ^= ((uint64_t *) in)[i];
|
||||
f_traits::keccakf(st, KECCAK_ROUNDS);
|
||||
}
|
||||
|
||||
|
||||
// last block and padding
|
||||
memcpy(temp, in, inlen);
|
||||
temp[inlen++] = 1;
|
||||
memset(temp + inlen, 0, rsiz - inlen);
|
||||
temp[rsiz - 1] |= 0x80;
|
||||
|
||||
for (i = 0; i < rsizw; i++)
|
||||
st[i] ^= ((uint64_t *) temp)[i];
|
||||
|
||||
f_traits::keccakf(st, KECCAK_ROUNDS);
|
||||
|
||||
memcpy(md, st, mdlen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*inline
|
||||
void print_state(UINT64* state, const char* comment, size_t rount)
|
||||
{
|
||||
printf("master_funct: %s round: %d\r\n", comment, rount);
|
||||
int i;
|
||||
for(i = 0; i != 25; i++)
|
||||
{
|
||||
printf("[%i]: %p\r\n", i, state[i]);
|
||||
}
|
||||
}*/
|
||||
|
||||
template<class f_traits, class callback_t>
|
||||
int wild_keccak(const uint8_t *in, size_t inlen, uint8_t *md, size_t mdlen, callback_t cb)
|
||||
{
|
||||
state_t_m st;
|
||||
uint8_t temp[144];
|
||||
uint64_t rsiz, rsizw;
|
||||
|
||||
rsiz = sizeof(state_t_m) == mdlen ? HASH_DATA_AREA : 200 - 2 * mdlen;
|
||||
rsizw = rsiz / 8;
|
||||
memset(&st[0], 0, 25*sizeof(st[0]));
|
||||
|
||||
|
||||
for ( ; inlen >= rsiz; inlen -= rsiz, in += rsiz)
|
||||
{
|
||||
for (size_t i = 0; i < rsizw; i++)
|
||||
st[i] ^= ((uint64_t *) in)[i];
|
||||
|
||||
for(size_t ll = 0; ll != KECCAK_ROUNDS; ll++)
|
||||
{
|
||||
if(ll != 0)
|
||||
{//skip first round
|
||||
mixin_t mix_in;
|
||||
cb(st, mix_in);
|
||||
for (size_t k = 0; k < KK_MIXIN_SIZE; k++)
|
||||
st[k] ^= mix_in[k];
|
||||
}
|
||||
//print_state(&st[0], "before_permut", ll);
|
||||
f_traits::keccakf(st, 1);
|
||||
//print_state(&st[0], "after_permut", ll);
|
||||
}
|
||||
}
|
||||
|
||||
// last block and padding
|
||||
memcpy(temp, in, inlen);
|
||||
temp[inlen++] = 1;
|
||||
memset(temp + inlen, 0, rsiz - inlen);
|
||||
temp[rsiz - 1] |= 0x80;
|
||||
|
||||
for (size_t i = 0; i < rsizw; i++)
|
||||
st[i] ^= ((uint64_t *) temp)[i];
|
||||
|
||||
for(size_t ll = 0; ll != KECCAK_ROUNDS; ll++)
|
||||
{
|
||||
if(ll != 0)
|
||||
{//skip first state with
|
||||
mixin_t mix_in;
|
||||
cb(st, mix_in);
|
||||
for (size_t k = 0; k < KK_MIXIN_SIZE; k++)
|
||||
st[k] ^= mix_in[k];
|
||||
}
|
||||
f_traits::keccakf(st, 1);
|
||||
}
|
||||
|
||||
memcpy(md, st, mdlen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class f_traits, class callback_t>
|
||||
int wild_keccak2(const uint8_t *in, size_t inlen, uint8_t *md, size_t mdlen, callback_t cb)
|
||||
{
|
||||
|
|
@ -191,15 +77,6 @@ namespace crypto
|
|||
return 0;
|
||||
}
|
||||
|
||||
template<class f_traits, class callback_t>
|
||||
int wild_keccak_dbl(const uint8_t *in, size_t inlen, uint8_t *md, size_t mdlen, callback_t cb)
|
||||
{
|
||||
//Satoshi's classic
|
||||
wild_keccak<f_traits>(in, inlen, md, mdlen, cb);
|
||||
wild_keccak<f_traits>(md, mdlen, md, mdlen, cb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class f_traits, class callback_t>
|
||||
int wild_keccak2_dbl(const uint8_t *in, size_t inlen, uint8_t *md, size_t mdlen, callback_t cb)
|
||||
{
|
||||
|
|
@ -215,11 +92,7 @@ namespace crypto
|
|||
static void keccakf(uint64_t st[25], int rounds);
|
||||
};
|
||||
|
||||
class mul_f
|
||||
{
|
||||
public:
|
||||
static void keccakf(uint64_t st[25], int rounds);
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
inline
|
||||
|
|
@ -284,30 +157,7 @@ namespace crypto
|
|||
return get_wild_keccak2(bd, res, scratchpad, scratchpad.size());
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
inline
|
||||
bool get_wild_keccak(const std::string& bd, crypto::hash& res, uint64_t height, const std::vector<crypto::hash>& scratchpad, uint64_t sz)
|
||||
{
|
||||
crypto::wild_keccak_dbl<crypto::mul_f>(reinterpret_cast<const uint8_t*>(bd.data()), bd.size(), reinterpret_cast<uint8_t*>(&res), sizeof(res), [&](crypto::state_t_m& st, crypto::mixin_t& mix)
|
||||
{
|
||||
if (!height)
|
||||
{
|
||||
memset(&mix, 0, sizeof(mix));
|
||||
return;
|
||||
}
|
||||
|
||||
#define OPT_GET_H(index) scratchpad[st[index]%sz]
|
||||
#define OPT_GET_M(index) scratchpad[mix[index]%sz]
|
||||
|
||||
for (size_t i = 0; i != 6; i++)
|
||||
{
|
||||
OPT_XOR_4_RES(OPT_GET_H(i * 4), OPT_GET_H(i * 4 + 1), OPT_GET_H(i * 4 + 2), OPT_GET_H(i * 4 + 3), (*(crypto::hash*)&mix[i * 4]));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool generate_scratchpad(const crypto::hash& source_data, std::vector<crypto::hash>& result_data, uint64_t target_size);
|
||||
bool generate_scratchpad2(const crypto::hash& source_data, std::vector<crypto::hash>& result_data, uint64_t target_size);
|
||||
bool generate_scratchpad_light(const crypto::hash& seed_data, std::vector<crypto::hash>& result_data, uint64_t target_size);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
|
|
@ -98,7 +97,8 @@
|
|||
#define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 2000 //by default, blocks ids count in synchronizing
|
||||
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 200 //by default, blocks count in blocks downloading
|
||||
#define BLOCKS_SYNCHRONIZING_DEFAULT_SIZE 2000000 //by default keep synchronizing packets not bigger then 2MB
|
||||
#define CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT 500
|
||||
#define CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT 500
|
||||
#define CURRENCY_PROTOCOL_MAX_TXS_REQUEST_COUNT 500
|
||||
|
||||
|
||||
#define CURRENCY_ALT_BLOCK_LIVETIME_COUNT (CURRENCY_BLOCKS_PER_DAY*7)//one week
|
||||
|
|
|
|||
|
|
@ -361,7 +361,8 @@ namespace currency
|
|||
LOG_PRINT_L2("[HANDLE]NOTIFY_REQUEST_GET_OBJECTS: arg.blocks.size() = " << arg.blocks.size() << ", arg.txs.size()="<< arg.txs.size());
|
||||
LOG_PRINT_L3("[HANDLE]NOTIFY_REQUEST_GET_OBJECTS: " << ENDL << currency::print_kv_structure(arg));
|
||||
|
||||
if (arg.blocks.size() > CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT)
|
||||
if (arg.blocks.size() > CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT ||
|
||||
arg.txs.size() > CURRENCY_PROTOCOL_MAX_TXS_REQUEST_COUNT)
|
||||
{
|
||||
LOG_ERROR_CCONTEXT("Requested objects count is to big (" << arg.blocks.size() <<")expected not more then " << CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT);
|
||||
m_p2p->drop_connection(context);
|
||||
|
|
|
|||
0
utils/Zano.sh
Normal file → Executable file
0
utils/Zano.sh
Normal file → Executable file
|
|
@ -31,7 +31,7 @@ WizardImageFile=../resources/installer_bg_164x313.bmp
|
|||
PrivilegesRequired=poweruser
|
||||
;SetupIconFile=../resources/app.ico
|
||||
AppMutex=Zano_instance
|
||||
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||
|
||||
|
||||
[Languages]
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ PrivilegesRequired=poweruser
|
|||
ArchitecturesAllowed=x64
|
||||
;SetupIconFile=../resources/app.ico
|
||||
AppMutex=Zano_instance
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||
|
||||
|
||||
[Languages]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue