From fd1370a1d030536caa6cdd60cad6e24600a0b02e Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:03:27 +0300 Subject: [PATCH 01/20] minor space --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 73a6af92..20f3f273 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@ TRD supports complex payments, pays in batches, provides two back ends for calcu https://medium.com/@huseyinabanox/tezos-reward-distributor-e6588c4d27e7 -## TRD Art Work +## TRD Art Work https://github.com/habanoz/trd-art contains logo images. If you are using TRD and want to let everybody know about it, feel free to place them in your website. From 647c43b3b3ca1e1dee84e887c3f95d2d78f76795 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:04:59 +0300 Subject: [PATCH 02/20] log added. --- src/rpc/rpc_block_api.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rpc/rpc_block_api.py b/src/rpc/rpc_block_api.py index 30e16402..da1337c0 100644 --- a/src/rpc/rpc_block_api.py +++ b/src/rpc/rpc_block_api.py @@ -1,6 +1,10 @@ from api.block_api import BlockApi from util.rpc_utils import parse_json_response +from src.log_config import main_logger + +logger = main_logger + COMM_HEAD = " rpc get http://{}/chains/main/blocks/head" COMM_REVELATION = " rpc get http://{}/chains/main/blocks/head/context/contracts/{}/manager_key" @@ -21,6 +25,9 @@ def get_current_level(self, verbose=False): def get_revelation(self, pkh, verbose=False): _, response = self.wllt_clnt_mngr.send_request(COMM_REVELATION.format(self.node_url, pkh)) manager_key = parse_json_response(response, verbose=verbose) + + logger.debug("Manager key is '{}'", manager_key) + bool_revelation = "key" in manager_key.keys() and len(manager_key["key"]) > 0 return bool_revelation From 9ff57da6c977e5d11836db12d606604a503b9ca7 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:08:52 +0300 Subject: [PATCH 03/20] import fix --- src/rpc/rpc_block_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/rpc_block_api.py b/src/rpc/rpc_block_api.py index da1337c0..33dd6688 100644 --- a/src/rpc/rpc_block_api.py +++ b/src/rpc/rpc_block_api.py @@ -1,7 +1,7 @@ from api.block_api import BlockApi from util.rpc_utils import parse_json_response -from src.log_config import main_logger +from log_config import main_logger logger = main_logger From 2920604aac9431fa61e27d2b6bf1080885f1c0b0 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:10:31 +0300 Subject: [PATCH 04/20] log fix --- src/rpc/rpc_block_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/rpc_block_api.py b/src/rpc/rpc_block_api.py index 33dd6688..ba34f782 100644 --- a/src/rpc/rpc_block_api.py +++ b/src/rpc/rpc_block_api.py @@ -26,7 +26,7 @@ def get_revelation(self, pkh, verbose=False): _, response = self.wllt_clnt_mngr.send_request(COMM_REVELATION.format(self.node_url, pkh)) manager_key = parse_json_response(response, verbose=verbose) - logger.debug("Manager key is '{}'", manager_key) + logger.debug("Manager key is '{}'".format(manager_key)) bool_revelation = "key" in manager_key.keys() and len(manager_key["key"]) > 0 return bool_revelation From 914ed8492acc617449a246e9d564a1d1e1377fbb Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:19:22 +0300 Subject: [PATCH 05/20] revelation logic change --- src/rpc/rpc_block_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/rpc_block_api.py b/src/rpc/rpc_block_api.py index ba34f782..2cc82cc9 100644 --- a/src/rpc/rpc_block_api.py +++ b/src/rpc/rpc_block_api.py @@ -28,7 +28,7 @@ def get_revelation(self, pkh, verbose=False): logger.debug("Manager key is '{}'".format(manager_key)) - bool_revelation = "key" in manager_key.keys() and len(manager_key["key"]) > 0 + bool_revelation = manager_key and manager_key!='null' return bool_revelation From ce8f21cd2965408f756b841beae10e84d94eaedc Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:22:38 +0300 Subject: [PATCH 06/20] temporarily disable revelation check --- src/tzscan/tzscan_block_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tzscan/tzscan_block_api.py b/src/tzscan/tzscan_block_api.py index 1c330c6d..ef4e1d38 100644 --- a/src/tzscan/tzscan_block_api.py +++ b/src/tzscan/tzscan_block_api.py @@ -52,6 +52,9 @@ def get_current_level(self, verbose=False): def get_revelation(self, pkh, verbose=False): uri = self.revelation_api['HEAD_API_URL'].replace("%MIRROR%", str(self.mirror_selector.get_mirror())).replace("%PKH%", pkh) + # todo remove + return True + if verbose: logger.debug("Requesting {}".format(uri)) From 9e629ec2e8671fcd30023656471796325c63bb79 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:28:45 +0300 Subject: [PATCH 07/20] check presence of lost_rewards_denounciation_baking --- src/tzscan/tzscan_reward_api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tzscan/tzscan_reward_api.py b/src/tzscan/tzscan_reward_api.py index de48d806..62fd715f 100644 --- a/src/tzscan/tzscan_reward_api.py +++ b/src/tzscan/tzscan_reward_api.py @@ -24,7 +24,12 @@ def get_rewards_for_cycle_map(self, cycle): future_blocks_rewards = int(root["future_blocks_rewards"]) endorsements_rewards = int(root["endorsements_rewards"]) future_endorsements_rewards = int(root["future_endorsements_rewards"]) - lost_rewards_denounciation = int(root["lost_rewards_denounciation_baking"])+int(root["lost_rewards_denounciation_endorsement"]) + + if "lost_rewards_denounciation_baking" in root: + lost_rewards_denounciation = int(root["lost_rewards_denounciation_baking"])+int(root["lost_rewards_denounciation_endorsement"]) + else: + lost_rewards_denounciation = int(root["lost_rewards_denounciation"]) + lost_fees_denounciation = int(root["lost_fees_denounciation_baking"])+int(root["lost_fees_denounciation_endorsement"]) fees = int(root["fees"]) From 98c07a42f4d7238489b84d0931752d2e2c4438d6 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 20:33:48 +0300 Subject: [PATCH 08/20] check presence of lost_fees_denounciation_baking --- src/tzscan/tzscan_reward_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tzscan/tzscan_reward_api.py b/src/tzscan/tzscan_reward_api.py index 62fd715f..45f6ed90 100644 --- a/src/tzscan/tzscan_reward_api.py +++ b/src/tzscan/tzscan_reward_api.py @@ -30,7 +30,11 @@ def get_rewards_for_cycle_map(self, cycle): else: lost_rewards_denounciation = int(root["lost_rewards_denounciation"]) - lost_fees_denounciation = int(root["lost_fees_denounciation_baking"])+int(root["lost_fees_denounciation_endorsement"]) + if "lost_fees_denounciation_baking" in root: + lost_fees_denounciation = int(root["lost_fees_denounciation_baking"])+int(root["lost_fees_denounciation_endorsement"]) + else: + lost_fees_denounciation = int(root["lost_fees_denounciation"]) + fees = int(root["fees"]) total_reward_amount = (blocks_rewards + endorsements_rewards + future_blocks_rewards + From 6acbf9be7fa12baba48b4dabf9421f2d3a298ef9 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 21:31:09 +0300 Subject: [PATCH 09/20] api changes fee changes --- fee.ini | 4 ++-- src/pay/batch_payer.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fee.ini b/fee.ini index 88bfa5da..6ebc6c60 100644 --- a/fee.ini +++ b/fee.ini @@ -2,6 +2,6 @@ fee=1274 [KTTX] -storage_limit=0 -gas_limit=10200 +storage_limit=300 +gas_limit=10300 base=100 diff --git a/src/pay/batch_payer.py b/src/pay/batch_payer.py index 6fd6113b..b0e39d68 100644 --- a/src/pay/batch_payer.py +++ b/src/pay/batch_payer.py @@ -26,6 +26,7 @@ FORGE_JSON = '{"branch": "%BRANCH%","contents":[%CONTENT%]}' RUNOPS_JSON = '{"branch": "%BRANCH%","contents":[%CONTENT%], "signature":"edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q"}' PREAPPLY_JSON = '[{"protocol":"%PROTOCOL%","branch":"%BRANCH%","contents":[%CONTENT%],"signature":"%SIGNATURE%"}]' +JSON_WRAP='{"operation": "%JSON%","chain_id":["%chain_id%"}' COMM_FORGE = " rpc post http://%NODE%/chains/main/blocks/head/helpers/forge/operations with '%JSON%'" COMM_RUNOPS = " rpc post http://%NODE%/chains/main/blocks/head/helpers/scripts/run_operation with '%JSON%'" COMM_PREAPPLY = " rpc post http://%NODE%/chains/main/blocks/head/helpers/preapply/operations with '%JSON%'" @@ -230,6 +231,7 @@ def attempt_single_batch(self, payment_records, op_counter, verbose=None, dry_ru _, response = self.wllt_clnt_mngr.send_request(self.comm_head, verbose_override=False) head = parse_json_response(response) branch = head["hash"] + chain_id = head["chain_id"] protocol = head["metadata"]["protocol"] logger.debug("head: branch {} counter {} protocol {}".format(branch, op_counter.get(), protocol)) @@ -260,6 +262,7 @@ def attempt_single_batch(self, payment_records, op_counter, verbose=None, dry_ru # run the operations logger.debug("Running {} operations".format(len(content_list))) runops_json = RUNOPS_JSON.replace('%BRANCH%', branch).replace("%CONTENT%", contents_string) + runops_json = JSON_WRAP.replace("%JSON%", runops_json).replace("%chain_id%",chain_id) runops_command_str = self.comm_runops.replace("%JSON%", runops_json) # if verbose: print("--> runops_command_str is |{}|".format(runops_command_str)) From c2f94c7399d85821533a90913711ff733c59a217 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 21:34:09 +0300 Subject: [PATCH 10/20] fix --- src/pay/batch_payer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pay/batch_payer.py b/src/pay/batch_payer.py index b0e39d68..24c73112 100644 --- a/src/pay/batch_payer.py +++ b/src/pay/batch_payer.py @@ -26,7 +26,7 @@ FORGE_JSON = '{"branch": "%BRANCH%","contents":[%CONTENT%]}' RUNOPS_JSON = '{"branch": "%BRANCH%","contents":[%CONTENT%], "signature":"edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q"}' PREAPPLY_JSON = '[{"protocol":"%PROTOCOL%","branch":"%BRANCH%","contents":[%CONTENT%],"signature":"%SIGNATURE%"}]' -JSON_WRAP='{"operation": "%JSON%","chain_id":["%chain_id%"}' +JSON_WRAP='{"operation": "%JSON%","chain_id":"%chain_id%"}' COMM_FORGE = " rpc post http://%NODE%/chains/main/blocks/head/helpers/forge/operations with '%JSON%'" COMM_RUNOPS = " rpc post http://%NODE%/chains/main/blocks/head/helpers/scripts/run_operation with '%JSON%'" COMM_PREAPPLY = " rpc post http://%NODE%/chains/main/blocks/head/helpers/preapply/operations with '%JSON%'" From 69f7aefcff4579df1a83487b694df46593643662 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 21:37:12 +0300 Subject: [PATCH 11/20] fix --- src/pay/batch_payer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pay/batch_payer.py b/src/pay/batch_payer.py index 24c73112..00dc2f23 100644 --- a/src/pay/batch_payer.py +++ b/src/pay/batch_payer.py @@ -26,7 +26,7 @@ FORGE_JSON = '{"branch": "%BRANCH%","contents":[%CONTENT%]}' RUNOPS_JSON = '{"branch": "%BRANCH%","contents":[%CONTENT%], "signature":"edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q"}' PREAPPLY_JSON = '[{"protocol":"%PROTOCOL%","branch":"%BRANCH%","contents":[%CONTENT%],"signature":"%SIGNATURE%"}]' -JSON_WRAP='{"operation": "%JSON%","chain_id":"%chain_id%"}' +JSON_WRAP='{"operation": %JSON%,"chain_id":"%chain_id%"}' COMM_FORGE = " rpc post http://%NODE%/chains/main/blocks/head/helpers/forge/operations with '%JSON%'" COMM_RUNOPS = " rpc post http://%NODE%/chains/main/blocks/head/helpers/scripts/run_operation with '%JSON%'" COMM_PREAPPLY = " rpc post http://%NODE%/chains/main/blocks/head/helpers/preapply/operations with '%JSON%'" From f150b10e461de2940a16c077bb120cb93abec2ef Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 22:44:18 +0300 Subject: [PATCH 12/20] disable kt address payment support --- src/cli/wallet_client_manager.py | 28 +++++++++++++-------------- src/config/yaml_baking_conf_parser.py | 5 ++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/cli/wallet_client_manager.py b/src/cli/wallet_client_manager.py index 61eb21ab..e707c4ef 100644 --- a/src/cli/wallet_client_manager.py +++ b/src/cli/wallet_client_manager.py @@ -78,8 +78,8 @@ def generate_address_dict(self): self.address_dict = {} - if self.contr_dict_by_alias is None: - self.contr_dict_by_alias = self.__list_known_contracts_by_alias() + #if self.contr_dict_by_alias is None: + # self.contr_dict_by_alias = self.__list_known_contracts_by_alias() if self.addr_dict_by_pkh is None: self.addr_dict_by_pkh = self.__list_known_addresses_by_pkh() @@ -92,20 +92,20 @@ def generate_address_dict(self): logger.debug("Known address added: {}".format(self.address_dict[pkh])) - for alias, pkh in self.contr_dict_by_alias.items(): - if pkh.startswith("KT"): - manager = self.get_manager_for_contract(pkh) - if manager not in self.addr_dict_by_pkh: - # raise ConfigurationException("Manager pkh {} not found in known addresses".format(manager)) - manager_sk = None - else: - manager_sk = self.addr_dict_by_pkh[manager]['sk'] + #for alias, pkh in self.contr_dict_by_alias.items(): + # if pkh.startswith("KT"): + # manager = self.get_manager_for_contract(pkh) + # if manager not in self.addr_dict_by_pkh: + # # raise ConfigurationException("Manager pkh {} not found in known addresses".format(manager)) + # manager_sk = None + # else: + # manager_sk = self.addr_dict_by_pkh[manager]['sk'] - self.address_dict[pkh] = {"pkh": pkh, "originated": True, "alias": alias, "sk": manager_sk, "manager": manager} - if pkh in self.addr_dict_by_pkh and "revealed" in self.addr_dict_by_pkh[pkh]: - self.address_dict[pkh]["revealed"] = self.addr_dict_by_pkh[pkh]["revealed"] + # self.address_dict[pkh] = {"pkh": pkh, "originated": True, "alias": alias, "sk": manager_sk, "manager": manager} + # if pkh in self.addr_dict_by_pkh and "revealed" in self.addr_dict_by_pkh[pkh]: + # self.address_dict[pkh]["revealed"] = self.addr_dict_by_pkh[pkh]["revealed"] - logger.debug("Known contract added: {}".format(self.address_dict[pkh])) + # logger.debug("Known contract added: {}".format(self.address_dict[pkh])) if not self.address_dict: logger.warn("No known address info is reached. Check your environment. Try to run in privileged mode.") diff --git a/src/config/yaml_baking_conf_parser.py b/src/config/yaml_baking_conf_parser.py index 6e6fae25..239f1422 100644 --- a/src/config/yaml_baking_conf_parser.py +++ b/src/config/yaml_baking_conf_parser.py @@ -118,7 +118,10 @@ def validate_payment_address(self, conf_obj): if not pymnt_addr: raise ConfigurationException("Payment address must be set") - if len(pymnt_addr) == PKH_LENGHT and (pymnt_addr.startswith("KT") or pymnt_addr.startswith("tz")): + if pymnt_addr.startswith("KT"): + raise ConfigurationException("KT address cannot be used for payments") + + if len(pymnt_addr) == PKH_LENGHT and pymnt_addr.startswith("tz"): addr_obj = self.wllt_clnt_mngr.get_addr_dict_by_pkh(pymnt_addr) From 14fd6627153d9c40cf012094d0b80bbb150a4d9a Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 22:54:22 +0300 Subject: [PATCH 13/20] disable kt address payment support --- src/config/yaml_baking_conf_parser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/config/yaml_baking_conf_parser.py b/src/config/yaml_baking_conf_parser.py index 239f1422..0bc693a1 100644 --- a/src/config/yaml_baking_conf_parser.py +++ b/src/config/yaml_baking_conf_parser.py @@ -127,14 +127,17 @@ def validate_payment_address(self, conf_obj): self.check_sk(addr_obj, pymnt_addr) - conf_obj[('__%s_type' % PAYMENT_ADDRESS)] = AddrType.KT if pymnt_addr.startswith("KT") else AddrType.TZ + conf_obj[('__%s_type' % PAYMENT_ADDRESS)] = AddrType.TZ conf_obj[('__%s_pkh' % PAYMENT_ADDRESS)] = pymnt_addr - conf_obj[('__%s_manager' % PAYMENT_ADDRESS)] = self.wllt_clnt_mngr.get_manager_for_contract(pymnt_addr) + conf_obj[('__%s_manager' % PAYMENT_ADDRESS)] = pymnt_addr else: if pymnt_addr in self.wllt_clnt_mngr.get_known_contracts_by_alias(): pkh = self.wllt_clnt_mngr.get_known_contract_by_alias(pymnt_addr) + if pkh.startswith("KT"): + raise ConfigurationException("KT address cannot be used for payments") + addr_obj = self.wllt_clnt_mngr.get_addr_dict_by_pkh(pkh) self.check_sk(addr_obj, pkh) From 9736f94e3d816b1284659b9567fc8e1eb2ac1778 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 22:56:16 +0300 Subject: [PATCH 14/20] disable kt address payment support --- src/config/yaml_baking_conf_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/yaml_baking_conf_parser.py b/src/config/yaml_baking_conf_parser.py index 0bc693a1..af995fa7 100644 --- a/src/config/yaml_baking_conf_parser.py +++ b/src/config/yaml_baking_conf_parser.py @@ -119,7 +119,7 @@ def validate_payment_address(self, conf_obj): raise ConfigurationException("Payment address must be set") if pymnt_addr.startswith("KT"): - raise ConfigurationException("KT address cannot be used for payments") + raise ConfigurationException("KT addresses cannot be used for payments. Only tz addresses are allowed") if len(pymnt_addr) == PKH_LENGHT and pymnt_addr.startswith("tz"): @@ -136,7 +136,7 @@ def validate_payment_address(self, conf_obj): pkh = self.wllt_clnt_mngr.get_known_contract_by_alias(pymnt_addr) if pkh.startswith("KT"): - raise ConfigurationException("KT address cannot be used for payments") + raise ConfigurationException("KT addresses cannot be used for payments. Only tz addresses are allowed") addr_obj = self.wllt_clnt_mngr.get_addr_dict_by_pkh(pkh) From c24acfeaf3469ab9093fa85a6c36fe9a61878074 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 23:14:20 +0300 Subject: [PATCH 15/20] debug --- src/cli/cmd_manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli/cmd_manager.py b/src/cli/cmd_manager.py index 0c3bfdd9..970fff5e 100644 --- a/src/cli/cmd_manager.py +++ b/src/cli/cmd_manager.py @@ -28,8 +28,10 @@ def execute(self, cmd, verbose_override=None, timeout=None): try: output = check_output(cmd, shell=True, stderr=STDOUT, timeout=timeout, encoding='utf8') except TimeoutExpired as e: + logger.debug("Command timed out") raise e except CalledProcessError as e: + logger.debug("Command failed, error is {}".format(e.output)) return False, e.output # output = output.decode('utf-8') From 87e5a57682b8477008b44543788ddfd7be73eefc Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 23:16:18 +0300 Subject: [PATCH 16/20] debug --- src/cli/cmd_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/cmd_manager.py b/src/cli/cmd_manager.py index 970fff5e..9580ab33 100644 --- a/src/cli/cmd_manager.py +++ b/src/cli/cmd_manager.py @@ -31,7 +31,7 @@ def execute(self, cmd, verbose_override=None, timeout=None): logger.debug("Command timed out") raise e except CalledProcessError as e: - logger.debug("Command failed, error is {}".format(e.output)) + logger.debug("Command failed, error is |{}|".format(e.output)) return False, e.output # output = output.decode('utf-8') From 95adc64a18961870c33815111c2694d40e22c9cf Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 23:17:36 +0300 Subject: [PATCH 17/20] debug --- src/cli/cmd_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/cmd_manager.py b/src/cli/cmd_manager.py index 9580ab33..7a88a32a 100644 --- a/src/cli/cmd_manager.py +++ b/src/cli/cmd_manager.py @@ -28,10 +28,10 @@ def execute(self, cmd, verbose_override=None, timeout=None): try: output = check_output(cmd, shell=True, stderr=STDOUT, timeout=timeout, encoding='utf8') except TimeoutExpired as e: - logger.debug("Command timed out") + logger.info("Command timed out") raise e except CalledProcessError as e: - logger.debug("Command failed, error is |{}|".format(e.output)) + logger.info("Command failed, error is |{}|".format(e.output)) return False, e.output # output = output.decode('utf-8') From b01e232554811f0be9cd86799b40a6a00368e5c0 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 23:22:00 +0300 Subject: [PATCH 18/20] test fix --- src/config/test_BakingYamlConfParser.py | 57 +++---------------------- 1 file changed, 5 insertions(+), 52 deletions(-) diff --git a/src/config/test_BakingYamlConfParser.py b/src/config/test_BakingYamlConfParser.py index f776aa07..7ce437e4 100644 --- a/src/config/test_BakingYamlConfParser.py +++ b/src/config/test_BakingYamlConfParser.py @@ -95,7 +95,7 @@ def test_validate_pymnt_alias(self): data_no_founders = """ version : 1.0 baking_address : tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj - payment_address : ktPay + payment_address : tzPay owners_map : {'KT2Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj':0.5,'KT3Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj':0.5} service_fee : 4.5 min_delegation_amt : 100 @@ -104,7 +104,7 @@ def test_validate_pymnt_alias(self): managers_map = {'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj', 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'} - contr_dict_by_alias = {'ktPay': 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'} + contr_dict_by_alias = {'kt': 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj','tzPay':'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'} addr_dict_by_pkh = { "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj": {"pkh": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj", "originated": False, "alias": "tz1", "sk": True, @@ -125,10 +125,10 @@ def test_validate_pymnt_alias(self): cnf_prsr.validate() self.assertEqual(cnf_prsr.get_conf_obj_attr('baking_address'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') - self.assertEqual(cnf_prsr.get_conf_obj_attr('payment_address'), 'ktPay') - self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_pkh'), 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') + self.assertEqual(cnf_prsr.get_conf_obj_attr('payment_address'), 'tzPay') + self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_pkh'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_manager'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') - self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_type'), AddrType.KTALS) + self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_type'), AddrType.TZALS) self.assertEqual(cnf_prsr.get_conf_obj_attr('founders_map'), dict()) self.assertEqual(cnf_prsr.get_conf_obj_attr('specials_map'), dict()) @@ -136,51 +136,4 @@ def test_validate_pymnt_alias(self): self.assertEqual(100, cnf_prsr.get_conf_obj_attr('min_delegation_amt')) - def test_validate_empty(self): - data_fine = """ - version : 1.0 - baking_address : tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj - payment_address : KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj - service_fee : 4.5 - founders_map : {} - owners_map : {} - specials_map : {} - supporters_set : {} - min_delegation_amt : 0 - """ - - - managers = {'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj', - 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'} - - contr_dict_by_alias = {} - addr_dict_by_pkh = { - "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj": {"pkh": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj", "originated": False, - "alias": "main1", "sk": True, "revealed" : True, - "manager": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj"}, - - "KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj": {"pkh": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj", "originated": False, - "alias": "ktPay", "sk": True, "revealed":True, - "manager": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj"} - } - - wallet_client_manager = WalletClientManager(client_path=None, addr_dict_by_pkh=addr_dict_by_pkh, - contr_dict_by_alias=contr_dict_by_alias, managers=managers) - - mirror_selector = TzScanMirrorSelector(network) - mirror_selector.initialize() - block_api = TzScanBlockApiImpl(network, mirror_selector) - cnf_prsr = BakingYamlConfParser(data_fine, wallet_client_manager, provider_factory=None, - network_config=network, node_url=mainnet_public_node_url, block_api=block_api) - - cnf_prsr.parse() - cnf_prsr.validate() - - self.assertEqual(cnf_prsr.get_conf_obj_attr('baking_address'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') - self.assertEqual(cnf_prsr.get_conf_obj_attr('payment_address'), 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') - self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_pkh'), 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') - self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_manager'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj') - self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_type'), AddrType.KT) - self.assertEqual(0, cnf_prsr.get_conf_obj_attr('min_delegation_amt')) - self.assertEqual(cnf_prsr.get_conf_obj_attr('supporters_set'), set()) From 545347a9f399d384015632b1109717587ad0d266 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 25 Sep 2019 23:41:51 +0300 Subject: [PATCH 19/20] remove temp line --- src/tzscan/tzscan_block_api.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tzscan/tzscan_block_api.py b/src/tzscan/tzscan_block_api.py index ef4e1d38..1c330c6d 100644 --- a/src/tzscan/tzscan_block_api.py +++ b/src/tzscan/tzscan_block_api.py @@ -52,9 +52,6 @@ def get_current_level(self, verbose=False): def get_revelation(self, pkh, verbose=False): uri = self.revelation_api['HEAD_API_URL'].replace("%MIRROR%", str(self.mirror_selector.get_mirror())).replace("%PKH%", pkh) - # todo remove - return True - if verbose: logger.debug("Requesting {}".format(uri)) From 7d783bfa16c96f7836d04e938ba41b7524d92f45 Mon Sep 17 00:00:00 2001 From: Huseyin ABANOZ Date: Wed, 16 Oct 2019 22:07:17 +0300 Subject: [PATCH 20/20] prpc-> Mainnet https://rpc.tulip.tools/mainnet Alphanet https://rpc.tulip.tools/alphanet Zeronet https://rpc.tulip.tools/zeronet --- src/api/provider_factory.py | 4 +--- src/launch_common.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/api/provider_factory.py b/src/api/provider_factory.py index 81bba21b..d6c661dd 100644 --- a/src/api/provider_factory.py +++ b/src/api/provider_factory.py @@ -8,9 +8,7 @@ class ProviderFactory: - URL = "{}.tzbeta.net/" - URL = "{}.tezrpc.me/" - url_prefixes = {"MAINNET": "rpc", "ALPHANET": "rpcalpha", "ZERONET": "rpczero"} + URL = "https://rpc.tulip.tools/{}/" url_prefixes = {"MAINNET": "mainnet", "ALPHANET": "alphanet", "ZERONET": "zeronet"} def __init__(self, provider, verbose=False): diff --git a/src/launch_common.py b/src/launch_common.py index 8fe91535..de0160f2 100644 --- a/src/launch_common.py +++ b/src/launch_common.py @@ -33,8 +33,8 @@ def add_argument_reports_base(parser): def add_argument_provider(parser): - parser.add_argument("-P", "--reward_data_provider", help="where reward data is provided. prpc=public rpc", choices=['tzscan', 'rpc','prpc'], - default='tzscan') + parser.add_argument("-P", "--reward_data_provider", help="where reward data is provided. prpc=public rpc", choices=['rpc','prpc'], + default='prpc') def add_argument_config_dir(parser):