tezos-reward-distributor-organization / tezos-reward-distributor

Tezos Reward Distributor (TRD): A reward distribution software for tezos bakers.
https://tezos-reward-distributor-organization.github.io/tezos-reward-distributor/
GNU General Public License v3.0
87 stars 50 forks source link

Payment fails under v5 due to unknown service #80

Closed amani1104 closed 5 years ago

amani1104 commented 5 years ago

Describe the bug When performing a payment, TRD v5 prints the following error message in verbose mode:

2019-05-27 09:20:33,730 - producer  - Current level 455104, head hash BMMHe9ZKS7ETDFeQ5VRA9nUjyRE9QMeCJKLs2qjnJLbhMkL3fR6
2019-05-27 09:20:33,730 - producer  - Cycle 105, preserved cycles 5, blocks per cycle 4096, level of interest 409601
--> Verbose : Command is |/usr/local/bin/tezos-client rpc get http://127.0.0.1:8732/chains/main/blocks/BMMHe9ZKS7ETDFeQ5VRA9nUjyRE9QMeCJKLs2qjnJLbhMkL3fR6~45503/context/raw/json/rolls/owner/snapshot/105/|
--- Verbose : Nothing in stdout, reading stderr...
<-- Verbose : Answer is |Disclaimer:
  The  Tezos  network  is  a  new  blockchain technology.
  Users are  solely responsible  for any risks associated
  with usage of the Tezos network.  Users should do their
  own  research to determine  if Tezos is the appropriate
  platform for their needs and should apply judgement and
  care in their network interactions.

Error:
  Did not find service: GET http://127.0.0.1:8732/describe/chains/main/blocks/BMMHe9ZKS7ETDFeQ5VRA9nUjyRE9QMeCJKLs2qjnJLbhMkL3fR6~45503/context/raw/json/rolls/owner/snapshot/105?recurse=no|
2019-05-27 09:20:34,138 - producer  - Error at payment producer loop
Traceback (most recent call last):
  File "/home/tezos/tezos-reward-distributor/src/pay/payment_producer.py", line 205, in try_to_pay
    reward_model = self.reward_api.get_rewards_for_cycle_map(pymnt_cycle, verbose=self.verbose)
  File "/home/tezos/tezos-reward-distributor/src/rpc/rpc_reward_api.py", line 47, in get_rewards_for_cycle_map
    "delegators"] = self.__get_delegators_and_delgators_balance(cycle)
  File "/home/tezos/tezos-reward-distributor/src/rpc/rpc_reward_api.py", line 99, in __get_delegators_and_delgators_balance
    hash_snapshot_block = self.__get_snapshot_block_hash(cycle)
  File "/home/tezos/tezos-reward-distributor/src/rpc/rpc_reward_api.py", line 141, in __get_snapshot_block_hash
    snapshots = parse_json_response(response)
  File "/home/tezos/tezos-reward-distributor/src/util/rpc_utils.py", line 34, in parse_json_response
    raise Exception("Unknown client response format")
Exception: Unknown client response format

To Reproduce The command I used to initiate the payment is the following:

python3 src/main.py -V -E /usr/local/bin -C 105 -M 3 -D

When entering the command tezos-client rpc get http://127.0.0.1:8732/chains/main/blocks/BMMHe9ZKS7ETDFeQ5VRA9nUjyRE9QMeCJKLs2qjnJLbhMkL3fR6~45503/context/raw/json/rolls/owner/snapshot/105/ used by TRD, I receive the following error message:

Error:
  Did not find service: GET http://127.0.0.1:8732/describe/chains/main/blocks/BMMHe9ZKS7ETDFeQ5VRA9nUjyRE9QMeCJKLs2qjnJLbhMkL3fR6~45503/context/raw/json/rolls/owner/snapshot/105?recurse=no

Environment

habanoz commented 5 years ago

This will be investigated. In the meantime you can use tzscan backend to complete your payments.

amani1104 commented 5 years ago

The same error occurs with tzscan. I'm using this command:

python3 src/main.py -E /usr/local/bin -C 105 -M 3 -P tzscan -D

habanoz commented 5 years ago

It is not likely. Tzscan backend cannot produce the same error.

Default backend is tzscan, if you do not use -P, tzscan will be used.

amani1104 commented 5 years ago

Then it's strange. The command I initially used and posted in this issue is this: python3 src/main.py -V -E /usr/local/bin -C 105 -M 3 -D The error log shows that TRD tries to query the local node, although it shouldn't:

--> Verbose : Command is |/usr/local/bin/tezos-client rpc get http://127.0.0.1:8732/chains/main/blocks/BMMHe9ZKS7ETDFeQ5VRA9nUjyRE9QMeCJKLs2qjnJLbhMkL3fR6~45503/context/raw/json/rolls/owner/snapshot/105/|

habanoz commented 5 years ago

Did you try to make a clean git clone? The behavior is not as it should be. RPC error needs to be fixed, but tzscan backend should work fine.

amani1104 commented 5 years ago

Ok, with a clean clone TRD loads from the tzscan API. However, it now throws the following error:

2019-05-29 09:42:49,016 - producer  - Error at payment producer loop
Traceback (most recent call last):
  File "/home/tezos/tezos-reward-distributor/src/pay/payment_producer.py", line 207, in try_to_pay
    reward_logs, total_amount = self.payment_calc.calculate(reward_model)
  File "/home/tezos/tezos-reward-distributor/src/calc/phased_payment_calculator.py", line 77, in calculate
    assert self.almost_equal(founder_parent.ratio3, calculated_founder_rewards)
AttributeError: 'NoneType' object has no attribute 'ratio3'
habanoz commented 5 years ago

Did you set your fee to "0"? This error happens if no reward is generated. In order to cover this case, I made small changes. You may git pull, and try again.

amani1104 commented 5 years ago

Yes, fee is set to "0". It is working now with your fix. Many thanks!

habanoz commented 5 years ago

The way to query the selected snaphot has changed with Athens. This is why RPC api is broken. It will be fixed shortly.

Full nodes will not be able to query past selected snapshots.

habanoz commented 5 years ago

Reopening. Closing was unintentional.

habanoz commented 5 years ago

RPC is fixed. However in order to use RPC layer for reward calculations you need to have an archive node. FULL node does not keep track of records to handle reward payments.

An rpc reward class is added to support use of public nodes to overcome this limitation. You can try it with -P prpc switch.

However, use of tzscan back end is a better option.

habanoz commented 5 years ago

Closing due to inactivity.