Compare commits

...
Author SHA1 Message Date
Job Evers f0b3eda16d add windows release 2016-07-29 14:47:18 -05:00
Job Evers 3b18eb3c9d another update 2016-07-29 14:11:52 -05:00
Job Evers 66cbc9f26f needed for windows 2016-07-29 12:40:22 -05:00
Job Evers caf3046ae7 try using CLI resources 2016-07-29 12:37:13 -05:00
Job Evers d79d9078bd add back bitcoin resource file for windows 2016-07-29 11:15:09 -05:00
Job Evers c00fa9cbc2 don't build QT; add patch file 2016-07-29 10:30:46 -05:00
Job Evers f80bca1346 actually check the target 2016-07-29 09:29:12 -05:00
Job Evers c8af27f222 oops. committed too soon 2016-07-29 09:13:13 -05:00
Job Evers d028671c80 add windows build to travis 2016-07-29 09:05:42 -05:00
Jeremy Kauffman c3e9266494 Merge pull request #30 from kaykurokawa/update_rpc_getvalueforname
adding effective amount to rpc command getvalueforname
2016-07-29 09:31:24 -04:00
kkurokawa 526b1866ee adding effective amount to rpc command getvalueforname 2016-07-28 18:14:14 -04:00
Jeremy Kauffman d0214d14c5 Merge pull request #14 from jimmykiselak/bogus_claimid_tests
Bogus claimid tests
2016-07-27 18:35:31 -04:00
Alex Grin a5dc212ef5 Merge pull request #24 from tpruvot/rpc
rpc: add claimtrie field in getblocktemplate
2016-07-25 12:30:18 -04:00
Tanguy Pruvot ce7f414962 rpc: add claimtrie field in getblocktemplate
getblocktemplate is supposed to output all required mining infos
2016-07-21 22:01:47 +02:00
Jeremy Kauffman 874948ec59 Merge pull request #23 from kaykurokawa/max_name_length_fix
Limits name length of claimtrie transactions to 255 bytes
2016-07-21 15:25:40 -04:00
kkurokawa ad7304e321 Limits name length of claimtrie transactions to 255 bytes 2016-07-21 14:58:49 -04:00
Jimmy Kiselak b6e686538f add tests that verify updates with bogus claimids never make it into the trie 2016-07-11 00:07:04 -04:00
13 changed files with 251 additions and 7 deletions

No files matched your search

+25 -4
View File
@@ -4,14 +4,23 @@ matrix:
sudo: required
dist: trusty
language: c
env: TARGET=linux
- os: linux
sudo: required
dist: trusty
language: c
env: TARGET=windows
- os: osx
language: c
osx_image: xcode7.3
env: TARGET=osx
cache:
apt: true
ccache: true
directories:
- build
- depends/built
before_install:
- date +%s > "${TRAVIS_BUILD_DIR}/start_time"
@@ -20,8 +29,12 @@ before_install:
install: true
script:
- ./reproducible_build.sh -t -o -c
- zip -j "lbrycrd-${TRAVIS_OS_NAME}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx
- if [[ "${TARGET}" == "osx" ]]; then ./reproducible_build.sh -t -o -c; fi
- if [[ "${TARGET}" == "linux" ]]; then ./reproducible_build.sh -t -o -c; fi
- if [[ "${TARGET}" == "windows" ]]; then ./packaging/build_windows.sh; fi
- if [[ "${TARGET}" == "osx" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi
- if [[ "${TARGET}" == "linux" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi
- if [[ "${TARGET}" == "windows" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd.exe src/lbrycrd-cli.exe src/lbrycrd-tx.exe; fi
before_cache:
- ls -lh build
@@ -33,7 +46,7 @@ deploy:
skip_cleanup: true
on:
tags: true
condition: "$TRAVIS_OS_NAME = linux"
condition: "$TARGET = linux"
api_key:
secure: "ibN+PQg84f0tgJLV3KaHjkHmgFNOPqBLIrSU42moen22xxT2VIn0j7DkFaLLts1fs/+/gxmrvhOQ0vUFJqmflZ3kCeyedP/CVgZz7D7HRVK0cYUMJ2F9VWMZAFIX6A67OUlypqZqzKAKrZHx3HXky6Z8NBU23JgWqDm8PcrbbgMLvB2lvWVASjJVKreaL9BOxFOOOrAj6xAIm9ogTOnFVI/AhufNOKOTZaiprcbqMngwHeaILbwEJVqv5P2YUurC6Sq+QaH26tX00DtsYOW+n8AA3Fe48+L6rqa6Q8ru+dhPuR/Apr2+DTZ+npzY8leV3A7mYUeLo4JLaEH6n1TLVt65cX7nuesS7KsSKBSxs7q7bsqeapDcMskZz5JR4EK4S96CuHZEnn6+efpH8IrxWpbeO3EibJfyT8tMJKw7Zym5mPr+sz6xSlVMoBVcCm+7z9e7Zcqukdvdy8jM7sGP9qusqEhpojh0o+gPgr9p13SfR+6OCpj9gwxPCnZO8RBfh1cbz9vFSVlDyUYcpI2CCCpPazA1glTsEDk+VtznnUMmWksXWfxBFV81jQB2SnoZKlnsiEuNMwhiMCMEkRFo74+AsUr2UjmKJ5KC8ACwsn475PoLZBh2J6fyXBHMdbrGfK+Zt5K2IHRRtDaZVT4eHqYzxh8KhalsuBNxCo3FygI="
- provider: releases
@@ -41,7 +54,15 @@ deploy:
skip_cleanup: true
on:
tags: true
condition: "$TRAVIS_OS_NAME = osx"
condition: "$TARGET = osx"
api_key:
secure: "ibN+PQg84f0tgJLV3KaHjkHmgFNOPqBLIrSU42moen22xxT2VIn0j7DkFaLLts1fs/+/gxmrvhOQ0vUFJqmflZ3kCeyedP/CVgZz7D7HRVK0cYUMJ2F9VWMZAFIX6A67OUlypqZqzKAKrZHx3HXky6Z8NBU23JgWqDm8PcrbbgMLvB2lvWVASjJVKreaL9BOxFOOOrAj6xAIm9ogTOnFVI/AhufNOKOTZaiprcbqMngwHeaILbwEJVqv5P2YUurC6Sq+QaH26tX00DtsYOW+n8AA3Fe48+L6rqa6Q8ru+dhPuR/Apr2+DTZ+npzY8leV3A7mYUeLo4JLaEH6n1TLVt65cX7nuesS7KsSKBSxs7q7bsqeapDcMskZz5JR4EK4S96CuHZEnn6+efpH8IrxWpbeO3EibJfyT8tMJKw7Zym5mPr+sz6xSlVMoBVcCm+7z9e7Zcqukdvdy8jM7sGP9qusqEhpojh0o+gPgr9p13SfR+6OCpj9gwxPCnZO8RBfh1cbz9vFSVlDyUYcpI2CCCpPazA1glTsEDk+VtznnUMmWksXWfxBFV81jQB2SnoZKlnsiEuNMwhiMCMEkRFo74+AsUr2UjmKJ5KC8ACwsn475PoLZBh2J6fyXBHMdbrGfK+Zt5K2IHRRtDaZVT4eHqYzxh8KhalsuBNxCo3FygI="
- provider: releases
file: lbrycrd-windows.zip
skip_cleanup: true
on:
tags: true
condition: "$TARGET = windows"
api_key:
secure: "ibN+PQg84f0tgJLV3KaHjkHmgFNOPqBLIrSU42moen22xxT2VIn0j7DkFaLLts1fs/+/gxmrvhOQ0vUFJqmflZ3kCeyedP/CVgZz7D7HRVK0cYUMJ2F9VWMZAFIX6A67OUlypqZqzKAKrZHx3HXky6Z8NBU23JgWqDm8PcrbbgMLvB2lvWVASjJVKreaL9BOxFOOOrAj6xAIm9ogTOnFVI/AhufNOKOTZaiprcbqMngwHeaILbwEJVqv5P2YUurC6Sq+QaH26tX00DtsYOW+n8AA3Fe48+L6rqa6Q8ru+dhPuR/Apr2+DTZ+npzY8leV3A7mYUeLo4JLaEH6n1TLVt65cX7nuesS7KsSKBSxs7q7bsqeapDcMskZz5JR4EK4S96CuHZEnn6+efpH8IrxWpbeO3EibJfyT8tMJKw7Zym5mPr+sz6xSlVMoBVcCm+7z9e7Zcqukdvdy8jM7sGP9qusqEhpojh0o+gPgr9p13SfR+6OCpj9gwxPCnZO8RBfh1cbz9vFSVlDyUYcpI2CCCpPazA1glTsEDk+VtznnUMmWksXWfxBFV81jQB2SnoZKlnsiEuNMwhiMCMEkRFo74+AsUr2UjmKJ5KC8ACwsn475PoLZBh2J6fyXBHMdbrGfK+Zt5K2IHRRtDaZVT4eHqYzxh8KhalsuBNxCo3FygI="
+1
View File
@@ -95,6 +95,7 @@ wallet_packages_$(NO_WALLET) = $(wallet_packages)
upnp_packages_$(NO_UPNP) = $(upnp_packages)
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_)
$(info $$packages is [${packages}])
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_)
all_packages = $(packages) $(native_packages)
+18
View File
@@ -0,0 +1,18 @@
#! /bin/bash
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
g++-mingw-w64-i686 mingw-w64-i686-dev g++-mingw-w64-x86-64 \
mingw-w64-x86-64-dev build-essential libtool autotools-dev automake pkg-config \
libssl-dev libevent-dev bsdmainutils curl ca-certificates
cd depends
make HOST=i686-w64-mingw32 NO_QT=1
cd ..
patch -p1 < packaging/remove_consensus.patch
./autogen.sh
./configure --prefix=`pwd`/depends/i686-w64-mingw32 --without-gui
make
+23
View File
@@ -0,0 +1,23 @@
diff --git a/src/Makefile.am b/src/Makefile.am
index a9f0a94..d71bfeb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,12 +64,12 @@ if ENABLE_ZMQ
EXTRA_LIBRARIES += libbitcoin_zmq.a
endif
-if BUILD_BITCOIN_LIBS
-lib_LTLIBRARIES = libbitcoinconsensus.la
-LIBBITCOINCONSENSUS=libbitcoinconsensus.la
-else
-LIBBITCOINCONSENSUS=
-endif
+# if BUILD_BITCOIN_LIBS
+# lib_LTLIBRARIES = libbitcoinconsensus.la
+# LIBBITCOINCONSENSUS=libbitcoinconsensus.la
+# else
+# LIBBITCOINCONSENSUS=
+# endif
bin_PROGRAMS =
TESTS =
+2 -2
View File
@@ -50,9 +50,9 @@ Var StartMenuGroup
# Installer attributes
OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-${VERSION}-win@WINDOWS_BITS@-setup.exe
!if "@WINDOWS_BITS@" == "64"
InstallDir $PROGRAMFILES64\Bitcoin
InstallDir $PROGRAMFILES64\Lbrycrd
!else
InstallDir $PROGRAMFILES\Bitcoin
InstallDir $PROGRAMFILES\Lbrycrd
!endif
CRCCheck on
XPStyle on
+1 -1
View File
@@ -357,7 +357,7 @@ lbrycrdd_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
lbrycrdd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
if TARGET_WINDOWS
lbrycrdd_SOURCES += lbrycrdd-res.rc
lbrycrdd_SOURCES += bitcoin-cli-res.rc
endif
lbrycrdd_LDADD = \
+6
View File
@@ -961,8 +961,14 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
return state.DoS(100, false, REJECT_INVALID, "bad-txns-txouttotal-toolarge");
// check claimtrie transactions
if (ClaimScriptSize(txout.scriptPubKey) > MAX_CLAIM_SCRIPT_SIZE)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-claimscriptsize-toolarge");
if (ClaimNameSize(txout.scriptPubKey) > MAX_CLAIM_NAME_SIZE)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-claimscriptname-toolarge");
}
// Check for duplicate inputs
+14
View File
@@ -136,3 +136,17 @@ size_t ClaimScriptSize(const CScript& scriptIn)
return scriptIn.size() - strippedScript.size();
}
size_t ClaimNameSize(const CScript& scriptIn)
{
std::vector<std::vector<unsigned char> > vvchParams;
CScript::const_iterator pc = scriptIn.begin();
int op;
if (!DecodeClaimScript(scriptIn, op, vvchParams, pc))
{
return 0;
}
else
{
return vvchParams[0].size();
}
}
+9
View File
@@ -6,8 +6,14 @@
#include <vector>
// This is the max claim script size in bytes, not including the script pubkey part of the script.
// Scripts exceeding this size are rejected in CheckTransaction in main.cpp
#define MAX_CLAIM_SCRIPT_SIZE 8192
// This is the max claim name size in bytes, for all claim trie transactions.
// Scripts exceeding this size are rejected in CheckTransaction in main.cpp
#define MAX_CLAIM_NAME_SIZE 255
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams);
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams, CScript::const_iterator& pc);
CScript StripClaimScriptPrefix(const CScript& scriptIn);
@@ -15,6 +21,9 @@ CScript StripClaimScriptPrefix(const CScript& scriptIn, int& op);
uint160 ClaimIdHash(const uint256& txhash, uint32_t nOut);
std::vector<unsigned char> uint32_t_to_vch(uint32_t n);
uint32_t vch_to_uint32_t(std::vector<unsigned char>& vchN);
// get size of the claim script, minus the script pubkey part
size_t ClaimScriptSize(const CScript& scriptIn);
// get size of the name in a claim script, returns 0 if scriptin is not a claimetrie transaction
size_t ClaimNameSize(const CScript& scriptIn);
#endif // BITCOIN_NAMECLAIM_H
+2
View File
@@ -136,6 +136,7 @@ UniValue getvalueforname(const UniValue& params, bool fHelp)
"\"txid\" (string) the hash of the transaction which successfully claimed the name\n"
"\"n\" (numeric) vout value\n"
"\"amount\" (numeric) txout amount\n"
"\"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim\n"
"\"height\" (numeric) the height of the block in which this transaction is located\n"
);
LOCK(cs_main);
@@ -169,6 +170,7 @@ UniValue getvalueforname(const UniValue& params, bool fHelp)
ret.push_back(Pair("txid", claim.outPoint.hash.GetHex()));
ret.push_back(Pair("n", (int)claim.outPoint.n));
ret.push_back(Pair("amount", claim.nAmount));
ret.push_back(Pair("effective amount", claim.nEffectiveAmount));
ret.push_back(Pair("height", claim.nHeight));
return ret;
}
+3
View File
@@ -659,6 +659,9 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));
if (pclaimTrie)
result.push_back(Pair("claimtrie", pclaimTrie->getMerkleHash().GetHex()));
return result;
}
+120
View File
@@ -2095,6 +2095,126 @@ BOOST_AUTO_TEST_CASE(claimtrie_supporting_claims2)
BOOST_CHECK(pclaimTrie->supportQueueEmpty());
}
BOOST_AUTO_TEST_CASE(claimtrie_invalid_claimid)
{
fRequireStandard = false;
BOOST_CHECK(pclaimTrie->nCurrentHeight = chainActive.Height() + 1);
LOCK(cs_main);
std::string sName("atest");
std::string sValue1("testa");
std::string sValue2("testb");
std::vector<unsigned char> vchName(sName.begin(), sName.end());
std::vector<unsigned char> vchValue1(sValue1.begin(), sValue1.end());
std::vector<unsigned char> vchValue2(sValue2.begin(), sValue2.end());
std::vector<CTransaction> coinbases;
BOOST_CHECK(CreateCoinbases(2, coinbases));
CMutableTransaction tx1 = BuildTransaction(coinbases[0]);
tx1.vout[0].scriptPubKey = CScript() << OP_CLAIM_NAME << vchName << vchValue1 << OP_2DROP << OP_DROP << OP_TRUE;
tx1.vout[0].nValue = 1;
COutPoint tx1OutPoint(tx1.GetHash(), 0);
CMutableTransaction tx2 = BuildTransaction(coinbases[1]);
tx2.vout[0].scriptPubKey = CScript() << OP_CLAIM_NAME << vchName << vchValue2 << OP_2DROP << OP_DROP << OP_TRUE;
tx2.vout[0].nValue = 5;
COutPoint tx2OutPoint(tx2.GetHash(), 0);
CMutableTransaction tx3 = BuildTransaction(tx2);
uint160 tx1ClaimId = ClaimIdHash(tx1.GetHash(), 0);
std::vector<unsigned char> vchTx1ClaimId(tx1ClaimId.begin(), tx1ClaimId.end());
tx3.vout[0].scriptPubKey = CScript() << OP_UPDATE_CLAIM << vchName << vchTx1ClaimId << vchValue2 << OP_2DROP << OP_2DROP << OP_TRUE;
tx3.vout[0].nValue = 4;
COutPoint tx3OutPoint(tx3.GetHash(), 0);
CMutableTransaction tx4 = BuildTransaction(tx3);
tx4.vout[0].scriptPubKey = CScript() << OP_UPDATE_CLAIM << vchName << vchTx1ClaimId << vchValue2 << OP_2DROP << OP_2DROP << OP_TRUE;
tx4.vout[0].nValue = 3;
COutPoint tx4OutPoint(tx4.GetHash(), 0);
CClaimValue val;
std::vector<uint256> blocks_to_invalidate;
// Verify that supports expire
// Create a 1 LBC claim (tx1)
AddToMempool(tx1);
BOOST_CHECK(CreateBlocks(1, 2));
blocks_to_invalidate.push_back(chainActive.Tip()->GetBlockHash());
BOOST_CHECK(pcoinsTip->HaveCoins(tx1.GetHash()));
BOOST_CHECK(!pclaimTrie->empty());
BOOST_CHECK(pclaimTrie->queueEmpty());
BOOST_CHECK(pclaimTrie->supportEmpty());
BOOST_CHECK(pclaimTrie->supportQueueEmpty());
// Make sure it gets way in there
BOOST_CHECK(CreateBlocks(100, 1));
// Create a 5 LBC claim (tx2)
AddToMempool(tx2);
BOOST_CHECK(CreateBlocks(1, 2));
BOOST_CHECK(pcoinsTip->HaveCoins(tx2.GetHash()));
BOOST_CHECK(!pclaimTrie->empty());
BOOST_CHECK(!pclaimTrie->queueEmpty());
// Create a tx with a bogus claimId
AddToMempool(tx3);
BOOST_CHECK(CreateBlocks(1, 2));
BOOST_CHECK(pcoinsTip->HaveCoins(tx3.GetHash()));
BOOST_CHECK(!pclaimTrie->empty());
BOOST_CHECK(pclaimTrie->queueEmpty());
// Verify it's not in the claim trie
BOOST_CHECK(pclaimTrie->getInfoForName(sName, val));
BOOST_CHECK(val.outPoint == tx1OutPoint);
BOOST_CHECK(!pclaimTrie->haveClaim(sName, tx4OutPoint));
// Update the tx with the bogus claimId
AddToMempool(tx4);
BOOST_CHECK(CreateBlocks(1, 2));
BOOST_CHECK(pcoinsTip->HaveCoins(tx4.GetHash()));
BOOST_CHECK(!pclaimTrie->empty());
BOOST_CHECK(pclaimTrie->queueEmpty());
// Verify it's not in the claim trie
BOOST_CHECK(!pclaimTrie->haveClaim(sName, tx4OutPoint));
BOOST_CHECK(pclaimTrie->getInfoForName(sName, val));
BOOST_CHECK(val.outPoint == tx1OutPoint);
// Go forward a few hundred blocks and verify it's not in there
BOOST_CHECK(CreateBlocks(300, 1));
BOOST_CHECK(!pclaimTrie->empty());
BOOST_CHECK(pclaimTrie->queueEmpty());
BOOST_CHECK(!pclaimTrie->haveClaim(sName, tx4OutPoint));
// go all the way back
BOOST_CHECK(RemoveBlock(blocks_to_invalidate.back()));
}
BOOST_AUTO_TEST_CASE(claimtrie_expiring_supports)
{
fRequireStandard = false;
+27
View File
@@ -12,6 +12,7 @@
#include "key.h"
#include "keystore.h"
#include "main.h" // For CheckTransaction
#include "nameclaim.h"
#include "policy/policy.h"
#include "script/script.h"
#include "script/script_error.h"
@@ -445,6 +446,7 @@ BOOST_AUTO_TEST_CASE(test_claimsValid)
BOOST_CHECK(CheckTransaction(t, state));
BOOST_CHECK(state.IsValid());
// exceeds max script size
vchName = std::vector<unsigned char>(2<<12, '0');
vchValue = std::vector<unsigned char>(2<<12, '0');
@@ -454,5 +456,30 @@ BOOST_AUTO_TEST_CASE(test_claimsValid)
BOOST_CHECK(!CheckTransaction(t, state));
BOOST_CHECK(!state.IsValid());
// does not exceed max name size
vchName = std::vector<unsigned char>(MAX_CLAIM_NAME_SIZE, '0');
vchValue = std::vector<unsigned char>(1, '0');
t.vout[0].scriptPubKey = CScript() << OP_CLAIM_NAME << vchName << vchValue << OP_2DROP << OP_DROP << OP_TRUE;
state = CValidationState();
BOOST_CHECK(CheckTransaction(t, state));
BOOST_CHECK(state.IsValid());
// exceeds max name size
vchName = std::vector<unsigned char>(MAX_CLAIM_NAME_SIZE+1, '0');
vchValue = std::vector<unsigned char>(1, '0');
t.vout[0].scriptPubKey = CScript() << OP_CLAIM_NAME << vchName << vchValue << OP_2DROP << OP_DROP << OP_TRUE;
state = CValidationState();
BOOST_CHECK(!CheckTransaction(t, state));
BOOST_CHECK(!state.IsValid());
}
BOOST_AUTO_TEST_SUITE_END()