From 0eff14e36bbaff93f837a85aef945068915da6ee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Jul 2019 19:12:55 +0800 Subject: [PATCH 01/10] Change mpz_t to use import/export --- src/cc/payments.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index be4d63271..65a01199e 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -77,6 +77,18 @@ // start of consensus code +void mpz_set_lli( mpz_t rop, long long op ) +{ + mpz_import(rop, 1, 1, sizeof(op), 0, 0, &op); +} + +int64_t mpz_get_si2( mpz_t op ) +{ + int64_t ret = 0; + mpz_export(&ret, NULL, 1, sizeof(ret), 0, 0, op); + return ret; +} + CScript EncodePaymentsTxidOpRet(int64_t allocation,std::vector scriptPubKey,std::vector destopret) { CScript opret; uint8_t evalcode = EVAL_PAYMENTS; @@ -277,7 +289,7 @@ int32_t payments_getallocations(int32_t top, int32_t bottom, const std::vectorInvalid("could not decode ccopret")); if ( tx.vout.back().scriptPubKey.IsOpReturn() ) fHasOpret = true; - mpz_set_si(mpzCheckamount,amountReleased); + mpz_set_lli(mpzCheckamount,amountReleased); } else return(eval->Invalid("could not decode ccopret")); // use the createtxid to fetch the tx and all of the plans info. @@ -382,7 +394,7 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & //fprintf(stderr, "totalallocations.%li checkallocations.%li\n",totalallocations, checkallocations); if ( totalallocations != checkallocations ) return(eval->Invalid("allocation missmatch")); - mpz_set_si(mpzTotalAllocations,totalallocations); + mpz_set_lli(mpzTotalAllocations,totalallocations); } else if ( funcid == 'S' || funcid == 'O' ) { @@ -438,16 +450,16 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & else { mpz_init(mpzAllocation); - mpz_set_si(mpzAllocation,allocations[n]); + mpz_set_lli(mpzAllocation,allocations[n]); mpz_mul(mpzAllocation,mpzAllocation,mpzCheckamount); mpz_tdiv_q(mpzAllocation,mpzAllocation,mpzTotalAllocations); - test = mpz_get_si(mpzAllocation); + test = mpz_get_si2(mpzAllocation); mpz_clear(mpzAllocation); } - //fprintf(stderr, "vout %i test.%li nValue.%li\n", i, test, tx.vout[i].nValue); + //fprintf(stderr, "vout.%i test.%lli vs nVlaue.%lli\n",i, (long long)test, (long long)tx.vout[i].nValue); if ( test != tx.vout[i].nValue ) { - fprintf(stderr, "vout.%i test.%li vs nVlaue.%li\n",i, test, tx.vout[i].nValue); + fprintf(stderr, "vout.%i test.%lli vs nVlaue.%lli\n",i, (long long)test, (long long)tx.vout[i].nValue); return(eval->Invalid("amounts do not match")); } if ( test < minimum ) @@ -463,10 +475,10 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction & { // need to check that the next allocation was less than minimum, otherwise ppl can truncate the tx at any place not paying all elegible addresses. mpz_init(mpzAllocation); - mpz_set_si(mpzAllocation,allocations[n+1]); + mpz_set_lli(mpzAllocation,allocations[n+1]); mpz_mul(mpzAllocation,mpzAllocation,mpzCheckamount); mpz_tdiv_q(mpzAllocation,mpzAllocation,mpzTotalAllocations); - int64_t test = mpz_get_si(mpzAllocation); + int64_t test = mpz_get_si2(mpzAllocation); //fprintf(stderr, "check next vout pays under min: test.%li > minimuim.%i\n", test, minimum); if ( test > minimum ) return(eval->Invalid("next allocation was not under minimum")); @@ -785,7 +797,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) return(result); } // set totalallocations to a mpz_t bignum, for amounts calculation later. - mpz_set_si(mpzTotalAllocations,totalallocations); + mpz_set_lli(mpzTotalAllocations,totalallocations); } else if ( funcid == 'S' || funcid == 'O' ) { @@ -852,7 +864,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) } newamount = amount; int64_t totalamountsent = 0; - mpz_t mpzAmount; mpz_init(mpzAmount); mpz_set_si(mpzAmount,amount); + mpz_t mpzAmount; mpz_init(mpzAmount); mpz_set_lli(mpzAmount,amount); for (i=0; i Date: Sat, 27 Jul 2019 21:08:29 +0200 Subject: [PATCH 02/10] update logo update Komodo logo on the ReadMe page --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d12521765..b4a18cbdc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/KomodoPlatform/komodo.svg?branch=dev)](https://travis-ci.org/KomodoPlatform/komodo) --- -![Komodo Logo](https://i.imgur.com/vIwVtqv.png "Komodo Logo") +![Komodo Logo](https://i.imgur.com/E8LtkAa.png "Komodo Logo") ## Komodo From 7933de4486a887c3b311ffcd04cf1697d2e11842 Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 30 Jul 2019 13:37:01 +0200 Subject: [PATCH 03/10] update RICK & MORTY --- src/assetchains.old | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assetchains.old b/src/assetchains.old index 8ee0b7daa..a3233bf27 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -46,8 +46,8 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=KSB -ac_supply=1000000000 -ac_end=1 -ac_public=1 -addnode=37.187.225.231 & ./komodod -pubkey=$pubkey -ac_name=OUR -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_supply=100000000 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c -ac_public=1 -addnode=51.255.195.65 -addnode=217.182.129.38 -addnode=37.187.225.231 & ./komodod -pubkey=$pubkey -ac_name=ILN -ac_supply=10000000000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=51.75.122.83 & -./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -addnode=138.201.136.145 & -./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -addnode=138.201.136.145 & +./komodod -pubkey=$pubkey -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 & +./komodod -pubkey=$pubkey -ac_name=MORTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=95.217.44.58 -addnode=138.201.136.145 & ./komodod -pubkey=$pubkey -ac_name=VOTE2019 -ac_supply=123651638 -ac_public=1 -addnode=95.213.238.98 & ./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 & ./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 & From d4a257f616eedb3d90fd1e4e5b0de912c076ea9a Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 30 Jul 2019 13:42:14 +0200 Subject: [PATCH 04/10] update RICK & MORTY --- src/assetchains.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index e68872d6b..f4488506d 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -233,14 +233,22 @@ "ac_supply": "90000000000", "ac_reward": "100000000", "ac_cc": "3", - "addnode": ["138.201.136.145"] + "ac_staked": "10", + "addnode": [ + "138.201.136.145", + "95.217.44.58" + ] }, { "ac_name": "MORTY", "ac_supply": "90000000000", "ac_reward": "100000000", "ac_cc": "3", - "addnode": ["138.201.136.145"] + "ac_staked": "10", + "addnode": [ + "138.201.136.145", + "95.217.44.58" + ] }, { "ac_name": "KOIN", From d9df55aad2448e688f1c046696f90fac1b7e6cfa Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sat, 3 Aug 2019 07:35:13 +0300 Subject: [PATCH 05/10] Reverting binary var --- src/assetchains | 3 ++- src/assetchains_stop | 4 +++- src/fiat-cli | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/assetchains b/src/assetchains index ce6c3aac2..0469fa728 100755 --- a/src/assetchains +++ b/src/assetchains @@ -5,6 +5,7 @@ set -eo pipefail source pubkey.txt overide_args="$@" seed_ip=`getent hosts zero.kolo.supernet.org | awk '{ print $1 }'` +komodo_binary='./komodod' if [ -z "$delay" ]; then delay=20; fi @@ -14,6 +15,6 @@ if [ -z "$delay" ]; then delay=20; fi gen=" -gen -genproclimit=1" fi - ./komodod $gen $args $overide_args -pubkey=$pubkey -addnode=$seed_ip & + $komodo_binary $gen $args $overide_args -pubkey=$pubkey -addnode=$seed_ip & sleep $delay done diff --git a/src/assetchains_stop b/src/assetchains_stop index 60549dc20..dfdfed0c9 100755 --- a/src/assetchains_stop +++ b/src/assetchains_stop @@ -1,6 +1,8 @@ #!/bin/bash set -eo pipefail +komodo_cli='./komodo-cli' ./listassetchains | while read chain; do - ./komodo-cli --ac_name=$chain stop + $komodo_cli --ac_name=$chain stop done + diff --git a/src/fiat-cli b/src/fiat-cli index 157fff828..49332696a 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -1,8 +1,9 @@ #!/bin/bash args="$@" +komodo_cli='./komodo-cli' ./listassetchains | while read chain; do echo $chain - ./komodo-cli --ac_name=$chain $args + $komodo_cli --ac_name=$chain $args done From 6195f50ea0a1b8b569cd5a60ec75c6728b1eb5a4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Aug 2019 03:27:48 -1100 Subject: [PATCH 06/10] Skip initdone --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index b067a0b5e..b2ffc26f0 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1420,7 +1420,7 @@ void komodo_passport_iteration() int32_t maxseconds = 10; FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t buf[3],starttime; uint64_t RTmask = 0; //CBlockIndex *pindex; expired = 0; - while ( KOMODO_INITDONE == 0 ) + while ( 0 && KOMODO_INITDONE == 0 ) { fprintf(stderr,"[%s] PASSPORT iteration waiting for KOMODO_INITDONE\n",ASSETCHAINS_SYMBOL); sleep(3); From 4215ba1ce2da366940d76566fb1befbc6a13eb56 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Aug 2019 03:56:19 -1100 Subject: [PATCH 07/10] -print --- src/komodo_nSPV_fullnode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index 3856caf12..78c3939cd 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -620,7 +620,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req iguana_rwnum(0,&request[len-8],sizeof(skipcount),&skipcount); iguana_rwnum(0,&request[len-4],sizeof(filter),&filter); } - if ( isCC != 0 ) + if ( 0 && isCC != 0 ) fprintf(stderr,"utxos %s isCC.%d skipcount.%d filter.%x\n",coinaddr,isCC,skipcount,filter); memset(&U,0,sizeof(U)); if ( (slen= NSPV_getaddressutxos(&U,coinaddr,isCC,skipcount,filter)) > 0 ) @@ -660,7 +660,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req iguana_rwnum(0,&request[len-8],sizeof(skipcount),&skipcount); iguana_rwnum(0,&request[len-4],sizeof(filter),&filter); } - //if ( isCC != 0 ) + if ( 0 && isCC != 0 ) fprintf(stderr,"txids %s isCC.%d skipcount.%d filter.%d\n",coinaddr,isCC,skipcount,filter); memset(&T,0,sizeof(T)); if ( (slen= NSPV_getaddresstxids(&T,coinaddr,isCC,skipcount,filter)) > 0 ) From 65dd98f02fecd73f7b78ea2b402175088eaac31a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Aug 2019 00:31:37 -1100 Subject: [PATCH 08/10] -prints --- src/cryptoconditions/src/cryptoconditions.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cryptoconditions/src/cryptoconditions.c b/src/cryptoconditions/src/cryptoconditions.c index 12f973b97..74949affc 100644 --- a/src/cryptoconditions/src/cryptoconditions.c +++ b/src/cryptoconditions/src/cryptoconditions.c @@ -272,10 +272,10 @@ int cc_verify(const struct CC *cond, const unsigned char *msg, size_t msgLength, unsigned char msgHash[32]; if (doHashMsg) sha256(msg, msgLength, msgHash); else memcpy(msgHash, msg, 32); - int32_t z; - for (z=0; z<32; z++) - fprintf(stderr,"%02x",msgHash[z]); - fprintf(stderr," msgHash msglen.%d\n",msgLength); + //int32_t z; + //for (z=0; z<32; z++) + // fprintf(stderr,"%02x",msgHash[z]); + //fprintf(stderr," msgHash msglen.%d\n",(int32_t)msgLength); if (!cc_secp256k1VerifyTreeMsg32(cond, msgHash)) { fprintf(stderr," cc_verify error C\n"); From 7c7fad183f4df032128aa431ed298ab2ee95485b Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sun, 25 Aug 2019 10:55:34 -0700 Subject: [PATCH 09/10] fix compile --- src/cc/gateways.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index 5f167a224..1a48928c4 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -1114,6 +1114,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui if ( CCchange != 0 ) mtx.vout.push_back(MakeTokensCC1vout(EVAL_GATEWAYS,CCchange,gatewayspk)); return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeGatewaysClaimOpRet('C',tokenid,bindtxid,refcoin,deposittxid,destpub,amount))); } + return(""); } std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount) From 9fac1230161bf824bf28388016e9234264b39dac Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Aug 2019 02:32:24 -1100 Subject: [PATCH 10/10] Don't change adaptivepow to default on: -ADAPTIVEPOW_CHANGETO_DEFAULTON --- src/bitcoind.cpp | 4 ++-- src/komodo_defs.h | 2 +- src/main.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 6180cd12b..f32b559bd 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -76,14 +76,14 @@ void WaitForShutdown(boost::thread_group* threadGroup) fprintf(stderr,"error: earlytx must be before block height %d or tx does not exist\n",KOMODO_EARLYTXID_HEIGHT); StartShutdown(); } - if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 ) + /*if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 ) { if ( pindex->nTime > ADAPTIVEPOW_CHANGETO_DEFAULTON ) { ASSETCHAINS_ADAPTIVEPOW = 1; fprintf(stderr,"default activate adaptivepow\n"); } else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON); - } //else fprintf(stderr,"cant find height 1\n"); + } //else fprintf(stderr,"cant find height 1\n");*/ if ( ASSETCHAINS_CBOPRET != 0 ) komodo_pricesinit(); while (!fShutdown) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index db4702920..9bebea215 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -20,7 +20,7 @@ #include "komodo_nk.h" #define KOMODO_EARLYTXID_HEIGHT 100 -#define ADAPTIVEPOW_CHANGETO_DEFAULTON 1572480000 +//#define ADAPTIVEPOW_CHANGETO_DEFAULTON 1572480000 #define ASSETCHAINS_MINHEIGHT 128 #define ASSETCHAINS_MAX_ERAS 7 #define KOMODO_ELECTION_GAP 2000 diff --git a/src/main.cpp b/src/main.cpp index 07fdd0ef0..da8b706ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4452,8 +4452,8 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc notarizedht = komodo_notarized_height(&prevMoMheight,¬arizedhash,&txid); if ( !fSkipdpow && pindexFork != 0 && pindexOldTip->GetHeight() > notarizedht && pindexFork->GetHeight() < notarizedht ) { - fprintf(stderr,"pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht,(int32_t)pindexOldTip->GetHeight(),notarizedht); - return state.DoS(100, error("ActivateBestChainStep(): pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht,(int32_t)pindexOldTip->GetHeight(),notarizedht), + fprintf(stderr,"pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexOldTip->GetHeight(),notarizedht,(int32_t)pindexFork->GetHeight(),notarizedht); + return state.DoS(100, error("ActivateBestChainStep(): pindexOldTip->GetHeight().%d > notarizedht %d && pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexOldTip->GetHeight(),notarizedht,(int32_t)pindexFork->GetHeight(),notarizedht), REJECT_INVALID, "past-notarized-height"); } // - On ChainDB initialization, pindexOldTip will be null, so there are no removable blocks.