mirror of https://github.com/lukechilds/komodo.git
committed by
GitHub
49 changed files with 919 additions and 486 deletions
@ -0,0 +1,34 @@ |
|||
package=libcurl |
|||
$(package)_version=7.54.0 |
|||
$(package)_download_path=https://curl.haxx.se/download |
|||
$(package)_file_name=curl-$($(package)_version).tar.gz |
|||
$(package)_sha256_hash=a84b635941c74e26cce69dd817489bec687eb1f230e7d1897fc5b5f108b59adf |
|||
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) |
|||
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32 |
|||
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix) |
|||
$(package)_cflags_darwin=-mmacosx-version-min=10.9 |
|||
$(package)_conf_tool=./configure |
|||
|
|||
ifeq ($(build_os),darwin) |
|||
define $(package)_set_vars |
|||
$(package)_build_env=MACOSX_DEPLOYMENT_TARGET="10.9" |
|||
endef |
|||
else |
|||
define $(package)_config_cmds |
|||
$($(package)_conf_tool) $($(package)_config_opts) |
|||
endef |
|||
endif |
|||
|
|||
ifeq ($(build_os),darwin) |
|||
define $(package)_build_cmds |
|||
$(MAKE) CPPFLAGS='-fPIC' CFLAGS='-mmacosx-version-min=10.9' |
|||
endef |
|||
else |
|||
define $(package)_build_cmds |
|||
$(MAKE) |
|||
endef |
|||
endif |
|||
|
|||
define $(package)_stage_cmds |
|||
$(MAKE) DESTDIR=$($(package)_staging_dir) install |
|||
endef |
@ -0,0 +1,17 @@ |
|||
#!/bin/sh |
|||
|
|||
binaries=("komodo-cli" "komodod") |
|||
|
|||
for binary in "${binaries[@]}"; |
|||
do |
|||
# find the dylibs to copy for komodod |
|||
DYLIBS=`otool -L src/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'` |
|||
echo "copying $DYLIBS to $src" |
|||
# copy the dylibs to the srcdir |
|||
for dylib in $DYLIBS; do cp -rf $dylib src/; done |
|||
|
|||
# modify komodod to point to dylibs |
|||
echo "modifying $binary to use local libraries" |
|||
for dylib in $DYLIBS; do install_name_tool -change $dylib @executable_path/`basename $dylib` src/$binary; done; |
|||
chmod +x src/$binary |
|||
done |
@ -0,0 +1,2 @@ |
|||
#!/bin/bash |
|||
./komodo-cli -ac_name=MNZ $1 $2 $3 $4 $5 $6 |
@ -0,0 +1,110 @@ |
|||
#include <gtest/gtest.h> |
|||
|
|||
#include "primitives/transaction.h" |
|||
#include "zcash/Note.hpp" |
|||
#include "zcash/Address.hpp" |
|||
|
|||
extern ZCJoinSplit* params; |
|||
extern int GenZero(int n); |
|||
extern int GenMax(int n); |
|||
|
|||
TEST(Transaction, JSDescriptionRandomized) { |
|||
// construct a merkle tree
|
|||
ZCIncrementalMerkleTree merkleTree; |
|||
|
|||
libzcash::SpendingKey k = libzcash::SpendingKey::random(); |
|||
libzcash::PaymentAddress addr = k.address(); |
|||
|
|||
libzcash::Note note(addr.a_pk, 100, uint256(), uint256()); |
|||
|
|||
// commitment from coin
|
|||
uint256 commitment = note.cm(); |
|||
|
|||
// insert commitment into the merkle tree
|
|||
merkleTree.append(commitment); |
|||
|
|||
// compute the merkle root we will be working with
|
|||
uint256 rt = merkleTree.root(); |
|||
|
|||
auto witness = merkleTree.witness(); |
|||
|
|||
// create JSDescription
|
|||
uint256 pubKeyHash; |
|||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = { |
|||
libzcash::JSInput(witness, note, k), |
|||
libzcash::JSInput() // dummy input of zero value
|
|||
}; |
|||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs = { |
|||
libzcash::JSOutput(addr, 50), |
|||
libzcash::JSOutput(addr, 50) |
|||
}; |
|||
#ifdef __LP64__ // required for building on MacOS
|
|||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> inputMap; |
|||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> outputMap; |
|||
#else |
|||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap; |
|||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap; |
|||
#endif |
|||
|
|||
{ |
|||
auto jsdesc = JSDescription::Randomized( |
|||
*params, pubKeyHash, rt, |
|||
inputs, outputs, |
|||
inputMap, outputMap, |
|||
0, 0, false); |
|||
|
|||
#ifdef __LP64__ // required for building on MacOS
|
|||
std::set<uint64_t> inputSet(inputMap.begin(), inputMap.end()); |
|||
std::set<uint64_t> expectedInputSet {0, 1}; |
|||
#else |
|||
std::set<size_t> inputSet(inputMap.begin(), inputMap.end()); |
|||
std::set<size_t> expectedInputSet {0, 1}; |
|||
#endif |
|||
EXPECT_EQ(expectedInputSet, inputSet); |
|||
|
|||
#ifdef __LP64__ // required for building on MacOS
|
|||
std::set<uint64_t> outputSet(outputMap.begin(), outputMap.end()); |
|||
std::set<uint64_t> expectedOutputSet {0, 1}; |
|||
#else |
|||
std::set<size_t> outputSet(outputMap.begin(), outputMap.end()); |
|||
std::set<size_t> expectedOutputSet {0, 1}; |
|||
#endif |
|||
EXPECT_EQ(expectedOutputSet, outputSet); |
|||
} |
|||
|
|||
{ |
|||
auto jsdesc = JSDescription::Randomized( |
|||
*params, pubKeyHash, rt, |
|||
inputs, outputs, |
|||
inputMap, outputMap, |
|||
0, 0, false, GenZero); |
|||
|
|||
#ifdef __LP64__ // required for building on MacOS
|
|||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0}; |
|||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0}; |
|||
#else |
|||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0}; |
|||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0}; |
|||
#endif |
|||
EXPECT_EQ(expectedInputMap, inputMap); |
|||
EXPECT_EQ(expectedOutputMap, outputMap); |
|||
} |
|||
|
|||
{ |
|||
auto jsdesc = JSDescription::Randomized( |
|||
*params, pubKeyHash, rt, |
|||
inputs, outputs, |
|||
inputMap, outputMap, |
|||
0, 0, false, GenMax); |
|||
|
|||
#ifdef __LP64__ // required for building on MacOS
|
|||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1}; |
|||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1}; |
|||
#else |
|||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1}; |
|||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1}; |
|||
#endif |
|||
EXPECT_EQ(expectedInputMap, inputMap); |
|||
EXPECT_EQ(expectedOutputMap, outputMap); |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
#!/bin/bash |
|||
HOST=x86_64-w64-mingw32 |
|||
CXX=x86_64-w64-mingw32-g++-posix |
|||
CC=x86_64-w64-mingw32-gcc-posix |
|||
PREFIX="$(pwd)/depends/$HOST" |
|||
|
|||
set -eu -o pipefail |
|||
|
|||
set -x |
|||
cd "$(dirname "$(readlink -f "$0")")/.." |
|||
|
|||
cd depends/ && make HOST=$HOST V=1 NO_QT=1 && cd ../ |
|||
./autogen.sh |
|||
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -DCURVE_ALT_BN128 -fopenmp -pthread" ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared |
|||
sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure |
|||
cd src/ |
|||
CC="${CC}" CXX="${CXX}" make V=1 komodod.exe komodo-cli.exe komodo-tx.exe |
Loading…
Reference in new issue