Skip to content

Commit

Permalink
[3.3.1] Consolidation of PR's and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blondfrogs authored Jan 15, 2020
2 parents d7289f6 + 1b6e616 commit af52517
Show file tree
Hide file tree
Showing 344 changed files with 106,682 additions and 53 deletions.
46 changes: 34 additions & 12 deletions .github/scripts/02-copy-build-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

OS=${1}
GITHUB_WORKSPACE=${2}
GITHUB_REF=${3}

if [[ ! ${OS} || ! ${GITHUB_WORKSPACE} ]]; then
echo "Error: Invalid options"
Expand All @@ -16,17 +17,38 @@ if [[ ${OS} == "arm32v7-disable-wallet" || ${OS} == "linux-disable-wallet" ]]; t
OS=`echo ${OS} | cut -d"-" -f1`
fi

echo "----------------------------------------"
echo "Retrieving Dependencies for ${OS}"
echo "----------------------------------------"
if [[ ${GITHUB_REF} =~ "release" ]]; then
echo "----------------------------------------"
echo "Building Dependencies for ${OS}"
echo "----------------------------------------"

cd ${GITHUB_WORKSPACE}
curl -O https://raven-build-resources.s3.amazonaws.com/${OS}/raven-${OS}-dependencies.tar.gz
curl -O https://raven-build-resources.s3.amazonaws.com/${OS}/SHASUM
if [[ $(sha256sum -c ${GITHUB_WORKSPACE}/SHASUM) ]]; then
cd ${GITHUB_WORKSPACE}/depends
tar zxvf ${GITHUB_WORKSPACE}/raven-${OS}-dependencies.tar.gz
cd depends
if [[ ${OS} == "windows" ]]; then
make HOST=x86_64-w64-mingw32 -j2
elif [[ ${OS} == "osx" ]]; then
cd ${GITHUB_WORKSPACE}
curl -O https://raven-build-resources.s3.amazonaws.com/osx/MacOSX10.11.sdk.tar.gz
mkdir -p ${GITHUB_WORKSPACE}/depends/SDKs
cd ${GITHUB_WORKSPACE}/depends/SDKs && tar -zxf ${GITHUB_WORKSPACE}/MacOSX10.11.sdk.tar.gz
cd ${GITHUB_WORKSPACE}/depends && make HOST=x86_64-apple-darwin14 -j2
elif [[ ${OS} == "linux" || ${OS} == "linux-disable-wallet" ]]; then
make HOST=x86_64-linux-gnu -j2
elif [[ ${OS} == "arm32v7" || ${OS} == "arm32v7-disable-wallet" ]]; then
make HOST=arm-linux-gnueabihf -j2
fi
else
echo "SHASUM doesn't match"
exit 1
fi
echo "----------------------------------------"
echo "Retrieving Dependencies for ${OS}"
echo "----------------------------------------"

cd /tmp
curl -O https://raven-build-resources.s3.amazonaws.com/${OS}/raven-${OS}-dependencies.tar.gz
curl -O https://raven-build-resources.s3.amazonaws.com/${OS}/SHASUM
if [[ $(sha256sum -c /tmp/SHASUM) ]]; then
cd ${GITHUB_WORKSPACE}/depends
tar zxvf /tmp/raven-${OS}-dependencies.tar.gz
else
echo "SHASUM doesn't match"
exit 1
fi
fi
6 changes: 4 additions & 2 deletions .github/scripts/04-configure-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ elif [[ ${OS} == "linux" || ${OS} == "linux-disable-wallet" ]]; then
elif [[ ${OS} == "arm32v7" || ${OS} == "arm32v7-disable-wallet" ]]; then
if [[ ${OS} == "arm32v7-disable-wallet" ]]; then
EXTRA_OPTS="--disable-wallet"
CONFIG_SITE=${GITHUB_WORKSPACE}/depends/arm-linux-gnueabihf/share/config.site ./configure --prefix=/ --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++ --disable-tests --with-libs=no --with-gui=no ${EXTRA_OPTS}
else
CONFIG_SITE=${GITHUB_WORKSPACE}/depends/arm-linux-gnueabihf/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking --enable-glibc-back-compat --enable-reduce-exports --disable-bench --disable-gui-tests CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" LDFLAGS="-static-libstdc++"
fi
CONFIG_SITE=${GITHUB_WORKSPACE}/depends/arm-linux-gnueabihf/share/config.site ./configure --prefix=/ --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++ --disable-tests --with-libs=no --with-gui=no ${EXTRA_OPTS}
else
echo "You must pass an OS."
echo "Usage: ${0} <operating system> <github workspace path> <disable wallet (true | false)>"
exit 1
fi
fi
2 changes: 1 addition & 1 deletion .github/workflows/build-raven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: sudo ${SCRIPTS}/00-install-deps.sh ${{ MATRIX.OS }}

- name: Copy Build Dependencies
run: ${SCRIPTS}/02-copy-build-dependencies.sh ${{ MATRIX.OS }} ${{ GITHUB.WORKSPACE }}
run: ${SCRIPTS}/02-copy-build-dependencies.sh ${{ MATRIX.OS }} ${{ GITHUB.WORKSPACE }} ${{ GITHUB.BASE_REF }} ${{ GITHUB.REF }}

- name: Add Dependencies to the System PATH
run: ${SCRIPTS}/03-export-path.sh ${{ MATRIX.OS }} ${{ GITHUB.WORKSPACE }}
Expand Down
17 changes: 16 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,21 @@ CLEANFILES = $(OSX_DMG) $(RAVEN_WIN_INSTALLER)

DISTCHECK_CONFIGURE_FLAGS = --enable-man

clean-local:
doc/doxygen/.stamp: doc/Doxyfile FORCE
$(MKDIR_P) $(@D)
$(DOXYGEN) $^
$(AM_V_at) touch $@

if HAVE_DOXYGEN
docs: doc/doxygen/.stamp
else
docs:
@echo "error: doxygen not found"
endif

clean-docs:
rm -rf doc/doxygen

clean-local: clean-docs
rm -rf coverage_percent.txt test_raven.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP)
rm -rf test/functional/__pycache__
89 changes: 89 additions & 0 deletions assets/tools/vanity_address_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from ravenrpc import Ravencoin # pip install ravenrpc
import sys
import os
import time

# Requires ravenrpc==0.2.4
#
# usage:
# ```
# python vanity_address_gen.py ( rpcuser ) ( rpcpass ) ( prefix ) ( ignore_case=True )
# ```



def valid_base58(s):
for c in ('0', 'O', 'l', '1'):
if c in s:
print(f'Cannot use charachter "{c}" in prefix!!')
exit()

def success_odds(prefix, ignore_case):
odds = 1
for letter in prefix[1:]:
if letter in ('o', 'l') or not ignore_case:
odds *= 58
else:
odds *= 29
return odds

def create_rvn_inst():
try:
rvn = Ravencoin(sys.argv[1], sys.argv[2])
except IndexError:
print('You must provide a valid rpc username and rpc password!')
exit()
return rvn

def get_args():
try:
prefix = sys.argv[3]
except IndexError:
print('Missing options!\n'
'Usage: `python gen.py <rpcuser> <rpcpass> <prefix> <ignore case (default True)>`')
exit()
ignore_case = sys.argv[4] if len(sys.argv) > 4 else True
if prefix[0] != 'R':
print('Please start your prefix with an "R"\n'
'Usage: `python gen.py <rpcuser> <rpcpass> <prefix> <ignore case (default True)>`')
exit()
return prefix, ignore_case, create_rvn_inst()

def validate_rvn(rvn):
if rvn.getinfo() == '':
print('Run ravend')
exit()

def display_stats(count, start, addr, prefix, odds):
addr_sec = count/(time.time() - start)
os.system('cls' if os.name == 'nt' else 'clear')
print(f'Tried {count} addresses\n'
f'Seconds Spent: {time.time() - start}\n'
f'Ave. Addresses/sec: {addr_sec}\n'
f'Lastest Address: {addr}\n'
f'Prefix: {prefix}\n'
f'You have a 1 in {odds} chance per address!\n'
f'At this rate, you will find your address in ~{odds/addr_sec/60} minutes!\n'
'To stop, press Ctrl-C', flush=True, end='')


def main():
prefix, ignore_case, rvn = get_args()
validate_rvn(rvn)
valid_base58(prefix)
start = time.time()
odds = success_odds(prefix, ignore_case)
count = 0
address = rvn.getnewaddress()['result']
try:
while not address.lower().startswith(prefix.lower()) if ignore_case else address.startswith(prefix):
address = rvn.getnewaddress()['result']
count += 1
if count % 100 == 1:
display_stats(count, start, address, prefix, odds)
except KeyboardInterrupt:
exit()
print(f'\nFound an address that starts with {prefix}!\n It is saved to your wallet. Use it freely!\n{address}')

if __name__ == '__main__':
main()
10 changes: 8 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
Expand Down Expand Up @@ -94,6 +94,12 @@ AC_PATH_TOOL(READELF, readelf)
AC_PATH_TOOL(CPPFILT, c++filt)
AC_PATH_TOOL(OBJCOPY, objcopy)

AC_PATH_PROG(DOXYGEN, doxygen)
if test -z "$DOXYGEN"; then
AC_MSG_WARN([Doxygen not found])
fi
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])

AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files)

# Enable wallet
Expand Down Expand Up @@ -1242,7 +1248,7 @@ AC_SUBST(PROTOBUF_LIBS)
AC_SUBST(QR_LIBS)
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini])
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
AC_CONFIG_FILES([doc/Doxyfile])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])
AC_CONFIG_LINKS([test/util/raven-util-test.py:test/util/raven-util-test.py])
Expand Down
Binary file added crash
Binary file not shown.
14 changes: 13 additions & 1 deletion doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,21 @@ Not OK (used plenty in the current source, but not picked up):
//
```

A full list of comment syntaxes picked up by doxygen can be found at http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html,
A full list of comment syntaxes picked up by doxygen can be found at
http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html,
but if possible use one of the above styles.

The Ravencoin Doxygen documentation can be generated by running `make docs` from the top-level
directory of the repository.
That creates the documentation in the directory "doc/doxygen" and the it can be accessed by a browser at:
doc/doxygen/html/index.html
The documentation can by deleted by running `make clean-docs`.

Before running `make docs`, you will need to install dependencies `doxygen` and `dot` (a component
of `graphviz`). For example,
on MacOS via Homebrew: `brew install doxygen --with-graphviz`
on Debian/Ubuntu: `sudo install doxygen graphviz`

Development tips and tricks
---------------------------

Expand Down
14 changes: 9 additions & 5 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
bool fIsOwner;
if (txout.scriptPubKey.IsAssetScript(nType, fIsOwner))
isAsset = true;

// Make sure that all asset tx have a nValue of zero RVN
if (isAsset && txout.nValue != 0)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-asset-tx-amount-isn't-zero");


// Check for transfers that don't meet the assets units only if the assetCache is not null
if (isAsset) {
// Get the transfer transaction data from the scriptPubKey
Expand Down Expand Up @@ -304,6 +300,14 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
if (transfer.nAmount < QUALIFIER_ASSET_MIN_AMOUNT || transfer.nAmount > QUALIFIER_ASSET_MAX_AMOUNT)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-transfer-qualifier-amount-must be between 1 - 100");
}

// Specific check and error message to go with to make sure the amount is 0
if (txout.nValue != 0)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-asset-transfer-amount-isn't-zero");
} else if (nType == TX_NEW_ASSET) {
// Specific check and error message to go with to make sure the amount is 0
if (txout.nValue != 0)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-asset-issued-amount-isn't-zero");
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>

#ifdef WIN32
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
#endif

/** Filesystem operations and types */
namespace fs = boost::filesystem;
Expand Down
8 changes: 5 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1937,9 +1937,11 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!pmessagechanneldb->ReadFlag("init", found)) {
uiInterface.InitMessage(_("Init Message Channels - Scanning Asset Transactions"));
std::string strLoadError;
if (!ScanForMessageChannels(strLoadError))
return InitError(strLoadError);
pmessagechanneldb->WriteFlag("init", true);
if (!ScanForMessageChannels(strLoadError)) {
LogPrintf("%s : Failed to scan for message channels, %s\n", __func__, strLoadError);
} else {
pmessagechanneldb->WriteFlag("init", true);
}
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/net_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PeerLogicValidation final: public CValidationInterface, public NetEventsIn
void EvictExtraOutboundPeers(int64_t time_in_seconds);

private:
int64_t m_stale_tip_check_time; //! Next time to check for stale tip
int64_t m_stale_tip_check_time; //!< Next time to check for stale tip
};

struct CNodeStateStats {
Expand Down
26 changes: 13 additions & 13 deletions src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ enum SOCKSVersion: uint8_t {

/** Values defined for METHOD in RFC1928 */
enum SOCKS5Method: uint8_t {
NOAUTH = 0x00, //! No authentication required
GSSAPI = 0x01, //! GSSAPI
USER_PASS = 0x02, //! Username/password
NO_ACCEPTABLE = 0xff, //! No acceptable methods
NOAUTH = 0x00, //!< No authentication required
GSSAPI = 0x01, //!< GSSAPI
USER_PASS = 0x02, //!< Username/password
NO_ACCEPTABLE = 0xff, //!< No acceptable methods
};

/** Values defined for CMD in RFC1928 */
Expand All @@ -208,15 +208,15 @@ enum SOCKS5Command: uint8_t {

/** Values defined for REP in RFC1928 */
enum SOCKS5Reply: uint8_t {
SUCCEEDED = 0x00, //! Succeeded
GENFAILURE = 0x01, //! General failure
NOTALLOWED = 0x02, //! Connection not allowed by ruleset
NETUNREACHABLE = 0x03, //! Network unreachable
HOSTUNREACHABLE = 0x04, //! Network unreachable
CONNREFUSED = 0x05, //! Connection refused
TTLEXPIRED = 0x06, //! TTL expired
CMDUNSUPPORTED = 0x07, //! Command not supported
ATYPEUNSUPPORTED = 0x08, //! Address type not supported
SUCCEEDED = 0x00, //!< Succeeded
GENFAILURE = 0x01, //!< General failure
NOTALLOWED = 0x02, //!< Connection not allowed by ruleset
NETUNREACHABLE = 0x03, //!< Network unreachable
HOSTUNREACHABLE = 0x04, //!< Network unreachable
CONNREFUSED = 0x05, //!< Connection refused
TTLEXPIRED = 0x06, //!< TTL expired
CMDUNSUPPORTED = 0x07, //!< Command not supported
ATYPEUNSUPPORTED = 0x08, //!< Address type not supported
};

/** Values defined for ATYPE in RFC1928 */
Expand Down
6 changes: 3 additions & 3 deletions src/policy/fees.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ std::string StringForFeeReason(FeeReason reason);

/* Used to determine type of fee estimation requested */
enum class FeeEstimateMode {
UNSET, //! Use default settings based on other criteria
ECONOMICAL, //! Force estimateSmartFee to use non-conservative estimates
CONSERVATIVE, //! Force estimateSmartFee to use conservative estimates
UNSET, //!< Use default settings based on other criteria
ECONOMICAL, //!< Force estimateSmartFee to use non-conservative estimates
CONSERVATIVE, //!< Force estimateSmartFee to use conservative estimates
};

bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode);
Expand Down
7 changes: 7 additions & 0 deletions src/primitives/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ CAmount CTransaction::GetValueOut() const
{
CAmount nValueOut = 0;
for (const auto& tx_out : vout) {

// Because we don't want to deal with assets messing up this calculation
// If this is an asset tx, we should move onto the next output in the transaction
// This will also help with processing speed of transaction that contain a large amounts of asset outputs in a transaction
if (tx_out.scriptPubKey.IsAssetScript())
continue;

nValueOut += tx_out.nValue;
if (!MoneyRange(tx_out.nValue) || !MoneyRange(nValueOut))
throw std::runtime_error(std::string(__func__) + ": value out of range");
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CTxIn
COutPoint prevout;
CScript scriptSig;
uint32_t nSequence;
CScriptWitness scriptWitness; //! Only serialized through CTransaction
CScriptWitness scriptWitness; //!< Only serialized through CTransaction

/* Setting nSequence to this value for every input in a transaction
* disables nLockTime. */
Expand Down
Loading

0 comments on commit af52517

Please sign in to comment.