Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle trx.ref_block_prefix == tapos_block_summary.block_id._hash[1] #680

Closed
froooze opened this issue Sep 5, 2019 · 6 comments
Assignees
Labels
[2] Advanced Issue Issue is a technically advanced or complex task. Requires prior knowledge [3] Type: Bug [4] Priority: High

Comments

@froooze
Copy link

froooze commented Sep 5, 2019

Expected Behavior

No error

Actual Behavior

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/dexbot/dexbot/orderengines/bitshares_engine.py", line 133, in _cancel_orders
orders, account=self.account, fee_asset=self.fee_asset['id']
File "/home/ubuntu/dexbot/dexbot/orderengines/bitshares_engine.py", line 648, in retry_action
return action(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bitshares/bitshares.py", line 956, in cancel
return self.finalizeOp(op, account["name"], "active", **kwargs)
File "/home/ubuntu/.local/lib/python3.6/site-packages/graphenecommon/chain.py", line 227, in finalizeOp
return self.txbuffer.broadcast()
File "/home/ubuntu/.local/lib/python3.6/site-packages/graphenecommon/transactionbuilder.py", line 504, in broadcast
raise e
File "/home/ubuntu/.local/lib/python3.6/site-packages/graphenecommon/transactionbuilder.py", line 502, in broadcast
self.blockchain.rpc.broadcast_transaction(ret, api="network_broadcast")
File "/home/ubuntu/.local/lib/python3.6/site-packages/grapheneapi/api.py", line 176, in func
self.post_process_exception(e)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bitsharesapi/bitsharesnoderpc.py", line 24, in post_process_exception
raise exceptions.UnhandledRPCError(msg)
bitsharesapi.exceptions.UnhandledRPCError: Assert Exception: trx.ref_block_prefix == tapos_block_summary.block_id._hash[1]:
bbot6 using account bbot6 on BTS/USD - ERROR - Unable to cancel order
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/grapheneapi/api.py", line 168, in func
r = func(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.6/site-packages/grapheneapi/rpc.py", line 138, in method
message = self.parse_response(r)
File "/home/ubuntu/.local/lib/python3.6/site-packages/grapheneapi/rpc.py", line 106, in parse_response
raise RPCError(ret["error"]["message"])
grapheneapi.exceptions.RPCError: Assert Exception: trx.ref_block_prefix == tapos_block_summary.block_id._hash[1]:

Steps to Reproduce the Problem

  1. Run KOTH on bitUSD/BTS
    │ buy_order_amount: 1.0
    │ buy_order_size_threshold: 1.0
    │ fee_asset: BTS
    │ lower_bound: 0.01
    │ market: BTS/USD
    │ min_order_lifetime: 6
    │ mode: both
    │ module: dexbot.strategies.king_of_the_hill
    │ relative_order_size: True
    │ sell_order_amount: 1.0
    │ sell_order_size_threshold: 1.0
    │ upper_bound: 1.0

Specifications

  • Version: 0.15.5
  • OS: Ubuntu 18.04
@bitphage
Copy link
Collaborator

bitphage commented Sep 6, 2019

This means the node you've been connected to didn't had correct tapos block, probably it wasn't synced, probably this is related to recent network stuck.

@bitphage bitphage changed the title KOTH stopped working Reconnect to next node on tapos_block_summary assertion Sep 6, 2019
@bitphage
Copy link
Collaborator

bitphage commented Sep 6, 2019

In the future we can add reconnection to another node when catching this error.

@PermieBTS
Copy link
Collaborator

@thehapax could this feature be added to the node sorter?

#635

Or does it require a new check for nodes whilst already in progress?

@bitphage
Copy link
Collaborator

bitphage commented Sep 6, 2019

I mean a check inside dexbot/orderengines/bitshares_engine.py retry_action() similar to handling of "trx.expiration <= now + chain_parameters.maximum_time_until_expiration".

@thehapax
Copy link
Collaborator

thehapax commented Sep 6, 2019

We should have auto next node within retry_action() and for all places where any order activity is happening (place, cancel orders). I can add the check but in general node rotation should be handled by node manager.

@bitphage
Copy link
Collaborator

bitphage commented Sep 6, 2019

place, cancel orders all uses retry_action(). Not all exceptions should switch node, like critical "Assert Exception: delta.amount > 0: Insufficient Balance"

@bitphage bitphage changed the title Reconnect to next node on tapos_block_summary assertion Properly handle trx.ref_block_prefix == tapos_block_summary.block_id._hash[1] Mar 11, 2020
@bitphage bitphage added [3] Type: Bug [2] Advanced Issue Issue is a technically advanced or complex task. Requires prior knowledge [4] Priority: High and removed [3] Type: Enhancement labels Mar 11, 2020
@bitphage bitphage self-assigned this Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[2] Advanced Issue Issue is a technically advanced or complex task. Requires prior knowledge [3] Type: Bug [4] Priority: High
Projects
None yet
Development

No branches or pull requests

4 participants