Browse Source

Merge pull request #186 from jl777/dev

sync dev
warmup
ca333 5 years ago
committed by GitHub
parent
commit
41be7b81c8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .gitlab-ci.yml
  2. 62
      CONTRIBUTING.md
  3. 30
      SECURITY.md
  4. 8
      depends/hosts/darwin.mk
  5. 121
      qa/rpc-tests/cryptoconditions_oracles.py
  6. 4
      src/cc/CCOracles.h
  7. 2
      src/cc/CCinclude.h
  8. 38
      src/cc/Makefile_custom
  9. 4
      src/cc/Makefile_rogue
  10. 4
      src/cc/crypto777/OS_portable.h
  11. 500
      src/cc/dapps/zmigrate.c
  12. 9
      src/cc/eval.cpp
  13. 2
      src/cc/makecclib
  14. 11
      src/cc/makecustom
  15. 243
      src/cc/oracles.cpp
  16. 21
      src/komodo.h
  17. 68
      src/komodo_defs.h
  18. 24
      src/komodo_gateway.h
  19. 3
      src/komodo_globals.h
  20. 4
      src/komodo_notary.h
  21. 85
      src/komodo_utils.h
  22. 21
      src/main.cpp
  23. 8
      src/rpc/blockchain.cpp
  24. 3
      src/rpc/mining.cpp
  25. 2
      src/rpc/misc.cpp
  26. 22
      src/rpc/server.cpp
  27. 1
      src/rpc/server.h
  28. 14
      src/wallet/db.h
  29. 57
      src/wallet/gtest/test_wallet.cpp
  30. 42
      src/wallet/rpcwallet.cpp
  31. 15
      src/wallet/wallet.h
  32. 3
      src/wallet/walletdb.cpp
  33. 2
      toolchain-info.sh
  34. 8
      zcutil/build-mac.sh
  35. 2
      zcutil/build-win.sh
  36. 2
      zcutil/build.sh

5
.gitlab-ci.yml

@ -40,6 +40,7 @@ build:ubuntu:
- mkdir ${PACKAGE_DIR_LINUX}
- cp src/komodod
src/komodo-cli
zcutil/fetch-params.sh
${PACKAGE_DIR_LINUX}
- chmod +x ${PACKAGE_DIR_LINUX}/komodod
- chmod +x ${PACKAGE_DIR_LINUX}/komodo-cli
@ -71,10 +72,8 @@ build:windows:
- cp src/komodod.exe
src/komodo-cli.exe
src/komodo-tx.exe
src/cc/rogue/rogue.exe
zcutil/wget64.exe
zcutil/fetch-params.bat
src/cc/rogue/x86_64-w64-mingw32/bin/libcurl-4.dll
src/cc/rogue/x86_64-w64-mingw32/bin/libncursesw6.dll
${PACKAGE_DIR_WINDOWS}
- zip -r ${PACKAGE_DIR_WINDOWS}.zip ${PACKAGE_DIR_WINDOWS}
- md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM}

62
CONTRIBUTING.md

@ -0,0 +1,62 @@
# Komodo Core (komodod) Software Contribution Guidelines
Thank you for reaching out and trying to make Komodo an even better software application and blockchain platform. These contribution guidelines shall help you figuring out where you can be helpful and how to easily get started.
## Table of Contents
0. [Types of contributions we're looking for](#types-of-contributions-were-looking-for)
0. [Ground rules & expectations](#ground-rules--expectations)
0. [How to contribute](#how-to-contribute)
0. [Style guide](#style-guide)
0. [Setting up your environment](#setting-up-your-environment)
0. [Contribution review process](#contribution-review-process)
0. [Community](#community)
## Types of contributions we're looking for
There are many ways you can directly contribute to Komodo:
* Debug and test the Komodo Core code
* Find and fix bugs
* Improve suboptimal code
* Extend our software
* Perform a secure code review of Komodo Core and other Komodo-related software
Interested in making a contribution? Read on!
## Ground rules & expectations
Before we get started, here are a few things we expect from you (and that you should expect from others):
* Be kind and thoughtful in your conversations around this project. We all come from different backgrounds and projects, which means we likely have different perspectives on "how open source is done." Try to listen to others rather than convince them that your way is correct.
* Open Source Guides are released with a [Contributor Code of Conduct](./code_of_conduct.md). By participating in this project, you agree to abide by its terms.
* If you open a pull request, please ensure that your contribution passes all tests. If there are test failures, you will need to address them before we can merge your contribution.
* When adding content, please consider if it is widely valuable. Please don't add references or links to things you or your employer have created as others will do so if they appreciate it.
## How to contribute
If you'd like to contribute, start by searching through the [issues](https://github.com/komodoplatform/komodo/issues) and [pull requests](https://github.com/komodoplatform/komodo/pulls) to see whether someone else has raised a similar idea or question.
If you don't see your idea listed, and you think it can contribute to Komodo, do one of the following:
* **If your contribution is minor,** such as a fixing a typo, open a pull request.
* **If your contribution is major,** such as a new feature or bugfix, start by opening an issue first. That way, other contributors can weigh in on the discussion before you do any work.
## Style guide
Write clear, clean and consistent code. Follow well-known and established style guidelines like [Google's C++ Style Guide](https://google.github.io/styleguide/cppguide.html) or [Bjarne Stroustrup's C++ Style FAQ](http://www.stroustrup.com/bs_faq2.html).
## Setting up your environment
The Komodo Core (komodod) is mainly written in C++ with specific modules written in C. Follow the [Getting Started](https://github.com/komodoplatform/komodo#getting-started) instructions to build komodod from sources. For more informations about the Komodo Platform and a full API documentation please visit the official [Komodo developer documentation](https://docs.komodoplatform.com/).
## Contribution review process
Our team and community will review your contribution and start a transparent testing and quality assurance process. As soon as your contribution has undergone sucessful review and QA signoff it gets merged into the Komodo sourcecode.
## Community
Discussions about Komodo's development take place on our [discord server](https://discord.gg/yhfzqsg). Anybody is welcome to join these conversations. There is also a [newsletter](http://komodoplatform.com) with regular updates.
Wherever possible, do not take these conversations to private channels, including contacting the maintainers directly. Keeping communication public means everybody can benefit and learn from the conversation.
This contribution guideline is adapted from the Open Source Guides.

30
SECURITY.md

@ -0,0 +1,30 @@
## Reporting a Vulnerability
Please use the below [contact data](https://komodoplatform.com/.well-known/security.txt.asc) to report vulnerabilities. We kindly ask you to not publish or exploit any found vulnerabilities.
```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Contact: security@komodoplatform.com
Contact: ca333@komodoplatform.com
Contact: noashh@komodoplatform.com
Encryption: http://pgp.key-server.io:11371/0x379287998EE6CF47
-----BEGIN PGP SIGNATURE-----
iQJNBAEBCAA3FiEEVez5U2AlPa805zvqN5KHmY7mz0cFAlz6EuMZHGNhMzMzQGtv
bW9kb3BsYXRmb3JtLmNvbQAKCRA3koeZjubPR8cIEACP+JjyXDIzjgIewMMi/02b
tsYswPyQ+9bAoEJnis3r94d1FP1rqXmt4oNz6VwFTqQLEa5opW+gvvaxBTFJSPb0
UzbS+1PjfAOox5cnT3Dnv9kcy4ECslnW/G+mH+85BUgz1HuqYc8A3kNQJL7KqLoi
YeD0Hd09KtlG+B4PWdnqLw/uvfbavSKdMn6WSIU6adNZWX0ewSubWPXvrWea5cI2
yKDdMcDqB8Sc9J4JR2L9zW8NqPQuaxfLQbkCt2tg9QjlClrAqQgb8OZQJgY9f1T/
kBlVXoA4ZUZeifvjSKxQ/3TdRFP+jbV9xsb6sr14zTx+Wcoqtgsh3l9F4+T3V2m8
/c/iS4mFlK31pJtwYyrJAq9hpggqymdCVi0Pa3yLZsEj3orBPaPWbmq2v7xeF3J8
y8vqAkt3M3T6251aZAKEcaN5RXYJW70CTseadwp0tmrAL2nIVmziNCMOF+Bufyxi
HddkasTcNX8VYfPCLWqBwrocx8d3n3E7dBGeS2x2iwuRVQ85pH5d+imxaMftcbqm
YrNuiqcI/0XDGk9pS6f1gpu5Eh5Q2QXGmOoRlfosfkAEfgFxfaMvmcu5Ay1s0gSR
MsTn0PrQyMYC3t3KpyP47C8ui9x7FtJFltR/QT4yzBF1QyDmINnK86ldQqSui402
2+gQFt7YFvLIBUiy1fh1Jw==
=UITq
-----END PGP SIGNATURE-----
```

8
depends/hosts/darwin.mk

@ -1,9 +1,9 @@
OSX_MIN_VERSION=10.8
OSX_SDK_VERSION=10.11
OSX_MIN_VERSION=10.12
OSX_SDK_VERSION=10.12
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=253.9
darwin_CC=gcc-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=g++-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)

121
qa/rpc-tests/cryptoconditions_oracles.py

@ -3,7 +3,6 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import CryptoconditionsTestFramework
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, assert_greater_than, \
@ -11,13 +10,11 @@ from test_framework.util import assert_equal, assert_greater_than, \
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
from cryptoconditions import assert_success, assert_error, generate_random_string
class CryptoconditionsOraclesTest(CryptoconditionsTestFramework):
def run_oracles_tests(self):
rpc = self.nodes[0]
rpc1 = self.nodes[1]
result = rpc1.oraclesaddress()
result = rpc.oraclesaddress()
@ -54,159 +51,197 @@ class CryptoconditionsOraclesTest(CryptoconditionsTestFramework):
too_long_description = generate_random_string(4100)
result = rpc.oraclescreate("Test", too_long_description, "s")
assert_error(result)
# need uxtos to create oracle? Crashes if without generate
rpc.generate(2)
# valid creating oracles of different types
# using such naming to re-use it for data publishing / reading (e.g. oracle_s for s type)
valid_formats = ["s", "S", "d", "D", "c", "C", "t", "T", "i", "I", "l", "L", "h", "Ihh"]
for f in valid_formats:
result = rpc.oraclescreate("Test", "Test", f)
result = rpc.oraclescreate("Test_"+f, "Test_"+f, f)
assert_success(result)
globals()["oracle_{}".format(f)] = self.send_and_mine(result['hex'], rpc)
# trying to register with negative datafee
for f in valid_formats:
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "-100")
assert_error(result)
# trying to register with zero datafee
for f in valid_formats:
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "0")
assert_error(result)
# trying to register with datafee less than txfee
for f in valid_formats:
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "500")
assert_error(result)
# trying to register valid
for f in valid_formats:
# trying to register valid (unfunded)
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "10000")
assert_error(result)
# Fund the oracles
result = rpc.oraclesfund(globals()["oracle_{}".format(f)])
assert_success(result)
fund_txid = self.send_and_mine(result["hex"], rpc)
assert fund_txid, "got txid"
# trying to register valid (funded)
result = rpc.oraclesregister(globals()["oracle_{}".format(f)], "10000")
print(f)
assert_success(result)
register_txid = self.send_and_mine(result["hex"], rpc)
assert register_txid, "got txid"
# TODO: for most of the non valid oraclesregister and oraclessubscribe transactions generating and broadcasting now
# so trying only valid oraclessubscribe atm
for f in valid_formats:
result = rpc.oraclessubscribe(globals()["oracle_{}".format(f)], self.pubkey, "1")
assert_success(result)
subscribe_txid = self.send_and_mine(result["hex"], rpc)
assert register_txid, "got txid"
rpc.generate(1)
# now lets publish and read valid data for each oracle type
# s type
result = rpc.oraclesdata(globals()["oracle_{}".format("s")], "05416e746f6e")
assert_success(result)
# baton
oraclesdata_s = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("s")], oraclesdata_s, "1")
assert_equal("[u'Anton']", str(result["samples"][0]), "Data match")
oraclesdata_s = self.send_and_mine(result["hex"], rpc)
info = rpc.oraclesinfo(globals()["oracle_{}".format("s")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("s")], batonaddr, "1")
assert_equal("[u'Anton']", str(result["samples"][0]['data']), "Data match")
# S type
result = rpc.oraclesdata(globals()["oracle_{}".format("S")], "000161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161")
assert_success(result)
# baton
oraclesdata_S = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("S")], oraclesdata_S, "1")
assert_equal("[u'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("S")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("S")], batonaddr, "1")
assert_equal("[u'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']", str(result["samples"][0]['data']), "Data match")
# d type
result = rpc.oraclesdata(globals()["oracle_{}".format("d")], "0101")
assert_success(result)
# baton
oraclesdata_d = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("d")], oraclesdata_d, "1")
assert_equal("[u'01']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("d")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("d")], batonaddr, "1")
assert_equal("[u'01']", str(result["samples"][0]['data']), "Data match")
# D type
result = rpc.oraclesdata(globals()["oracle_{}".format("D")], "010001")
assert_success(result)
# baton
oraclesdata_D = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("D")], oraclesdata_D, "1")
assert_equal("[u'01']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("D")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("D")], batonaddr, "1")
assert_equal("[u'01']", str(result["samples"][0]['data']), "Data match")
# c type
result = rpc.oraclesdata(globals()["oracle_{}".format("c")], "ff")
assert_success(result)
# baton
oraclesdata_c = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("c")], oraclesdata_c, "1")
assert_equal("[u'-1']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("c")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("c")], batonaddr, "1")
assert_equal("[u'-1']", str(result["samples"][0]['data']), "Data match")
# C type
result = rpc.oraclesdata(globals()["oracle_{}".format("C")], "ff")
assert_success(result)
# baton
oraclesdata_C = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("C")], oraclesdata_C, "1")
assert_equal("[u'255']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("C")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("C")], batonaddr, "1")
assert_equal("[u'255']", str(result["samples"][0]['data']), "Data match")
# t type
result = rpc.oraclesdata(globals()["oracle_{}".format("t")], "ffff")
assert_success(result)
# baton
oraclesdata_t = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("t")], oraclesdata_t, "1")
assert_equal("[u'-1']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("t")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("t")], batonaddr, "1")
assert_equal("[u'-1']", str(result["samples"][0]['data']), "Data match")
# T type
result = rpc.oraclesdata(globals()["oracle_{}".format("T")], "ffff")
assert_success(result)
# baton
oraclesdata_T = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("T")], oraclesdata_T, "1")
assert_equal("[u'65535']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("T")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("T")], batonaddr, "1")
assert_equal("[u'65535']", str(result["samples"][0]['data']), "Data match")
# i type
result = rpc.oraclesdata(globals()["oracle_{}".format("i")], "ffffffff")
assert_success(result)
# baton
oraclesdata_i = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("i")], oraclesdata_i, "1")
assert_equal("[u'-1']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("i")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("i")], batonaddr, "1")
assert_equal("[u'-1']", str(result["samples"][0]['data']), "Data match")
# I type
result = rpc.oraclesdata(globals()["oracle_{}".format("I")], "ffffffff")
assert_success(result)
# baton
oraclesdata_I = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("I")], oraclesdata_I, "1")
assert_equal("[u'4294967295']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("I")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("I")], batonaddr, "1")
assert_equal("[u'4294967295']", str(result["samples"][0]['data']), "Data match")
# l type
result = rpc.oraclesdata(globals()["oracle_{}".format("l")], "00000000ffffffff")
assert_success(result)
# baton
oraclesdata_l = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("l")], oraclesdata_l, "1")
# TODO: working not correct now!
#assert_equal("[u'-4294967296']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("l")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("l")], batonaddr, "1")
assert_equal("[u'-4294967296']", str(result["samples"][0]['data']), "Data match")
# L type
result = rpc.oraclesdata(globals()["oracle_{}".format("L")], "00000000ffffffff")
assert_success(result)
# baton
oraclesdata_L = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("L")], oraclesdata_L, "1")
assert_equal("[u'18446744069414584320']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("L")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("L")], batonaddr, "1")
assert_equal("[u'18446744069414584320']", str(result["samples"][0]['data']), "Data match")
# h type
result = rpc.oraclesdata(globals()["oracle_{}".format("h")], "00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff")
assert_success(result)
# baton
oraclesdata_h = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("h")], oraclesdata_h, "1")
assert_equal("[u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("h")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("h")], batonaddr, "1")
assert_equal("[u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]['data']), "Data match")
# Ihh type
result = rpc.oraclesdata(globals()["oracle_{}".format("Ihh")], "ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff")
assert_success(result)
# baton
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], oraclesdata_Ihh, "1")
assert_equal("[u'4294967295', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]), "Data match")
info = rpc.oraclesinfo(globals()["oracle_{}".format("Ihh")])
batonaddr = info['registered'][0]['baton']
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], batonaddr, "1")
print(result)
assert_equal("[u'4294967295', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000', u'ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000']", str(result["samples"][0]['data']), "Data match")
def run_test(self):
print("Mining blocks...")

4
src/cc/CCOracles.h

@ -21,12 +21,12 @@
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format);
std::string OracleFund(int64_t txfee,uint256 oracletxid);
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee);
std::string OracleSubscribe(int64_t txfee,uint256 oracletxid,CPubKey publisher,int64_t amount);
std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> data);
// CCcustom
UniValue OracleDataSamples(uint256 reforacletxid,uint256 batontxid,int32_t num);
UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num);
UniValue OracleInfo(uint256 origtxid);
UniValue OraclesList();

2
src/cc/CCinclude.h

@ -59,6 +59,8 @@ one other technical note is that komodod has the insight-explorer extensions bui
#define SMALLVAL 0.000000000000001
#define SATOSHIDEN ((uint64_t)100000000L)
#define dstr(x) ((double)(x) / SATOSHIDEN)
#define CCDISABLEALL memset(ASSETCHAINS_CCDISABLES,1,sizeof(ASSETCHAINS_CCDISABLES))
#define CCENABLE(x) ASSETCHAINS_CCDISABLES[((uint8_t)x)] = 0
#ifndef _BITS256
#define _BITS256

38
src/cc/Makefile_custom

@ -0,0 +1,38 @@
SHELL = /bin/sh
CC = gcc
CC_DARWIN = g++-8
CC_WIN = x86_64-w64-mingw32-gcc-posix
CFLAGS_DARWIN = -DBUILD_CUSTOMCC -std=c++11 -arch x86_64 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
CFLAGS = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
CFLAGS_WIN = -Wno-write-strings -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../../depends/x86_64-w64-mingw32/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
DEBUGFLAGS = -O0 -D _DEBUG
RELEASEFLAGS = -O2 -D NDEBUG -combine -fwhole-program
$(info $(OS))
OS := $(shell uname -s)
$(info $(OS))
TARGET = customcc.so
TARGET_DARWIN = customcc.dylib
TARGET_WIN = customcc.dll
SOURCES = cclib.cpp
#HEADERS = $(shell echo ../cryptoconditions/include/*.h) -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/
all: $(TARGET)
$(TARGET): $(SOURCES)
$(info Building cclib to src/)
ifeq ($(OS),Darwin)
$(CC_DARWIN) $(CFLAGS_DARWIN) $(DEBUGFLAGS) -o $(TARGET_DARWIN) -c $(SOURCES)
cp $(TARGET_DARWIN) ../libcc.dylib
else ifeq ($(HOST),x86_64-w64-mingw32)
$(info WINDOWS)
$(CC_WIN) $(CFLAGS_WIN) $(DEBUGFLAGS) -o $(TARGET_WIN) -c $(SOURCES)
cp $(TARGET_WIN) ../libcc.dll
#else ifeq ($(WIN_HOST),True) - todo: pass ENV var from build.sh if WIN host
else
$(info LINUX)
$(CC) $(CFLAGS) $(DEBUGFLAGS) -o $(TARGET) -c $(SOURCES)
cp $(TARGET) ../libcc.so
endif
clean:
rm -rf $(TARGET)

4
src/cc/Makefile_rogue

@ -1,6 +1,6 @@
SHELL = /bin/sh
CC = gcc
CC_DARWIN = g++-6
CC_DARWIN = g++-8
CC_WIN = x86_64-w64-mingw32-gcc-posix
CFLAGS_DARWIN = -DBUILD_ROGUE -std=c++11 -arch x86_64 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -Wl,-undefined -Wl,dynamic_lookup -Wno-write-strings -shared -dynamiclib
CFLAGS = -Wno-write-strings -DBUILD_ROGUE -std=c++11 -I../../depends/$(shell echo `../..//depends/config.guess`/include) -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared
@ -14,7 +14,7 @@ TARGET = librogue.so
TARGET_DARWIN = librogue.dylib
TARGET_WIN = librogue.dll
SOURCES = cclib.cpp
#HEADERS = $(shell echo ../cryptoconditions/include/*.h) -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/
#HEADERS = $(shell echo ../cryptoconditions/include/*.h) -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/
all: $(TARGET)

4
src/cc/crypto777/OS_portable.h

@ -309,8 +309,8 @@ char *uppercase_str(char *buf,char *str);
char *lowercase_str(char *buf,char *str);
int32_t strsearch(char *strs[],int32_t num,char *name);
int32_t OS_getline(int32_t waitflag,char *line,int32_t max,char *dispstr);
int32_t sort64s(uint64_t *buf,uint32_t num,int32_t size);
int32_t revsort64s(uint64_t *buf,uint32_t num,int32_t size);
void sort64s(uint64_t *buf,uint32_t num,int32_t size);
void revsort64s(uint64_t *buf,uint32_t num,int32_t size);
int decode_base32(uint8_t *token,uint8_t *tokenstr,int32_t len);
int init_base32(char *tokenstr,uint8_t *token,int32_t len);
char *OS_mvstr();

500
src/cc/dapps/zmigrate.c

@ -315,6 +315,8 @@ cJSON *get_komodocli(char *refcoin,char **retstrp,char *acname,char *method,char
{
long fsize; cJSON *retjson = 0; char cmdstr[32768],*jsonstr,fname[256];
sprintf(fname,"/tmp/zmigrate.%s",method);
//if ( (acname == 0 || acname[0] == 0) && strcmp(refcoin,"KMD") != 0 )
// acname = refcoin;
if ( acname[0] != 0 )
{
if ( refcoin[0] != 0 && strcmp(refcoin,"KMD") != 0 )
@ -938,7 +940,505 @@ int32_t have_pending_opid(char *coinstr,int32_t clearresults)
return(pending);
}
int64_t utxo_value(char *refcoin,char *srcaddr,bits256 txid,int32_t v)
{
cJSON *txjson,*vouts,*vout,*sobj,*array; int32_t numvouts,numaddrs; int64_t val,value = 0; char *addr,str[65];
srcaddr[0] = 0;
if ( (txjson= get_rawtransaction(refcoin,"",txid)) != 0 )
{
if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && v < numvouts )
{
vout = jitem(vouts,v);
if ( (val= jdouble(vout,"value")*SATOSHIDEN) != 0 && (sobj= jobj(vout,"scriptPubKey")) != 0 )
{
if ( (array= jarray(&numaddrs,sobj,"addresses")) != 0 && numaddrs == 1 && (addr= jstri(array,0)) != 0 && strlen(addr) < 64 )
{
strcpy(srcaddr,addr);
value = val;
} else printf("couldnt get unique address for %s/%d\n",bits256_str(str,txid),v);
} else printf("error getting value for %s/v%d\n",bits256_str(str,txid),v);
}
}
return(value);
}
int32_t verify_vin(char *refcoin,bits256 txid,int32_t v,char *cmpaddr)
{
cJSON *txjson,*vins,*vin; int32_t numvins; char vinaddr[64],str[65];
vinaddr[0] = 0;
if ( (txjson= get_rawtransaction(refcoin,"",txid)) != 0 )
{
if ( (vins= jarray(&numvins,txjson,"vin")) != 0 && v < numvins )
{
vin = jitem(vins,v);
if ( utxo_value(refcoin,vinaddr,jbits256(vin,"txid"),jint(vin,"vout")) > 0 && strcmp(vinaddr,cmpaddr) == 0 )
return(0);
printf("mismatched vinaddr.(%s) vs %s\n",vinaddr,cmpaddr);
}
}
return(-1);
}
int32_t txid_in_vins(char *refcoin,bits256 txid,bits256 cmptxid)
{
cJSON *txjson,*vins,*vin; int32_t numvins,v,vinvout; bits256 vintxid; char str[65];
if ( (txjson= get_rawtransaction(refcoin,"",txid)) != 0 )
{
if ( (vins= jarray(&numvins,txjson,"vin")) != 0 )
{
for (v=0; v<numvins; v++)
{
vin = jitem(vins,v);
vintxid = jbits256(vin,"txid");
vinvout = jint(vin,"vout");
if ( memcmp(&vintxid,&cmptxid,sizeof(vintxid)) == 0 && vinvout == 0 )
{
return(0);
}
}
}
}
return(-1);
}
void genpayout(char *coinstr,char *destaddr,int32_t amount)
{
char cmd[1024];
sprintf(cmd,"curl -s --url \"http://127.0.0.1:7783\" --data \"{\\\"userpass\\\":\\\"$userpass\\\",\\\"method\\\":\\\"withdraw\\\",\\\"coin\\\":\\\"%s\\\",\\\"outputs\\\":[{\\\"%s\\\":%.8f},{\\\"RWXL82m4xnBTg1kk6PuS2xekonu7oEeiJG\\\":0.0002}],\\\"broadcast\\\":1}\"\nsleep 3\n",coinstr,destaddr,dstr(amount+20000));
printf("%s",cmd);
}
bits256 SECONDVIN; int32_t SECONDVOUT;
void genrefund(char *cmd,char *coinstr,bits256 vintxid,char *destaddr,int64_t amount)
{
char str[65],str2[65];
sprintf(cmd,"curl -s --url \"http://127.0.0.1:7783\" --data \"{\\\"userpass\\\":\\\"$userpass\\\",\\\"method\\\":\\\"withdraw\\\",\\\"coin\\\":\\\"%s\\\",\\\"onevin\\\":2,\\\"utxotxid\\\":\\\"%s\\\",\\\"utxovout\\\":1,\\\"utxotxid2\\\":\\\"%s\\\",\\\"utxovout2\\\":%d,\\\"outputs\\\":[{\\\"%s\\\":%.8f}],\\\"broadcast\\\":1}\"\nsleep 3\n",coinstr,bits256_str(str,vintxid),bits256_str(str2,SECONDVIN),SECONDVOUT,destaddr,dstr(amount));
system(cmd);
}
struct addritem
{
int64_t total,numutxos;
char addr[64];
} ADDRESSES[1200];
struct claimitem
{
bits256 txid;
int64_t total,refundvalue;
int32_t numutxos,disputed,approved;
char oldaddr[64],destaddr[64],username[64];
} CLAIMS[10000];
int32_t NUM_ADDRESSES,NUM_CLAIMS;
int32_t itemvalid(char *refcoin,int64_t *refundedp,int64_t *waitingp,struct claimitem *item)
{
cJSON *curljson,*txids; int32_t i,numtxids; char str[65],str2[65],url[1000],*retstr; bits256 txid;
*refundedp = *waitingp = 0;
if ( item->refundvalue < 0 )
return(-1);
sprintf(url,"https://kmd.explorer.dexstats.info/insight-api-komodo/addr/%s",item->destaddr);
if ( (retstr= send_curl(url,"/tmp/itemvalid")) != 0 )
{
if ( (curljson= cJSON_Parse(retstr)) != 0 )
{
if ( (txids= jarray(&numtxids,curljson,"transactions")) != 0 )
{
for (i=0; i<numtxids; i++)
{
txid = jbits256i(txids,i);
if ( txid_in_vins(refcoin,txid,item->txid) == 0 )
{
printf("found item->txid %s inside %s\n",bits256_str(str,item->txid),bits256_str(str2,txid));
item->approved = 1;
break;
}
}
}
free_json(curljson);
}
//printf("%s\n",retstr);
free(retstr);
}
if ( item->approved != 0 )
return(1);
*waitingp = item->refundvalue;
return(-1);
}
void scan_claims(int32_t issueflag,char *refcoin,int32_t batchid)
{
char str[65]; int32_t i,num,numstolen=0,numcandidates=0,numinvalids=0,numrefunded=0,numwaiting=0; struct claimitem *item; int64_t batchmin,batchmax,waiting,refunded,possiblerefund=0,possiblestolen = 0,invalidsum=0,totalrefunded=0,waitingsum=0;
if ( batchid == 0 )
{
batchmin = 0;
batchmax = 7 * SATOSHIDEN;
}
else if ( batchid == 1 )
{
batchmin = 7 * SATOSHIDEN;
batchmax = 777 * SATOSHIDEN;
}
else if ( batchid == 2 )
{
batchmin = 1;//777 * SATOSHIDEN;
batchmax = 77777 * SATOSHIDEN;
}
else if ( batchid == 3 )
{
batchmin = 77777 * SATOSHIDEN;
batchmax = 1000000 * SATOSHIDEN;
}
for (i=0; i<NUM_CLAIMS; i++)
{
item = &CLAIMS[i];
if ( item->refundvalue < batchmin || item->refundvalue >= batchmax )
continue;
if ( itemvalid(refcoin,&refunded,&waiting,item) < 0 )
{
if ( refunded != 0 )
{
numrefunded++;
totalrefunded += refunded;
}
else if ( waiting != 0 )
{
numwaiting++;
waitingsum += waiting;
}
else
{
invalidsum += item->refundvalue;
numinvalids++;
}
continue;
}
if ( item->total > item->refundvalue*1.1 + 10*SATOSHIDEN )
{
printf("possible.%d stolen %s %.8f vs refund %.8f -> %.8f\n",batchid,item->oldaddr,dstr(item->total),dstr(item->refundvalue),dstr(item->total)-dstr(item->refundvalue));
numstolen++;
possiblestolen += (item->total - item->refundvalue);
item->approved = 0;
}
else
{
printf("candidate.%d %s %.8f vs refund %.8f -> %s\n",batchid,item->oldaddr,dstr(item->total),dstr(item->refundvalue),item->destaddr);
numcandidates++;
possiblerefund += item->refundvalue;
}
}
printf("batchid.%d TOTAL exposure %d %.8f, possible refund %d %.8f, invalids %d %.8f, numrefunded %d %.8f, waiting %d %.8f\n",batchid,numstolen,dstr(possiblestolen),numcandidates,dstr(possiblerefund),numinvalids,dstr(invalidsum),numrefunded,dstr(totalrefunded),numwaiting,dstr(waitingsum));
for (i=num=0; i<NUM_CLAIMS; i++)
{
item = &CLAIMS[i];
if ( item->approved != 0 )
{
printf("%d.%d: approved.%d %s %.8f vs refund %.8f -> %s\n",i,num,batchid,item->oldaddr,dstr(item->total),dstr(item->refundvalue),item->destaddr);
num++;
if ( issueflag != 0 )
{
static FILE *fp; char cmd[1024];
if ( fp == 0 )
fp = fopen("refund.log","wb");
genrefund(cmd,refcoin,item->txid,item->destaddr,item->refundvalue);
if ( fp != 0 )
{
fprintf(fp,"%s,%s,%s,%s,%s,%.8f,%s\n",item->username,refcoin,bits256_str(str,item->txid),item->oldaddr,item->destaddr,dstr(item->refundvalue),cmd);
fflush(fp);
}
memset(&SECONDVIN,0,sizeof(SECONDVIN));
SECONDVOUT = 1;
//printf(">>>>>>>>>>>>>>>>>> getchar after (%s)\n",cmd);
//getchar();
}
}
}
}
int32_t update_claimvalue(int32_t *disputedp,char *addr,int64_t amount,bits256 txid)
{
int32_t i; struct claimitem *item;
*disputedp = 0;
for (i=0; i<NUM_CLAIMS; i++)
{
if ( strcmp(addr,CLAIMS[i].oldaddr) == 0 )
{
item = &CLAIMS[i];
item->refundvalue = amount;
if ( bits256_nonz(item->txid) != 0 )
printf("disputed.%d %s claimed %.8f vs %.8f\n",item->disputed,addr,dstr(item->total),dstr(amount));
item->txid = txid;
if ( item->disputed != 0 )
*disputedp = 1;
return(i);
}
}
return(-1);
}
int64_t update_claimstats(char *username,char *oldaddr,char *destaddr,int64_t amount)
{
int32_t i; struct claimitem *item;
for (i=0; i<NUM_CLAIMS; i++)
{
if ( strcmp(oldaddr,CLAIMS[i].oldaddr) == 0 )
{
item = &CLAIMS[i];
if ( strcmp(destaddr,item->destaddr) != 0 )//|| strcmp(username,item->username) != 0 )
{
item->disputed++;
printf("disputed.%d claim.%-4d: (%36s -> %36s %s) vs. (%36s -> %36s %s) \n",item->disputed,i,oldaddr,destaddr,username,item->oldaddr,item->destaddr,item->username);
}
item->numutxos++;
item->total += amount;
return(amount);
}
}
item = &CLAIMS[NUM_CLAIMS++];
item->total = amount;
item->numutxos = 1;
strncpy(item->oldaddr,oldaddr,sizeof(item->oldaddr));
strncpy(item->destaddr,destaddr,sizeof(item->destaddr));
strncpy(item->username,username,sizeof(item->username));
printf("new claim.%-4d: %36s %16.8f -> %36s %s\n",NUM_CLAIMS,oldaddr,dstr(amount),destaddr,username);
return(amount);
}
int32_t update_addrstats(char *srcaddr,int64_t amount)
{
int32_t i; struct addritem *item;
for (i=0; i<NUM_ADDRESSES; i++)
{
if ( strcmp(srcaddr,ADDRESSES[i].addr) == 0 )
{
ADDRESSES[i].numutxos++;
ADDRESSES[i].total += amount;
return(i);
}
}
item = &ADDRESSES[NUM_ADDRESSES++];
item->total = amount;
item->numutxos = 1;
strcpy(item->addr,srcaddr);
printf("%d new address %s\n",NUM_ADDRESSES,srcaddr);
return(-1);
}
int64_t sum_of_vins(char *refcoin,int32_t *totalvinsp,int32_t *uniqaddrsp,bits256 txid)
{
cJSON *txjson,*vins,*vin; char str[65],srcaddr[64]; int32_t i,numarray; int64_t amount,total = 0;
if ( (txjson= get_rawtransaction(refcoin,"",txid)) != 0 )
{
if ( (vins= jarray(&numarray,txjson,"vin")) != 0)
{
for (i=0; i<numarray; i++)
{
if ( (vin= jitem(vins,i)) != 0 )
{
if ( (amount= utxo_value(refcoin,srcaddr,jbits256(vin,"txid"),jint(vin,"vout"))) == 0 )
printf("error getting value from %s/v%d\n",bits256_str(str,jbits256(vin,"txid")),jint(vin,"vout"));
else
{
if ( update_addrstats(srcaddr,amount) < 0 )
(*uniqaddrsp)++;
//printf("add %s <- %.8f\n",srcaddr,dstr(amount));
total += amount;
(*totalvinsp)++;
}
}
}
}
}
if ( total == 0 )
printf("sum_of_vins error %s\n",bits256_str(str,txid));
return(total);
}
void reconcile_claims(char *fname)
{
FILE *fp; double amount; int32_t i,n,numlines = 0; char buf[1024],fields[16][256],*str; int64_t total = 0;
if ( (fp= fopen(fname,"rb")) != 0 )
{
while ( fgets(buf,sizeof(buf),fp) > 0 )
{
//printf("%d.(%s)\n",numlines,buf);
str = buf;
n = i = 0;
memset(fields,0,sizeof(fields));
while ( *str != 0 )
{
if ( *str == ',' || *str == '\n' || *str == '\r' )
{
fields[n][i] = 0;
i = 0;
if ( n > 1 )
{
//printf("(%16s) ",fields[n]);
}
n++;
if ( *str == '\n' || *str == '\r' )
break;
}
if ( *str == ',' || *str == ' ' )
str++;
else fields[n][i++] = *str++;
}
//printf("%s\n",fields[0]);
total += update_claimstats(fields[1],fields[3],fields[6],atof(fields[4])*SATOSHIDEN + 0.0000000049);
numlines++;
}
fclose(fp);
}
printf("total claims %.8f\n",dstr(total));
}
int32_t main(int32_t argc,char **argv)
{
char *coinstr,*acstr,*addr,buf[64],srcaddr[64],str[65]; cJSON *retjson,*item; int32_t i,n,disputed,numdisputed,numsmall=0,numpayouts=0,numclaims=0,num=0,totalvins=0,uniqaddrs=0; int64_t amount,total = 0,total2 = 0,payout,maxpayout,smallpayout=0,totalpayout = 0,totaldisputed = 0,totaldisputed2 = 0,fundingamount = 0;
if ( argc != 2 )
{
printf("argc needs to be 2: <prog> coin\n");
return(-1);
}
if ( strcmp(argv[1],"KMD") == 0 )
{
REFCOIN_CLI = "./komodo-cli";
coinstr = clonestr("KMD");
acstr = "";
}
else if ( strcmp(argv[1],"CHIPS") == 0 )
{
REFCOIN_CLI = "./chips-cli";
coinstr = clonestr("CHIPS");
acstr = "";
}
else
{
sprintf(buf,"./komodo-cli -ac_name=%s",argv[1]);
REFCOIN_CLI = clonestr(buf);
coinstr = clonestr(argv[1]);
acstr = coinstr;
}
if ( 1 )//strcmp(coinstr,"KMD") == 0 )
{
sprintf(buf,"%s-Claims.csv",coinstr);
reconcile_claims(buf);
for (i=0; i<NUM_CLAIMS; i++)
{
if ( CLAIMS[i].disputed != 0 )
{
totaldisputed += CLAIMS[i].total;
printf("disputed %s %.8f\n",CLAIMS[i].oldaddr,dstr(CLAIMS[i].total));
}
}
printf("total disputed %.8f\n",dstr(totaldisputed));
totaldisputed2 = 0;
if ( (retjson= get_listunspent(coinstr,acstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(retjson)) > 0 )
{
for (i=0; i<n; i++)
{
item = jitem(retjson,i);
amount = jdouble(item,"amount")*SATOSHIDEN;
if ( (addr= jstr(item,"address")) != 0 && strcmp(addr,"RWXL82m4xnBTg1kk6PuS2xekonu7oEeiJG") == 0 )
{
if ( amount != 20000 )
{
if ( amount > fundingamount )
{
fundingamount = amount;
SECONDVIN = jbits256(item,"txid");
SECONDVOUT = jint(item,"vout");
printf("set SECONDVIN to %s/v%d %.8f\n",bits256_str(str,SECONDVIN),SECONDVOUT,dstr(amount));
}
continue;
}
if ( strcmp(coinstr,"KMD") == 0 && verify_vin(coinstr,jbits256(item,"txid"),0,"R9JCEd6xnCxNUSpLrHEWvzPSh7CNXm7z75") < 0 )
{
printf("WARNING: imposter dust detected! %s\n",bits256_str(str,jbits256(item,"txid")));
continue;
}
else if ( strcmp(coinstr,"KMD") != 0 && verify_vin(coinstr,jbits256(item,"txid"),0,"R9MUnxXijovvSeT9sFuUX23TiFtVvZEGjT") < 0 )
{
printf("WARNING: imposter dust detected! %s\n",bits256_str(str,jbits256(item,"txid")));
continue;
}
amount = (utxo_value(coinstr,srcaddr,jbits256(item,"txid"),0) - 20000) * SATOSHIDEN;
//printf("%d: %s claimvalue %.8f\n",num,srcaddr,dstr(amount));
num++;
total2 += amount;
if ( update_claimvalue(&disputed,srcaddr,amount,jbits256(item,"txid")) >= 0 )
{
if ( disputed != 0 )
{
totaldisputed2 += amount;
numdisputed++;
}
else
{
numclaims++;
total += amount;
}
}
}
}
}
free_json(retjson);
printf("remaining refunds.%d %.8f, numclaims.%d %.8f, numdisputed.%d %.8f\n",num,dstr(total2),numclaims,dstr(total),numdisputed,dstr(totaldisputed2));
}
//scan_claims(0,coinstr,0);
//scan_claims(0,coinstr,1);
scan_claims(0,coinstr,2);
//scan_claims(0,coinstr,3);
}
else if ( (retjson= get_listunspent(coinstr,acstr)) != 0 )
{
if ( (n= cJSON_GetArraySize(retjson)) > 0 )
{
for (i=0; i<n; i++)
{
item = jitem(retjson,i);
if ( (addr= jstr(item,"address")) != 0 && strcmp(addr,"RSgD2cmm3niFRu2kwwtrEHoHMywJdkbkeF") == 0 )
{
if ( (amount= jdouble(item,"amount")*SATOSHIDEN) != 0 )
{
num++;
total += amount;
total2 += sum_of_vins(coinstr,&totalvins,&uniqaddrs,jbits256(item,"txid"));
}
}
}
}
free_json(retjson);
maxpayout = 0;
for (i=0; i<NUM_ADDRESSES; i++)
{
if ( ADDRESSES[i].total >= SATOSHIDEN )
{
payout = ADDRESSES[i].total / SATOSHIDEN;
if ( payout > maxpayout )
maxpayout = payout;
totalpayout += payout;
numpayouts++;
//if ( payout >= 7 )
//{
// numsmall++;
//smallpayout += payout;
genpayout(coinstr,ADDRESSES[i].addr,payout);
//}
//printf("%-4d: %-64s numutxos.%-4lld %llu\n",i,ADDRESSES[i].addr,ADDRESSES[i].numutxos,(long long)payout);
}
}
printf("num.%d total %.8f vs vintotal %.8f, totalvins.%d uniqaddrs.%d:%d totalpayout %llu maxpayout %llu numpayouts.%d numsmall.%d %llu\n",num,dstr(total),dstr(total2),totalvins,uniqaddrs,NUM_ADDRESSES,(long long)totalpayout,(long long)maxpayout,numpayouts,numsmall,(long long)smallpayout);
}
}
int32_t zmigratemain(int32_t argc,char **argv)
{
char buf[1024],*zsaddr,*coinstr;
if ( argc != 3 )

9
src/cc/eval.cpp

@ -78,8 +78,13 @@ bool Eval::Dispatch(const CC *cond, const CTransaction &txTo, unsigned int nIn)
uint8_t ecode = cond->code[0];
if ( ASSETCHAINS_CCDISABLES[ecode] != 0 )
{
fprintf(stderr,"%s evalcode.%d %02x\n",txTo.GetHash().GetHex().c_str(),ecode,ecode);
return Invalid("disabled-code, -ac_ccenables didnt include this ecode");
// check if a height activation has been set.
if ( mapHeightEvalActivate[ecode] == 0 || this->GetCurrentHeight() == 0 || mapHeightEvalActivate[ecode] > this->GetCurrentHeight() )
{
fprintf(stderr,"%s evalcode.%d %02x\n",txTo.GetHash().GetHex().c_str(),ecode,ecode);
fprintf(stderr, "ac_ccactivateht: evalcode.%i activates at height.%i vs current height.%i\n", ecode, mapHeightEvalActivate[ecode], this->GetCurrentHeight());
return Invalid("disabled-code, -ac_ccenables didnt include this ecode");
}
}
std::vector<uint8_t> vparams(cond->code+1, cond->code+cond->codeLength);
if ( ecode >= EVAL_FIRSTUSER && ecode <= EVAL_LASTUSER )

2
src/cc/makecclib

@ -7,8 +7,6 @@ make -f Makefile_rogue
rm ../libcc.so
cp librogue.so ../libcc.so
#exit 0
echo sudoku/musig/dilithium
gcc -O3 -std=c++11 -I../secp256k1/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared -c -o sudokucc.so cclib.cpp

11
src/cc/makecustom

@ -1,6 +1,7 @@
#!/bin/sh
gcc -O3 -DBUILD_CUSTOMCC -std=c++11 -I../secp256k1/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared -c -o customcc.so cclib.cpp
cp customcc.so ../libcc.so
cd ..
make
cd cc
if make -f Makefile_custom "$@"; then
echo CUSTOMCC BUILD SUCCESSFUL
else
echo CUSTOMCC BUILD FAILED
exit 1
fi

243
src/cc/oracles.cpp

@ -92,10 +92,11 @@
vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format
*/
extern int32_t komodo_currentheight();
#define PUBKEY_SPOOFING_FIX_ACTIVATION 1563148800
#define CC_MARKER_VALUE 10000
// start of consensus code
CScript EncodeOraclesCreateOpRet(uint8_t funcid,std::string name,std::string description,std::string format)
{
CScript opret; uint8_t evalcode = EVAL_ORACLES;
@ -124,6 +125,7 @@ uint8_t DecodeOraclesCreateOpRet(const CScript &scriptPubKey,std::string &name,s
CScript EncodeOraclesOpRet(uint8_t funcid,uint256 oracletxid,CPubKey pk,int64_t num)
{
CScript opret; uint8_t evalcode = EVAL_ORACLES;
opret << OP_RETURN << E_MARSHAL(ss << evalcode << funcid << oracletxid << pk << num);
return(opret);
}
@ -131,11 +133,12 @@ CScript EncodeOraclesOpRet(uint8_t funcid,uint256 oracletxid,CPubKey pk,int64_t
uint8_t DecodeOraclesOpRet(const CScript &scriptPubKey,uint256 &oracletxid,CPubKey &pk,int64_t &num)
{
std::vector<uint8_t> vopret; uint8_t *script,e,f;
GetOpReturnData(scriptPubKey,vopret);
script = (uint8_t *)vopret.data();
if ( vopret.size() > 2 && script[0] == EVAL_ORACLES )
{
if (script[0] == EVAL_ORACLES && (script[1]== 'R' || script[1] == 'S') && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> oracletxid; ss >> pk; ss >> num)!=0)
if (script[0] == EVAL_ORACLES && (script[1]== 'R' || script[1] == 'S' || script[1] == 'F') && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> oracletxid; ss >> pk; ss >> num)!=0)
return(f);
else return(script[1]);
}
@ -633,9 +636,21 @@ bool OraclesDataValidate(struct CCcontract_info *cp,Eval* eval,const CTransactio
else return(true);
}
int32_t GetLatestTimestamp(int32_t height)
{
uint256 blockHash; CBlock block; CBlockIndex* pindex;
blockHash = chainActive[height]->GetBlockHash();
pindex = mapBlockIndex[blockHash];
return(pindex->nTime);
}
bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
{
uint256 txid,oracletxid,batontxid; uint64_t txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts; uint8_t *script; std::vector<uint8_t> vopret,data; CScript scriptPubKey; CPubKey publisher;
uint256 oracletxid,batontxid; uint64_t txfee=10000; int32_t numvins,numvouts,preventCCvins,preventCCvouts; int64_t amount; uint256 hashblock;
uint8_t *script; std::vector<uint8_t> vopret,data; CPubKey publisher,tmppk,oraclespk; char tmpaddress[64],vinaddress[64],oraclesaddr[64];
CTransaction tmptx; std::string name,desc,format;
numvins = tx.vin.size();
numvouts = tx.vout.size();
preventCCvins = preventCCvouts = -1;
@ -643,10 +658,11 @@ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
return eval->Invalid("no vouts");
else
{
txid = tx.GetHash();
GetOpReturnData(tx.vout[numvouts-1].scriptPubKey,vopret);
if ( vopret.size() > 2 )
{
{
oraclespk=GetUnspendable(cp,0);
Getscriptaddress(oraclesaddr,CScript() << ParseHex(HexStr(oraclespk)) << OP_CHECKSIG);
script = (uint8_t *)vopret.data();
switch ( script[1] )
{
@ -657,13 +673,45 @@ bool OraclesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
// vout.n-1: opreturn with name and description and format for data
return eval->Invalid("unexpected OraclesValidate for create");
break;
case 'R': // register
case 'F': // fund (activation on Jul 15th 2019 00:00)
// vins.*: normal inputs
// vout.0: txfee to oracle CC address of users pubkey
// vout.1: change, if any
// vout.n-1: opreturn with createtxid, pubkey and amount
return eval->Invalid("unexpected OraclesValidate for create");
break;
case 'R': // register
// vin.0: normal inputs
// vin.n-1: CC input from pubkeys oracle CC addres - to prove that register came from pubkey that is registred (activation on Jul 15th 2019 00:00)
// vout.0: txfee tag to normal marker address
// vout.1: baton CC utxo
// vout.2: change, if any
// vout.2: marker from oraclesfund tx to normal pubkey address (activation on Jul 15th 2019 00:00)
// vout.n-2: change, if any
// vout.n-1: opreturn with createtxid, pubkey and price per data point
return eval->Invalid("unexpected OraclesValidate for register");
if (GetLatestTimestamp(eval->GetCurrentHeight())>PUBKEY_SPOOFING_FIX_ACTIVATION)
{
if ((numvouts=tx.vout.size()) < 1 || DecodeOraclesOpRet(tx.vout[numvouts-1].scriptPubKey,oracletxid,tmppk,amount)!='R')
return eval->Invalid("invalid oraclesregister OP_RETURN data!");
else if (myGetTransaction(oracletxid,tmptx,hashblock) == 0)
return eval->Invalid("invalid oraclescreate txid!");
else if ((numvouts=tmptx.vout.size()) < 1 || DecodeOraclesCreateOpRet(tmptx.vout[numvouts-1].scriptPubKey,name,desc,format)!='C')
return eval->Invalid("invalid oraclescreate OP_RETURN data!");
else if ( IsCCInput(tmptx.vin[0].scriptSig) != 0 )
return eval->Invalid("vin.0 is normal for oraclescreate!");
else if (ConstrainVout(tmptx.vout[0],0,oraclesaddr,txfee)==0)
return eval->Invalid("invalid marker for oraclescreate!");
else if ( IsCCInput(tx.vin[0].scriptSig) != 0 )
return eval->Invalid("vin.0 is normal for oraclesregister!");
else if ((*cp->ismyvin)(tx.vin[tx.vin.size()-1].scriptSig) == 0 || myGetTransaction(tx.vin[tx.vin.size()-1].prevout.hash,tmptx,hashblock)==0
|| tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].nValue!=CC_MARKER_VALUE || !Getscriptaddress(vinaddress,tmptx.vout[tx.vin[tx.vin.size()-1].prevout.n].scriptPubKey)
|| !GetCCaddress(cp,tmpaddress,tmppk) || strcmp(tmpaddress,vinaddress)!=0)
return eval->Invalid("vin."+std::to_string(tx.vin.size()-1)+" is CC for oraclesregister or pubkey not same as vin pubkey, register must be done from owner of pubkey that registers to oracle!!");
else if (CCtxidaddr(tmpaddress,oracletxid).IsValid() && ConstrainVout(tx.vout[0],0,tmpaddress,txfee)==0)
return eval->Invalid("invalid marker for oraclesregister!");
else if (!Getscriptaddress(tmpaddress,CScript() << ParseHex(HexStr(tmppk)) << OP_CHECKSIG) || ConstrainVout(tx.vout[2],0,tmpaddress,CC_MARKER_VALUE)==0)
return eval->Invalid("pubkey in OP_RETURN and in vout.2 not matching, register must be done from owner of pubkey that registers to oracle!");
}
else return eval->Invalid("unexpected OraclesValidate for register");
break;
case 'S': // subscribe
// vins.*: normal inputs
@ -762,6 +810,45 @@ int64_t LifetimeOraclesFunds(struct CCcontract_info *cp,uint256 oracletxid,CPubK
return(total);
}
int64_t AddMyOraclesFunds(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 oracletxid)
{
char coinaddr[64],funcid; int64_t nValue,tmpamount; uint256 tmporacletxid,txid,hashBlock,ignoretxid; int32_t numvouts,vout,ignorevin;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; CTransaction vintx; CPubKey tmppk;
GetCCaddress(cp,coinaddr,pk);
SetCCunspents(unspentOutputs,coinaddr,true);
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{
txid = it->first.txhash;
vout = (int32_t)it->first.index;
nValue = it->second.satoshis;
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts=vintx.vout.size())>0)
{
if ((funcid=DecodeOraclesOpRet(vintx.vout[numvouts-1].scriptPubKey,tmporacletxid,tmppk,tmpamount))!=0 && funcid=='F' && tmppk==pk
&& tmporacletxid==oracletxid && tmpamount==nValue && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout)==0)
{
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
return (nValue);
}
} else fprintf(stderr,"couldnt find transaction\n");
}
BOOST_FOREACH(const CTxMemPoolEntry &e, mempool.mapTx)
{
const CTransaction &txmempool = e.GetTx();
const uint256 &hash = txmempool.GetHash();
nValue=txmempool.vout[0].nValue;
if ((funcid=DecodeOraclesOpRet(txmempool.vout[txmempool.vout.size()-1].scriptPubKey,tmporacletxid,tmppk,tmpamount))!=0 && funcid=='F'
&& tmppk==pk && tmporacletxid==oracletxid && tmpamount==nValue && myIsutxo_spentinmempool(ignoretxid,ignorevin,hash,0)==0)
{
mtx.vin.push_back(CTxIn(hash,0,CScript()));
return (nValue);
}
}
return (0);
}
std::string OracleCreate(int64_t txfee,std::string name,std::string description,std::string format)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
@ -802,10 +889,36 @@ std::string OracleCreate(int64_t txfee,std::string name,std::string description,
return("");
}
std::string OracleFund(int64_t txfee,uint256 oracletxid)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C;
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
{
CCerror = strprintf("oraclesfund not active yet, activation scheduled for July 15th");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
cp = CCinit(&C,EVAL_ORACLES);
if ( txfee == 0 )
txfee = 10000;
mypk = pubkey2pk(Mypubkey());
if (AddNormalinputs(mtx,mypk,txfee+CC_MARKER_VALUE,2))
{
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CC_MARKER_VALUE,mypk));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('F',oracletxid,mypk,CC_MARKER_VALUE)));
}
CCerror = strprintf("error adding normal inputs");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
{
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CPubKey mypk,markerpubkey,batonpk; struct CCcontract_info *cp,C; char markeraddr[64],batonaddr[64];
CPubKey mypk,markerpubkey,batonpk,oraclespk; struct CCcontract_info *cp,C; char markeraddr[64],batonaddr[64];
cp = CCinit(&C,EVAL_ORACLES);
if ( txfee == 0 )
txfee = 10000;
@ -816,12 +929,20 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
return("");
}
mypk = pubkey2pk(Mypubkey());
oraclespk = GetUnspendable(cp,0);
batonpk = OracleBatonPk(batonaddr,cp);
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
if ( AddNormalinputs(mtx,mypk,3*txfee,4) > 0 )
if (AddNormalinputs(mtx,mypk,3*txfee,4))
{
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE)
{
CCerror = strprintf("error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
}
CCerror = strprintf("error adding normal inputs");
@ -924,43 +1045,70 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
UniValue OracleFormat(uint8_t *data,int32_t datalen,char *format,int32_t formatlen)
{
uint256 hash; int32_t i,j=0; int64_t val; char str[IGUANA_MAXSCRIPTSIZE*2+1];
UniValue obj(UniValue::VARR); uint256 hash; int32_t i,j=0; int64_t val; char str[IGUANA_MAXSCRIPTSIZE*2+1];
for (i=0; i<formatlen && j<datalen; i++)
{
str[0] = 0;
j = oracle_format(&hash,&val,str,format[i],data,j,datalen);
obj.push_back(str);
if ( j < 0 )
break;
if ( j >= datalen )
break;
}
return(str);
return(obj);
}
UniValue OracleDataSamples(uint256 reforacletxid,uint256 batontxid,int32_t num)
UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
{
UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 hashBlock,btxid,oracletxid;
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0; std::vector<uint8_t> data; char str[67], *formatstr = 0;
UniValue result(UniValue::VOBJ),b(UniValue::VARR); CTransaction tx,oracletx; uint256 txid,hashBlock,btxid,oracletxid;
CPubKey pk; std::string name,description,format; int32_t numvouts,n=0,vout; std::vector<uint8_t> data; char *formatstr = 0;
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; int64_t nValue;
result.push_back(Pair("result","success"));
if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 )
{
if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
{
while ( GetTransaction(batontxid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
BOOST_FOREACH(const CTxMemPoolEntry &e, mempool.mapTx)
{
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
const CTransaction &txmempool = e.GetTx();
const uint256 &hash = txmempool.GetHash();
if ((numvouts=txmempool.vout.size())>0 && DecodeOraclesData(txmempool.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
{
if ( (formatstr= (char *)format.c_str()) == 0 )
formatstr = (char *)"";
UniValue a(UniValue::VOBJ);
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
a.push_back(Pair("txid",uint256_str(str,batontxid)));
a.push_back(Pair("txid",hash.GetHex()));
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
b.push_back(a);
batontxid = btxid;
if ( ++n >= num && num != 0)
break;
} else break;
}
}
SetCCtxids(addressIndex,batonaddr,true);
if (addressIndex.size()>0)
{
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.end()-1; it!=addressIndex.begin(); it--)
{
txid=it->first.txhash;
vout = (int32_t)it->first.index;
nValue = (int64_t)it->second;
if (vout==1 && nValue==10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
{
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
{
if ( (formatstr= (char *)format.c_str()) == 0 )
formatstr = (char *)"";
UniValue a(UniValue::VOBJ);
a.push_back(Pair("txid",txid.GetHex()));
a.push_back(Pair("data",OracleFormat((uint8_t *)data.data(),(int32_t)data.size(),formatstr,(int32_t)format.size())));
b.push_back(a);
if ( ++n >= num && num != 0)
break;
}
}
}
}
}
}
@ -971,10 +1119,12 @@ UniValue OracleDataSamples(uint256 reforacletxid,uint256 batontxid,int32_t num)
UniValue OracleInfo(uint256 origtxid)
{
UniValue result(UniValue::VOBJ),a(UniValue::VARR);
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; int32_t height;
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
CTransaction regtx,tx; std::string name,description,format; uint256 hashBlock,txid,oracletxid,batontxid; CPubKey pk;
CTransaction tx; std::string name,description,format; uint256 hashBlock,txid,oracletxid,batontxid; CPubKey pk;
struct CCcontract_info *cp,C; int64_t datafee,funding; char str[67],markeraddr[64],numstr[64],batonaddr[64]; std::vector <uint8_t> data;
std::map<CPubKey,std::pair<uint256,int32_t>> publishers;
cp = CCinit(&C,EVAL_ORACLES);
CCtxidaddr(markeraddr,origtxid);
if ( GetTransaction(origtxid,tx,hashBlock,false) == 0 )
@ -998,28 +1148,38 @@ UniValue OracleInfo(uint256 origtxid)
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{
txid = it->first.txhash;
if ( GetTransaction(txid,regtx,hashBlock,false) != 0 )
height = (int32_t)it->second.blockHeight;
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 &&
DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R' && oracletxid == origtxid )
{
if ( regtx.vout.size() > 0 && DecodeOraclesOpRet(regtx.vout[regtx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R' && oracletxid == origtxid )
if (publishers.find(pk)==publishers.end() || height>publishers[pk].second)
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("publisher",pubkey33_str(str,(uint8_t *)pk.begin())));
Getscriptaddress(batonaddr,regtx.vout[1].scriptPubKey);
batontxid = OracleBatonUtxo(10000,cp,oracletxid,batonaddr,pk,data);
obj.push_back(Pair("baton",batonaddr));
obj.push_back(Pair("batontxid",uint256_str(str,batontxid)));
funding = LifetimeOraclesFunds(cp,oracletxid,pk);
sprintf(numstr,"%.8f",(double)funding/COIN);
obj.push_back(Pair("lifetime",numstr));
funding = AddOracleInputs(cp,mtx,oracletxid,pk,0,0);
sprintf(numstr,"%.8f",(double)funding/COIN);
obj.push_back(Pair("funds",numstr));
sprintf(numstr,"%.8f",(double)datafee/COIN);
obj.push_back(Pair("datafee",numstr));
a.push_back(obj);
publishers[pk].first=txid;
publishers[pk].second=height;
}
}
}
for (std::map<CPubKey,std::pair<uint256,int32_t>>::iterator it = publishers.begin(); it != publishers.end(); ++it)
{
if ( GetTransaction(it->second.first,tx,hashBlock,false) != 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R')
{
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("publisher",pubkey33_str(str,(uint8_t *)pk.begin())));
Getscriptaddress(batonaddr,tx.vout[1].scriptPubKey);
batontxid = OracleBatonUtxo(10000,cp,oracletxid,batonaddr,pk,data);
obj.push_back(Pair("baton",batonaddr));
obj.push_back(Pair("batontxid",uint256_str(str,batontxid)));
funding = LifetimeOraclesFunds(cp,oracletxid,pk);
sprintf(numstr,"%.8f",(double)funding/COIN);
obj.push_back(Pair("lifetime",numstr));
funding = AddOracleInputs(cp,mtx,oracletxid,pk,0,0);
sprintf(numstr,"%.8f",(double)funding/COIN);
obj.push_back(Pair("funds",numstr));
sprintf(numstr,"%.8f",(double)datafee/COIN);
obj.push_back(Pair("datafee",numstr));
a.push_back(obj);
}
}
result.push_back(Pair("registered",a));
}
}
@ -1044,4 +1204,3 @@ UniValue OraclesList()
}
return(result);
}

21
src/komodo.h

@ -803,7 +803,10 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys
return(-1);
}
// int32_t !
// int32_t (!!!)
/*
read blackjok3rtt comments in main.cpp
*/
int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
{
static int32_t hwmheight;
@ -897,8 +900,8 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
}
numvalid = bitweight(signedmask);
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
numvalid > (numnotaries/5) )
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
numvalid > (numnotaries/5) )
{
if ( !fJustCheck && ASSETCHAINS_SYMBOL[0] != 0)
{
@ -918,7 +921,7 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
fflush(signedfp);
}
transaction = i;
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
}
notarized = 1;
}
@ -1014,7 +1017,9 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
if ( !fJustCheck && pindex->GetHeight() == hwmheight )
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
} else fprintf(stderr,"komodo_connectblock: unexpected null pindex\n");
}
else
{ fprintf(stderr,"komodo_connectblock: unexpected null pindex\n"); return(0); }
//KOMODO_INITDONE = (uint32_t)time(NULL);
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
if (fJustCheck)
@ -1025,6 +1030,12 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
return(1);
if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) )
return(-1);
fprintf(stderr,"komodo_connectblock: unxexpected behaviour when fJustCheck == true, report blackjok3rtt plz ! \n");
/* this needed by gcc-8, it counts here that control reaches end of non-void function without this.
by default, we count that if control reached here -> the valid notarization isnt in position 1 or there are too many notarizations in this block.
*/
return(-1);
}
else return(0);
}

68
src/komodo_defs.h

@ -179,7 +179,70 @@ static const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] =
{"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" },
},
{
{"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }
{"madmax_NA", "0237e0d3268cebfa235958808db1efc20cc43b31100813b1f3e15cc5aa647ad2c3" }, // 0
{"alright_AR", "020566fe2fb3874258b2d3cf1809a5d650e0edc7ba746fa5eec72750c5188c9cc9" },
{"strob_NA", "0206f7a2e972d9dfef1c424c731503a0a27de1ba7a15a91a362dc7ec0d0fb47685" },
{"dwy_EU", "021c7cf1f10c4dc39d13451123707ab780a741feedab6ac449766affe37515a29e" },
{"phm87_SH", "021773a38db1bc3ede7f28142f901a161c7b7737875edbb40082a201c55dcf0add" },
{"chainmakers_NA", "02285d813c30c0bf7eefdab1ff0a8ad08a07a0d26d8b95b3943ce814ac8e24d885" },
{"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" },
{"blackjok3r_SH", "021eac26dbad256cbb6f74d41b10763183ee07fb609dbd03480dd50634170547cc" },
{"chainmakers_EU", "03fdf5a3fce8db7dee89724e706059c32e5aa3f233a6b6cc256fea337f05e3dbf7" },
{"titomane_AR", "023e3aa9834c46971ff3e7cb86a200ec9c8074a9566a3ea85d400d5739662ee989" },
{"fullmoon_SH", "023b7252968ea8a955cd63b9e57dee45a74f2d7ba23b4e0595572138ad1fb42d21" }, // 10
{"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" },
{"chmex_EU", "0281304ebbcc39e4f09fda85f4232dd8dacd668e20e5fc11fba6b985186c90086e" },
{"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" },
{"ca333_DEV", "02856843af2d9457b5b1c907068bef6077ea0904cc8bd4df1ced013f64bf267958" },
{"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" },
{"pungocloud_SH", "024dfc76fa1f19b892be9d06e985d0c411e60dbbeb36bd100af9892a39555018f6" },
{"voskcoin_EU", "034190b1c062a04124ad15b0fa56dfdf34aa06c164c7163b6aec0d654e5f118afb" },
{"decker_DEV", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" },
{"cryptoeconomy_EU", "0290ab4937e85246e048552df3e9a66cba2c1602db76e03763e16c671e750145d1" },
{"etszombi_EU", "0293ea48d8841af7a419a24d9da11c34b39127ef041f847651bae6ab14dcd1f6b4" }, // 20
{"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" },
{"pirate_AR", "03e29c90354815a750db8ea9cb3c1b9550911bb205f83d0355a061ac47c4cf2fde" },
{"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" },
{"zatjum_SH", "02d6b0c89cacd58a0af038139a9a90c9e02cd1e33803a1f15fceabea1f7e9c263a" },
{"madmax_AR", "03c5941fe49d673c094bc8e9bb1a95766b4670c88be76d576e915daf2c30a454d3" },
{"lukechilds_NA", "03f1051e62c2d280212481c62fe52aab0a5b23c95de5b8e9ad5f80d8af4277a64b" },
{"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" },
{"tonyl_AR", "02cc8bc862f2b65ad4f99d5f68d3011c138bf517acdc8d4261166b0be8f64189e1" },
{"infotech_DEV", "0345ad4ab5254782479f6322c369cec77a7535d2f2162d103d666917d5e4f30c4c" },
{"fullmoon_NA", "032c716701fe3a6a3f90a97b9d874a9d6eedb066419209eed7060b0cc6b710c60b" }, // 30
{"etszombi_AR", "02e55e104aa94f70cde68165d7df3e162d4410c76afd4643b161dea044aa6d06ce" },
{"node-9_EU", "0372e5b51e86e2392bb15039bac0c8f975b852b45028a5e43b324c294e9f12e411" },
{"phba2061_EU", "03f6bd15dba7e986f0c976ea19d8a9093cb7c989d499f1708a0386c5c5659e6c4e" },
{"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" },
{"and1-89_EU", "02736cbf8d7b50835afd50a319f162dd4beffe65f2b1dc6b90e64b32c8e7849ddd" },
{"komodopioneers_SH", "032a238a5747777da7e819cfa3c859f3677a2daf14e4dce50916fc65d00ad9c52a" },
{"komodopioneers_EU", "036d02425916444fff8cc7203fcbfc155c956dda5ceb647505836bef59885b6866" },
{"d0ct0r_NA", "0303725d8525b6f969122faf04152653eb4bf34e10de92182263321769c334bf58" },
{"kolo_DEV", "02849e12199dcc27ba09c3902686d2ad0adcbfcee9d67520e9abbdda045ba83227" },
{"peer2cloud_AR", "02acc001fe1fe8fd68685ba26c0bc245924cb592e10cec71e9917df98b0e9d7c37" }, // 40
{"webworker01_SH", "031e50ba6de3c16f99d414bb89866e578d963a54bde7916c810608966fb5700776" },
{"webworker01_NA", "032735e9cad1bb00eaababfa6d27864fa4c1db0300c85e01e52176be2ca6a243ce" },
{"pbca26_NA", "03a97606153d52338bcffd1bf19bb69ef8ce5a7cbdc2dbc3ff4f89d91ea6bbb4dc" },
{"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" },
{"pirate_NA", "0255e32d8a56671dee8aa7f717debb00efa7f0086ee802de0692f2d67ee3ee06ee" },
{"lukechilds_AR", "025c6a73ff6d750b9ddf6755b390948cffdd00f344a639472d398dd5c6b4735d23" },
{"dragonhound_NA", "0224a9d951d3a06d8e941cc7362b788bb1237bb0d56cc313e797eb027f37c2d375" },
{"fullmoon_AR", "03da64dd7cd0db4c123c2f79d548a96095a5a103e5b9d956e9832865818ffa7872" },
{"chainzilla_SH", "0360804b8817fd25ded6e9c0b50e3b0782ac666545b5416644198e18bc3903d9f9" },
{"titomane_EU", "03772ac0aad6b0e9feec5e591bff5de6775d6132e888633e73d3ba896bdd8e0afb" }, // 50
{"jeezy_EU", "037f182facbad35684a6e960699f5da4ba89e99f0d0d62a87e8400dd086c8e5dd7" },
{"titomane_SH", "03850fdddf2413b51790daf51dd30823addb37313c8854b508ea6228205047ef9b" },
{"alien_AR", "03911a60395801082194b6834244fa78a3c30ff3e888667498e157b4aa80b0a65f" },
{"pirate_EU", "03fff24efd5648870a23badf46e26510e96d9e79ce281b27cfe963993039dd1351" },
{"thegaltmines_NA", "02db1a16c7043f45d6033ccfbd0a51c2d789b32db428902f98b9e155cf0d7910ed" },
{"computergenie_NA", "03a78ae070a5e9e935112cf7ea8293f18950f1011694ea0260799e8762c8a6f0a4" },
{"nutellalicka_SH", "02f7d90d0510c598ce45915e6372a9cd0ba72664cb65ce231f25d526fc3c5479fc" },
{"chainstrike_SH", "03b806be3bf7a1f2f6290ec5c1ea7d3ea57774dcfcf2129a82b2569e585100e1cb" },
{"dwy_SH", "036536d2d52d85f630b68b050f29ea1d7f90f3b42c10f8c5cdf3dbe1359af80aff" },
{"alien_EU", "03bb749e337b9074465fa28e757b5aa92cb1f0fea1a39589bca91a602834d443cd" }, // 60
{"gt_AR", "0348430538a4944d3162bb4749d8c5ed51299c2434f3ee69c11a1f7815b3f46135" },
{"patchkez_SH", "03f45e9beb5c4cd46525db8195eb05c1db84ae7ef3603566b3d775770eba3b96ee" },
{"decker_AR", "03ffdf1a116300a78729608d9930742cd349f11a9d64fcc336b8f18592dd9c91bc" }, // 63
}
};
@ -240,7 +303,9 @@ extern int32_t KOMODO_TESTNODE, KOMODO_SNAPSHOT_INTERVAL;
extern int32_t ASSETCHAINS_EARLYTXIDCONTRACT;
int tx_height( const uint256 &hash );
extern std::vector<std::string> vWhiteListAddress;
extern std::map <std::int8_t, int32_t> mapHeightEvalActivate;
void komodo_netevent(std::vector<uint8_t> payload);
int32_t getacseason(uint32_t timestamp);
#define IGUANA_MAXSCRIPTSIZE 10001
#define KOMODO_KVDURATION 1440
@ -269,6 +334,7 @@ uint32_t komodo_heightstamp(int32_t height);
int64_t komodo_pricemult(int32_t ind);
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
int32_t komodo_currentheight();
#endif

24
src/komodo_gateway.h

@ -627,7 +627,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
const char *banned_txids[] =
{
"78cb4e21245c26b015b888b14c4f5096e18137d2741a6de9734d62b07014dfca", //233559
"78cb4e21245c26b015b888b14c4f5096e18137d2741a6de9734d62b07014dfca", // vout1 only 233559
"00697be658e05561febdee1aafe368b821ca33fbb89b7027365e3d77b5dfede5", //234172
"e909465788b32047c472d73e882d79a92b0d550f90be008f76e1edaee6d742ea", //234187
"f56c6873748a327d0b92b8108f8ec8505a2843a541b1926022883678fb24f9dc", //234188
@ -645,8 +645,24 @@ const char *banned_txids[] =
// all vouts banned
"c4ea1462c207547cd6fb6a4155ca6d042b22170d29801a465db5c09fec55b19d", //246748
"305dc96d8bc23a69d3db955e03a6a87c1832673470c32fe25473a46cc473c7d1", //247204
//"43416a0c4da6b1a5c1d375bdbe8f7dc8d44d8f60df593d3376aa8221ec66357e", // vout0 only
//"1eb295ed54c47f35cbccd7e7e40d03041f1853581da6d41102a9d8813782b6cb",
//"db121e4012222adfc841824984a2a90b7e5b018dd71307822537d58160195e43",
//"28f95b8148ac4ae6e09c7380e34422fab41d568a411e53dc94823e36a3d6f386",
//"01d8c839463bda2f2f6400ede4611357913684927a767422a8560ead1b22557c",
//"6e4980a9e1bd669f4df04732dc6f11b7773b6de88d1abcf89a6b9007d72ef9ac",
//"6cc1d0495170bc0e11fd3925297623562e529ea1336b66ea61f8a1159041aed2",
};
int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts)
{
if ( k < indallvouts )
return(vout == 1);
else if ( k == indallvouts || k == indallvouts+1 )
return(1);
else return(vout == 0);
}
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max)
{
int32_t i;
@ -691,7 +707,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
{
for (k=0; k<numbanned; k++)
{
if ( block.vtx[i].vin[j].prevout.hash == array[k] && (block.vtx[i].vin[j].prevout.n == 1 || k >= indallvouts) )
if ( block.vtx[i].vin[j].prevout.hash == array[k] && komodo_checkvout(block.vtx[i].vin[j].prevout.n,k,indallvouts) != 0 ) //(block.vtx[i].vin[j].prevout.n == 1 || k >= indallvouts) )
{
printf("banned tx.%d being used at ht.%d txi.%d vini.%d\n",k,height,i,j);
return(-1);
@ -2597,7 +2613,7 @@ static int cmp_llu(const void *a, const void*b)
else return(1);
}
static int64_t sort64(int64_t *l, int32_t llen)
static void sort64(int64_t *l, int32_t llen)
{
qsort(l,llen,sizeof(uint64_t),cmp_llu);
}
@ -2611,7 +2627,7 @@ static int revcmp_llu(const void *a, const void*b)
else return(1);
}
static int64_t revsort64(int64_t *l, int32_t llen)
static void revsort64(int64_t *l, int32_t llen)
{
qsort(l,llen,sizeof(uint64_t),revcmp_llu);
}

3
src/komodo_globals.h

@ -29,6 +29,7 @@ uint64_t komodo_paxtotal();
int32_t komodo_longestchain();
uint64_t komodo_maxallowed(int32_t baseid);
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts);
pthread_mutex_t komodo_mutex,staked_mutex;
@ -114,6 +115,8 @@ int32_t KOMODO_TESTNODE, KOMODO_SNAPSHOT_INTERVAL;
CScript KOMODO_EARLYTXID_SCRIPTPUB;
int32_t ASSETCHAINS_EARLYTXIDCONTRACT;
std::map <std::int8_t, int32_t> mapHeightEvalActivate;
struct komodo_kv *KOMODO_KV;
pthread_mutex_t KOMODO_KV_mutex,KOMODO_CC_mutex;

4
src/komodo_notary.h

@ -65,7 +65,6 @@ const char *Notaries_genesis[][2] =
int32_t getkmdseason(int32_t height)
{
int8_t season = 0;
if ( height <= KMD_SEASON_HEIGHTS[0] )
return(1);
for (int32_t i = 1; i < NUM_KMD_SEASONS; i++)
@ -76,9 +75,8 @@ int32_t getkmdseason(int32_t height)
return(0);
};
int32_t getacseason(int32_t timestamp)
int32_t getacseason(uint32_t timestamp)
{
int8_t season = 0;
if ( timestamp <= KMD_SEASON_TIMESTAMPS[0] )
return(1);
for (int32_t i = 1; i < NUM_KMD_SEASONS; i++)

85
src/komodo_utils.h

@ -14,6 +14,7 @@
******************************************************************************/
#include "komodo_defs.h"
#include "key_io.h"
#include "cc/CCinclude.h"
#include <string.h>
#ifdef _WIN32
@ -1665,7 +1666,6 @@ uint64_t komodo_ac_block_subsidy(int nHeight)
extern int64_t MAX_MONEY;
void komodo_cbopretupdate(int32_t forceflag);
int32_t getacseason(int32_t timestamp);
void SplitStr(const std::string& strVal, std::vector<std::string> &outVals);
int8_t equihash_params_possible(uint64_t n, uint64_t k)
@ -1692,7 +1692,7 @@ int8_t equihash_params_possible(uint64_t n, uint64_t k)
void komodo_args(char *argv0)
{
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256];
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512];
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
IS_STAKED_NOTARY = GetArg("-stakednotary", -1);
memset(ccenables,0,sizeof(ccenables));
@ -1757,6 +1757,27 @@ void komodo_args(char *argv0)
ASSETCHAINS_PRIVATE = GetArg("-ac_private",0);
KOMODO_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0);
Split(GetArg("-ac_nk",""), ASSETCHAINS_NK, 0);
// -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height....
Split(GetArg("-ac_ccactivateht",""), ccEnablesHeight, 0);
// fill map with all eval codes and activation height of 0.
for ( int i = 0; i < 256; i++ )
mapHeightEvalActivate[i] = 0;
for ( int i = 0; i < 512; i++ )
{
int32_t ecode = ccEnablesHeight[i];
int32_t ht = ccEnablesHeight[i+1];
if ( ecode > 256 )
fprintf(stderr, "ac_ccactivateht: invalid evalcode.%i must be between 0 and 256.\n", ecode);
else if ( ht > 0 )
{
// update global map.
mapHeightEvalActivate[ecode] = ht;
fprintf(stderr, "ac_ccactivateht: ecode.%i activates at height.%i\n", ecode, mapHeightEvalActivate[ecode]);
}
i++;
}
if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 )
{
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
@ -2297,6 +2318,66 @@ void komodo_args(char *argv0)
fprintf(stderr,"-ac_private for a non-PIRATE chain is not supported. The only reason to have an -ac_private chain is for total privacy and that is best achieved with the largest anon set. PIRATE has that and it is recommended to just use PIRATE\n");
StartShutdown();
}
// Set cc enables for all existing ac_cc chains here.
if ( strcmp("AXO",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("CCL",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("COQUI",ASSETCHAINS_SYMBOL) == 0 )
{
CCDISABLEALL;
CCENABLE(EVAL_DICE);
CCENABLE(EVAL_CHANNELS);
CCENABLE(EVAL_ORACLES);
CCENABLE(EVAL_ASSETS);
CCENABLE(EVAL_TOKENS);
}
if ( strcmp("DION",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("EQL",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("ILN",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("OUR",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("ZEXO",ASSETCHAINS_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("SEC",ASSETCHAINS_SYMBOL) == 0 )
{
CCDISABLEALL;
CCENABLE(EVAL_ASSETS);
CCENABLE(EVAL_TOKENS);
CCENABLE(EVAL_ORACLES);
}
if ( strcmp("KMDICE",ASSETCHAINS_SYMBOL) == 0 )
{
CCDISABLEALL;
CCENABLE(EVAL_FAUCET);
CCENABLE(EVAL_DICE);
CCENABLE(EVAL_ORACLES);
}
} else BITCOIND_RPCPORT = GetArg("-rpcport", BaseParams().RPCPort());
KOMODO_DPOWCONFS = GetArg("-dpowconfs",dpowconfs);
if ( ASSETCHAINS_SYMBOL[0] == 0 || strcmp(ASSETCHAINS_SYMBOL,"SUPERNET") == 0 || strcmp(ASSETCHAINS_SYMBOL,"DEX") == 0 || strcmp(ASSETCHAINS_SYMBOL,"COQUI") == 0 || strcmp(ASSETCHAINS_SYMBOL,"PIRATE") == 0 || strcmp(ASSETCHAINS_SYMBOL,"KMDICE") == 0 )

21
src/main.cpp

@ -1341,16 +1341,19 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
if ( *(int32_t *)&array[0] == 0 )
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
n = tx.vin.size();
for (j=0; j<n; j++)
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
for (k=0; k<numbanned; k++)
for (j=0; j<n; j++)
{
if ( tx.vin[j].prevout.hash == array[k] && (tx.vin[j].prevout.n == 1 || k >= indallvouts) )
for (k=0; k<numbanned; k++)
{
static uint32_t counter;
if ( counter++ < 100 )
printf("MEMPOOL: banned tx.%d being used at ht.%d vout.%d\n",k,(int32_t)chainActive.Tip()->GetHeight(),j);
return(false);
if ( tx.vin[j].prevout.hash == array[k] && komodo_checkvout(tx.vin[j].prevout.n,k,indallvouts) != 0 ) //(tx.vin[j].prevout.n == 1 || k >= indallvouts) )
{
static uint32_t counter;
if ( counter++ < 100 )
printf("MEMPOOL: banned tx.%d being used at ht.%d vout.%d\n",k,(int32_t)chainActive.Tip()->GetHeight(),j);
return(false);
}
}
}
}
@ -1373,8 +1376,6 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
}
}
extern int32_t getacseason(int32_t timestamp);
int32_t komodo_isnotaryvout(char *coinaddr,uint32_t tiptime) // from ac_private chains only
{
int32_t season = getacseason(tiptime);
@ -3392,7 +3393,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
{
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
int notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
int32_t notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
// -1 means that the valid notarization isnt in position 1 or there are too many notarizations in this block.
if ( notarisationTx == -1 )
return state.DoS(100, error("ConnectBlock(): Notarization is not in TX position 1 or block contains more than 1 notarization! Invalid Block!"),

8
src/rpc/blockchain.cpp

@ -51,6 +51,7 @@ using namespace std;
extern int32_t KOMODO_INSYNC;
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp);
#include "komodo_defs.h"
#include "komodo_structs.h"
@ -133,6 +134,9 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
result.push_back(Pair("error", "null blockhash"));
return(result);
}
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height;
notarized_height = komodo_notarized_height(&prevMoMheight,&notarized_hash,&notarized_desttxid);
result.push_back(Pair("last_notarized_height", notarized_height));
result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
int confirmations = -1;
// Only report confirmations if the block is on the main chain
@ -284,6 +288,9 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false)
{
UniValue result(UniValue::VOBJ);
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height;
notarized_height = komodo_notarized_height(&prevMoMheight,&notarized_hash,&notarized_desttxid);
result.push_back(Pair("last_notarized_height", notarized_height));
result.push_back(Pair("hash", block.GetHash().GetHex()));
int confirmations = -1;
// Only report confirmations if the block is on the main chain
@ -1846,7 +1853,6 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
/* Construct the output array. */
UniValue res(UniValue::VARR); const CBlockIndex *forked;
BOOST_FOREACH(const CBlockIndex* block, setTips)
BOOST_FOREACH(const CBlockIndex* block, setTips)
{
UniValue obj(UniValue::VOBJ);

3
src/rpc/mining.cpp

@ -60,7 +60,8 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
* or over the difficulty averaging window if 'lookup' is nonpositive.
* If 'height' is nonnegative, compute the estimate at the time when a given block was found.
*/
int64_t GetNetworkHashPS(int lookup, int height) {
int64_t GetNetworkHashPS(int lookup, int height)
{
CBlockIndex *pb = chainActive.LastTip();
if (height >= 0 && height < chainActive.Height())

2
src/rpc/misc.cpp

@ -78,7 +78,7 @@ int8_t StakedNotaryID(std::string &notaryname, char *Raddress);
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount);
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
#define KOMODO_VERSION "0.3.3b"
#define KOMODO_VERSION "0.4.0a"
#define VERUS_VERSION "0.4.0g"
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
extern uint32_t ASSETCHAINS_CC;

22
src/rpc/server.cpp

@ -1,5 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -45,6 +46,7 @@
using namespace RPCServer;
using namespace std;
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
static bool fRPCRunning = false;
static bool fRPCInWarmup = true;
@ -454,6 +456,7 @@ static const CRPCCommand vRPCCommands[] =
{ "oracles", "oracleslist", &oracleslist, true },
{ "oracles", "oraclesinfo", &oraclesinfo, true },
{ "oracles", "oraclescreate", &oraclescreate, true },
{ "oracles", "oraclesfund", &oraclesfund, true },
{ "oracles", "oraclesregister", &oraclesregister, true },
{ "oracles", "oraclessubscribe", &oraclessubscribe, true },
{ "oracles", "oraclesdata", &oraclesdata, true },
@ -853,21 +856,30 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params
std::string HelpExampleCli(const std::string& methodname, const std::string& args)
{
return "> komodo-cli " + methodname + " " + args + "\n";
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
return "> komodo-cli " + methodname + " " + args + "\n";
} else if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3", 5) == 0) ) {
return "> hush-cli " + methodname + " " + args + "\n";
} else {
return "> komodo-cli -ac_name=" + strprintf("%s", ASSETCHAINS_SYMBOL) + " " + methodname + " " + args + "\n";
}
}
std::string HelpExampleRpc(const std::string& methodname, const std::string& args)
{
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:7771/\n";
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:" + to_string(ASSETCHAINS_RPCPORT) + "/\n";
}
string experimentalDisabledHelpMsg(const string& rpc, const string& enableArg)
{
string daemon = ASSETCHAINS_SYMBOL[0] == 0 ? "komodod" : "hushd";
string ticker = ASSETCHAINS_SYMBOL[0] == 0 ? "komodo" : ASSETCHAINS_SYMBOL;
return "\nWARNING: " + rpc + " is disabled.\n"
"To enable it, restart zcashd with the -experimentalfeatures and\n"
"To enable it, restart " + daemon + " with the -experimentalfeatures and\n"
"-" + enableArg + " commandline options, or add these two lines\n"
"to the zcash.conf file:\n\n"
"to the " + ticker + ".conf file:\n\n"
"experimentalfeatures=1\n"
+ enableArg + "=1\n";
}

1
src/rpc/server.h

@ -267,6 +267,7 @@ extern UniValue oraclesaddress(const UniValue& params, bool fHelp);
extern UniValue oracleslist(const UniValue& params, bool fHelp);
extern UniValue oraclesinfo(const UniValue& params, bool fHelp);
extern UniValue oraclescreate(const UniValue& params, bool fHelp);
extern UniValue oraclesfund(const UniValue& params, bool fHelp);
extern UniValue oraclesregister(const UniValue& params, bool fHelp);
extern UniValue oraclessubscribe(const UniValue& params, bool fHelp);
extern UniValue oraclesdata(const UniValue& params, bool fHelp);

14
src/wallet/db.h

@ -33,9 +33,17 @@
#include <boost/filesystem/path.hpp>
// If CCLIB fails to compile with this, use the one below.
#include <db_cxx.h>
//#include "../depends/x86_64-unknown-linux-gnu/include/db_cxx.h"
#ifdef BUILD_ROGUE
#ifdef __APPLE__
#include "../depends/x86_64-apple-darwin18.6.0/include/db_cxx.h"
#elif defined(_WIN32)
#include "../depends/x86_64-w64-mingw32/include/db_cxx.h"
#else
#include "../depends/x86_64-unknown-linux-gnu/include/db_cxx.h"
#endif
#else
#include <db_cxx.h>
#endif
extern unsigned int nWalletDBUpdated;

57
src/wallet/gtest/test_wallet.cpp

@ -1680,6 +1680,63 @@ TEST(WalletTests, WriteWitnessCache) {
wallet.SetBestChain(walletdb, loc);
}
TEST(WalletTests, SetBestChainIgnoresTxsWithoutShieldedData) {
SelectParams(CBaseChainParams::REGTEST);
TestWallet wallet;
MockWalletDB walletdb;
CBlockLocator loc;
// Set up transparent address
CKey tsk = DecodeSecret(tSecretRegtest);
wallet.AddKey(tsk);
auto scriptPubKey = GetScriptForDestination(tsk.GetPubKey().GetID());
// Set up a Sprout address
auto sk = libzcash::SproutSpendingKey::random();
wallet.AddSproutSpendingKey(sk);
// Generate a transparent transaction that is ours
CMutableTransaction t;
t.vout.resize(1);
t.vout[0].nValue = 90*CENT;
t.vout[0].scriptPubKey = scriptPubKey;
CWalletTx wtxTransparent {nullptr, t};
wallet.AddToWallet(wtxTransparent, true, NULL);
// Generate a Sprout transaction that is ours
auto wtxSprout = GetValidReceive(sk, 10, true);
auto noteMap = wallet.FindMySproutNotes(wtxSprout);
wtxSprout.SetSproutNoteData(noteMap);
wallet.AddToWallet(wtxSprout, true, NULL);
// Generate a Sprout transaction that only involves our transparent address
auto sk2 = libzcash::SproutSpendingKey::random();
auto wtxInput = GetValidReceive(sk2, 10, true);
auto note = GetNote(sk2, wtxInput, 0, 0);
auto wtxTmp = GetValidSpend(sk2, note, 5);
CMutableTransaction mtx {wtxTmp};
mtx.vout[0].scriptPubKey = scriptPubKey;
CWalletTx wtxSproutTransparent {NULL, mtx};
wallet.AddToWallet(wtxSproutTransparent, true, NULL);
EXPECT_CALL(walletdb, TxnBegin())
.WillOnce(Return(true));
EXPECT_CALL(walletdb, WriteTx(wtxTransparent.GetHash(), wtxTransparent))
.Times(0);
EXPECT_CALL(walletdb, WriteTx(wtxSprout.GetHash(), wtxSprout))
.Times(1).WillOnce(Return(true));
EXPECT_CALL(walletdb, WriteTx(wtxSproutTransparent.GetHash(), wtxSproutTransparent))
.Times(0);
EXPECT_CALL(walletdb, WriteWitnessCacheSize(0))
.WillOnce(Return(true));
EXPECT_CALL(walletdb, WriteBestBlock(loc))
.WillOnce(Return(true));
EXPECT_CALL(walletdb, TxnCommit())
.WillOnce(Return(true));
wallet.SetBestChain(walletdb, loc);
}
TEST(WalletTests, UpdateSproutNullifierNoteMap) {
TestWallet wallet;
uint256 r {GetRandHash()};

42
src/wallet/rpcwallet.cpp

@ -4353,8 +4353,9 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
//else if ( ASSETCHAINS_PRIVATE != 0 && komodo_isnotaryvout((char *)address.c_str()) == 0 )
// throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "cant use transparent addresses in private chain");
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+address);
// Allowing duplicate receivers helps various HushList protocol operations
//if (setAddress.count(address))
// throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+address);
setAddress.insert(address);
UniValue memoValue = find_value(o, "memo");
@ -5341,8 +5342,13 @@ int32_t ensure_CCrequirements(uint8_t evalcode)
CCerror = "";
if ( ASSETCHAINS_CCDISABLES[evalcode] != 0 || (evalcode == EVAL_MARMARA && ASSETCHAINS_MARMARA == 0) )
{
fprintf(stderr,"evalcode %d disabled\n",evalcode);
return(-1);
// check if a height activation has been set.
fprintf(stderr, "evalcode.%i activates at height. %i current height.%i\n", evalcode, mapHeightEvalActivate[evalcode], komodo_currentheight());
if ( mapHeightEvalActivate[evalcode] == 0 || komodo_currentheight() == 0 || mapHeightEvalActivate[evalcode] > komodo_currentheight() )
{
fprintf(stderr,"evalcode %d disabled\n",evalcode);
return(-1);
}
}
if ( NOTARY_PUBKEY33[0] == 0 )
{
@ -6760,6 +6766,26 @@ UniValue oraclesinfo(const UniValue& params, bool fHelp)
return(OracleInfo(txid));
}
UniValue oraclesfund(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint256 txid; std::string hex;
if ( fHelp || params.size() != 1 )
throw runtime_error("oraclesfund oracletxid\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
LOCK2(cs_main, pwalletMain->cs_wallet);
txid = Parseuint256((char *)params[0].get_str().c_str());
hex = OracleFund(0,txid);
RETURN_IF_ERROR(CCerror);
if ( hex.size() > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else ERR_RESULT("couldnt fund with oracle txid");
return(result);
}
UniValue oraclesregister(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint256 txid; int64_t datafee; std::string hex;
@ -6806,17 +6832,17 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp)
UniValue oraclessamples(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num;
UniValue result(UniValue::VOBJ); uint256 txid; int32_t num; char *batonaddr;
if ( fHelp || params.size() != 3 )
throw runtime_error("oraclessamples oracletxid batonutxo num\n");
throw runtime_error("oraclessamples oracletxid batonaddress num\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
LOCK2(cs_main, pwalletMain->cs_wallet);
txid = Parseuint256((char *)params[0].get_str().c_str());
batontxid = Parseuint256((char *)params[1].get_str().c_str());
batonaddr = (char *)params[1].get_str().c_str();
num = atoi((char *)params[2].get_str().c_str());
return(OracleDataSamples(txid,batontxid,num));
return(OracleDataSamples(txid,batonaddr,num));
}
UniValue oraclesdata(const UniValue& params, bool fHelp)

15
src/wallet/wallet.h

@ -807,10 +807,17 @@ protected:
}
try {
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
if (!walletdb.WriteTx(wtxItem.first, wtxItem.second)) {
LogPrintf("SetBestChain(): Failed to write CWalletTx, aborting atomic write\n");
walletdb.TxnAbort();
return;
auto wtx = wtxItem.second;
// We skip transactions for which mapSproutNoteData and mapSaplingNoteData
// are empty. This covers transactions that have no Sprout or Sapling data
// (i.e. are purely transparent), as well as shielding and unshielding
// transactions in which we only have transparent addresses involved.
if (!(wtx.mapSproutNoteData.empty() && wtx.mapSaplingNoteData.empty())) {
if (!walletdb.WriteTx(wtxItem.first, wtx)) {
LogPrintf("SetBestChain(): Failed to write CWalletTx, aborting atomic write\n");
walletdb.TxnAbort();
return;
}
}
}
if (!walletdb.WriteWitnessCacheSize(nWitnessCacheSize)) {

3
src/wallet/walletdb.cpp

@ -488,7 +488,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
auto verifier = libzcash::ProofVerifier::Strict();
// ac_public chains set at height like KMD and ZEX, will force a rescan if we dont ignore this error: bad-txns-acpublic-chain
// there cannot be any ztx in the wallet on ac_public chains that started from block 1, so this wont affect those.
if ( !(CheckTransaction(0,wtx, state, verifier) && (wtx.GetHash() == hash) && state.IsValid()) && (state.GetRejectReason() != "bad-txns-acpublic-chain") )
// PIRATE fails this check for notary nodes, need exception. Triggers full rescan without it.
if ( !(CheckTransaction(0,wtx, state, verifier) && (wtx.GetHash() == hash) && state.IsValid()) && (state.GetRejectReason() != "bad-txns-acpublic-chain" && state.GetRejectReason() != "bad-txns-acprivacy-chain") )
{
//fprintf(stderr, "tx failed: %s rejectreason.%s\n", wtx.GetHash().GetHex().c_str(), state.GetRejectReason().c_str());
// vin-empty on staking chains is error relating to a failed staking tx, that for some unknown reason did not fully erase. save them here to erase and re-add later on.

2
toolchain-info.sh

@ -1,6 +1,6 @@
#!/bin/bash
tools=("gcc-6" "g++-6" "otool" "nm")
tools=("gcc-8" "g++-8" "otool" "nm")
echo "Platform: `uname -a`"
echo "-------------------------------------"

8
zcutil/build-mac.sh

@ -1,6 +1,6 @@
#!/bin/bash
export CC=gcc-6
export CXX=g++-6
export CC=gcc-8
export CXX=g++-8
export LIBTOOL=libtool
export AR=ar
export RANLIB=ranlib
@ -47,12 +47,12 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1
WD=$PWD
cd src/cc
echo $PWD
./makerogue
./makecustom
cd $WD
./autogen.sh
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
make "$@" V=1 NO_GTEST=1 STATIC=1

2
zcutil/build-win.sh

@ -14,7 +14,7 @@ cd ../
WD=$PWD
cd src/cc
echo $PWD
./makerogue
./makecustom
cd $WD
./autogen.sh

2
zcutil/build.sh

@ -106,7 +106,7 @@ CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG"
WD=$PWD
cd src/cc
echo $PWD
./makecclib
./makecustom
cd $WD
"$MAKE" "$@" V=1

Loading…
Cancel
Save