reinforceAttack Bug
nikohd12 opened this issue · comments
Hi Cocco,
As discussed, I have tried the new reinforceAttack on my latest loot and I am getting this error.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/ec2-user/crabada-niko/bin/looting/reinforceAttack.py", line 28, in <module>
nReinforced = reinforceAttack(userAddress)
File "/home/ec2-user/crabada-niko/src/bot/looting/reinforceAttack.py", line 40, in reinforceAttack
strategyName = user.getTeamConfig(mine["team_id"]).get("reinforceStrategyName")
AttributeError: 'NoneType' object has no attribute 'get'
I encountered this error before when running the reinforceDefense script when a team that is mining is not added to the roster of teams in the .env file.
With this looting wallet, I have only 1 team. So I am not sure why I am encountering this error.
Upon manual reinforcement, the script can read that the user does not need reinforcements.
src.common.logger - INFO - No loots to reinforce for user 0x123456
Hi Cocco,
I was able to fix the issue by replacing strategyName = user.getTeamConfig(mine["team_id"]).get("reinforceStrategyName")
with strategyName = user.getTeamConfig(mine["attack_team_id"]).get("reinforceStrategyName")
on src/bot/looting/reinforceAttack.py
However, the reinforcement keeps failing and eating up my gas.
Logs:
src.common.logger - INFO - Borrowing crab 23877 for mine xxxxxxx at 16.9 TUS... [strategy=HighestBp, BP=237, MP=66]
src.common.txLogger - DEBUG - AttributeDict({'blockHash': HexBytes('0x109c706e0f8e7921bb40c4d59a9b3857db2947d3300a0bf700d90a830f70f113'), 'blockNumber': 12159957, 'contractAddress': None, 'cumulativeGasUsed': 2189103, 'effectiveGasPrice': 42943582952, 'from': '0x7344Fe975Ce35cD7047BbA5e17325aeFcc2e76FB', 'gasUsed': 53835, 'logs': [], 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'status': 0, 'to': '0x82a85407BD612f52577909F4A58bfC6873f14DA8', 'transactionHash': HexBytes('0x244fe56e0fe229318375e77f654d1a661f530850a94c3f034f2347721764e977'), 'transactionIndex': 13, 'type': '0x2'})
src.common.txLogger - DEBUG - Spent 0.00231186778822092 ETH
src.common.logger - ERROR - Error reinforcing mine 24xxxxx
EDIT:
After 5 tries, reinforceAttack worked! If I may suggest, I think the HighestBp reinforce strategy is set too aggressively wherein it gets the cheapest Bulk (which is good) but waste a lot of gas cause it keeps failing. Maybe we can set a minimumTus spent to an acceptable amount to prevent this from happening?
src.common.logger - INFO - Borrowing crab 36153 for mine 243xxxx at 16 TUS... [strategy=HighestBp, BP=237, MP=66]
src.common.txLogger - INFO - 0x329d6e3ff954b22697449593650af7853a13467e2a64a4de24bba3b16ba456b3
src.common.txLogger - DEBUG - Spent 0.00912026099887364 ETH
src.common.logger - INFO - Mine 243xxxxx reinforced correctly