Skip to content

Commit

Permalink
Merge branch 'dev' into FSM
Browse files Browse the repository at this point in the history
  • Loading branch information
jl777 committed Nov 26, 2019
2 parents 9202f3f + 931e7dd commit 09a21b1
Show file tree
Hide file tree
Showing 107 changed files with 2,788 additions and 785 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/komodod_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- name: Install deps (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get remove php7.1-fpm
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool libncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev ntp ntpdate nano software-properties-common curl libevent-dev libcurl4-gnutls-dev cmake clang libsodium-dev -y
Expand Down Expand Up @@ -73,6 +74,7 @@ jobs:
DEBIAN_FRONTEND: noninteractive
if: runner.os == 'Linux'
run: |
sudo apt-get remove php7.1-fpm
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool libncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev ntp ntpdate nano software-properties-common curl libevent-dev libcurl4-gnutls-dev cmake clang libsodium-dev -y
Expand Down
23 changes: 21 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ build:ubuntu:
- chmod +x ${PACKAGE_DIR_LINUX}/komodo-cli
- tar -czvf ${AGAMA_ARTIFACTS_LINUX} ${PACKAGE_DIR_LINUX}
- md5sum ${AGAMA_ARTIFACTS_LINUX} > ${AGAMA_ARTIFACTS_LINUX_CHECKSUM}
only:
- master
- beta
- dev
artifacts:
paths:
- ${AGAMA_ARTIFACTS_LINUX}
Expand Down Expand Up @@ -77,6 +81,10 @@ build:windows:
${PACKAGE_DIR_WINDOWS}
- zip -r ${PACKAGE_DIR_WINDOWS}.zip ${PACKAGE_DIR_WINDOWS}
- md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM}
only:
- master
- beta
- dev
artifacts:
paths:
- ${AGAMA_ARTIFACTS_WINDOWS}
Expand All @@ -89,17 +97,28 @@ build:windows:
########################################################################################################################
build:macos:
stage: build
tags: ["High Sierra"]
tags:
- osx
cache:
key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}"
paths:
- depends/built
allow_failure: true
script:
- zcutil/build-mac.sh -j$(sysctl -n hw.physicalcpu)
- ./makeRelease.sh ${PACKAGE_DIR_MACOS}
- mkdir ${PACKAGE_DIR_MACOS}
- cp src/komodod
src/komodo-cli
zcutil/fetch-params.sh
${PACKAGE_DIR_MACOS}
- chmod +x ${PACKAGE_DIR_MACOS}/komodod
- chmod +x ${PACKAGE_DIR_MACOS}/komodo-cli
- tar -czvf ${AGAMA_ARTIFACTS_MACOS} ${PACKAGE_DIR_MACOS}
- md5sum ${AGAMA_ARTIFACTS_MACOS} > ${AGAMA_ARTIFACTS_MACOS_CHECKSUM}
only:
- master
- beta
- dev
artifacts:
paths:
- ${AGAMA_ARTIFACTS_MACOS}
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ matrix:
- os: linux
dist: xenial
sudo: required
env: LINUX_DEPLOY="true" OSX_DEPLOY="false" $TRAVIS_OS_NAME="linux"
env: LINUX_DEPLOY="false" OSX_DEPLOY="false" $TRAVIS_OS_NAME="linux"
branches:
only:
- master
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
[![Build Status](https://travis-ci.org/KomodoPlatform/komodo.svg?branch=master)](https://travis-ci.org/KomodoPlatform/komodo)
[![Issues](https://img.shields.io/github/issues-raw/komodoplatform/komodo)](https://github.com/KomodoPlatform/komodo/issues)
[![PRs](https://img.shields.io/github/issues-pr-closed/komodoplatform/komodo)](https://github.com/KomodoPlatform/komodo/pulls)
[![Commits](https://img.shields.io/github/commit-activity/y/komodoplatform/komodo)](https://github.com/KomodoPlatform/komodo/commits/dev)
[![Contributors](https://img.shields.io/github/contributors/komodoplatform/komodo)](https://github.com/KomodoPlatform/komodo/graphs/contributors)
[![Last Commit](https://img.shields.io/github/last-commit/komodoplatform/komodo)](https://github.com/KomodoPlatform/komodo/graphs/commit-activity)


[![gitstars](https://img.shields.io/github/stars/komodoplatform/komodo?style=social)](https://github.com/KomodoPlatform/komodo/stargazers)
[![twitter](https://img.shields.io/twitter/follow/komodoplatform?style=social)](https://twitter.com/komodoplatform)
[![discord](https://img.shields.io/discord/412898016371015680)](https://discord.gg/tvp96Gf)

---
![Komodo Logo](https://i.imgur.com/E8LtkAa.png "Komodo Logo")

Expand All @@ -16,7 +27,7 @@ This is the official Komodo sourcecode repository based on https://github.com/jl
- Mail: [[email protected]](mailto:[email protected])
- Support: [https://support.komodoplatform.com/support/home](https://support.komodoplatform.com/support/home)
- Knowledgebase & How-to: [https://support.komodoplatform.com/en/support/solutions](https://support.komodoplatform.com/en/support/solutions)
- API references & Dev Documentation: [https://docs.komodoplatform.com](https://docs.komodoplatform.com/)
- API references & Dev Documentation: [https://developers.komodoplatform.com](https://developers.komodoplatform.com/)
- Blog: [https://blog.komodoplatform.com](https://blog.komodoplatform.com/)
- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/whitepaper)
- Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0)
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ AC_ARG_ENABLE([glibc-back-compat],
[use_glibc_compat=$enableval],
[use_glibc_compat=no])

AC_ARG_ENABLE([experimental-asm],
[AS_HELP_STRING([--enable-experimental-asm],
[Enable experimental assembly routines (default is no)])],
[experimental_asm=$enableval],
[experimental_asm=no])

if test "x$experimental_asm" = xyes; then
AC_DEFINE(EXPERIMENTAL_ASM, 1, [Define this symbol to build in experimental assembly routines])
fi

AC_ARG_ENABLE([zmq],
[AS_HELP_STRING([--disable-zmq],
[disable ZMQ notifications])],
Expand Down Expand Up @@ -892,6 +902,7 @@ AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])
AM_CONDITIONAL([EXPERIMENTAL_ASM],[test x$experimental_asm = xyes])
AM_CONDITIONAL([ASAN],[test x$use_asan = xyes])
AM_CONDITIONAL([TSAN],[test x$use_tsan = xyes])

Expand Down
7 changes: 3 additions & 4 deletions depends/packages/libsodium.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package=libsodium
$(package)_version=1.0.15
$(package)_download_path=https://download.libsodium.org/libsodium/releases/old
$(package)_version=1.0.18
$(package)_download_path=https://download.libsodium.org/libsodium/releases
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=fb6a9e879a2f674592e4328c5d9f79f082405ee4bb05cb6e679b90afe9e178f4
$(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1
$(package)_dependencies=
$(package)_config_opts=

ifeq ($(build_os),darwin)
define $(package)_set_vars
$(package)_build_env=MACOSX_DEPLOYMENT_TARGET="10.11"
Expand Down
75 changes: 39 additions & 36 deletions qa/rpc-tests/cc_pytest/test_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest
import json
import time

from util import assert_success, assert_error, check_if_mined, send_and_mine, rpc_connect, wait_some_blocks, generate_random_string

Expand Down Expand Up @@ -191,39 +192,41 @@ def test_channels():
result = rpc.channelspayment(channel1_txid, "100000")
assert_error(result)

# creating new channel to test the case when node B initiate payment when node A revealed secret in offline
# 10 payments, 100000 sat denomination channel opening with second node pubkey
new_channel_hex2 = rpc.channelsopen(pubkey1, "10", "100000")
assert_success(new_channel_hex)
channel2_txid = send_and_mine(new_channel_hex2["hex"], rpc)
assert channel2_txid, "got channel txid"

wait_some_blocks(rpc, 2)

# disconnecting first node from network
rpc.setban("127.0.0.0/24", "add")
assert rpc.getinfo()["connections"] == 0
assert rpc1.getinfo()["connections"] == 0

# sending one payment to mempool to reveal the secret but not mine it
payment_hex = rpc.channelspayment(channel2_txid, "100000")
result = rpc.sendrawtransaction(payment_hex["hex"])
assert result, "got payment txid"

secret = rpc.channelsinfo(channel2_txid)["Transactions"][1]["Secret"]
assert secret, "Secret revealed"

# secret shouldn't be available for node B
secret_not_revealed = None
try:
rpc1.channelsinfo(channel2_txid)["Transactions"][1]["Secret"]
except Exception:
secret_not_revealed = True
assert secret_not_revealed == True

# trying to initiate payment from second node with revealed secret
assert rpc1.getinfo()["connections"] == 0
dc_payment_hex = rpc1.channelspayment(channel2_txid, "100000", secret)
assert_success(dc_payment_hex)
result = rpc1.sendrawtransaction(dc_payment_hex["hex"])
assert result, "got channelspayment transaction id"
# TODO: fixme
# # creating new channel to test the case when node B initiate payment when node A revealed secret in offline
# # 10 payments, 100000 sat denomination channel opening with second node pubkey
# new_channel_hex2 = rpc.channelsopen(pubkey1, "10", "100000")
# assert_success(new_channel_hex)
# channel2_txid = send_and_mine(new_channel_hex2["hex"], rpc)
# assert channel2_txid, "got channel txid"

# wait_some_blocks(rpc, 2)

# # disconnecting first node from network
# rpc.setban("127.0.0.0/24", "add")
# assert rpc.getinfo()["connections"] == 0
# time.sleep(5)
# assert rpc1.getinfo()["connections"] == 0

# # sending one payment to mempool to reveal the secret but not mine it
# payment_hex = rpc.channelspayment(channel2_txid, "100000")
# result = rpc.sendrawtransaction(payment_hex["hex"])
# assert result, "got payment txid"

# secret = rpc.channelsinfo(channel2_txid)["Transactions"][1]["Secret"]
# assert secret, "Secret revealed"

# # secret shouldn't be available for node B
# secret_not_revealed = None
# try:
# rpc1.channelsinfo(channel2_txid)["Transactions"][1]["Secret"]
# except Exception:
# secret_not_revealed = True
# assert secret_not_revealed == True

# # trying to initiate payment from second node with revealed secret
# assert rpc1.getinfo()["connections"] == 0
# dc_payment_hex = rpc1.channelspayment(channel2_txid, "100000", secret)
# assert_success(dc_payment_hex)
# result = rpc1.sendrawtransaction(dc_payment_hex["hex"])
# assert result, "got channelspayment transaction id"
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ crypto_libbitcoin_crypto_a_SOURCES = \
crypto/verus_hash.h \
crypto/verus_hash.cpp

if EXPERIMENTAL_ASM
crypto_libbitcoin_crypto_a_SOURCES += crypto/sha256_sse4.cpp
endif

if ENABLE_MINING
EQUIHASH_TROMP_SOURCES = \
pow/tromp/equi_miner.h \
Expand Down
2 changes: 2 additions & 0 deletions src/ac/commod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=COMMOD $1 $2 $3 $4 $5 $6
2 changes: 2 additions & 0 deletions src/ac/wlc21
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=WLC21 $1 $2 $3 $4 $5 $6
28 changes: 27 additions & 1 deletion src/assetchains.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,31 @@
"157.230.45.184",
"165.22.52.123"
]
}
},
{
"ac_name": "COMMOD",
"ac_supply": "0",
"ac_reward": "204800000000,100000000",
"ac_end": "482130,0",
"ac_halving": "43830,525960",
"ac_decay": "50000000,10000000",
"ac_eras": "2",
"ac_cc": "777",
"ac_public": "1",
"addnode": [
"34.246.186.176",
"34.251.151.148"
]
},
{
"ac_name": "WLC21",
"ac_supply": "21000000",
"ac_reward": "190258751",
"ac_staked": "90",
"ac_public": "1",
"addnode": [
"37.187.225.231",
"51.38.38.134"
]
}
]
6 changes: 4 additions & 2 deletions src/assetchains.old
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -ac_ccactivate=205000 -addnode=46.101.124.153 &
./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -ac_sapling=5000000 -addnode=51.68.215.104 &
./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=95.213.238.98 &
~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
#~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 &
./komodod -pubkey=$pubkey -ac_name=CCL -ac_supply=200000000 -ac_end=1 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=142.93.136.89 -addnode=195.201.22.89 &
./komodod -pubkey=$pubkey -ac_name=PIRATE -ac_supply=0 -ac_reward=25600000000 -ac_halving=77777 -ac_private=1 -addnode=178.63.77.56 &
Expand All @@ -48,9 +48,11 @@ echo $pubkey
./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 -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 &
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac &
./komodod -pubkey=$pubkey -ac_name=THC -ac_supply=251253103 -ac_reward=360000000,300000000,240000000,180000000,150000000,90000000,0 -ac_staked=100 -ac_eras=7 -ac_end=500001,1000001,1500001,2000001,2500001,4500001,0 -ac_perc=233333333 -ac_cc=2 -ac_ccenable=229,236,240 -ac_script=2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401ccb8 -ac_founders=150 -ac_cbmaturity=1 -ac_sapling=1 -addnode=157.230.45.184 -addnode=165.22.52.123 -earlytxid=7e4a76259e99c9379551389e9f757fc5f46c33ae922a8644dc2b187af2a6adc1 &
./komodod -pubkey=$pubkey -ac_name=COMMOD -ac_supply=0 -ac_reward=204800000000,100000000 -ac_end=482130,0 -ac_halving=43830,525960 -ac_decay=50000000,10000000 -ac_eras=2 -ac_cc=777 -ac_public=1 -addnode=34.246.186.176 -addnode=34.251.151.148 &
./komodod -pubkey=$pubkey -ac_name=WLC21 -ac_supply=21000000 -ac_reward=190258751 -ac_staked=90 -ac_public=1 -addnode=37.187.225.231 -addnode=51.38.38.134 &

1 change: 1 addition & 0 deletions src/cc/CCrewards.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define CC_REWARDS_H

#include "CCinclude.h"
#include <gmp.h>

#define EVAL_REWARDS 0xe5
#define REWARDSCC_MAXAPR (COIN * 25)
Expand Down
6 changes: 6 additions & 0 deletions src/cc/CCutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ bool CheckTxFee(const CTransaction &tx, uint64_t txfee, uint32_t height, uint64_
return true;
}

uint32_t GetLatestTimestamp(int32_t height)
{
if ( KOMODO_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
return(komodo_heightstamp(height));
} // :P

void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
{
cp->unspendableEvalcode2 = evalcode;
Expand Down
4 changes: 2 additions & 2 deletions src/cc/oracles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,11 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
else return(true);
}

int32_t GetLatestTimestamp(int32_t height)
/*nt32_t GetLatestTimestamp(int32_t height)
{
if ( KOMODO_NSPV_SUPERLITE ) return (NSPV_blocktime(height));
return(komodo_heightstamp(height));
}
} */

bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
{
Expand Down
7 changes: 7 additions & 0 deletions src/cc/payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ int64_t mpz_get_si2( mpz_t op )
return ret;
}

uint64_t mpz_get_ui2( mpz_t op )
{
uint64_t ret = 0;
mpz_export(&ret, NULL, 1, sizeof(ret), 0, 0, op);
return ret;
}

CScript EncodePaymentsTxidOpRet(int64_t allocation,std::vector<uint8_t> scriptPubKey,std::vector<uint8_t> destopret)
{
CScript opret; uint8_t evalcode = EVAL_PAYMENTS;
Expand Down
Loading

0 comments on commit 09a21b1

Please sign in to comment.