Skip to content

Commit

Permalink
0.7.0 (turtlecoin#387)
Browse files Browse the repository at this point in the history
* Replace Dockerfile version with branch

* Readline support for ZedWallet

* Handle comma separators in amounts for csv output

* Add optional cors header to walletd

* LWMA-2 Tweaks

* Add progress bar for file save (as some saves are long/slow)

* Update CryptoNoteProtocolHandler.cpp

update from Simplewallet to ZedWallet

* Fix mnemonic seed info not being output to walletd log file

* Remove unneeded logging

* WARNING: Breaking change. removes additional binary serializers from the wallet <-> node communication payloads

* Zedwallet improvements

* Fix build?

* Fix build??

* Fix build???

* Fix build????

* Fix build??????

* Update ColouredMsg.h

* Timeout on status comman

* Fix build???????????????????

* Gonna neck myself

* Adding a JSON HTTP command /feeinfo that a node operator can specify for donations regarding usage of the node. Per @RocksteadyTC

* Adding the scripts I use to generate the checkpoints for pull requests to  github.com/turtlecoin/checkpoints

* Small tweaks

* Typo

* FAST timestamps

god i'm an idiot

* Use an explicit cast

* Updating before we forget.

* Bug fixes, tweaks to make us more forkable

* Ubuntu is not Linux

oops

* Add integrated addresses to zedwallet

* Add a method createIntegratedAddress to walletd

* Support integrated addresses in sendTransaction()

* More small tweaks to make forking easier

* Adds a send_all command

* Cmake static assert flag

Improve compatibility of static assert. Cmake tries to compile then set flag to C_FLAGS and CXX_FLAGS if necessary.

* Add files for cmake static assert flag

Files needed for cmake static assert flag, on try_compile.

* Remove static_assert.h in hash-ops.h

* Delete static_assert.h

static_assert.h is no longer needed. Cmake static assert flag will do.

* Use period of time rather than amount of blocks for fork notifier

* Remove hardcoded 11898 port (turtlecoin#343)

* Remove hardcoded 11898 port

* C strings pls go

* Adjusting make targets (turtlecoin#348)

* Changing make target for daemon to TurtleCoind

Allows: make TurtleCoind

* Changing make target for PaymentGateService to walletd

allows for: make walletd

* Chaging make target for PoolWallet to proper cAsIng

* Changing make target for Miner to proper cAsInG

* Port over karbo crypto, and some of aeon/monero's crypto (mainly slow hash) (turtlecoin#349)

* Port over karbo crypto, and some of aeon/monero's crypto (mainly slow hash)

* Update licenses

* Tweaks

* Fix tests not building

* Windows fixes

* walletd -> service

https://github.com/turtlecoin/meta/issues/112

* Fix makechange (turtlecoin#351)

* fix broken link (turtlecoin#350)

https://chat.turtlecoin.lol -> http://chat.turtlecoin.lol

* Typo (turtlecoin#352)

* Update Default Build Instructions (turtlecoin#356)

Updating directions to always inform new users to build from master.

* updates cmake to support arm (turtlecoin#355)

* Update multi_installer.sh (turtlecoin#357)

* Update nightly.sh (turtlecoin#358)

* Fix proof of work too weak on v0.6.4 and my fusion fuckup (turtlecoin#359)

* Fix proof of work too weak on v0.6.4

* Fix fusion transactions occasionaly failing

* Fix fusion with dust inputs being unsendable

* Bring config param in line with others

* Make walletd print out proper error when a wallet file specified doesnt exist (turtlecoin#360)

* fix broken link

https://chat.turtlecoin.lol -> http://chat.turtlecoin.lol

* make walletd print a proper error when a wallet being opened dont exist

instead of wrong wallet version:
a) checks if -g is passed. if so, it doent print an error, because the 
wallet file being specified wouldn't exist
b)It takes the name specified and appends a .wallet. if a  wallet 
exists, tells them: maybe u meant xyz.wallet?
c)if it doesnt exist at all; tells em to check ur spelling myb. coz it 
no exist.

cant figure out a way to make it print in red. maybe later? anyways its 
the only thing being printed so i dont think it matters

* fix error

* Fix the size of unprepared transactions being undeterministic

* This is overrated... we'll actually rip the code out later. RIP @crappyrules

* Update .travis.yml

Updating to grab the name change of walletd and include the LICENSE file in the resulting package

* Speed up the block verification time

Removing the divisions and replacing them by per-calculated values,  
Slightly reduces the time required to verify a block

* Fixed merge mistakes

* Fixing build targets for rename from walletd to service

* Fixing typo

* Update slow-hash.c

* Fixing: Fatal error: boost::bad_any_cast: failed conversion using boost::any_cast

* Further slow hash optimizations

*  Make outgoing transfers negative in csv export

* typo: totalamount

* Renamed walletd to service

Walletd has been renamed to service

* Update CMakeLists.txt

Setting a few more flags here that may help with issue #228

* Updating the default checkpoints and enabling them by default

* Rework integrated addresses to be more compact

* byebye poolwallet

if this is a surprise to you, just shut your shit down now. you played yourself.

* Improve cmake output on readline not found

* Handle non GNU Readline on Apple

* Let's talk about convenience charges...

* Adding nodeFee to splitTX

* Improve status command, remove references to service

* Update CMakeLists.txt

* Style improvements for splitTX (turtlecoin#2)

Thanks @ZedPea

* Cleaning up after removing poolwallet, shuffling some libraries around, removing dead files, etc.

* Update CryptoNoteCheckpoints.h

* Update version.h.in
  • Loading branch information
RocksteadyTC committed Aug 10, 2018
1 parent 3550e84 commit 4cc06d1
Show file tree
Hide file tree
Showing 174 changed files with 6,773 additions and 9,655 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -24,13 +24,15 @@ before_install:
install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install librocksdb-dev
-y ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install readline; brew link --force readline; fi
script:
- mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DSTATIC=true .. && make
before_deploy:
- cd src
- mkdir turtlecoin-${TRAVIS_TAG}
- mv TurtleCoind miner zedwallet walletd poolwallet turtlecoin-${TRAVIS_TAG}/
- mv TurtleCoind miner zedwallet service poolwallet turtlecoin-${TRAVIS_TAG}/
- cp ../../LICENSE turtlecoin-${TRAVIS_TAG}/
- tar cvfz turtlecoin-${TRAVIS_TAG}-${TRAVIS_OS_NAME}.tar.gz turtlecoin-${TRAVIS_TAG}/
deploy:
provider: releases
Expand Down
56 changes: 52 additions & 4 deletions CMakeLists.txt
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 2.8.6)

# Required for finding Threads on arm
enable_language(C)
enable_language(CXX)
find_package(Threads)

set(VERSION "0.1")
# $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$

Expand All @@ -10,6 +15,13 @@ set(CMAKE_SKIP_INSTALL_RULES OFF)
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY ON)
set(CMAKE_SUPPRESS_REGENERATION ON)
set(DO_TESTS ON CACHE STRING "Spend time making tests? Defaults to ON")
set(FORCE_READLINE ON CACHE BOOL "Make readline support mandatory on Linux and Mac? Defaults to ON")

# GNU Readline isn't easy to get working on Windows :(
if (MSVC)
set(FORCE_READLINE OFF)
endif()

set(STATIC ON CACHE BOOL "Link libraries statically")

set(ENABLE_AVX OFF CACHE STRING "Enable RocksDB AVX/AVX2 support detection? Defaults to OFF")
Expand All @@ -20,6 +32,7 @@ set(ENABLE_SYNC_FILE_RANGE_WRITE OFF CACHE STRING "Enable RocksDB SYNC_FILE_RANG
set(ENABLE_PTHREAD_MUTEX_ADAPTIVE_NP OFF CACHE STRING "Enable RocksDB PTHREAD_MUTEX_ADAPTIVE_NP support detection? Defaults to OFF")
set(ENABLE_MALLOC_USABLE_SIZE OFF CACHE STRING "Enable RocksDB MALLOC_USABLE_SIZE support detection? Defaults to OFF")
set(ENABLE_SCHED_GETCPU OFF CACHE STRING "Enable RocksDB SCHED_GETCPU support detection? Defaults to OFF")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

if(DO_TESTS)
message(STATUS "BUILD TESTS: enabled")
Expand Down Expand Up @@ -50,6 +63,21 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/Platform/Linux)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/Platform/Posix)
endif()

# Don't bother searching for readline on windows
if (NOT MSVC)
find_package(Readline)

if(READLINE_FOUND)
add_definitions(-DHAVE_READLINE)
include_directories(${Readline_INCLUDE_DIR})
link_libraries(${Readline_LIBRARY})
else()
if(FORCE_READLINE)
message(FATAL_ERROR "Could not find GNU Readline library!\nYou can fix this by either re-running cmake like so:\ncmake .. -DFORCE_READLINE=FALSE\nAlternatively, you can install the readline package for your operating system.\nUbuntu: sudo apt-get install libreadline-dev\nApple: brew install readline; brew link --force readline")
endif()
endif()
endif()

if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /D_VARIADIC_MAX=8 /D__SSE4_1__")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760")
Expand Down Expand Up @@ -89,11 +117,31 @@ else()
endif()
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")

try_compile(STATICASSERTC_RESULT "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/tests/Common/TestStaticAssert.c" COMPILE_DEFINITIONS "-std=c11")
if(STATICASSERTC_RESULT)
set(STATICASSERTC_FLAG "")
else()
set(STATICASSERTC_FLAG "-Dstatic_assert=_Static_assert")
endif()

try_compile(STATICASSERTCPP_RESULT "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/tests/Common/TestStaticAssert.cpp" COMPILE_DEFINITIONS "-std=c++11")
if(STATICASSERTCPP_RESULT)
set(STATICASSERTCPP_FLAG "")
else()
set(STATICASSERTCPP_FLAG "-Dstatic_assert=_Static_assert")
endif()

# -maes is not supported on arm
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${STATICASSERTC_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
endif()
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${MINGW_FLAG} ${STATICASSERTCPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0")
endif()
Expand Down Expand Up @@ -179,7 +227,7 @@ endif()
## We need to setup the RocksDB build environment to match our system
if(NOT MSVC)
execute_process(
COMMAND cmake ${CMAKE_CURRENT_SOURCE_DIR}/external/rocksdb -DWITH_GFLAGS=0 -B${PROJECT_BINARY_DIR}/rocksdb
COMMAND cmake ${CMAKE_CURRENT_SOURCE_DIR}/external/rocksdb -DWITH_GFLAGS=0 -DCMAKE_BUILD_TYPE=MinSizeRel -DWITH_TESTS=OFF -DWITH_TOOLS=OFF -DPORTABLE=ON -B${PROJECT_BINARY_DIR}/rocksdb
)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_BINARY_DIR}/rocksdb/librocksdb.a")
endif()
endif()
6 changes: 3 additions & 3 deletions Dockerfile
Expand Up @@ -11,8 +11,8 @@ RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
ADD https://github.com/just-containers/socklog-overlay/releases/download/v2.1.0-0/socklog-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/socklog-overlay-amd64.tar.gz -C /

ARG TURTLECOIN_VERSION=v0.6.0
ENV TURTLECOIN_VERSION=${TURTLECOIN_VERSION}
ARG TURTLECOIN_BRANCH=master
ENV TURTLECOIN_BRANCH=${TURTLECOIN_BRANCH}

# install build dependencies
# checkout the latest tag
Expand All @@ -28,7 +28,7 @@ RUN apt-get update && \
librocksdb-dev && \
git clone https://github.com/turtlecoin/turtlecoin.git /src/turtlecoin && \
cd /src/turtlecoin && \
git checkout $TURTLECOIN_VERSION && \
git checkout $TURTLECOIN_BRANCH && \
mkdir build && \
cd build && \
cmake -DCMAKE_CXX_FLAGS="-g0 -Os -fPIC -std=gnu++11" .. && \
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.test
Expand Up @@ -22,8 +22,8 @@ ADD https://raw.githubusercontent.com/turtlecoin/checkpoints/master/checkpoints.
# In a multi-node testnet, we'll want to have the slave nodes "wait" for the master node to wake up, so let's get ready
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /tmp/

ARG TURTLECOIN_VERSION=v0.6.0
ENV TURTLECOIN_VERSION=${TURTLECOIN_VERSION}
ARG TURTLECOIN_BRANCH=master
ENV TURTLECOIN_BRANCH=${TURTLECOIN_BRANCH}

# install build dependencies
# checkout the latest tag
Expand All @@ -39,7 +39,7 @@ RUN apt-get update && \
librocksdb-dev && \
git clone https://github.com/turtlecoin/turtlecoin.git /src/turtlecoin && \
cd /src/turtlecoin && \
git checkout $TURTLECOIN_VERSION && \
git checkout $TURTLECOIN_BRANCH && \
sed -i '/std::vector<uint64_t> timestamps_o(timestamps);/i \\/*\n Lower difficulty to static 500 for testnet\n The rest of this function is ignored\n*\/\nreturn 500;\n\n' src/CryptoNoteCore/Currency.cpp && \
sed -i -e 's/"104.236.227.176:11897",/"172.16.76.11:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"46.101.132.184:11897",/"172.16.76.12:11897",/g' src/CryptoNoteConfig.h && \
Expand Down
15 changes: 9 additions & 6 deletions README.md
Expand Up @@ -4,6 +4,10 @@
[![Build status](https://ci.appveyor.com/api/projects/status/an6je6l48eawteyg?svg=true)](https://ci.appveyor.com/project/RocksteadyTC/turtlecoin)
### How To Compile

On Linux or Mac on a non standard architecture, and can't get GNU Readline installed?

Disable it with `cmake .. -DFORCE_READLINE=FALSE`

#### Ubuntu 16.04+ and MacOS 10.10+

There is a bash installation script for Ubuntu 16.04+ and MacOS 10.10+ which can be used to checkout and build the project from source:
Expand All @@ -20,12 +24,10 @@ If the script doesn't work for you:

#### Linux

If you are using Arch Linux, there is an AUR precompiled package, `turtlecoin-bin`, or a build from source version, `turtlecoin-git`.

##### Prerequisites

- You will need the following packages: boost (1.55 or higher), rocksdb, cmake, git, gcc (4.9 or higher), g++ (4.9 or higher), make, and python. Most of these should already be installed on your system.
- For example on Ubuntu: `sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev librocksdb-dev`
- You will need the following packages: boost (1.55 or higher), rocksdb, cmake, git, gcc (4.9 or higher), g++ (4.9 or higher), make, GNU readline, and python. Most of these should already be installed on your system.
- For example on Ubuntu: `sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev librocksdb-dev libreadline-dev`
- If you are using Ubuntu and your version of Ubuntu doesn't have librocksdb-dev, you can get it from a ppa instead:
```
sudo add-apt-repository ppa:ethcore/ethcore -y
Expand All @@ -35,7 +37,7 @@ sudo apt-get install librocksdb-dev

##### Building

- `git clone https://github.com/turtlecoin/turtlecoin`
- `git clone -b master https://github.com/turtlecoin/turtlecoin`
- `cd turtlecoin`
- `mkdir build && cd $_`
- `cmake ..`
Expand All @@ -47,11 +49,12 @@ sudo apt-get install librocksdb-dev

- Install [cmake](https://cmake.org/). See [here](https://stackoverflow.com/questions/23849962/cmake-installer-for-mac-fails-to-create-usr-bin-symlinks) if you are unable call `cmake` from the terminal after installing.
- Install the [boost](http://www.boost.org/) libraries. Either compile boost manually or run `brew install boost`.
- Install [GNU Readline](https://tiswww.case.edu/php/chet/readline/rltop.html) by running `brew install readline; brew link --force readline`. - Make sure you run this full command, or it will link the wrong version of readline
- Install XCode and Developer Tools.

##### Building

- `git clone https://github.com/turtlecoin/turtlecoin`
- `git clone -b master https://github.com/turtlecoin/turtlecoin`
- `cd turtlecoin`
- `mkdir build && cd $_`
- `cmake ..` or `cmake -DBOOST_ROOT=<path_to_boost_install> ..` when building
Expand Down
53 changes: 53 additions & 0 deletions cmake/FindReadline.cmake
@@ -0,0 +1,53 @@
# Search for the path containing library's headers
find_path(Readline_ROOT_DIR
NAMES include/readline/readline.h
)

# Search for include directory
find_path(Readline_INCLUDE_DIR
NAMES readline/readline.h
HINTS ${Readline_ROOT_DIR}/include
)

# Search for library
find_library(Readline_LIBRARY
NAMES readline
HINTS ${Readline_ROOT_DIR}/lib
)

# Conditionally set READLINE_FOUND value
if(Readline_INCLUDE_DIR AND Readline_LIBRARY)
set(READLINE_FOUND TRUE)
else()
FIND_LIBRARY(Readline_LIBRARY NAMES readline)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY )

MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
endif()

# Apple uses the system readline library rather than GNU Readline, which doesn't
# support the stuff we need.
if (APPLE AND Readline_INCLUDE_DIR STREQUAL "/usr/include")
# Unset readline found so it doesn't get cached, and we check again, e.g.
# if they install the correct readline
unset(READLINE_FOUND CACHE)

# Also unset the two path variables, so it doesn't instantly find them
# without re-searching
unset(Readline_INCLUDE_DIR CACHE)
unset(Readline_LIBRARY CACHE)

message(FATAL_ERROR "Readline library found, but it is using the Apple version of readline rather than GNU Readline.\nTo fix this, run:\nbrew install readline; brew link --force readline\nThen, re-run cmake.\nAlternatively, run:\ncmake .. -DFORCE_READLINE=FALSE\nTo disable readline support")

endif()


# Hide these variables in cmake GUIs
mark_as_advanced(
Readline_ROOT_DIR
Readline_INCLUDE_DIR
Readline_LIBRARY
)
3 changes: 3 additions & 0 deletions include/INode.h
Expand Up @@ -88,6 +88,7 @@ class INode {
virtual uint32_t getKnownBlockCount() const = 0;
virtual uint64_t getLastLocalBlockTimestamp() const = 0;
virtual std::string getInfo() = 0;
virtual void getFeeInfo() = 0;

virtual void getBlockHashesByTimestamps(uint64_t timestampBegin, size_t secondsCount, std::vector<Crypto::Hash>& blockHashes, const Callback& callback) = 0;
virtual void getTransactionHashesByPaymentId(const Crypto::Hash& paymentId, std::vector<Crypto::Hash>& transactionHashes, const Callback& callback) = 0;
Expand All @@ -106,6 +107,8 @@ class INode {
virtual void getBlock(const uint32_t blockHeight, BlockDetails &block, const Callback& callback) = 0;
virtual void getTransactions(const std::vector<Crypto::Hash>& transactionHashes, std::vector<TransactionDetails>& transactions, const Callback& callback) = 0;
virtual void isSynchronized(bool& syncStatus, const Callback& callback) = 0;
virtual std::string feeAddress() = 0;
virtual uint32_t feeAmount() = 0;
};

}
80 changes: 80 additions & 0 deletions scripts/checkpointer/delayed-checkpoints.py
@@ -0,0 +1,80 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import json
import requests

topbuffer = 3 * 24 * 60 * 2


def lastknownblock():
try:
with open(sys.argv[1], 'r') as cp:
(block, hash) = list(cp)[-1].split(',')
cp.close()
return int(block)
except:
return 0


def height():
base_url = 'http://localhost:11898/getheight'
resp = requests.get(base_url).json()
if 'height' not in resp:
print ('Unexpected response, make sure TurtleCoind is running',
resp)
sys.exit(-1)
else:
return resp['height']


def rpc(method, params={}):
base_url = 'http://localhost:11898/json_rpc'
payload = {
'jsonrpc': '2.0',
'id': 'block_info',
'method': method,
'params': params,
}
resp = requests.post(base_url, data=json.dumps(payload)).json()
if 'result' not in resp:
print ('Unexpected response, make sure Turtlecoind is running with block explorer enabled'
, resp)
sys.exit(-1)
else:
return resp['result']


def get_height():
resp = rpc('getblockcount')
return resp['count']


def get_block_info(from_height):
resp = rpc('f_blocks_list_json', {'height': from_height})
return resp['blocks']


stop_height = lastknownblock() + 1

current_height = height() - topbuffer
all_blocks = []
while current_height > stop_height:
try:
blocks = get_block_info(current_height)
for b in blocks:
print '%(height)s,%(hash)s' % b
all_blocks.append('%(height)s,%(hash)s' % b)
current_height = b['height'] - 1
if current_height < stop_height:
break
except:
print "Whoops... let's try that again"

all_blocks.reverse()

with open(sys.argv[1], 'a') as f:
f.write('\n'.join(all_blocks))
if len(all_blocks) > 0:
f.write('\n')

0 comments on commit 4cc06d1

Please sign in to comment.