Skip to content

Commit

Permalink
Refs #109
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC01 committed Aug 4, 2018
1 parent cf24254 commit 3ddb738
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
28 changes: 16 additions & 12 deletions apps/hashblock_rest/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@
import shared.asset as asset
import shared.exchange as exchange

LOGGER = logging.getLogger(__name__)

# Initialize configuration
load_hashblock_config()
print("Succesfully loaded hasblock-rest configuration")

# Initialize ZMQ
initialize_txn_vc()
print("Succesfully initialized ZMQ connection")
# Initialize decoder
initialize_decode()

# Setup upload location for batch submissions
UPLOAD_FOLDER = '/uploads/files/'
Expand All @@ -61,6 +50,11 @@
application = Flask(__name__)
application.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

if __name__ != '__main__':
gunicorn_logger = logging.getLogger('gunicorn.error')
application.logger.handlers = gunicorn_logger.handlers
application.logger.setLevel(gunicorn_logger.level)

api = Api(
application,
validate=True,
Expand All @@ -70,7 +64,17 @@

ns = api.namespace('hashblock', description='hashblock operations')

# Utility functions
LOGGER = application.logger

# Initialize configuration
load_hashblock_config()
LOGGER.info("Succesfully loaded hasblock-rest configuration")

# Initialize ZMQ
initialize_txn_vc()
LOGGER.info("Succesfully initialized ZMQ connection")
# Initialize decoder
initialize_decode()


def assetlinks(data):
Expand Down
1 change: 1 addition & 0 deletions docker/compose/hashblock-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ services:
command: >
gunicorn -b 0.0.0.0:8000
--access-logfile -
--log-level=debug
--reload
"hashblock_rest.app:application"
stop_signal: SIGKILL
Expand Down
7 changes: 5 additions & 2 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import sys
import os
import logging
from yaml import load

from modules.state import State
Expand All @@ -39,6 +40,8 @@
UNKNOWN_OWNER = '__unknown_key_owner_value__'
UNKNOWN_AGREEMENT = '__unknown_agreement__'

LOGGER = logging


def keys_path():
return KEYS_PATH
Expand Down Expand Up @@ -211,12 +214,12 @@ def __fabricate_signer():

def __load_cfg_and_keys(configfile):
"""Reads the configuration file and converts any priv keys to public"""
print("Reading {} from {}".format(configfile, DEFAULT_CFGR_PATH))
LOGGER.debug("Reading {} from {}".format(configfile, DEFAULT_CFGR_PATH))
try:
with open(os.path.join(DEFAULT_CFGR_PATH, configfile), 'r') as f:
doc = load(f)
except IOError:
print("Could not read {}".format(configfile))
LOGGER.error("Could not read {}".format(configfile))
raise

signer_keys = {}
Expand Down
7 changes: 5 additions & 2 deletions modules/dualities.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@
# ------------------------------------------------------------------------------

import os
import logging
from yaml import load
from abc import ABC, abstractmethod

LOGGER = logging


def _load_dualities(cfg_path, configfile):
"""Reads the duality configuration file"""
print("Reading {} from {}".format(configfile, cfg_path))
LOGGER.info("Reading {} from {}".format(configfile, cfg_path))
try:
with open(os.path.join(cfg_path, configfile), 'r') as f:
doc = load(f)
except IOError:
print("Could not read {}".format(configfile))
LOGGER.error("Could not read {}".format(configfile))
raise
return doc

Expand Down
17 changes: 8 additions & 9 deletions zkPROC/hashblock_zkproc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ set(SOURCES src/hbzkproc.c)
set(CMAKE_C_FLAGS "-Wall -std=c99 -Wall -Wextra -Wfatal-errors -O2")

# Link settings
find_library(HB_LIBUNIVALUE NAMES libunivalue)
find_library(HB_LIBMEMENV NAMES libmemenv)
find_library(HB_LIBSNARK NAMES libsnark PATHS /root/zcash/src/snark)
find_library(HB_LIBBITCOIN_CRYPTO NAMES libbitcoin_crypto)
find_library(HB_LIBSECP256K1 NAMES libsecp256k1)
find_library(HB_LIBBITCOIN_UTIL NAMES libbitcoin_util)
find_library(HB_LIBBITCOIN_CLI NAMES libbitcoin_cli)
find_library(HB_LIBZCASH NAMES libzcash)
find_library(HB_LIBUNIVALUE NAMES univalue PATHS /root/zcash/src/univalue/.libs)
find_library(HB_LIBMEMENV NAMES memenv PATHS /root/zcash/src/leveldb)
find_library(HB_LIBSNARK NAMES snark PATHS /root/zcash/src/snark)
find_library(HB_LIBBITCOIN_CRYPTO NAMES bitcoin_crypto PATHS /root/zcash/src/crypto)
find_library(HB_LIBSECP256K1 NAMES secp256k1 PATHS /root/zcash/src/secp256k1/.libs)
find_library(HB_LIBBITCOIN_UTIL NAMES bitcoin_util PATHS /root/zcash/src)
find_library(HB_LIBBITCOIN_CLI NAMES bitcoin_cli PATHS /root/zcash/src)
find_library(HB_LIBZCASH NAMES zcash)


add_executable(hbzkproc ${SOURCES})
target_link_libraries(hbzkproc
-rdynamic
-std=c99 -Wall -Wextra -Wfatal-errors
${HB_LIBUNIVALUE}
${HB_LIBMEMENV}
Expand Down

0 comments on commit 3ddb738

Please sign in to comment.